diff mbox series

snd/hda: Detangle unwind to avoid double release of display powerwell

Message ID 20190408094337.8709-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series snd/hda: Detangle unwind to avoid double release of display powerwell | expand

Commit Message

Chris Wilson April 8, 2019, 9:43 a.m. UTC
<4> [265.019572] Unmatched wakeref (tracking 3), count 3
<4> [265.019680] WARNING: CPU: 1 PID: 163 at drivers/gpu/drm/i915/intel_runtime_pm.c:162 cancel_intel_runtime_pm_wakeref+0x87/0x160 [i915]
<4> [265.019682] Modules linked in: snd_hda_intel i915 vgem snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic mei_hdcp x86_pkg_temp_thermal coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_codec snd_hwdep snd_hda_core snd_pcm mei_me r8169 prime_numbers realtek mei i2c_hid pinctrl_geminilake pinctrl_intel [last unloaded: i915]
<4> [265.019702] CPU: 1 PID: 163 Comm: kworker/1:2 Tainted: G     U  W         5.1.0-rc4-CI-CI_DRM_5887+ #1
<4> [265.019705] Hardware name: Intel Corp. Geminilake/GLK RVP2 LP4SD (07), BIOS GELKRVPA.X64.0062.B30.1708222146 08/22/2017
<4> [265.019710] Workqueue: events azx_probe_work [snd_hda_intel]
<4> [265.019761] RIP: 0010:cancel_intel_runtime_pm_wakeref+0x87/0x160 [i915]
<4> [265.019763] Code: 48 8d 48 ff 75 dc 4c 89 ee 48 89 df e8 42 77 84 e1 8b 95 b0 ae 00 00 48 8b b5 00 af 00 00 48 c7 c7 58 77 2c a0 e8 f9 80 f5 e0 <0f> 0b 48 8b 3d 10 1b ff e1 ba 00 10 00 00 be c0 0c 00 00 e8 51 87
<4> [265.019766] RSP: 0018:ffffc90000fb3da8 EFLAGS: 00010282
<4> [265.019769] RAX: 0000000000000000 RBX: ffff8881452caeb8 RCX: 0000000000000000
<4> [265.019771] RDX: 0000000000000007 RSI: ffff8881788f08e0 RDI: 00000000ffffffff
<4> [265.019773] RBP: ffff8881452c0000 R08: 0000000085ca34c4 R09: 0000000000000000
<4> [265.019775] R10: 0000000000000000 R11: 0000000000000000 R12: 00000000cb400003
<4> [265.019777] R13: 0000000000000292 R14: 0000000000000000 R15: ffff888173798870
<4> [265.019780] FS:  0000000000000000(0000) GS:ffff88817ba80000(0000) knlGS:0000000000000000
<4> [265.019782] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
<4> [265.019784] CR2: 00007f971402e138 CR3: 00000001736dc000 CR4: 0000000000340ee0
<4> [265.019786] Call Trace:
<4> [265.019839]  intel_display_power_put+0x16/0x20 [i915]
<4> [265.019849]  snd_hdac_display_power+0xe3/0x100 [snd_hda_core]
<4> [265.019856]  azx_probe_work+0x4ed/0x7e0 [snd_hda_intel]
<4> [265.019865]  process_one_work+0x245/0x610
<4> [265.019874]  worker_thread+0x37/0x380
<4> [265.019879]  ? process_one_work+0x610/0x610
<4> [265.019882]  kthread+0x119/0x130
<4> [265.019885]  ? kthread_park+0x80/0x80
<4> [265.019892]  ret_from_fork+0x3a/0x50
<4> [265.019903] irq event stamp: 709708
<4> [265.019908] hardirqs last  enabled at (709707): [<ffffffff81124a27>] console_unlock+0x3f7/0x5a0
<4> [265.019911] hardirqs last disabled at (709708): [<ffffffff810019b0>] trace_hardirqs_off_thunk+0x1a/0x1c
<4> [265.019914] softirqs last  enabled at (709656): [<ffffffff81c0033a>] __do_softirq+0x33a/0x4b9
<4> [265.019918] softirqs last disabled at (709647): [<ffffffff810b5159>] irq_exit+0xa9/0xc0
<4> [265.019967] WARNING: CPU: 1 PID: 163 at drivers/gpu/drm/i915/intel_runtime_pm.c:162 cancel_intel_runtime_pm_wakeref+0x87/0x160 [i915]
<4> [265.019970] ---[ end trace 4b6d3cc703fecad8 ]---
<7> [265.020142] [drm:cancel_intel_runtime_pm_wakeref [i915]] wakeref cb400003 from
   intel_display_power_get+0x18/0x50 [i915]
   i915_audio_component_get_power+0x19/0x60 [i915]
   snd_hdac_display_power+0x6a/0x100 [snd_hda_core]
   azx_probe_work+0x88/0x7e0 [snd_hda_intel]
   process_one_work+0x245/0x610
   worker_thread+0x37/0x380
   kthread+0x119/0x130
   ret_from_fork+0x3a/0x50

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Imre Deak <imre.deak@intel.com>
---
 sound/pci/hda/hda_intel.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

