Re: [PATCH 3/4] rcutorture: Run NMI-safe SRCU readers from NMI

From: Mathieu Desnoyers

Date: Wed Nov 11 2026 - 09:17:30 EST


On 2026-11-10 17:46, Paul E. McKenney wrote:
On Tue, Nov 10, 2026 at 02:28:43PM -0500, Mathieu Desnoyers wrote:
[...]
A good addition! Vanilla RCU could benefit from this as well, but that
can be done later.

Thanks!

[...]
+ if (READ_ONCE(p->rtort_pipe_count) > 1)
+ atomic_inc(&n_rcu_torture_error);

Doesn't this miss doing a splat on RCU too-short grace period?
[...]
Maybe a separate global array for NMIs, parallel to the "Reader Pipe:"
and "Reader Batch:" arrays, that is atomically updated and printed
separately, maybe "NMI Reader Pipe:" or similar?

Or is there a better way?

It does miss it. The test still ends in FAILURE. But there is no
"!!!", no warning, and nothing in "Reader Pipe:".

v2 takes your approach. The NMI reader counts its pipe and batch values
in two arrays of atomic_long_t. rcu_torture_stats_print() prints them
as "NMI Reader Pipe:" and "NMI Reader Batch:", only when readers ran in
NMI. A too-short grace period in NMI joins the "!!!" condition, with
its own WARN_ON_ONCE(). So the other readers keep their this_cpu_inc().

The NMI reader skips the trace event and rcu_ftrace_dump() of the other
readers. The "!!!" and the warning then come from the statistics
kthread.

I checked it with a mutation that makes every NMI reader see a pipe
count of 2: the run splats as expected.

[...]
cur_ops->call(&rtncp->rh, rcu_torture_nmi_invoked);

OK, the invocation of ->call() without testing ->call() is OK because
rcu_torture_nmi_do_calls never gets set if ->call() is NULL.

Yes.

Thanks!

Mathieu


--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com