Re: [PATCH] timekeeping: Register default clocksource before taking tk_core.lock
From: Mikhail Gavrilov
Date: Tue Jun 16 2026 - 15:29:20 EST
On Tue, Jun 16, 2026 at 1:42 PM Breno Leitao <leitao@xxxxxxxxxx> wrote:
> I am seeing a similar issue, although from a different code path.
>
> =============================
> [ BUG: Invalid wait context ]
> 7.1.0-next-20260615upstream-14023-g8d6dbbbe3ba6 #32 Not tainted
> -----------------------------
> swapper/0/0 is trying to lock:
> ffff800084e4bd80 (clocksource_mutex){....}-{4:4}, at: __clocksource_register_scale+0x5c4/0xa48
> other info that might help us debug this:
> context-{5:5}
> 1 lock held by swapper/0/0:
> #0: ffff80008ca99930 (&tkd->lock){....}-{2:2}, at: timekeeping_init+0x158/0x290
> stack backtrace:
> CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 7.1.0-next-20260615upstream-14023-g8d6dbbbe3ba6 #32 PREEMPT(full)
> Hardware name: linux,dummy-virt (DT)
> Call trace:
> show_stack+0x24/0x38 (C)
> __dump_stack+0x28/0x38
> dump_stack_lvl+0x94/0xe0
> dump_stack+0x18/0x24
> __lock_acquire+0xba4/0x3520
> lock_acquire+0x150/0x390
> __mutex_lock+0xe4/0x1240
> mutex_lock_nested+0x30/0x48
> __clocksource_register_scale+0x5c4/0xa48
> clocksource_default_clock+0x40/0x68
> timekeeping_init+0x164/0x290
> start_kernel+0x2b0/0x4b8
> __primary_switched+0x8c/0xa0
>
>
> Reviwed-by: Breno Leitao <leitao@xxxxxxxxxx>
Thanks for the Reviewed-by and the arm64 confirmation. Note that
f24df84cbe05, which this fixes, is itself Cc: stable, so this should
land in the same stable trees. I'm happy to resend with Cc:
stable@xxxxxxxxxxxxxxx added if you prefer; otherwise it can be picked
up via the Fixes: tag or added on apply.
--
Best Regards,
Mike Gavrilov.