Bug 215530

Summary: typec kernel error
Product: Drivers Reporter: neoe (hi2)
Component: USBAssignee: Default virtual assignee for Drivers/USB (drivers_usb)
Status: RESOLVED DUPLICATE    
Severity: normal CC: regressions
Priority: P1    
Hardware: All   
OS: Linux   
See Also: https://bugzilla.kernel.org/show_bug.cgi?id=215529
Kernel Version: 5.17-rc1 Subsystem:
Regression: No Bisected commit-id:

Description neoe 2022-01-25 01:47:20 UTC
almost same config for working v5.16 build. but fail on v5.17-rc1
dmesg:


[    7.967005] Oops: 0000 [#1] PREEMPT SMP NOPTI
[    7.967694] CPU: 3 PID: 265 Comm: kworker/3:2 Not tainted 5.17.0-rc1-gs #1
[    7.968374] Hardware name: ASUS System Product Name/PRIME B550M-A (WI-FI), BIOS 2423 08/09/2021
[    7.969043] Workqueue: events_long ucsi_init_work [typec_ucsi]
[    7.969714] RIP: 0010:typec_port_match+0x4b/0x90 [typec]
[    7.970382] Code: 8b 98 90 02 00 00 48 89 df 48 83 eb 10 e8 dd 59 c1 c0 84 c0 b8 00 00 00 00 48 0f 44 d8 4c 39 eb 74 0c 41 8b 84 24 70 fd ff ff <39> 03 74 0b 5b 31 c0 41 5c 41 5d 41 5e 5d c3 49 8b 3e 49 8d 76 08
[    7.971099] RSP: 0018:ffffacf640ffbd48 EFLAGS: 00010207
[    7.971810] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
[    7.972525] RDX: 0000000000000001 RSI: ffffacf640ffbdb8 RDI: 0000000000000000
[    7.973238] RBP: ffffacf640ffbd68 R08: ffff9a62003d96a0 R09: ffffacf640ffbc08
[    7.973955] R10: ffff9a6225f36000 R11: 0000000000000000 R12: ffff9a62016e7a90
[    7.974679] R13: ffff9a62016e7800 R14: ffffacf640ffbdb8 R15: ffff9a6200c96c08
[    7.975405] FS:  0000000000000000(0000) GS:ffff9a80ae8c0000(0000) knlGS:0000000000000000
[    7.976128] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    7.976844] CR2: 0000000000000000 CR3: 0000000121dfa000 CR4: 0000000000350ee0
[    7.977561] Call Trace:
[    7.978272]  
[    7.978979]  ? typec_port_compare+0x10/0x10 [typec]
[    7.979694]  bus_for_each_dev+0x7e/0xc0
[    7.980408]  typec_link_ports+0x45/0x80 [typec]
[    7.981110]  typec_register_port+0x1d4/0x2d0 [typec]
[    7.981808]  ucsi_init_work+0x401/0x720 [typec_ucsi]
[    7.982508]  process_one_work+0x21d/0x3f0
[    7.983202]  worker_thread+0x50/0x3d0
[    7.983887]  ? rescuer_thread+0x380/0x380
[    7.984571]  kthread+0xff/0x130
[    7.985246]  ? kthread_complete_and_exit+0x20/0x20
[    7.985927]  ret_from_fork+0x22/0x30
[    7.986608]  
[    7.987282] Modules linked in: snd_hda_codec_realtek snd_hda_codec_generic kvm_amd ledtrig_audio iwlmvm(+) kvm snd_hda_codec_hdmi crct10dif_pclmul mac80211 ghash_clmulni_intel libarc4 snd_hda_intel btusb snd_intel_dspcfg snd_intel_sdw_acpi aesni_intel btrtl snd_hda_codec btbcm iwlwifi crypto_simd btintel asus_wmi snd_hda_core cryptd platform_profile btmtk sparse_keymap snd_hwdep input_leds rapl wmi_bmof video bluetooth ucsi_ccg cfg80211 snd_pcm efi_pstore typec_ucsi snd_timer ecdh_generic k10temp typec snd sp5100_tco ccp ecc soundcore mac_hid amdgpu iommu_v2 gpu_sched drm_ttm_helper ttm drm_kms_helper cec drm i2c_algo_bit fb_sys_fops syscopyarea sysfillrect sysimgblt hid_generic crc32_pclmul i2c_piix4 r8169 usbhid i2c_designware_pci realtek hid wmi gpio_amdpt gpio_generic
[    7.990356] CR2: 0000000000000000
[    7.991132] ---[ end trace 0000000000000000 ]---
[    8.060078] iwlwifi 0000:09:00.0: Detected RF HR B3, rfid=0x10a100
[    8.129116] RIP: 0010:typec_port_match+0x4b/0x90 [typec]
[    8.130024] Code: 8b 98 90 02 00 00 48 89 df 48 83 eb 10 e8 dd 59 c1 c0 84 c0 b8 00 00 00 00 48 0f 44 d8 4c 39 eb 74 0c 41 8b 84 24 70 fd ff ff <39> 03 74 0b 5b 31 c0 41 5c 41 5d 41 5e 5d c3 49 8b 3e 49 8d 76 08
[    8.130919] RSP: 0018:ffffacf640ffbd48 EFLAGS: 00010207
[    8.131763] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
[    8.132462] iwlwifi 0000:09:00.0: base HW address: 08:5b:d6:51:40:96
[    8.132598] RDX: 0000000000000001 RSI: ffffacf640ffbdb8 RDI: 0000000000000000
[    8.134511] RBP: ffffacf640ffbd68 R08: ffff9a62003d96a0 R09: ffffacf640ffbc08
[    8.135417] R10: ffff9a6225f36000 R11: 0000000000000000 R12: ffff9a62016e7a90
[    8.136317] R13: ffff9a62016e7800 R14: ffffacf640ffbdb8 R15: ffff9a6200c96c08
[    8.137190] FS:  0000000000000000(0000) GS:ffff9a80ae8c0000(0000) knlGS:0000000000000000
[    8.138035] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    8.138869] CR2: 0000000000000000 CR3: 0000000121dfa000 CR4: 0000000000350ee0
Comment 1 The Linux kernel's regression tracker (Thorsten Leemhuis) 2022-01-26 09:15:34 UTC
I'm not involved here, but I wonder if this will help: 

