Bug 216683

Summary: [REGRESSION] HCI_QUIRK_NO_SUSPEND_NOTIFIER causes kernel panic on fake CSR 5.0 clones
Product: Drivers Reporter: JustANormalTinkererMihir (justanormaltinkerermihir)
Component: BluetoothAssignee: linux-bluetooth (linux-bluetooth)
Status: RESOLVED CODE_FIX    
Severity: high CC: dxor+kernel, justanormaltinkerermihir, lelgenio, luiz.dentz, ostroffjh, regressions
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 6.0.7 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: btmon log

Description JustANormalTinkererMihir 2022-11-12 06:31:37 UTC
[   71.985884] ------------[ cut here ]------------
[   71.985887] notifier callback hci_suspend_notifier [bluetooth] already registered
[   71.985945] WARNING: CPU: 1 PID: 268 at kernel/notifier.c:28 notifier_chain_register+0x3e/0x70
[   71.985955] Modules linked in: rfcomm snd_seq_dummy snd_hrtimer snd_seq snd_seq_device qrtr bnep ccm algif_aead cbc des_generic libdes ecb algif_skcipher cmac md4 algif_hash af_alg btusb(OE) btrtl btbcm btintel btmtk bluetooth(OE) intel_rapl_msr intel_rapl_common x86_pkg_temp_thermal intel_powerclamp coretemp cfg80211 kvm_intel kvm irqbypass vfat fat crct10dif_pclmul crc32_pclmul snd_hda_codec_realtek polyval_clmulni polyval_generic snd_hda_codec_generic gf128mul ghash_clmulni_intel ledtrig_audio aesni_intel snd_hda_codec_hdmi crypto_simd cryptd rapl intel_cstate intel_uncore hp_wmi snd_hda_intel snd_intel_dspcfg sparse_keymap ecdh_generic platform_profile snd_intel_sdw_acpi snd_hda_codec rfkill iTCO_wdt intel_pmc_bxt mei_wdt iTCO_vendor_support psmouse wmi_bmof snd_hda_core pkcs8_key_parser at24 mei_hdcp gpio_ich mei_pxp snd_hwdep snd_pcm mousedev joydev tpm_infineon snd_timer nvidia_drm(POE) tpm_tis nvidia_modeset(POE) wmi snd nvidia_uvm(POE) e1000e soundcore tpm_tis_core i2c_i801
[   71.986060]  mei_me tpm mei i2c_smbus rng_core mac_hid lpc_ich nvidia(POE) fuse crypto_user bpf_preload ip_tables x_tables ext4 crc32c_generic crc16 mbcache jbd2 raid0 uas usb_storage usbhid md_mod serio_raw atkbd libps2 vivaldi_fmap crc32c_intel i8042 serio
[   71.986093] CPU: 1 PID: 268 Comm: kworker/1:3 Tainted: P           OE      6.0.7-arch1-1 #1 54734d35253fb4c526adcfdfa2e7225be9ec4a9a
[   71.986096] Hardware name: Hewlett-Packard HP Compaq 8200 Elite SFF PC/1495, BIOS J01 v02.33 04/12/2019
[   71.986098] Workqueue: usb_hub_wq hub_event
[   71.986103] RIP: 0010:notifier_chain_register+0x3e/0x70
[   71.986107] Code: 10 7f 33 75 04 84 d2 75 3b 48 8d 78 08 48 8b 40 08 48 85 c0 74 20 48 39 c6 75 e0 48 8b 36 48 c7 c7 08 c6 d1 b9 e8 92 6d ac 00 <0f> 0b b8 ef ff ff ff c3 cc cc cc cc 48 89 46 08 31 c0 48 89 37 c3
[   71.986108] RSP: 0018:ffffa676005fb810 EFLAGS: 00010286
[   71.986110] RAX: 0000000000000000 RBX: ffffffffba45b000 RCX: 0000000000000027
[   71.986112] RDX: ffff895fa5ca1668 RSI: 0000000000000001 RDI: ffff895fa5ca1660
[   71.986113] RBP: ffff895e8341eb78 R08: 0000000000000000 R09: ffffa676005fb698
[   71.986114] R10: 0000000000000003 R11: ffffffffba4cb508 R12: ffffffffba45b028
[   71.986115] R13: ffff895e8341e030 R14: ffff895e8341ed08 R15: ffffffffc35e9ca0
[   71.986117] FS:  0000000000000000(0000) GS:ffff895fa5c80000(0000) knlGS:0000000000000000
[   71.986118] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   71.986120] CR2: 000055dffc48e078 CR3: 0000000029010006 CR4: 00000000000606e0
[   71.986122] Call Trace:
[   71.986124]  <TASK>
[   71.986125]  blocking_notifier_chain_register+0x33/0x60
[   71.986130]  hci_register_dev+0x316/0x3d0 [bluetooth 99b5497ea3d09708fa1366c1dc03288bf3cca8da]
[   71.986154]  btusb_probe+0x979/0xd85 [btusb e1e0605a4f4c01984a4b9c8ac58c3666ae287477]
[   71.986159]  ? __pm_runtime_set_status+0x1a9/0x300
[   71.986162]  ? ktime_get_mono_fast_ns+0x3e/0x90
[   71.986167]  usb_probe_interface+0xe3/0x2b0
[   71.986171]  really_probe+0xdb/0x380
[   71.986174]  ? pm_runtime_barrier+0x54/0x90
[   71.986177]  __driver_probe_device+0x78/0x170
[   71.986180]  driver_probe_device+0x1f/0x90
[   71.986183]  __device_attach_driver+0x89/0x110
[   71.986186]  ? driver_allows_async_probing+0x70/0x70
[   71.986189]  bus_for_each_drv+0x8c/0xe0
[   71.986192]  __device_attach+0xb2/0x1e0
[   71.986195]  bus_probe_device+0x92/0xb0
[   71.986198]  device_add+0x422/0x9a0
[   71.986201]  ? sysfs_merge_group+0xd4/0x110
[   71.986205]  usb_set_configuration+0x57a/0x820
[   71.986208]  usb_generic_driver_probe+0x4f/0x70
[   71.986211]  usb_probe_device+0x3a/0x110
[   71.986213]  really_probe+0xdb/0x380
[   71.986216]  ? pm_runtime_barrier+0x54/0x90
[   71.986219]  __driver_probe_device+0x78/0x170
[   71.986221]  driver_probe_device+0x1f/0x90
[   71.986224]  __device_attach_driver+0x89/0x110
[   71.986227]  ? driver_allows_async_probing+0x70/0x70
[   71.986230]  bus_for_each_drv+0x8c/0xe0
[   71.986232]  __device_attach+0xb2/0x1e0
[   71.986235]  bus_probe_device+0x92/0xb0
[   71.986237]  device_add+0x422/0x9a0
[   71.986239]  ? _dev_info+0x7d/0x98
[   71.986242]  ? blake2s_update+0x4c/0xc0
[   71.986246]  usb_new_device.cold+0x148/0x36d
[   71.986250]  hub_event+0xa8a/0x1910
[   71.986255]  process_one_work+0x1c4/0x380
[   71.986259]  worker_thread+0x51/0x390
[   71.986262]  ? rescuer_thread+0x3b0/0x3b0
[   71.986264]  kthread+0xdb/0x110
[   71.986266]  ? kthread_complete_and_exit+0x20/0x20
[   71.986268]  ret_from_fork+0x1f/0x30
[   71.986273]  </TASK>
[   71.986274] ---[ end trace 0000000000000000 ]---
[   71.986284] btusb: probe of 2-1.6:1.0 failed with error -17

