On Sat, Jul 22, 2023 at 09:14:28PM +0100, Yun Levi wrote: > Hi Paul. > > > Suppose that the scheduler-clock interrupt invoking rcu_sched_clock_irq() > > happened just before the lock was acquired in rcu_report_qs_rdp(). > > Suppose further that the RCU grace-period kthread started a new grace > > period just before that interrupt occurred. Then mightn't that interrupt > > notice the new grace period and set ->cpu_no_qs.b.norm to true before > > fully returning? > > IIUC, RCU grace-period kthread couldn't start new grace period > because the interrupted cpu don't report qs to rnp via rcu_report_qs_rdp. > That situation is listened like new gp could be started thou all cpus > doesn't enter yet. > That's is the reason why it's better to use WARN_ON_ONCE as you suggest > to notice if the buggy situation happens And try testing with CONFIG_RCU_STRICT_GRACE_PERIOD=y and CONFIG_PREEMPT=n. Though there might be better Kconfig options to use. Those two come immediately to mind. > Am I missing something or wrong? I cannot see into your head, so I cannot say. But one critical piece is that softirq handlers, including the RCU_SOFTIRQ handler rcu_core_si(), can be invoked upon return from interrupts. Another critical piece is that if a CPU is idle during any part of a grace period, the grace-period kthread can report a quiescent state on its behalf. Does that help? Thanx, Paul