Bug 120451 - snd_hda_* crash after resuming laptop from suspend
Summary: snd_hda_* crash after resuming laptop from suspend
Status: NEW
Alias: None
Product: Other
Classification: Unclassified
Component: Modules (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: other_modules
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-16 08:37 UTC by Paolo Stivanin
Modified: 2016-07-14 16:23 UTC (History)
2 users (show)

See Also:
Kernel Version: 4.5.x, 4.6.x
Subsystem:
Regression: No
Bisected commit-id:


Attachments
full dmesg output (69.24 KB, text/plain)
2016-07-11 07:43 UTC, Paolo Stivanin
Details
Patch for 4.6.4 reverting the commit causing this problem. (1.62 KB, patch)
2016-07-14 12:39 UTC, Hans de Goede
Details | Diff
dmesg after patch (12.06 KB, text/plain)
2016-07-14 16:23 UTC, Paolo Stivanin
Details

Description Paolo Stivanin 2016-06-16 08:37:13 UTC
Hi, all,
after my laptop is resumed from the suspend status, I always hear a weird sound (like "crtoc") and my headphones stop working. Without headphones everything's fine.
Checking with dmesg, I have noticed that after resuming my laptop a segfault/crash/something happens:

$ dmesg|grep -i snd
[    5.258218] snd_hda_intel 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[    5.282659] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC892: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:line
[    5.282660] snd_hda_codec_realtek hdaudioC0D0:    speaker_outs=1 (0x14/0x0/0x0/0x0/0x0)
[    5.282661] snd_hda_codec_realtek hdaudioC0D0:    hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
[    5.282661] snd_hda_codec_realtek hdaudioC0D0:    mono: mono_out=0x0
[    5.282662] snd_hda_codec_realtek hdaudioC0D0:    dig-out=0x1e/0x0
[    5.282662] snd_hda_codec_realtek hdaudioC0D0:    inputs:
[    5.282663] snd_hda_codec_realtek hdaudioC0D0:      Mic=0x18
[    5.282664] snd_hda_codec_realtek hdaudioC0D0:      Internal Mic=0x12
[   76.025795] Modules linked in: sha256_ssse3 sha256_generic hmac drbg ansi_cprng ctr ccm cmac ecb fuse joydev mousedev snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_core videodev btusb media btrtl arc4 bnep nvram msr intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp iwlmvm kvm_intel kvm mac80211 mxm_wmi irqbypass crct10dif_pclmul crc32_pclmul crc32c_intel snd_hda_intel ghash_clmulni_intel aesni_intel snd_hda_codec aes_x86_64 lrw snd_hda_core gf128mul glue_helper ablk_helper cryptd snd_hwdep iwlwifi evdev snd_pcm input_leds led_class mac_hid pcspkr snd_timer psmouse cfg80211 rtsx_pci_ms r8169 serio_raw snd memstick soundcore i2c_i801 mii hci_uart btbcm btqca btintel thermal bluetooth i915 rfkill i2c_hid hid
[   76.025889]  [<ffffffffa1313dbf>] snd_hdac_set_codec_wakeup+0x3f/0xa0 [snd_hda_core]
[   76.025891]  [<ffffffffa1325ab3>] azx_runtime_resume+0x1a3/0x1c0 [snd_hda_intel]
[   76.025908]  [<ffffffffa1233212>] ? snd_pcm_hw_rule_add+0x122/0x1d0 [snd_pcm]
[   76.025911]  [<ffffffffa130ded3>] snd_hdac_power_up+0x13/0x20 [snd_hda_core]
[   76.025914]  [<ffffffffa134b119>] azx_pcm_open+0x1d9/0x390 [snd_hda_codec]
[   76.025916]  [<ffffffffa123202b>] snd_pcm_open_substream+0x7b/0x130 [snd_pcm]
[   76.025918]  [<ffffffffa1232197>] snd_pcm_open+0xb7/0x250 [snd_pcm]
[   76.025923]  [<ffffffffa1232377>] snd_pcm_capture_open+0x47/0x70 [snd_pcm]
[   76.025925]  [<ffffffffa10f7451>] snd_open+0xb1/0x180 [snd]

Laptop specification:
CPU i7-6700HQ
Video Nvidia GTX 970m
Distro Archlinux x64 (gnome 3.20)
Kernel: 4.6.1

$ lsmod|grep snd
snd_hda_codec_hdmi     45056  1
snd_hda_codec_realtek    69632  1
snd_hda_codec_generic    69632  1 snd_hda_codec_realtek
snd_hda_intel          32768  6
snd_hda_codec         106496  4 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_intel
snd_hda_core           61440  5 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_codec,snd_hda_intel
snd_hwdep              16384  1 snd_hda_codec
snd_pcm                86016  4 snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel,snd_hda_core
snd_timer              28672  1 snd_pcm
snd                    65536  20 snd_hda_codec_realtek,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_hda_codec_generic,snd_hda_codec,snd_hda_intel
soundcore              16384  1 snd

$ lspci
00:00.0 Host bridge: Intel Corporation Skylake Host Bridge/DRAM Registers (rev 07)
00:01.0 PCI bridge: Intel Corporation Skylake PCIe Controller (x16) (rev 07)
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
00:14.0 USB controller: Intel Corporation Sunrise Point-H USB 3.0 xHCI Controller (rev 31)
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-H Thermal subsystem (rev 31)
00:16.0 Communication controller: Intel Corporation Sunrise Point-H CSME HECI #1 (rev 31)
00:17.0 SATA controller: Intel Corporation Sunrise Point-H SATA Controller [AHCI mode] (rev 31)
00:1c.0 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #5 (rev f1)
00:1c.5 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #6 (rev f1)
00:1f.0 ISA bridge: Intel Corporation Sunrise Point-H LPC Controller (rev 31)
00:1f.2 Memory controller: Intel Corporation Sunrise Point-H PMC (rev 31)
00:1f.3 Audio device: Intel Corporation Sunrise Point-H HD Audio (rev 31)
00:1f.4 SMBus: Intel Corporation Sunrise Point-H SMBus (rev 31)
01:00.0 VGA compatible controller: NVIDIA Corporation GM204M [GeForce GTX 970M] (rev a1)
02:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. Device 5287 (rev 01)
02:00.1 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 12)
03:00.0 Network controller: Intel Corporation Wireless 8260 (rev 3a)
Comment 1 Peter Wu 2016-07-11 00:00:21 UTC
Please post a full dmesg? The stacktrace is missing essential details.

