Re: [PATCH v2] srcu: Fix WARN_ON() for timer_delete_sync() in cleanup_srcu_struct()
From: Frederic Weisbecker
Date: Tue Aug 11 2026 - 10:56:56 EST
Le Tue, Aug 11, 2026 at 08:29:51AM +0800, Zqiang a écrit :
> The WARN_ON() for timer_delete_sync() means that the caller forgot
> to call srcu_barrier() before cleanup. however, it still can trigger
> even when srcu_barrier() was properly called.
>
> When a SRCU grace period ends and find that the allocation of srcu_node
> tree has been completed, but the ss_state is still less than SRCU_SIZE_BIG,
> the mask=~0 causes delay_work timer be queued on every CPU which has
> been online regardless of whether it's sdp->srcu_cblist has callbacks.
> the srcu_barrier() only wait srcu_barrier_head's callbacks to complete,
> however, the srcu_barrier_head will not be inserted into an empty
> sdp->srcu_cblist. after that, when cleanup_srcu_struct() finds a pending
> delay_work timer on a CPU with no callbacks, triggering a false positive.
>
> This commit therefore add rcu_segcblist_n_cbs() to WARN_ON(), make the
> warning triggers only when the timer is still pending and there are
> actual outstanding callbacks.
>
> Fixes: 05c3e88488ed ("srcu: Queue sdp->work when the delay timer is successfully deleted")
> Reported-by: Breno Leitao <leitao@xxxxxxxxxx>
> Reported-by: kernel test robot <oliver.sang@xxxxxxxxx>
> Closes: https://lore.kernel.org/oe-lkp/202608060833.bce92909-lkp@xxxxxxxxx/
> Tested-by: kernel test robot <oliver.sang@xxxxxxxxx>
> Signed-off-by: Zqiang <qiang.zhang@xxxxxxxxx>
Reviewed-by: Frederic Weisbecker <frederic@xxxxxxxxxx>
--
Frederic Weisbecker
SUSE Labs