On 12 September 2026 00:12:25 BST, "Paul E. McKenney" <[email protected]>
wrote:
>On Fri, Sep 11, 2026 at 10:18:04PM +0100, Bradley Morgan wrote:
>> On 11 September 2026 17:09:13 BST, Kunwu Chan <[email protected]>
>wrote:
>> >Add the RCU_LOCKDEP_WARN and early-boot check that the Tree version
>> >gained, srcu_lock_sync() was already present.
>> >
>> >Suggested-by: Zqiang <[email protected]>
>>
>> Ok.
>>
>> Reviewed-by: Bradley Morgan <[email protected]>
>
>Applied, thank you!
>
>> >Signed-off-by: Kunwu Chan <[email protected]>
>> >---
>> > kernel/rcu/srcutiny.c | 6 ++++++
>> > 1 file changed, 6 insertions(+)
>> >
>> >diff --git a/kernel/rcu/srcutiny.c b/kernel/rcu/srcutiny.c
>> >index 99f8bfd98b04..76411562366f 100644
>> >--- a/kernel/rcu/srcutiny.c
>> >+++ b/kernel/rcu/srcutiny.c
>> >@@ -361,6 +361,12 @@ void synchronize_srcu_atomic(struct srcu_struct
>*ssp)
>> >
>> > srcu_lock_sync(&ssp->dep_map);
>> >
>> >+ RCU_LOCKDEP_WARN(lockdep_is_held(ssp),
>> >+ "Illegal synchronize_srcu_atomic() in same-type SRCU
>> >read-side critical section");
>> >+
>> >+ if (rcu_scheduler_active == RCU_SCHEDULER_INACTIVE)
>> >+ return;
>> >+
>>
>> Wow!
>
>If you think that this one is fun, take a look at the implementation of
>synchronize_rcu() in kernel/rcu/tiny.c. ;-)
void synchronize_rcu(void)
{
RCU_LOCKDEP_WARN(...);
preempt_disable();
WRITE_ONCE(rcu_ctrlblk.gp_seq, rcu_ctrlblk.gp_seq + 2);
preempt_enable();
}
Hah!
>
> Thanx, Paul
>
>> > if (IS_ENABLED(CONFIG_PREEMPTION))
>> > synchronize_rcu(); // Needed for RCU Tasks Trace to imply RCU
>> > grace period.
>> > // And in Tiny RCU, it is near zero cost and
>> > doesn't block.
>> >
>>
>> --- Thanks!
>>
>https://lore.kernel.org/all/[email protected]/
--- Thanks!
https://lore.kernel.org/all/[email protected]/