How reproducible is this? Your laptop looks like a Clevo P6xxRE, maybe I can reproduce it on a P651RA.
Comment 2 Paolo Stivanin 2016-07-11 07:43:51 UTC
Created attachment 222751 [details]
full dmesg output

Hello Peter,
yes my laptop (Santech T67) is based on a Clevo P640RE.
Attached you can find a full dmesg output after the laptop has been resumed.

PS: I had this problem also with kernel 4.5.x and on Ubuntu 16.04.
Comment 3 Peter Wu 2016-07-11 08:40:43 UTC
Oh, it is just a warning. Not a crash as you mentioned before:

[ 82.571396] WARNING: CPU: 7 PID: 899 at drivers/gpu/drm/i915/intel_uncore.c:649 __unclaimed_reg_debug+0x7b/0x90 [i915]
[ 82.571398] Unclaimed register detected after reading register 0x65f10

I've seen this happen without even headphones plugged in (with no nvidia/nouveau, but bbswitch and the Plasma desktop) and if I remember correctly, without even having to suspend.
Comment 4 Paolo Stivanin 2016-07-11 08:54:55 UTC
Sorry, I thought it was a crash.
BTW, I do have this problem, every time I resume my laptop headphones don't work any more.

PS I'm not using bbswitch or Plasma. Only the official nvidia driver with Gnome.  And I'm using only the intel card (xorg.conf setting) because I don't need the nvidia one :)
Comment 5 Peter Wu 2016-07-11 09:05:15 UTC
I mentioned my environment for completeness (forgot to mention that the power_save module option is on).

It looks like the bug is known and a patch is available:
https://bugs.freedesktop.org/show_bug.cgi?id=96214
https://patchwork.freedesktop.org/patch/97995/
Comment 6 Paolo Stivanin 2016-07-11 09:12:16 UTC
I've seen that the patch hasn't been merged on 4.7-rc7. 
Do you know it if will be merged before the final 4.7 release? Or do I have to wait for the 4.8-rc1 one?

Thank you very much Peter!
Comment 7 Peter Wu 2016-07-11 09:16:28 UTC
The patch is currently still under review. I see no indication of a backport (CC: stable@..), but I guess you could request it and add that you seem to lose sound. Are you able to test this patch and report upstream that it has been tested?
Comment 8 Paolo Stivanin 2016-07-11 10:41:15 UTC
I have patched the kernel 4.6.3 but nothing changed.
Same warning on dmesg and same result: can't use my headphones after the laptop has been resumed.

Cheers
Comment 9 Peter Wu 2016-07-12 16:55:08 UTC
@Paolo can you double-check that the patch was applied?
Comment 10 Paolo Stivanin 2016-07-12 17:55:58 UTC
@Peter: double-checked, the patch is there :(

Actually, using "init-headphone" my problem is solved. Better than nothing :-)
Comment 11 Hans de Goede 2016-07-14 12:39:32 UTC
Created attachment 223831 [details]
Patch for 4.6.4 reverting the commit causing this problem.

As discussed in:

https://bugs.freedesktop.org/show_bug.cgi?id=96214

The original patch indeed did not work. Attached is another patch (suggested by Chris Wilson) which does fix the WARN_ON for me.
Comment 12 Paolo Stivanin 2016-07-14 15:41:14 UTC
@Hans thank you! I'm rebuilding 4.6.4 kernel right now.

How do I know if the patch has worked? Will the "unclaimed reg blabla" disappear or will my headphone start working after the laptop has been resumed?
Comment 13 Paolo Stivanin 2016-07-14 16:23:35 UTC
Created attachment 223841 [details]
dmesg after patch

Hi,
I have applied the patch against the 4.6.4 source but still nothing changed :(
Attached you can find the dmesg output before and after suspending the laptop.


Cheers

Note You need to log in before you can comment on or make changes to this bug.