diff mbox

drm/i915: Initialize audio only when display is present

Message ID 1510320714-19904-1-git-send-email-mika.kahola@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kahola Nov. 10, 2017, 1:31 p.m. UTC
At least in Coffee Lake it happens that we start initiliazing audio when
no display is connected. This was discovered by CI when running IGT test
case

drv_module_reload --r basic-no-display

The issue here is that the 'intel_device_info_runtime_init()' sets
num_pipes to 0 but before this happens the audio part has already started
to initialize itself. Later on the num_pipes is updated to 0 in
intel_device_info_runtime_init() and we hit that when audio part is digging
out ELD. This causes a warning in dmesg. To fix this issue, let's register
the audio driver only in a case when display is enabled.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103206
Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Chris Wilson Nov. 10, 2017, 1:37 p.m. UTC | #1
Quoting Mika Kahola (2017-11-10 13:31:54)
> At least in Coffee Lake it happens that we start initiliazing audio when
> no display is connected. This was discovered by CI when running IGT test
> case
> 
> drv_module_reload --r basic-no-display
> 
> The issue here is that the 'intel_device_info_runtime_init()' sets
> num_pipes to 0 but before this happens the audio part has already started
> to initialize itself. Later on the num_pipes is updated to 0 in
> intel_device_info_runtime_init()

runtime_init happens twice? (I am confused by this pair of sentences.)

and we hit that when audio part is digging
> out ELD. This causes a warning in dmesg. To fix this issue, let's register
> the audio driver only in a case when display is enabled.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103206
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index e7e9e06..f3cee1b 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -1243,7 +1243,8 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
>         if (IS_GEN5(dev_priv))
>                 intel_gpu_ips_init(dev_priv);
>  
> -       intel_audio_init(dev_priv);
> +       if (!i915_modparams.disable_display)

INTEL_INFO()->num_ports == 0 is the derived value that includes cases
where the display is fused off as well.
-Chris
Mika Kahola Nov. 10, 2017, 2:06 p.m. UTC | #2
On Fri, 2017-11-10 at 13:37 +0000, Chris Wilson wrote:
> Quoting Mika Kahola (2017-11-10 13:31:54)
> > 
> > At least in Coffee Lake it happens that we start initiliazing audio
> > when
> > no display is connected. This was discovered by CI when running IGT
> > test
> > case
> > 
> > drv_module_reload --r basic-no-display
> > 
> > The issue here is that the 'intel_device_info_runtime_init()' sets
> > num_pipes to 0 but before this happens the audio part has already
> > started
> > to initialize itself. Later on the num_pipes is updated to 0 in
> > intel_device_info_runtime_init()
> runtime_init happens twice? (I am confused by this pair of
> sentences.)
> 
> and we hit that when audio part is digging
This is tricky. i915_audio_component_get_eld() gets called from a sound
driver. Even though, I disable intel_audio_init() call, these num_pipes
warnings keep popping up in dmesg like this.