kernel test robot April 8, 2019, 12:27 p.m. UTC | #1
Hi Chris,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on sound/for-next]
[also build test ERROR on v5.1-rc4 next-20190405]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Chris-Wilson/snd-hda-Detangle-unwind-to-avoid-double-release-of-display-powerwell/20190408-185235
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
config: i386-randconfig-x012-201914 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   sound/pci/hda/hda_intel.c: In function 'azx_probe_continue':
>> sound/pci/hda/hda_intel.c:2252:4: error: label 'power' used but not defined
       goto power;
       ^~~~

vim +/power +2252 sound/pci/hda/hda_intel.c

  2231	
  2232		/* create codec instances */
  2233		err = azx_probe_codecs(chip, azx_max_codecs[chip->driver_type]);
  2234		if (err < 0)
  2235			goto power;
  2236	
  2237	#ifdef CONFIG_SND_HDA_PATCH_LOADER
  2238		if (chip->fw) {
  2239			err = snd_hda_load_patch(&chip->bus, chip->fw->size,
  2240						 chip->fw->data);
  2241			if (err < 0)
  2242				goto power;
  2243	#ifndef CONFIG_PM
  2244			release_firmware(chip->fw); /* no longer needed */
  2245			chip->fw = NULL;
  2246	#endif
  2247		}
  2248	#endif
  2249		if ((probe_only[dev] & 1) == 0) {
  2250			err = azx_codec_configure(chip);
  2251			if (err < 0)
> 2252				goto power;
  2253		}
  2254	
  2255		err = snd_card_register(chip->card);
  2256		if (err < 0)
  2257			goto out_power;
  2258	
  2259		setup_vga_switcheroo_runtime_pm(chip);
  2260	
  2261		chip->running = 1;
  2262		azx_add_card_list(chip);
  2263	
  2264		set_default_power_save(chip);
  2265	
  2266		if (azx_has_pm_runtime(chip))
  2267			pm_runtime_put_autosuspend(&pci->dev);
  2268	
  2269	out_power:
  2270		if (err < 0 || !hda->need_i915_power)
  2271			display_power(chip, false);
  2272	out_free:
  2273		if (err < 0)
  2274			hda->init_failed = 1;
  2275		complete_all(&hda->probe_wait);
  2276		to_hda_bus(bus)->bus_probing = 0;
  2277		return err;
  2278	}
  2279	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Chris Wilson April 8, 2019, 12:53 p.m. UTC | #2
Quoting Patchwork (2019-04-08 13:51:08)
> #### Warnings ####
> 
>   * igt@i915_pm_rpm@module-reload:
>     - fi-glk-dsi:         DMESG-WARN [fdo#105538] / [fdo#107732] / [fdo#109513] -> INCOMPLETE [fdo#103359] / [k.org#198133]

In other words, no that wasn't the fix it purported to be.
-Chris
diff mbox series

Patch

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index ece256a3b48f..3795708ac903 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2223,7 +2223,7 @@  static int azx_probe_continue(struct azx *chip)
 
 	err = azx_first_init(chip);
 	if (err < 0)
-		goto out_free;
+		goto power;
 
 #ifdef CONFIG_SND_HDA_INPUT_BEEP
 	chip->beep_mode = beep_mode[dev];
@@ -2232,14 +2232,14 @@  static int azx_probe_continue(struct azx *chip)
 	/* create codec instances */
 	err = azx_probe_codecs(chip, azx_max_codecs[chip->driver_type]);
 	if (err < 0)
-		goto out_free;
+		goto power;
 
 #ifdef CONFIG_SND_HDA_PATCH_LOADER
 	if (chip->fw) {
 		err = snd_hda_load_patch(&chip->bus, chip->fw->size,
 					 chip->fw->data);
 		if (err < 0)
-			goto out_free;
+			goto power;
 #ifndef CONFIG_PM
 		release_firmware(chip->fw); /* no longer needed */
 		chip->fw = NULL;
@@ -2249,12 +2249,12 @@  static int azx_probe_continue(struct azx *chip)
 	if ((probe_only[dev] & 1) == 0) {
 		err = azx_codec_configure(chip);
 		if (err < 0)
-			goto out_free;
+			goto power;
 	}
 
 	err = snd_card_register(chip->card);
 	if (err < 0)
-		goto out_free;
+		goto out_power;
 
 	setup_vga_switcheroo_runtime_pm(chip);
 
@@ -2266,9 +2266,10 @@  static int azx_probe_continue(struct azx *chip)
 	if (azx_has_pm_runtime(chip))
 		pm_runtime_put_autosuspend(&pci->dev);
 
-out_free:
+out_power:
 	if (err < 0 || !hda->need_i915_power)
 		display_power(chip, false);
+out_free:
 	if (err < 0)
 		hda->init_failed = 1;
 	complete_all(&hda->probe_wait);