Re: [PATCH v5] driver core: enforce device_lock for driver_match_device()

From: Alexander Stein

Date: Wed Feb 11 2026 - 05:47:24 EST


Hi,

Am Dienstag, 20. Januar 2026, 14:22:19 CET schrieb Mark Brown:
> On Wed, Jan 14, 2026 at 12:28:43AM +0800, Gui-Dong Han wrote:
> > Currently, driver_match_device() is called from three sites. One site
> > (__device_attach_driver) holds device_lock(dev), but the other two
> > (bind_store and __driver_attach) do not. This inconsistency means that
> > bus match() callbacks are not guaranteed to be called with the lock
> > held.
>
> I'm seeing boot hangs on Arm Juno in next/pending-fixes which bisect to
> this commit. The boot grinds to a halt near the end of boot:
>
> [ 2.570549] ledtrig-cpu: registered to indicate activity on CPUs
> [ 2.618301] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
> [ 2.623547] msm_serial: driver initialized
> [ 2.624058] SuperH (H)SCI(F) driver initialized
> [ 2.624312] STM32 USART driver initialized
>
> with no further output, full log:
>
> https://lava.sirena.org.uk/scheduler/job/2387335#L862
>
> We are also seeing similar looking boot hangs on some Qualcomm platforms
> in Arm's test lab which aren't verified to be the same thing but are
> hanging at a similar point in boot.

I've also experienced a boot problem on an NXP i.MX8QM based board
(DT currently in process of upstreaming). Bisect also resulted in this
commit.

Boot suddenly blocks, after about 4 minutes I get a blocked task backtrace:
[ 1.053132] NET: Registered PF_PACKET protocol family
[ 1.057958] Key type dns_resolver registered
[ 1.070822] registered taskstats version 1
[ 1.074738] Loading compiled-in X.509 certificates
[ 1.091208] Demotion targets for Node 0: null
[ 1.099632] imx-scu system-controller: NXP i.MX SCU Initialized
[ 242.855834] INFO: task swapper/0:1 blocked for more than 120 seconds.
[ 242.861994] Not tainted 6.19.0-rc5+ #41
[ 242.866304] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 242.874122] task:swapper/0 state:D stack:0 pid:1 tgid:1 ppid:0 task_flags:0x0140 flags:0x00000010
[ 242.884981] Call trace:
[ 242.887406] __switch_to+0xdc/0x120 (T)
[ 242.891233] __schedule+0x310/0x7a0
[ 242.894708] schedule+0x30/0xa4
[ 242.897835] schedule_timeout+0x10c/0x118
[ 242.901831] wait_for_completion+0xd4/0x170
[ 242.906002] __flush_work+0x6c/0xdc
[ 242.909476] flush_work+0x2c/0x38
[ 242.912777] deferred_probe_initcall+0x58/0xb0
[ 242.917208] do_one_initcall+0x40/0x24c
[ 242.921030] do_initcalls+0xf0/0x1c4
[ 242.924592] kernel_init_freeable+0x114/0x224
[ 242.928936] kernel_init+0x20/0x1d4
[ 242.932413] ret_from_fork+0x10/0x20
[ 242.935990] INFO: task kworker/u16:1:42 blocked for more than 120 seconds.
[ 242.942836] Not tainted 6.19.0-rc5+ #41
[ 242.947179] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 242.955000] task:kworker/u16:1 state:D stack:0 pid:42 tgid:42 ppid:2 task_flags:0x4208060 flags:0x00000010
[ 242.966127] Workqueue: events_unbound deferred_probe_work_func
[ 242.971940] Call trace:
[ 242.974364] __switch_to+0xdc/0x120 (T)
[ 242.978195] __schedule+0x310/0x7a0
[ 242.981669] schedule+0x30/0xa4
[ 242.984803] schedule_preempt_disabled+0x20/0x38
[ 242.989401] __mutex_lock.constprop.0+0x4c4/0xc90
[ 242.994094] __mutex_lock_slowpath+0x10/0x18
[ 242.998349] mutex_lock+0x68/0x74
[ 243.001650] __driver_attach+0x28/0x254
[ 243.005473] bus_for_each_dev+0x74/0xd4
[ 243.009295] driver_attach+0x20/0x28
[ 243.012857] bus_add_driver+0x118/0x238
[ 243.016681] driver_register+0x58/0x114
[ 243.020502] __platform_driver_register+0x20/0x28
[ 243.025193] imx_clk_scu_init+0xe8/0xf8
[ 243.029016] imx8qxp_clk_probe+0x3c/0x11c0
[ 243.033099] platform_probe+0x58/0x90
[ 243.036748] really_probe+0xbc/0x3d4
[ 243.040310] __driver_probe_device+0x7c/0x174
[ 243.044653] driver_probe_device+0x38/0x108
[ 243.048823] __device_attach_driver+0xb0/0x154
[ 243.053254] bus_for_each_drv+0x80/0xdc
[ 243.057076] __device_attach+0x9c/0x1bc
[ 243.060899] device_initial_probe+0x48/0x4c
[ 243.065069] bus_probe_device+0x34/0x98
[ 243.068898] device_add+0x4bc/0x6b4
[ 243.072367] of_device_add+0x40/0x58
[ 243.075929] of_platform_device_create_pdata+0x94/0x158
[ 243.081141] of_platform_bus_create+0xcc/0x280
[ 243.085571] of_platform_populate+0x78/0x174
[ 243.089828] devm_of_platform_populate+0x54/0xb0
[ 243.094435] imx_scu_probe+0x1f8/0x30c
[ 243.098169] platform_probe+0x58/0x90
[ 243.101819] really_probe+0xbc/0x3d4
[ 243.105379] __driver_probe_device+0x7c/0x174
[ 243.109728] driver_probe_device+0x38/0x108
[ 243.113896] __device_attach_driver+0xb0/0x154
[ 243.118326] bus_for_each_drv+0x80/0xdc
[ 243.122148] __device_attach+0x9c/0x1bc
[ 243.125971] device_initial_probe+0x48/0x4c
[ 243.130141] bus_probe_device+0x34/0x98
[ 243.133963] deferred_probe_work_func+0x9c/0xf4
[ 243.138480] process_one_work+0x14c/0x3c0
[ 243.142477] worker_thread+0x2dc/0x3f0
[ 243.146212] kthread+0x124/0x1e4
[ 243.149427] ret_from_fork+0x10/0x20
[ 243.152992] INFO: task kworker/u16:1:42 is blocked on a mutex likely owned by task kworker/u16:1:42.

The patches regarding QSPI or SMMU in this thread don't seem to apply for / affect this platform.

Best regards,
Alexander
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/