https://lore.kernel.org/linux-usb/20220124090228.41396-3-heikki.krogerus@linux.intel.com/
Comment 2 neoe 2022-01-26 09:28:12 UTC
(In reply to The Linux kernel's regression tracker (Thorsten Leemhuis) from comment #1)
> I'm not involved here, but I wonder if this will help: 
> 
> https://lore.kernel.org/linux-usb/20220124090228.41396-3-heikki.
> krogerus@linux.intel.com/

Thank you for the information. I also tried that patch, but not work for me.
Comment 3 The Linux kernel's regression tracker (Thorsten Leemhuis) 2022-01-26 11:21:11 UTC
(In reply to neoe from comment #2)
> I also tried that patch, but not work for me.

Only that patch or both of them from that thread? If the latter, than you might want to join the discussions on the mailing lists.
Comment 4 neoe 2022-01-26 11:41:22 UTC
Thank you for your insist. I checked again. I did the patch manually and made a mistake. 
However, Now I applied the both patch correctly this time. 
It works. I guess the first one is enough for my issue.

*** This bug has been marked as a duplicate of bug 215529 ***
Comment 5 neoe 2022-01-26 11:42:19 UTC
diff --git a/drivers/usb/typec/port-mapper.c b/drivers/usb/typec/port-mapper.c
index 07d307418b470..b6e0c6acc628c 100644
--- a/drivers/usb/typec/port-mapper.c
+++ b/drivers/usb/typec/port-mapper.c
@@ -56,6 +56,9 @@ int typec_link_ports(struct typec_port *con)
 {
 	struct each_port_arg arg = { .port = con, .match = NULL };
 
+	if (!has_acpi_companion(&con->dev))
+		return 0;
+
 	bus_for_each_dev(&acpi_bus_type, NULL, &arg, typec_port_match);
 
 	/*
@@ -74,5 +77,6 @@ int typec_link_ports(struct typec_port *con)
 
 void typec_unlink_ports(struct typec_port *con)
 {
-	component_master_del(&con->dev, &typec_aggregate_ops);
+	if (has_acpi_companion(&con->dev))
+		component_master_del(&con->dev, &typec_aggregate_ops);
 }
Comment 6 neoe 2022-01-26 11:44:26 UTC
(In reply to The Linux kernel's regression tracker (Thorsten Leemhuis) from comment #3)
> (In reply to neoe from comment #2)
> > I also tried that patch, but not work for me.
> 
> Only that patch or both of them from that thread? If the latter, than you
> might want to join the discussions on the mailing lists.

The patch works for me.