[ISSUE] WARNING in base/core.c when executing link reset of remote PHY and rmmod SAS driver simultaneously

From: liuqi (BA)
Date: Fri Oct 29 2021 - 22:56:46 EST


Hi all,

I met a issue on v5.15-rc6, WARNING is triggered when executing link reset of remote PHY and rmmod SAS driver simultaneously. Here is the WARNING log:

WARNING: CPU: 61 PID: 21818 at drivers/base/core.c:1349 __device_links_no_driver+0xb4/0xc0
CPU: 61 PID: 21818 Comm: kworker/u256:4 Kdump: loaded Tainted: G W 5.15.0-rc5+ #25
Hardware name: Huawei TaiShan 2280 V2/BC82AMDC, BIOS 2280-V2 CS V5.B170.01 06/30/2021
Workqueue: 0000:74:02.0_disco_q sas_revalidate_domain [libsas]
pstate: 20400009 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : __device_links_no_driver+0xb4/0xc0
lr : device_links_driver_cleanup+0xb0/0xfc
sp : ffff800049e73b10
x29: ffff800049e73b10 x28: 0000000000000000 x27: 0000000000000000
x26: ffff00209ecd7428 x25: 0000000000000000 x24: ffff204002bc8000
x23: ffff00209ff53190 x22: ffff00209ff53190 x21: 0000000000000001
x20: ffff00209ff53230 x19: ffff00209ff53210 x18: 0000000000000030
x17: 74796274736f6820 x16: 3a746c7573655220 x15: 3a64656c69616620
x14: 2930312865686361 x13: 4b4f5f5245564952 x12: 443d657479627265
x11: 7669726420343078 x10: ffff0020913b0640 x9 : ffffccc6d592b514
x8 : ffff204002bc8a00 x7 : ffffffff80000000 x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff00209ff53250
x2 : 0000000000000003 x1 : 000000000000004c x0 : ffff00209ee60c00
Call trace:
__device_links_no_driver+0xb4/0xc0
device_links_driver_cleanup+0xb0/0xfc
__device_release_driver+0x198/0x23c
device_release_driver+0x38/0x50
bus_remove_device+0x130/0x140
device_del+0x184/0x434
__scsi_remove_device+0x118/0x150
scsi_remove_target+0x1bc/0x240
sas_rphy_remove+0x90/0x94
sas_rphy_delete+0x24/0x3c
sas_destruct_devices+0x64/0xa0 [libsas]
sas_revalidate_domain+0xe4/0x150 [libsas]
process_one_work+0x1e0/0x46c
worker_thread+0x15c/0x464
kthread+0x160/0x170
ret_from_fork+0x10/0x20
---[ end trace 71e059eb58f85d4a ]---

Normally in __device_links_no_driver(), link->status is DL_STATE_SUPPLIER_UNBIND, but in the WARNING scenario, link->status is DL_STATE_ACTIVE.

I'm not sure this warning is caused by libsas, lldd or sas scsi transport code. Does anyone have any ideas?

Thanks,
Qi