Repository navigation
[CML][HDA] Kernel panic when tried to remove sof module (sof_pci_dev) #837
Copy link
Copy link
Closed
Labels
CMLApplies to Comet Lake platformApplies to Comet Lake platformHDAApplies to HD-Audio bus for codec connectionApplies to HD-Audio bus for codec connectionbugSomething isn't workingSomething isn't working
Description
Summary
Kernel panic when tried to remove sof module.
To reproduce
- sudo rmmod sof_pci_dev
Actual result
Kernel Panic
Test recipe
Kernel: 2de29fa [thesofproject/linux: topic/sof-dev] +[RanderWang/linux: cml-validation-20190415] d04ccf4 + bfb0729 + 8a2b13a + 63ceb8f + db89510
Firmware: bardliao/sof@00bbb11 + bardliao/sof@5738003
Topology: sof-hda-generic.tplg
dmesg log
[ 1569.663137] ------------[ cut here ]------------
[ 1569.663138] sysfs group 'power' not found for kobject 'ehdaudio0D0'
[ 1569.663145] WARNING: CPU: 4 PID: 3004 at fs/sysfs/group.c:256 sysfs_remove_group+0x71/0x80
[ 1569.663145] Modules linked in: snd_soc_skl_hda_dsp snd_soc_hdac_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_soc_dmic sof_pci_dev(-) snd_sof_intel_hda_common snd_soc_hdac_hda snd_sof_intel_hda snd_sof_xtensa_dsp snd_sof iwlmvm snd_soc_acpi_intel_match snd_soc_acpi snd_hda_ext_core ax88179_178a snd_soc_core usbnet snd_hda_codec snd_hwdep snd_hda_core intel_lpss_pci intel_lpss iwlwifi snd_pcm x86_pkg_temp_thermal mfd_core efivarfs xhci_pci xhci_hcd
[ 1569.663156] CPU: 4 PID: 3004 Comm: rmmod Not tainted 5.0.0-cml-validation-20190415-4-hda-sof-db89510 #5.0.0
[ 1569.663156] Hardware name: Dell Inc. Inspiron 5590/, BIOS 86.1.4 04/08/2019
[ 1569.663158] RIP: 0010:sysfs_remove_group+0x71/0x80
[ 1569.663159] Code: 48 89 df 5b 5d 41 5c e9 6d c0 ff ff 48 89 df e8 c5 bc ff ff eb cb 49 8b 14 24 48 8b 75 00 48 c7 c7 90 1a 22 a0 e8 cf 82 e2 ff <0f> 0b 5b 5d 41 5c c3 0f 1f 84 00 00 00 00 00 48 85 f6 74 31 41 54
[ 1569.663159] RSP: 0018:ffffa11f04c23ac8 EFLAGS: 00010286
[ 1569.663160] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000006
[ 1569.663161] RDX: 0000000000000007 RSI: 0000000000000092 RDI: ffff993458315410
[ 1569.663161] RBP: ffffffffa00bac80 R08: 0000000000000048 R09: 0000000000000004
[ 1569.663162] R10: ffff993451649ac0 R11: 0000000000000001 R12: ffff9934525a7010
[ 1569.663162] R13: ffff993452b8b000 R14: 0000000000000000 R15: ffffffffa020ee2b
[ 1569.663163] FS: 00007f9d0f55a540(0000) GS:ffff993458300000(0000) knlGS:0000000000000000
[ 1569.663164] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1569.663164] CR2: 00005653dcf4e430 CR3: 00000004fd464004 CR4: 00000000003606e0
[ 1569.663165] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 1569.663165] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 1569.663166] Call Trace:
[ 1569.663170] device_del+0x51/0x350
[ 1569.663173] snd_hdac_device_unregister+0x19/0x30 [snd_hda_core]
[ 1569.663177] snd_hda_codec_dev_free+0x14/0x40 [snd_hda_codec]
[ 1569.663180] __snd_device_free+0x43/0x70
[ 1569.663181] snd_device_free_all+0x36/0x80
[ 1569.663183] release_card_device+0x14/0x60
[ 1569.663184] device_release+0x2b/0x80
[ 1569.663187] kobject_put+0x84/0x1b0
[ 1569.663188] snd_card_free+0x60/0x90
[ 1569.663191] soc_cleanup_card_resources+0x22/0x390 [snd_soc_core]
[ 1569.663194] snd_soc_unbind_card.part.59+0xa8/0xf0 [snd_soc_core]
[ 1569.663197] snd_soc_unregister_component+0x8f/0xd0 [snd_soc_core]
[ 1569.663199] release_nodes+0x121/0x220
[ 1569.663201] device_release_driver_internal+0x190/0x240
[ 1569.663202] bus_remove_device+0xe0/0x150
[ 1569.663203] device_del+0x133/0x350
[ 1569.663205] snd_hdac_device_unregister+0x19/0x30 [snd_hda_core]
[ 1569.663208] snd_hdac_ext_bus_device_remove+0x2a/0x60 [snd_hda_ext_core]
[ 1569.663214] hda_dsp_remove+0x26/0x110 [snd_sof_intel_hda_common]
[ 1569.663217] snd_sof_device_remove+0x5c/0x90 [snd_sof]
[ 1569.663219] sof_pci_remove+0x10/0x20 [sof_pci_dev]
[ 1569.663221] pci_device_remove+0x36/0xb0
[ 1569.663222] device_release_driver_internal+0x180/0x240
[ 1569.663224] driver_detach+0x48/0x80
[ 1569.663225] bus_remove_driver+0x4c/0xc0
[ 1569.663226] pci_unregister_driver+0x1d/0x90
[ 1569.663228] __x64_sys_delete_module+0x155/0x240
[ 1569.663230] do_syscall_64+0x43/0xf0
[ 1569.663232] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 1569.663233] RIP: 0033:0x7f9d0f0781b7
[ 1569.663235] Code: 73 01 c3 48 8b 0d d1 8c 2c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d a1 8c 2c 00 f7 d8 64 89 01 48
[ 1569.663236] RSP: 002b:00007ffcbccabe68 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
[ 1569.663236] RAX: ffffffffffffffda RBX: 00007ffcbccabec8 RCX: 00007f9d0f0781b7
[ 1569.663237] RDX: 000000000000000a RSI: 0000000000000800 RDI: 000055f65674f7b8
[ 1569.663238] RBP: 000055f65674f750 R08: 00007ffcbccaade1 R09: 0000000000000000
[ 1569.663238] R10: 00007f9d0f0f4cc0 R11: 0000000000000206 R12: 00007ffcbccac090
[ 1569.663239] R13: 00007ffcbccac7d5 R14: 000055f65674e260 R15: 000055f65674f750
[ 1569.663240] ---[ end trace f504933eaff4071b ]---
Metadata
Metadata
Assignees
Labels
CMLApplies to Comet Lake platformApplies to Comet Lake platformHDAApplies to HD-Audio bus for codec connectionApplies to HD-Audio bus for codec connectionbugSomething isn't workingSomething isn't working
Activity
bardliao commentedon Apr 17, 2019
I found that the ehdaudio0D0 kobj is removed twice and kernel will crash in the second remove. I am trying to figure out why it is removed twice.
wenqingfu commentedon Apr 17, 2019
😓
ranj063 commentedon Apr 17, 2019
@bardliao looks like we call snd_hdac_ext_bus_device_remove(bus) in hda_dsp_remove() first which removes the codec devices already. The second one seems to be coming from snd_hda_codec_dev_free(). I havent verified but thats my guess.
ranj063 commentedon Apr 17, 2019
my hunch is maybe we should do something like this:
bardliao commentedon Apr 18, 2019
@ranj063 Indeed, the first snd_hdac_device_unregister() is called by snd_hdac_ext_bus_device_remove() and the second one is from snd_hda_codec_dev_free(). But, I think we still need to call snd_hdac_ext_bus_device_remove() since it will also remove hdmi for us. The reason we see this issue only on hda codec but not on hdmi is that snd_hda_codec_device_new() is call in hdac_hda.c but not in hdac_hdmi.c. Right now I am thinking is snd_hdac_device_unregister() is necessary called by snd_hda_codec_dev_free(). In fact, the issue can be fixed by removing snd_hdac_device_unregister() in snd_hda_codec_dev_free(). But my concern is that snd_hda_codec_dev_free() is a common function which will be used by legacy HDA driver, but snd_hdac_ext_bus_device_remove() is not called by legacy HDA driver.
Also, I am wondering how can hdac_hdmi.c register a hda codec without using snd_hda_codec_device_new() and can we do the same thing in hdac_hda.c?
plbossart commentedon Apr 22, 2019
@bardliao this problem should also affect the Skylake driver, no? There may be other issues with that driver but with the list of patches shared internally we should be able to test on e.g. a NUC if we can reproduce the same problem.
bardliao commentedon Apr 23, 2019
@plbossart I checked the internal patches list, but I didn't find a patch which is related to this issue. And I believe that we will see the same issue on Skylake driver. @keqiaozhang Could QA do the test on Skylake driver?
stevyan commentedon Apr 24, 2019
Summary
it can be reproduced on ICL RVP nocodec.
Test recipe
Date: 2019-04-24
sof (master): e4c1651
kernel (topic/sof-dev): 2e94569
topology: sof-icl-nocodec.tplg
dmesg log
Jiangxinx commentedon Apr 24, 2019
Fixed by #856 ,I will closed this issue until it is merged.
Test recipe
Kernel repo | https://github.com/RanderWang/linux/tree/cml-validation-20190424
Made from:
2e94569 [thesofproject/linux: topic/sof-dev]
85a86d9 [RanderWang/linux: cml-validation-20190424]
b51284b[RanderWang/linux: cml-validation-20190424]
8f41f15 [RanderWang/linux: cml-validation-20190424]
202216f [RanderWang/linux: cml-validation-20190424]
ce16096 [RanderWang/linux: cml-validation-20190424]
4459c97 [RanderWang/linux: cml-validation-20190424]
4f4bfb1 [RanderWang/linux: cml-validation-20190424]
0bc8e92 [RanderWang/linux: cml-validation-20190424]
4de6c77 [RanderWang/linux: cml-validation-20190424]
7ec78da [RanderWang/linux: cml-validation-20190424]
30d5691 [RanderWang/linux: cml-validation-20190424]
98d6916 [RanderWang/linux: cml-validation-20190424]
Firmware repo | https://github.com/RanderWang/linux/tree/cml-validation-20190424
Made from:
0c93261 [thesofproject/sof: master]
e3ade00 [RanderWang/sof: cml-linux-20190424]
08d40fc [RanderWang/sof: cml-linux-20190424]
stevyan commentedon May 7, 2019
Summary
it can be reproduced on ICL RVP nocodec.
Test recipe
Date: 2019-05-07
sof (master): 47fcac2
kernel (topic/sof-dev): 820e841
topology: sof-icl-nocodec.tplg
dmesg log
ranj063 commentedon May 7, 2019
@stevyan could you please check if #863 fixes this?
stevyan commentedon May 7, 2019
This error cannot reproduce with patch #863 based on ICL RVP nocodec.
Test Recipe
date: 2019-05-07
kernel (topic/sof-dev): 820e841 + (PR #863)
sof (master): 47fcac2
topology: sof-icl-nocodec.tplg
wenqingfu commentedon May 7, 2019
ok, let's close it after #863 is merged then.
bardliao commentedon May 13, 2019
The issue on ICL nocodec is #861 and #863 is merged.