[  475.875800] Setting dangerous option reset - tainting kernel
[  476.966234] WARN_ON(pipe >= intel_info((dev_priv))->num_pipes)
[  476.966247] ------------[ cut here ]------------
[  476.966264] WARNING: CPU: 3 PID: 4697 at
drivers/gpu/drm/i915/intel_audio.c:782 get_saved_enc+0x6f/0x90 [i915]
[  476.966266] Modules linked in: snd_hda_codec_hdmi(+)
snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_codec
snd_hwdep snd_hda_core snd_pcm i915 vgem ax88179_178a usbnet
x86_pkg_temp_thermal intel_powerclamp mii coretemp crct10dif_pclmul
crc32_pclmul ghash_clmulni_intel e1000e ptp prime_numbers pps_core
i2c_hid [last unloaded: i915]
[  476.966302] CPU: 3 PID: 4697 Comm: modprobe Tainted:
G     U          4.14.0-rc8-CI-Trybot_1397+ #1
[  476.966303] Hardware name: Intel Corporation CoffeeLake Client
Platform/CoffeeLake S UDIMM RVP, BIOS CNLSFWR1.R00.X104.B11.1710091318
10/09/2017
[  476.966305] task: ffff8803f0622880 task.stack: ffffc90000718000
[  476.966320] RIP: 0010:get_saved_enc+0x6f/0x90 [i915]
[  476.966322] RSP: 0018:ffffc9000071ba58 EFLAGS: 00010292
[  476.966325] RAX: 0000000000000032 RBX: ffff8803f7b00000 RCX:
0000000000000006
[  476.966326] RDX: 000000000000203a RSI: ffffffff81d11254 RDI:
ffffffff81cc3d2e
[  476.966328] RBP: ffffc9000071ba58 R08: ffff8803f06231e0 R09:
0000000000000000
[  476.966329] R10: ffffc9000071ba58 R11: 0000000000000000 R12:
ffff8803f7b07738
[  476.966331] R13: ffff880452530278 R14: 0000000000000001 R15:
ffff880452530270
[  476.966332] FS:  00007fd67cba0700(0000) GS:ffff88045b2c0000(0000)
knlGS:0000000000000000
[  476.966334] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  476.966335] CR2: 000055cf58ac3050 CR3: 000000044e615003 CR4:
00000000003606e0
[  476.966337] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
0000000000000000
[  476.966338] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
0000000000000400
[  476.966340] Call Trace:
[  476.966355]  i915_audio_component_get_eld+0x4c/0x160 [i915]
[  476.966361]  snd_hdac_acomp_get_eld+0x64/0x80 [snd_hda_core]
[  476.966365]  hdmi_present_sense+0xaa/0x390 [snd_hda_codec_hdmi]
[  476.966369]  generic_hdmi_build_controls+0x15b/0x200
[snd_hda_codec_hdmi]
[  476.966375]  snd_hda_codec_build_controls+0x188/0x1d0
[snd_hda_codec]
[  476.966379]  hda_codec_driver_probe+0x80/0x110 [snd_hda_codec]
[  476.966383]  driver_probe_device+0x29c/0x450
[  476.966386]  __driver_attach+0xe3/0xf0
[  476.966389]  ? driver_probe_device+0x450/0x450
[  476.966391]  bus_for_each_dev+0x62/0xa0
[  476.966395]  driver_attach+0x1e/0x20
[  476.966397]  bus_add_driver+0x173/0x270
[  476.966400]  driver_register+0x60/0xe0
[  476.966401]  ? 0xffffffffa012a000
[  476.966405]  __hda_codec_driver_register+0x5a/0x60 [snd_hda_codec]
[  476.966408]  hdmi_driver_init+0x1e/0x1000 [snd_hda_codec_hdmi]
[  476.966410]  do_one_initcall+0x43/0x170
[  476.966413]  ? rcu_read_lock_sched_held+0x7a/0x90
[  476.966415]  ? kmem_cache_alloc_trace+0x270/0x2d0
[  476.966419]  do_init_module+0x5f/0x206
[  476.966422]  load_module+0x2581/0x2dd0
[  476.966425]  ? show_coresize+0x30/0x30
[  476.966428]  ? kernel_read+0x31/0x50
[  476.966433]  SyS_finit_module+0xc1/0x100
[  476.966435]  ? SyS_finit_module+0xc1/0x100
[  476.966441]  entry_SYSCALL_64_fastpath+0x1c/0xb1
[  476.966442] RIP: 0033:0x7fd67c6d69f9
[  476.966444] RSP: 002b:00007fff8bd21c98 EFLAGS: 00000246 ORIG_RAX:
0000000000000139
[  476.966447] RAX: ffffffffffffffda RBX: ffffffff81492003 RCX:
00007fd67c6d69f9
[  476.966448] RDX: 0000000000000000 RSI: 000055cf57227f8b RDI:
0000000000000000
[  476.966450] RBP: ffffc9000071bf88 R08: 0000000000000000 R09:
0000000000000000
[  476.966451] R10: 0000000000000000 R11: 0000000000000246 R12:
0000000000040000
[  476.966453] R13: 000055cf58abd720 R14: 0000000000000000 R15:
000055cf58ac29f0
[  476.966455]  ? __this_cpu_preempt_check+0x13/0x20
[  476.966459] Code: 70 0b 74 05 3b 70 74 74 27 48 83 c2 01 39 d1 7f e0
31 c0 c3 55 48 c7 c6 08 19 40 a0 48 c7 c7 fa 81 3e a0 48 89 e5 e8 32 9a
db e0 <0f> ff 5d 31 c0 f3 c3 83 78 70 0b 74 f8 31 c0 85 d2 74 ad eb f0 
[  476.966542] ---[ end trace 0b809f2b0052649f ]---


> > 
> > out ELD. This causes a warning in dmesg. To fix this issue, let's
> > register
> > the audio driver only in a case when display is enabled.
> > 
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103206
> > Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_drv.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_drv.c
> > b/drivers/gpu/drm/i915/i915_drv.c
> > index e7e9e06..f3cee1b 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.c
> > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > @@ -1243,7 +1243,8 @@ static void i915_driver_register(struct
> > drm_i915_private *dev_priv)
> >         if (IS_GEN5(dev_priv))
> >                 intel_gpu_ips_init(dev_priv);
> >  
> > -       intel_audio_init(dev_priv);
> > +       if (!i915_modparams.disable_display)
> INTEL_INFO()->num_ports == 0 is the derived value that includes cases
> where the display is fused off as well.
> -Chris
Chris Wilson Nov. 10, 2017, 3:48 p.m. UTC | #3
Quoting Mika Kahola (2017-11-10 14:06:38)
> On Fri, 2017-11-10 at 13:37 +0000, Chris Wilson wrote:
> > Quoting Mika Kahola (2017-11-10 13:31:54)
> > > 
> > > At least in Coffee Lake it happens that we start initiliazing audio
> > > when
> > > no display is connected. This was discovered by CI when running IGT
> > > test
> > > case
> > > 
> > > drv_module_reload --r basic-no-display
> > > 
> > > The issue here is that the 'intel_device_info_runtime_init()' sets
> > > num_pipes to 0 but before this happens the audio part has already
> > > started
> > > to initialize itself. Later on the num_pipes is updated to 0 in
> > > intel_device_info_runtime_init()
> > runtime_init happens twice? (I am confused by this pair of
> > sentences.)
> > 
> > and we hit that when audio part is digging
> This is tricky. i915_audio_component_get_eld() gets called from a sound
> driver. Even though, I disable intel_audio_init() call, these num_pipes
> warnings keep popping up in dmesg like this.

Ask for a kasan run. I don't see where i915 is unbound during cleanup.
component_del() only unbinds the master, and not itself. As I read the
code it seems like the old i915 device is not uncoupled.

First time I dipped my toe into the component code so take that with a
pinch of salt.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index e7e9e06..f3cee1b 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1243,7 +1243,8 @@  static void i915_driver_register(struct drm_i915_private *dev_priv)
 	if (IS_GEN5(dev_priv))
 		intel_gpu_ips_init(dev_priv);
 
-	intel_audio_init(dev_priv);
+	if (!i915_modparams.disable_display)
+		intel_audio_init(dev_priv);
 
 	/*
 	 * Some ports require correctly set-up hpd registers for detection to