* qcom_slim_ngd_ctrl_probe: blocked on a mutex
@ 2026-03-12 0:14 Tj
2026-03-13 9:54 ` Konrad Dybcio
0 siblings, 1 reply; 4+ messages in thread
From: Tj @ 2026-03-12 0:14 UTC (permalink / raw)
To: Srinivas Kandagatla; +Cc: linux-arm-msm, linux-sound
Currently working on sdm850 device (Samsung Galaxy Book2 W737) and
seeing kernel hang early and never recover when probing qcom-ngd-ctrl
platform driver. Only able to capture a photo of the stack traces as a
result; I'll try to transcribe the important parts here. My diagnosis
suggests that the module is calling __platform_driver_register() twice
and may be the cause of the hang.
INFO: task swapper/0:1 is blocked on a mutex likely owned by task
swapper/0:1
INFO: task swapper/0:1 blocked for more than 1232 seconds.
Not tainted 7.0.0.-rc2-adm845 #80
task:swapper/0 state:D pid:1 tgid:1 ppid:0 task_flags:0x <-- not in photo
Call trace:
__switch_to_0x104/0x1c8 (T)
__schedule+0x438/0x1168
schedule+0x3c/0x120
schedule_preempt_disabled+0x2c/0x50
__mutex_lock.constprop.0+0x3d0/0x938
__mutex_lock_slowpath+0x1c/0x30
__driver_attach+0x38/0x280
bus_for_each_dev+0x80/0xc8
driver_attach+0x2c/0x40
bus_add_driver+0x128/0x258
driver_register+0x68/0x138
__platform_driver_register+0x2c/0x40
qcom_slim_ngd_ctrl_probe+0x1f4/0x400
platform_probe+0x64/0xa8
really_probe+0xc8/0x3f0
__driver_probe_device+0x88/0x190
driver_probe_device+0x44/0x120
__driver_attach+0x138/0x280
bus_for_each_dev+0x80/0xc8
driver_attach+0x2c/0x40
bus_add_driver+0x128/0x258
driver_register+0x68/0x138
__platform_driver_register+0x2c/0x40
qcom_slim_ngd_ctrl_driver_init+0x24/0x38
do_one_initcall+0x60/0x450
kernel_init_freeable+0x23c/0x630
kernel_init+0x2c/0x1f8
ret_from_fork+0x10/0x20
My analysis:
=drivers/slimbus/qcom-ngd-ctrl.c
module_platform_driver(qcom_slim_ngd_ctrl_driver);
=include/linux/platform_device.h
#define module_platform_driver(__platform_driver) \
module_driver(__platform_driver, platform_driver_register,
platform_driver_unregister)
=include/device/driver.h
/* Each module may only use this macro once */
#define module_driver(__driver, __register, __unregister, ...)
return __register(&(__driver) , ##__VA_ARGS__);
// __register == platform_driver_register
#define platform_driver_register(drv)
__platform_driver_register(drv, THIS_MODULE)
=drivers/base/platform.c
__platform_driver_register(struct platform_driver *drv, struct
module *owner)
=drivers/base/driver.c
driver_register(&drv->driver);
bus_add_driver()
driver_attach()
bus_for_each_dev()
__dirver_attach()
driver_probe_device()
really_probe()
platform_probe()
=drivers/slimbus/qcom-ngd-ctrl.c
qcom_slim_ngd_ctrl_probe(struct platform_device
*pdev)
platform_driver_register(&qcom_slim_ngd_driver);
// and round we go again!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: qcom_slim_ngd_ctrl_probe: blocked on a mutex
2026-03-12 0:14 qcom_slim_ngd_ctrl_probe: blocked on a mutex Tj
@ 2026-03-13 9:54 ` Konrad Dybcio
2026-03-13 12:00 ` Tj
0 siblings, 1 reply; 4+ messages in thread
From: Konrad Dybcio @ 2026-03-13 9:54 UTC (permalink / raw)
To: Tj, Srinivas Kandagatla; +Cc: linux-arm-msm, linux-sound
On 3/12/26 1:14 AM, Tj wrote:
> Currently working on sdm850 device (Samsung Galaxy Book2 W737) and
> seeing kernel hang early and never recover when probing qcom-ngd-ctrl
> platform driver. Only able to capture a photo of the stack traces as a
> result; I'll try to transcribe the important parts here. My diagnosis
> suggests that the module is calling __platform_driver_register() twice
> and may be the cause of the hang.
https://lore.kernel.org/all/20260309-slim-ngd-dev-v1-0-5843e3ed62a3@oss.qualcomm.com/
should be able to help with some of that
Konrad
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: qcom_slim_ngd_ctrl_probe: blocked on a mutex
2026-03-13 9:54 ` Konrad Dybcio
@ 2026-03-13 12:00 ` Tj
2026-03-13 12:03 ` Konrad Dybcio
0 siblings, 1 reply; 4+ messages in thread
From: Tj @ 2026-03-13 12:00 UTC (permalink / raw)
To: Konrad Dybcio, Srinivas Kandagatla; +Cc: linux-arm-msm, linux-sound
On 13/03/2026 09:54, Konrad Dybcio wrote:
> On 3/12/26 1:14 AM, Tj wrote:
>> Currently working on sdm850 device (Samsung Galaxy Book2 W737) and
>> seeing kernel hang early and never recover when probing qcom-ngd-ctrl
>> platform driver. Only able to capture a photo of the stack traces as a
>> result; I'll try to transcribe the important parts here. My diagnosis
>> suggests that the module is calling __platform_driver_register() twice
>> and may be the cause of the hang.
> https://lore.kernel.org/all/20260309-slim-ngd-dev-v1-0-5843e3ed62a3@oss.qualcomm.com/
>
> should be able to help with some of that
Thank-you. This morning I'd just resolved the platform_driver_register
issue myself so now seeing
qcom,slim-ngd-ctrl 171c0000.slim-ngd: SLIM SAT: Rcvd master capability
qcom,slim-ngd-ctrl 171c0000.slim-ngd: SLIM controller Registered
However the order of registration of the two drivers is important; ctrl
should be last, so I'm surprised that Patch 1 works.
My local fix is:
slimbus: ngd: fix lock hang on probe
Module contains two platform_drivers. The initial probe calls
platform_register_driver() with the second struct platform_driver.
This caused a hung task due to mutex lock in __driver_attach():
INFO: task swapper/0:1 blocked for more than 1232 seconds.
Not tainted 7.0.0.-rc2-sdm845 #89
task:swapper/0 state:D pid:1 tgid:1 ppid:0 task_flags:0x0140
flags:0x00000010
Call trace:
__switch_to_0x104/0x1c8 (T)
__schedule+0x438/0x1168
schedule+0x3c/0x120
schedule_preempt_disabled+0x2c/0x50
__mutex_lock.constprop.0+0x3d0/0x938
__mutex_lock_slowpath+0x1c/0x30
__driver_attach+0x38/0x280
bus_for_each_dev+0x80/0xc8
driver_attach+0x2c/0x40
bus_add_driver+0x128/0x258
driver_register+0x68/0x138
__platform_driver_register+0x2c/0x40
qcom_slim_ngd_ctrl_probe+0x1f4/0x400
platform_probe+0x64/0xa8
really_probe+0xc8/0x3f0
__driver_probe_device+0x88/0x190
driver_probe_device+0x44/0x120
__driver_attach+0x138/0x280
bus_for_each_dev+0x80/0xc8
driver_attach+0x2c/0x40
bus_add_driver+0x128/0x258
driver_register+0x68/0x138
__platform_driver_register+0x2c/0x40
qcom_slim_ngd_ctrl_driver_init+0x24/0x38
do_one_initcall+0x60/0x450
kernel_init_freeable+0x23c/0x630
kernel_init+0x2c/0x1f8
ret_from_fork+0x10/0x20
INFO: task swapper/0:1 is blocked on a mutex likely owned by task
swapper/0:1.
Showing all locks held in the system:
2 locks held by swapper/0/1:
#0: ffff000080ff80f8 (&dev->mutex){....}-{4:4}, at:
__driver_attach+0x19c/0x2c0
#1: ffff000080ff80f8 (&dev->mutex){....}-{4:4}, at:
__driver_attach+0x38/0x2c0
1 lock held by khungtaskd/73:
#0: ffffbc5dfc38f1d8 (rcu_read_lock){....}-{1:3}, at:
debug_show_all_locks+0x18/0x1f0
After this fix:
qcom,slim-ngd-ctrl 171c0000.slim-ngd: SLIM SAT: Rcvd master capability
qcom,slim-ngd-ctrl 171c0000.slim-ngd: SLIM controller Registered
diff --git a/drivers/slimbus/qcom-ngd-ctrl.c
b/drivers/slimbus/qcom-ngd-ctrl.c
index 9aa7218b4e8d2..abdd4ad57f2d2 100644
--- a/drivers/slimbus/qcom-ngd-ctrl.c
+++ b/drivers/slimbus/qcom-ngd-ctrl.c
@@ -1664,7 +1664,6 @@ static int qcom_slim_ngd_ctrl_probe(struct
platform_device *pdev)
goto err_pdr_lookup;
}
- platform_driver_register(&qcom_slim_ngd_driver);
return of_qcom_slim_ngd_register(dev, ctrl);
err_pdr_alloc:
@@ -1754,6 +1753,23 @@ static struct platform_driver
qcom_slim_ngd_driver = {
},
};
-module_platform_driver(qcom_slim_ngd_ctrl_driver);
+static struct platform_driver * const qcom_slim_ngd_drivers[] = {
+ /* Order here is important; ctrl last */
+ &qcom_slim_ngd_driver,
+ &qcom_slim_ngd_ctrl_driver,
+};
+
+static int __init qcom_slim_ngd_init(void)
+{
+ return platform_register_drivers(qcom_slim_ngd_drivers,
ARRAY_SIZE(qcom_slim_ngd_drivers));
+}
+module_init(qcom_slim_ngd_init);
+
+static void __exit qcom_slim_ngd_exit(void)
+{
+ return platform_unregister_drivers(qcom_slim_ngd_drivers,
ARRAY_SIZE(qcom_slim_ngd_drivers));
+}
+module_exit(qcom_slim_ngd_exit);
+
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("Qualcomm SLIMBus NGD controller");
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: qcom_slim_ngd_ctrl_probe: blocked on a mutex
2026-03-13 12:00 ` Tj
@ 2026-03-13 12:03 ` Konrad Dybcio
0 siblings, 0 replies; 4+ messages in thread
From: Konrad Dybcio @ 2026-03-13 12:03 UTC (permalink / raw)
To: Tj, Srinivas Kandagatla; +Cc: linux-arm-msm, linux-sound
On 3/13/26 1:00 PM, Tj wrote:
> On 13/03/2026 09:54, Konrad Dybcio wrote:
>> On 3/12/26 1:14 AM, Tj wrote:
>>> Currently working on sdm850 device (Samsung Galaxy Book2 W737) and
>>> seeing kernel hang early and never recover when probing qcom-ngd-ctrl
>>> platform driver. Only able to capture a photo of the stack traces as a
>>> result; I'll try to transcribe the important parts here. My diagnosis
>>> suggests that the module is calling __platform_driver_register() twice
>>> and may be the cause of the hang.
>> https://lore.kernel.org/all/20260309-slim-ngd-dev-v1-0-5843e3ed62a3@oss.qualcomm.com/
>>
>> should be able to help with some of that
>
> Thank-you. This morning I'd just resolved the platform_driver_register
> issue myself so now seeing
>
> qcom,slim-ngd-ctrl 171c0000.slim-ngd: SLIM SAT: Rcvd master capability
> qcom,slim-ngd-ctrl 171c0000.slim-ngd: SLIM controller Registered
>
> However the order of registration of the two drivers is important; ctrl
> should be last, so I'm surprised that Patch 1 works.
Please direct your findings to that thread.
Konrad
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-13 12:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 0:14 qcom_slim_ngd_ctrl_probe: blocked on a mutex Tj
2026-03-13 9:54 ` Konrad Dybcio
2026-03-13 12:00 ` Tj
2026-03-13 12:03 ` Konrad Dybcio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox