Re: [PATCH] rcu: remove unnecessary check cpu_no_qs.norm on rcu_report_qs_rdp

From: Yun Levi
Date: Sat Jul 22 2023 - 16:14:44 EST


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

Am I missing something or wrong?

Thanks.

--------
Sincerely,
Levi.