Steps to reproduce: plug in your bluetooth dongle and unplug it, do it till this appears in the dmesg, this also makes the computer pretty much useless unless I force restart it.

Please note I have applied this patchset to the kernel 6.0.7: https://patchwork.kernel.org/project/bluetooth/list/?series=690177&state=*
Comment 1 Jack 2022-11-25 02:41:33 UTC
I'm getting what may be the same issue not quite daily, without any unplug/replug of my cheap CSR clone BT dongles.  I'm currently on 6.0.8 (Gentoo sources) with what I think is the same patchset mentioned above.  (That link shows no current patches for me.)  When it happens, the PC seems to respond for a while, but by the time I realize there is a problem, a power cycle is the only recovery that works for me.  

Nov 23 14:23:29 ffortso9 kernel: ------------[ cut here ]------------
Nov 23 14:23:29 ffortso9 kernel: notifier callback hci_suspend_notifier [bluetooth] already registered
Nov 23 14:23:29 ffortso9 kernel: WARNING: CPU: 6 PID: 2174 at kernel/notifier.c:28 notifier_chain_register+0x3e/0x70
Nov 23 14:23:29 ffortso9 kernel: Modules linked in: fuse rfcomm auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache netfs sunrpc cmac algif_skcipher bnep vfat fat amdgpu mfd_core iommu_v2 gpu_sched drm_buddy radeon uvcvideo btusb videobuf2_vmalloc btrtl kvm_amd btbcm videobuf2_memops i2c_algo_bit btintel videobuf2_v4l2 kvm drm_ttm_helper snd_usb_audio videobuf2_common bluetooth ttm snd_usbmidi_lib irqbypass crct10dif_pclmul snd_hda_codec_realtek videodev drm_display_helper crc32_pclmul sr_mod snd_rawmidi rfkill snd_hda_codec_generic crc32c_intel mc ecdh_generic ledtrig_audio snd_hda_codec_hdmi snd_hda_intel drm_kms_helper cdrom ghash_clmulni_intel snd_intel_dspcfg sd_mod syscopyarea snd_hda_codec sysfillrect sysimgblt nct6775 snd_hwdep aic7xxx aesni_intel fb_sys_fops snd_hda_core nct6775_core ppdev hwmon_vid crypto_simd cryptd scsi_transport_spi snd_pcm drm sp5100_tco snd_timer xhci_pci pcspkr backlight rapl xhci_pci_renesas snd i2c_piix4 parport_pc cec ccp ahci efi_pstore soundcore xhci_hcd k10temp
Nov 23 14:23:29 ffortso9 kernel:  parport libahci i2c_core gpio_amdpt gpio_generic acpi_cpufreq efivarfs
Nov 23 14:23:29 ffortso9 kernel: CPU: 6 PID: 2174 Comm: kworker/6:1 Not tainted 6.0.8-gentoo-x86_64-01 #1
Nov 23 14:23:29 ffortso9 kernel: Hardware name: Micro-Star International Co., Ltd. MS-7A34/B350 TOMAHAWK (MS-7A34), BIOS 1.M0 01/23/2019
Nov 23 14:23:29 ffortso9 kernel: Workqueue: usb_hub_wq hub_event
Nov 23 14:23:29 ffortso9 kernel: RIP: 0010:notifier_chain_register+0x3e/0x70
Nov 23 14:23:29 ffortso9 kernel: Code: 10 7f 33 75 04 84 d2 75 3b 48 8d 78 08 48 8b 40 08 48 85 c0 74 20 48 39 c6 75 e0 48 8b 36 48 c7 c7 40 ad 34 8b e8 a9 f1 a7 00 <0f> 0b b8 ef ff ff ff e9 e6 17 d6 00 48 89 46 08 31 c0 48 89 37 e9
Nov 23 14:23:29 ffortso9 kernel: RSP: 0018:ffffb3e0d420f7d8 EFLAGS: 00010286
Nov 23 14:23:29 ffortso9 kernel: RAX: 0000000000000000 RBX: ffffffffc0a91170 RCX: 0000000000000000
Nov 23 14:23:29 ffortso9 kernel: RDX: 0000000000000001 RSI: ffffffff8b39ae13 RDI: 00000000ffffffff
Nov 23 14:23:29 ffortso9 kernel: RBP: ffffffff8b64f0a0 R08: 0000000000000000 R09: ffffffff8bdc0da0
Nov 23 14:23:29 ffortso9 kernel: R10: 0000000000000001 R11: 0000000000000001 R12: ffff8c647188cb78
Nov 23 14:23:29 ffortso9 kernel: R13: ffffffff8b64f0c8 R14: ffff8c647188cd08 R15: ffffffffc0f1a7e0
Nov 23 14:23:29 ffortso9 kernel: FS:  0000000000000000(0000) GS:ffff8c6afa780000(0000) knlGS:0000000000000000
Nov 23 14:23:29 ffortso9 kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Nov 23 14:23:29 ffortso9 kernel: CR2: 00007f0c4c003078 CR3: 00000001db098000 CR4: 00000000003506e0
Nov 23 14:23:29 ffortso9 kernel: Call Trace:
Nov 23 14:23:29 ffortso9 kernel:  <TASK>
Nov 23 14:23:29 ffortso9 kernel:  blocking_notifier_chain_register+0x3d/0x80
Nov 23 14:23:29 ffortso9 kernel:  hci_register_dev+0x32d/0x3e0 [bluetooth]
Nov 23 14:23:29 ffortso9 kernel:  btusb_probe+0xc24/0xdea [btusb]
Nov 23 14:23:29 ffortso9 kernel:  ? recalibrate_cpu_khz+0x10/0x10
Nov 23 14:23:29 ffortso9 kernel:  ? ktime_get_mono_fast_ns+0x3d/0x90
Nov 23 14:23:29 ffortso9 kernel:  usb_probe_interface+0xf6/0x2d0
Nov 23 14:23:29 ffortso9 kernel:  really_probe+0xe1/0x3a0
Nov 23 14:23:29 ffortso9 kernel:  ? pm_runtime_barrier+0x61/0xb0
Nov 23 14:23:29 ffortso9 kernel:  __driver_probe_device+0x78/0x180
Nov 23 14:23:29 ffortso9 kernel:  driver_probe_device+0x2c/0xb0
Nov 23 14:23:29 ffortso9 kernel:  __device_attach_driver+0x8c/0x100
Nov 23 14:23:29 ffortso9 kernel:  ? driver_allows_async_probing+0x60/0x60
Nov 23 14:23:29 ffortso9 kernel:  ? driver_allows_async_probing+0x60/0x60
Nov 23 14:23:29 ffortso9 kernel:  bus_for_each_drv+0x7e/0xd0
Nov 23 14:23:29 ffortso9 kernel:  __device_attach+0xca/0x230
Nov 23 14:23:29 ffortso9 kernel:  bus_probe_device+0x8e/0xb0
Nov 23 14:23:29 ffortso9 kernel:  device_add+0x45c/0x970
Nov 23 14:23:29 ffortso9 kernel:  ? preempt_count_add+0x70/0xa0
Nov 23 14:23:29 ffortso9 kernel:  usb_set_configuration+0x483/0x890
Nov 23 14:23:29 ffortso9 kernel:  usb_generic_driver_probe+0x50/0x70
Nov 23 14:23:29 ffortso9 kernel:  usb_probe_device+0x47/0x110
Nov 23 14:23:29 ffortso9 kernel:  really_probe+0xe1/0x3a0
Nov 23 14:23:29 ffortso9 kernel:  ? pm_runtime_barrier+0x61/0xb0
Nov 23 14:23:29 ffortso9 kernel:  __driver_probe_device+0x78/0x180
Nov 23 14:23:29 ffortso9 kernel:  driver_probe_device+0x2c/0xb0
Nov 23 14:23:29 ffortso9 kernel:  __device_attach_driver+0x8c/0x100
Nov 23 14:23:29 ffortso9 kernel:  ? driver_allows_async_probing+0x60/0x60
Nov 23 14:23:29 ffortso9 kernel:  ? driver_allows_async_probing+0x60/0x60
Nov 23 14:23:29 ffortso9 kernel:  bus_for_each_drv+0x7e/0xd0
Nov 23 14:23:29 ffortso9 kernel:  __device_attach+0xca/0x230
Nov 23 14:23:29 ffortso9 kernel:  bus_probe_device+0x8e/0xb0
Nov 23 14:23:29 ffortso9 kernel:  device_add+0x45c/0x970
Nov 23 14:23:29 ffortso9 kernel:  ? blake2s_update+0x5c/0xe0
Nov 23 14:23:29 ffortso9 kernel:  usb_new_device.cold+0x148/0x36a
Nov 23 14:23:29 ffortso9 kernel:  hub_event+0xfa8/0x1950
Nov 23 14:23:29 ffortso9 kernel:  process_one_work+0x1e5/0x3b0
Nov 23 14:23:29 ffortso9 kernel:  ? rescuer_thread+0x390/0x390
Nov 23 14:23:29 ffortso9 kernel:  worker_thread+0x50/0x3b0
Nov 23 14:23:29 ffortso9 kernel:  ? rescuer_thread+0x390/0x390
Nov 23 14:23:29 ffortso9 kernel:  kthread+0xe8/0x110
Nov 23 14:23:29 ffortso9 kernel:  ? kthread_complete_and_exit+0x20/0x20
Nov 23 14:23:29 ffortso9 kernel:  ret_from_fork+0x22/0x30
Nov 23 14:23:29 ffortso9 kernel:  </TASK>
Nov 23 14:23:29 ffortso9 kernel: ---[ end trace 0000000000000000 ]---
Nov 23 14:23:29 ffortso9 kernel: btusb: probe of 1-1:1.0 failed with error -17
Nov 23 14:23:31 ffortso9 kernel: general protection fault, probably for non-canonical address 0xff4c6734ff4f2703: 0000 [#1] PREEMPT SMP NOPTI
Nov 23 14:23:31 ffortso9 kernel: CPU: 6 PID: 2174 Comm: kworker/6:1 Tainted: G        W          6.0.8-gentoo-x86_64-01 #1
Nov 23 14:23:31 ffortso9 kernel: Hardware name: Micro-Star International Co., Ltd. MS-7A34/B350 TOMAHAWK (MS-7A34), BIOS 1.M0 01/23/2019
Nov 23 14:23:31 ffortso9 kernel: Workqueue: pm pm_runtime_work
Nov 23 14:23:31 ffortso9 kernel: RIP: 0010:queued_spin_lock_slowpath+0x25b/0x2a0
Nov 23 14:23:31 ffortso9 kernel: Code: ff f3 90 48 8b 13 48 85 d2 74 f6 eb d6 c1 ea 12 83 e0 03 ff ca 48 c1 e0 04 48 63 d2 48 05 00 c0 02 00 48 03 04 d5 20 18 43 8b <48> 89 18 8b 43 08 85 c0 75 09 f3 90 8b 53 08 85 d2 74 f7 48 8b 13
Nov 23 14:23:31 ffortso9 kernel: RSP: 0018:ffffb3e0d420fcf8 EFLAGS: 00010086
Nov 23 14:23:31 ffortso9 kernel: RAX: ff4c6734ff4f2703 RBX: ffff8c6afa7ac000 RCX: 0000000000000007
Nov 23 14:23:31 ffortso9 kernel: RDX: 0000000000003ffe RSI: ffffffff8b39ae13 RDI: ffffffff8b368d04
Nov 23 14:23:31 ffortso9 kernel: RBP: ffff8c64692be18c R08: ffff8c6a62350800 R09: ffff8c64692be8a8
Nov 23 14:23:31 ffortso9 kernel: R10: 0000000000000003 R11: 000000000018e656 R12: 00000000001c0000
Nov 23 14:23:31 ffortso9 kernel: R13: 00000000001c0000 R14: 0000000000000002 R15: ffff8c6afa7b2105
Nov 23 14:23:31 ffortso9 kernel: FS:  0000000000000000(0000) GS:ffff8c6afa780000(0000) knlGS:0000000000000000
Nov 23 14:23:31 ffortso9 kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Nov 23 14:23:31 ffortso9 kernel: CR2: 0000562aa8908098 CR3: 0000000103c8a000 CR4: 00000000003506e0
Nov 23 14:23:31 ffortso9 kernel: Call Trace:
Nov 23 14:23:31 ffortso9 kernel:  <TASK>
Nov 23 14:23:31 ffortso9 kernel:  btusb_suspend+0x87/0x1c0 [btusb]
Nov 23 14:23:31 ffortso9 kernel:  usb_suspend_both+0xaa/0x220
Nov 23 14:23:31 ffortso9 kernel:  usb_runtime_suspend+0x2b/0x70
Nov 23 14:23:31 ffortso9 kernel:  ? usb_autoresume_device+0x60/0x60
Nov 23 14:23:31 ffortso9 kernel:  __rpm_callback+0x5b/0x140
Nov 23 14:23:31 ffortso9 kernel:  ? usb_autoresume_device+0x60/0x60
Nov 23 14:23:31 ffortso9 kernel:  rpm_callback+0x79/0x90
Nov 23 14:23:31 ffortso9 kernel:  ? usb_autoresume_device+0x60/0x60
Nov 23 14:23:31 ffortso9 kernel:  rpm_suspend+0x14a/0x730
Nov 23 14:23:31 ffortso9 kernel:  ? vtime_task_switch_generic+0x8d/0xf0
Nov 23 14:23:31 ffortso9 kernel:  ? _raw_spin_unlock+0x12/0x40
Nov 23 14:23:31 ffortso9 kernel:  ? finish_task_switch.isra.0+0x96/0x2d0
Nov 23 14:23:31 ffortso9 kernel:  pm_runtime_work+0x94/0xa0
Nov 23 14:23:31 ffortso9 kernel:  process_one_work+0x1e5/0x3b0
Nov 23 14:23:31 ffortso9 kernel:  ? rescuer_thread+0x390/0x390
Nov 23 14:23:31 ffortso9 kernel:  worker_thread+0x50/0x3b0
Nov 23 14:23:31 ffortso9 kernel:  ? rescuer_thread+0x390/0x390
Nov 23 14:23:31 ffortso9 kernel:  kthread+0xe8/0x110
Nov 23 14:23:31 ffortso9 kernel:  ? kthread_complete_and_exit+0x20/0x20
Nov 23 14:23:31 ffortso9 kernel:  ret_from_fork+0x22/0x30
Nov 23 14:23:31 ffortso9 kernel:  </TASK>
Nov 23 14:23:31 ffortso9 kernel: Modules linked in: fuse rfcomm auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache netfs sunrpc cmac algif_skcipher bnep vfat fat amdgpu mfd_core iommu_v2 gpu_sched drm_buddy radeon uvcvideo btusb videobuf2_vmalloc btrtl kvm_amd btbcm videobuf2_memops i2c_algo_bit btintel videobuf2_v4l2 kvm drm_ttm_helper snd_usb_audio videobuf2_common bluetooth ttm snd_usbmidi_lib irqbypass crct10dif_pclmul snd_hda_codec_realtek videodev drm_display_helper crc32_pclmul sr_mod snd_rawmidi rfkill snd_hda_codec_generic crc32c_intel mc ecdh_generic ledtrig_audio snd_hda_codec_hdmi snd_hda_intel drm_kms_helper cdrom ghash_clmulni_intel snd_intel_dspcfg sd_mod syscopyarea snd_hda_codec sysfillrect sysimgblt nct6775 snd_hwdep aic7xxx aesni_intel fb_sys_fops snd_hda_core nct6775_core ppdev hwmon_vid crypto_simd cryptd scsi_transport_spi snd_pcm drm sp5100_tco snd_timer xhci_pci pcspkr backlight rapl xhci_pci_renesas snd i2c_piix4 parport_pc cec ccp ahci efi_pstore soundcore xhci_hcd k10temp
Nov 23 14:23:31 ffortso9 kernel:  parport libahci i2c_core gpio_amdpt gpio_generic acpi_cpufreq efivarfs
Nov 23 14:23:31 ffortso9 kernel: ---[ end trace 0000000000000000 ]---
Nov 23 14:23:31 ffortso9 kernel: RIP: 0010:queued_spin_lock_slowpath+0x25b/0x2a0
Nov 23 14:23:31 ffortso9 kernel: Code: ff f3 90 48 8b 13 48 85 d2 74 f6 eb d6 c1 ea 12 83 e0 03 ff ca 48 c1 e0 04 48 63 d2 48 05 00 c0 02 00 48 03 04 d5 20 18 43 8b <48> 89 18 8b 43 08 85 c0 75 09 f3 90 8b 53 08 85 d2 74 f7 48 8b 13
Nov 23 14:23:31 ffortso9 kernel: RSP: 0018:ffffb3e0d420fcf8 EFLAGS: 00010086
Nov 23 14:23:31 ffortso9 kernel: RAX: ff4c6734ff4f2703 RBX: ffff8c6afa7ac000 RCX: 0000000000000007
Nov 23 14:23:31 ffortso9 kernel: RDX: 0000000000003ffe RSI: ffffffff8b39ae13 RDI: ffffffff8b368d04
Nov 23 14:23:31 ffortso9 kernel: RBP: ffff8c64692be18c R08: ffff8c6a62350800 R09: ffff8c64692be8a8
Nov 23 14:23:31 ffortso9 kernel: R10: 0000000000000003 R11: 000000000018e656 R12: 00000000001c0000
Nov 23 14:23:31 ffortso9 kernel: R13: 00000000001c0000 R14: 0000000000000002 R15: ffff8c6afa7b2105
Nov 23 14:23:31 ffortso9 kernel: FS:  0000000000000000(0000) GS:ffff8c6afa780000(0000) knlGS:0000000000000000
Nov 23 14:23:31 ffortso9 kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Nov 23 14:23:31 ffortso9 kernel: CR2: 0000562aa8908098 CR3: 0000000103c8a000 CR4: 00000000003506e0
Nov 23 14:23:31 ffortso9 kernel: note: kworker/6:1[2174] exited with preempt_count 1
Comment 2 JustANormalTinkererMihir 2022-11-26 14:37:29 UTC
It seems for me the USB device reconnects every so often on my computer I have tracked the issue down to the HCI_QUIRK_NO_SUSPEND_NOTIFIER, can you remove the line set_bit(HCI_QUIRK_NO_SUSPEND_NOTIFIER); from btusb.c and recompile the module to test if it doesn't occur to you anymore
Comment 3 JustANormalTinkererMihir 2022-11-26 16:05:32 UTC
I'll resubmit this regression as it looks like it didn't go to the https://lore.kernel.org/regressions/
Comment 4 JustANormalTinkererMihir 2022-11-26 16:29:28 UTC
Marking the resubmition as a duplicate, it doesn't look like bugs submitted on bugzilla go to the regressions mailing list, sorry I don't really know what I am doing this is confusing as hell. And adding regressions@lists.linux.dev to CC just doesn't work
Comment 5 JustANormalTinkererMihir 2022-11-26 16:30:20 UTC
*** Bug 216742 has been marked as a duplicate of this bug. ***
Comment 6 Jack 2022-11-26 23:26:24 UTC
Per Comment#4 commenting out that one line does seem to prevent the crash.  In 6.0.8, with the patch from Comment #0 applied, and also in 6.0.9 without that patch applied.  In 6.0.9 (Gentoo sources) the dongle is never recognized, but the crash happens anyway.
Comment 7 The Linux kernel's regression tracker (Thorsten Leemhuis) 2022-11-27 12:32:28 UTC
(In reply to JustANormalTinkererMihir from comment #4)
> I don't really know what I am doing this is confusing as hell.

Well, ideally you would have followed these guides:

https://docs.kernel.org/admin-guide/reporting-issues.html
https://docs.kernel.org/admin-guide/reporting-regressions.html

But whatever, it's not important.

Thing is: when you patch your kernel (or Gentoo might have -- don't known) you are own your own. And that seems to be the case here.

But TBH: the hole situation wrt to the problems recently discussed in Bug 60824 are confusing for outsiders like me (and developers likely as well). But I'm willing to help there. Could you maybe please provide me with an update? All adapters that used to work really should work again without any external patches -- and ideally without any new module parameters or similar tricks, unless that can't be avoided (for example due to security concerns or because it would cause regressions for others).
Comment 8 Jack 2022-11-27 19:54:12 UTC
I have reconfirmed with a vanilla 6.0.9 kernel.  I got the crash in less than an hour, without even unplug/replug.  Comment out that one line in btusb.c and no crash with multiple unplug/replug of the dongle.  When I get more time, I'll try applying the patch in Comment #0 to confirm it allows the dongle to work.
Comment 9 JustANormalTinkererMihir 2022-11-28 16:26:23 UTC
(In reply to The Linux kernel's regression tracker (Thorsten Leemhuis) from comment #7)
What sort of update do you require? As far as I can tell HCI_QUIRK_NO_SUSPEND_NOTIFIER causes this regression, and the dongle continues to work fine after just removing the line. One thing I have noticed in the dmesg log is that the dongle sometimes disconnects and reconnects, this is largely the reason why the kernel fault even occurs, it disconnects and reconnects like this:
[   53.494546] Bluetooth: RFCOMM TTY layer initialized
[   53.494558] Bluetooth: RFCOMM socket layer initialized
[   53.494561] Bluetooth: RFCOMM ver 1.11
[   60.757711] rfkill: input handler disabled
[   73.717144] rfkill: input handler enabled
[   80.462376] rfkill: input handler disabled
[   80.468335] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Quota mode: none.
[   93.275986] input: Airdopes 121v2 (AVRCP) as /devices/virtual/input/input23
[  136.650027] usb 2-1.5: USB disconnect, device number 3
[  136.892439] usb 2-1.5: new full-speed USB device number 4 using ehci-pci
[  136.998154] usb 2-1.5: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=88.91
[  136.998160] usb 2-1.5: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[  136.998162] usb 2-1.5: Product: BT DONGLE10
[  137.000158] Bluetooth: hci0: CSR: Setting up dongle with HCI ver=9 rev=0810; LMP ver=9 subver=2312; manufacturer=10
[  137.000163] Bluetooth: hci0: CSR: Unbranded CSR clone detected; adding workarounds...
[  137.000164] Bluetooth: hci0: CSR: Unbranded CSR clone detected; force-suspending once...
[  137.000166] Bluetooth: hci0: CSR: Couldn't suspend the device for our Barrot 8041a02 receive-issue workaround
[  137.000188] Bluetooth: hci0: HCI Delete Stored Link Key command is advertised, but not supported.
[  137.000189] Bluetooth: hci0: HCI Read Default Erroneous Data Reporting command is advertised, but not supported.
[  137.000190] Bluetooth: hci0: HCI Set Event Filter command not supported.
[  137.082247] Bluetooth: MGMT ver 1.22
[  143.561978] usb 2-1.5: USB disconnect, device number 4

This seems to only happen when idle not when there is any activity. Maybe the dongle has some built-in power saving feature that disables the dongle when not in use? Please note this also happens after disabling the HCI_QUIRK_NO_SUSPEND_NOTIFIER. These dongles seem really messed up.
Comment 10 JustANormalTinkererMihir 2022-11-28 16:31:28 UTC
Also please note btusb.enable_autosuspend=0 is a kernel parameter I have set and the issue still occurs. It also occurs without it being set.
Comment 11 JustANormalTinkererMihir 2022-11-28 17:04:00 UTC
Created attachment 303310 [details]
btmon log
Comment 12 JustANormalTinkererMihir 2022-11-28 17:10:41 UTC
I am now able to reproduce this issue on kernel 5.19. Same kernel fault, same thing happened again, the dongle disconnected and reconnected causing the kernel fault.
Comment 13 Luiz Von Dentz 2022-11-28 17:48:55 UTC
(In reply to JustANormalTinkererMihir from comment #12)
> I am now able to reproduce this issue on kernel 5.19. Same kernel fault,
> same thing happened again, the dongle disconnected and reconnected causing
> the kernel fault.

I don't think this is related to HCI_QUIRK_NO_SUSPEND_NOTIFIER as it was only introduced by the following change:

https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/commit/drivers/bluetooth/btusb.c?id=b3cf94c8b6b2f1a2b94825a025db291da2b151fd

Or did it reach 5.19 via stable?
Comment 14 Luiz Von Dentz 2022-11-28 18:14:18 UTC
@JustANormalTinkererMihir

Could you try something like bellow:

https://gist.github.com/Vudentz/0e0cb034a434e94daaf219f26f921aa2
Comment 15 JustANormalTinkererMihir 2022-11-29 09:26:57 UTC
(In reply to Luiz Von Dentz from comment #14)
> @JustANormalTinkererMihir
> 
> Could you try something like bellow:
> 
> https://gist.github.com/Vudentz/0e0cb034a434e94daaf219f26f921aa2

This seems to work, I disconnected and reconnect my device several times and it seems to work now, no kernel fault can be observed as of now, I'll report back  here if it happens even with this patch. By the way the linux kernel 5.19 that I was talking about was a ubuntu kernel so they might have backported the patch. 
Please note: I have added the set_bit(HCI_QUIRK_NO_SUSPEND_NOTIFIER) line back and it works fine with that now.
Comment 16 Luiz Von Dentz 2022-11-29 21:54:31 UTC
https://patchwork.kernel.org/project/bluetooth/patch/20221129205413.1537851-1-luiz.dentz@gmail.com/

Please respond with Tested-by if you are not able to reproduce it anymore.
Comment 17 Jack 2022-11-30 21:59:26 UTC
If you mean does your patch (without commenting out the set_bit line) result in no more crash on unplug/resource, then yes

Tested-by ostroffjh@users.sourceforge.net

But I still need the earlier patch (set of three) for the dongle to function.  tested with 6.0.9, both vanilla and Gentoo-sources.
Comment 18 Daniel 2022-12-01 11:31:57 UTC
I also need all four patches to make it work. However, after a sleep I get the following in my dmesg output:

```
[32332.754468] Bluetooth: hci0: command 0x0405 tx timeout
```

After that I get the following repeating:

```
[36431.813695] Bluetooth: hci0: command 0x0c24 tx timeout
[36431.813705] Bluetooth: hci0: Opcode 0x c24 failed: -110
[36533.323814] Bluetooth: hci0: command 0x0408 tx timeout

```
Comment 19 Luiz Von Dentz 2022-12-02 00:39:34 UTC
(In reply to Jack from comment #17)
> If you mean does your patch (without commenting out the set_bit line) result
> in no more crash on unplug/resource, then yes
> 
> Tested-by ostroffjh@users.sourceforge.net
> 
> But I still need the earlier patch (set of three) for the dongle to
> function.  tested with 6.0.9, both vanilla and Gentoo-sources.

What patches are you talking about, are they already in bluetooth-next?

https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/
Comment 20 Luiz Von Dentz 2022-12-02 00:45:22 UTC
(In reply to Daniel from comment #18)
> I also need all four patches to make it work. However, after a sleep I get
> the following in my dmesg output:
> 
> ```
> [32332.754468] Bluetooth: hci0: command 0x0405 tx timeout
> ```
> 
> After that I get the following repeating:
> 
> ```
> [36431.813695] Bluetooth: hci0: command 0x0c24 tx timeout
> [36431.813705] Bluetooth: hci0: Opcode 0x c24 failed: -110
> [36533.323814] Bluetooth: hci0: command 0x0408 tx timeout
> 
> ```

Your controller is probably in a bad state, perhaps something like hciconfig reset hci0, anyway this is probably no related to this bug.
Comment 21 Jack 2022-12-02 02:46:35 UTC
(In reply to Luiz Von Dentz from comment #19)
> What patches are you talking about, are they already in bluetooth-next?
Apologies if I wasn't clear, but this is getting too confusing.  For this specific bug, there is really only one relevant patch.
I am confirming no more crash using your patch from Comment #16.
The patch your mention in Comment #13 is definitely in 5.17.16, but I don't know which version it actually landed in.  Commenting out one of the set_bit lines from that patch also avoids the crash, but your patch works without removing that line.

The fact that my dongle is only recognized if I use the set of patches to revert the regression regarding the cheap CSR clones (I can't easily find the other bug number) is probably irrelevant to this bug, and I mentioned it only for completeness.
Comment 22 Leonardo EugĂȘnio 2022-12-02 03:10:25 UTC
(In reply to Luiz Von Dentz from comment #16)
> https://patchwork.kernel.org/project/bluetooth/patch/20221129205413.1537851-
> 1-luiz.dentz@gmail.com/
> 
> Please respond with Tested-by if you are not able to reproduce it anymore.

Works wonderfully! Tried re-plugging multiple times and also left my system running for 3 days using this patch, no more kernel panics!

Tested-by lelgenio@disroot.org