<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/kernel/rcu, branch master</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>Merge branches 'misc.2026.10.06a' and 'torture.2026.10.12a' into HEAD</title>
<updated>2026-10-12T23:53:20+00:00</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@kernel.org</email>
</author>
<published>2026-10-12T23:53:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d9011419496a3dc6b455b5308846684c63c18de5'/>
<id>d9011419496a3dc6b455b5308846684c63c18de5</id>
<content type='text'>
misc.2026.10.06a: Miscellaneous fixes.
torture.2026.10.12a: Make call_{s,}rcu() invocable from any environment,
	add atomic SRCU, additional SRCU updates, and torture-test updates.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
misc.2026.10.06a: Miscellaneous fixes.
torture.2026.10.12a: Make call_{s,}rcu() invocable from any environment,
	add atomic SRCU, additional SRCU updates, and torture-test updates.
</pre>
</div>
</content>
</entry>
<entry>
<title>rcutorture: Add atomic SRCU cross-CPU IRQ context mismatch test</title>
<updated>2026-10-12T23:51:52+00:00</updated>
<author>
<name>Kunwu Chan</name>
<email>kunwu.chan@gmail.com</email>
</author>
<published>2026-09-14T09:34:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=945f87baf00af62ce47237b3c766caa0269f0522'/>
<id>945f87baf00af62ce47237b3c766caa0269f0522</id>
<content type='text'>
Add testtype 7 to verify that lockdep detects an IRQ-context
mismatch when an atomic SRCU read-side critical section is held
with IRQs enabled on one CPU and synchronize_srcu_atomic() is
called from an IPI handler on another CPU.

This covers the cross-CPU case that cannot be detected by
checking the current task's held locks.

Co-developed-by: Zqiang &lt;qiang.zhang@linux.dev&gt;
Signed-off-by: Zqiang &lt;qiang.zhang@linux.dev&gt;
Signed-off-by: Kunwu Chan &lt;kunwu.chan@gmail.com&gt;
Acked-by: Boqun Feng &lt;boqun@kernel.org&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add testtype 7 to verify that lockdep detects an IRQ-context
mismatch when an atomic SRCU read-side critical section is held
with IRQs enabled on one CPU and synchronize_srcu_atomic() is
called from an IPI handler on another CPU.

This covers the cross-CPU case that cannot be detected by
checking the current task's held locks.

Co-developed-by: Zqiang &lt;qiang.zhang@linux.dev&gt;
Signed-off-by: Zqiang &lt;qiang.zhang@linux.dev&gt;
Signed-off-by: Kunwu Chan &lt;kunwu.chan@gmail.com&gt;
Acked-by: Boqun Feng &lt;boqun@kernel.org&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rcutorture: Add atomic SRCU lockdep support</title>
<updated>2026-10-12T23:51:52+00:00</updated>
<author>
<name>Kunwu Chan</name>
<email>kunwu.chan@gmail.com</email>
</author>
<published>2026-09-14T09:34:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a692cb8e40d9d7475a3f27b714acc7fa46f9d1df'/>
<id>a692cb8e40d9d7475a3f27b714acc7fa46f9d1df</id>
<content type='text'>
Add three testtypes covering atomic SRCU lockdep behavior:

  testtype 4: atomic SRCU same-type deadlock
  testtype 5: atomic SRCU + raw spinlock dependency cycle
  testtype 6: synchronize_srcu_atomic() inside rcu_read_lock()

Co-developed-by: Zqiang &lt;qiang.zhang@linux.dev&gt;
Signed-off-by: Zqiang &lt;qiang.zhang@linux.dev&gt;
Signed-off-by: Kunwu Chan &lt;kunwu.chan@gmail.com&gt;
Acked-by: Boqun Feng &lt;boqun@kernel.org&gt;
Reviewed-by: Joel Fernandes &lt;joelagnelf@nvidia.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add three testtypes covering atomic SRCU lockdep behavior:

  testtype 4: atomic SRCU same-type deadlock
  testtype 5: atomic SRCU + raw spinlock dependency cycle
  testtype 6: synchronize_srcu_atomic() inside rcu_read_lock()

Co-developed-by: Zqiang &lt;qiang.zhang@linux.dev&gt;
Signed-off-by: Zqiang &lt;qiang.zhang@linux.dev&gt;
Signed-off-by: Kunwu Chan &lt;kunwu.chan@gmail.com&gt;
Acked-by: Boqun Feng &lt;boqun@kernel.org&gt;
Reviewed-by: Joel Fernandes &lt;joelagnelf@nvidia.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rcutorture: Synchronously wait for all rcu_torture_irq() callbacks to complete</title>
<updated>2026-10-12T23:51:51+00:00</updated>
<author>
<name>Zqiang</name>
<email>qiang.zhang@linux.dev</email>
</author>
<published>2026-08-24T09:24:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=704e59c721d9156201705860c5d0a5e85415f8cc'/>
<id>704e59c721d9156201705860c5d0a5e85415f8cc</id>
<content type='text'>
The rcu_torture_reader() drives RCU readers from interrupt context via
smp_call_function_single(cpu, rcu_torture_irq, NULL, 0) with wait=0, to
runs rcu_torture_irq() on a remote CPU. this is async, nothing waits for
the remote handler to run.

On shutdown, torture_stop_kthread() only waits for each reader kthread to
return, and the reader's timer_delete_sync() only drains its timer. Neither
waits for a rcu_torture_irq() which still pending or executing on a remote
CPU, so it can run after all readers have exited and rcu_torture_cleanup()
has already advanced.

1. rcu_torture_irq() may issue cur_ops-&gt;call(rhp, rcu_torture_timer_cb)
   after cur_ops-&gt;cb_barrier() has been waiting for all outstanding
   callbacks complete. once the module is unloaded, fires into freed
   module text, a use-after-free happen.

2. rcu_torture_irq() may still be inside rcu_torture_one_read(), holding
   a read-side critical section, when cur_ops-&gt;cleanup() tears the flavor
   down (e.g. cleanup_srcu_struct()), triggering an active-reader warning
   or use-after-free of the torn-down structure.

This commit therefore issue a kick_all_cpus_sync() after all readers
kthread have returned and before cur_ops-&gt;cb_barrier(), synchronous IPI
round trip to every CPU guarantees that every rcu_torture_irq() which
previously issued by any reader has completed.

Signed-off-by: Zqiang &lt;qiang.zhang@linux.dev&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The rcu_torture_reader() drives RCU readers from interrupt context via
smp_call_function_single(cpu, rcu_torture_irq, NULL, 0) with wait=0, to
runs rcu_torture_irq() on a remote CPU. this is async, nothing waits for
the remote handler to run.

On shutdown, torture_stop_kthread() only waits for each reader kthread to
return, and the reader's timer_delete_sync() only drains its timer. Neither
waits for a rcu_torture_irq() which still pending or executing on a remote
CPU, so it can run after all readers have exited and rcu_torture_cleanup()
has already advanced.

1. rcu_torture_irq() may issue cur_ops-&gt;call(rhp, rcu_torture_timer_cb)
   after cur_ops-&gt;cb_barrier() has been waiting for all outstanding
   callbacks complete. once the module is unloaded, fires into freed
   module text, a use-after-free happen.

2. rcu_torture_irq() may still be inside rcu_torture_one_read(), holding
   a read-side critical section, when cur_ops-&gt;cleanup() tears the flavor
   down (e.g. cleanup_srcu_struct()), triggering an active-reader warning
   or use-after-free of the torn-down structure.

This commit therefore issue a kick_all_cpus_sync() after all readers
kthread have returned and before cur_ops-&gt;cb_barrier(), synchronous IPI
round trip to every CPU guarantees that every rcu_torture_irq() which
previously issued by any reader has completed.

Signed-off-by: Zqiang &lt;qiang.zhang@linux.dev&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rcutorture: Fix divide-by-zero with fwd_progress_div=1</title>
<updated>2026-10-12T23:51:51+00:00</updated>
<author>
<name>Kunwu Chan</name>
<email>kunwu.chan@gmail.com</email>
</author>
<published>2026-08-20T09:42:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5b748d8aa6833f2dec3f545311be69a2064bc6d1'/>
<id>5b748d8aa6833f2dec3f545311be69a2064bc6d1</id>
<content type='text'>
When fwd_progress_div=1, the forward-progress test computes:
  sd4 = (sd + div - 1) / div = sd
  dur = sd4 + torture_random(&amp;trs) % (sd - sd4) = sd4 + % 0

The modulo operation with a zero divisor triggers an integer
division by zero (undefined behavior at the C level, #DE trap on x86),
causing a kernel Oops and panic. On x86_64, this manifests as:

  rcu_torture_fwd_prog_nr: Starting forward-progress test 0
  Oops: divide error: 0000 [#1] SMP PTI
  RIP: 0010:rcu_torture_fwd_prog+0x90b/0x1160
  R12: 0000000000000000

The existing guard only handles non-positive values. However,
fwd_progress_div=1 also makes the random range empty because
sd4 == sd.

Change the guard to reject values below 2. The forward-progress test
only reaches this calculation when stall_dur() is positive, so
sd = stall_dur() + 1 &gt;= 2. For fwd_progress_div &gt;= 2, sd4 &lt; sd,
ensuring that sd - sd4 is at least 1.

Keep the existing fallback to the default value of 4 for invalid
values.

Verified with QEMU/KVM: a 138-second run with fwd_progress_div=1
completed 81 forward-progress test cycles without a crash.

Fixes: 1b27291b1ea4f ("rcutorture: Add forward-progress tests for RCU grace periods")
Signed-off-by: Kunwu Chan &lt;kunwu.chan@gmail.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When fwd_progress_div=1, the forward-progress test computes:
  sd4 = (sd + div - 1) / div = sd
  dur = sd4 + torture_random(&amp;trs) % (sd - sd4) = sd4 + % 0

The modulo operation with a zero divisor triggers an integer
division by zero (undefined behavior at the C level, #DE trap on x86),
causing a kernel Oops and panic. On x86_64, this manifests as:

  rcu_torture_fwd_prog_nr: Starting forward-progress test 0
  Oops: divide error: 0000 [#1] SMP PTI
  RIP: 0010:rcu_torture_fwd_prog+0x90b/0x1160
  R12: 0000000000000000

The existing guard only handles non-positive values. However,
fwd_progress_div=1 also makes the random range empty because
sd4 == sd.

Change the guard to reject values below 2. The forward-progress test
only reaches this calculation when stall_dur() is positive, so
sd = stall_dur() + 1 &gt;= 2. For fwd_progress_div &gt;= 2, sd4 &lt; sd,
ensuring that sd - sd4 is at least 1.

Keep the existing fallback to the default value of 4 for invalid
values.

Verified with QEMU/KVM: a 138-second run with fwd_progress_div=1
completed 81 forward-progress test cycles without a crash.

Fixes: 1b27291b1ea4f ("rcutorture: Add forward-progress tests for RCU grace periods")
Signed-off-by: Kunwu Chan &lt;kunwu.chan@gmail.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>srcutree: Preserve IRQ state in synchronize_srcu_atomic() callchain</title>
<updated>2026-10-12T23:50:40+00:00</updated>
<author>
<name>Kunwu Chan</name>
<email>kunwu.chan@gmail.com</email>
</author>
<published>2026-09-14T09:34:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=13fbbaefb0ac4e4a37e357e0083ca67e84302cd6'/>
<id>13fbbaefb0ac4e4a37e357e0083ca67e84302cd6</id>
<content type='text'>
synchronize_srcu_atomic() may be called with interrupts disabled, but
its callchain uses raw_spin_lock_irq_rcu_node() /
raw_spin_unlock_irq_rcu_node(), which unconditionally enables
interrupts on unlock. This can incorrectly change the caller's IRQ
state.

Use the irqsave/irqrestore variants for the locks in this callchain
so that the caller's IRQ state is preserved.

Co-developed-by: Zqiang &lt;qiang.zhang@linux.dev&gt;
Signed-off-by: Zqiang &lt;qiang.zhang@linux.dev&gt;
Signed-off-by: Kunwu Chan &lt;kunwu.chan@gmail.com&gt;
Acked-by: Boqun Feng &lt;boqun@kernel.org&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
synchronize_srcu_atomic() may be called with interrupts disabled, but
its callchain uses raw_spin_lock_irq_rcu_node() /
raw_spin_unlock_irq_rcu_node(), which unconditionally enables
interrupts on unlock. This can incorrectly change the caller's IRQ
state.

Use the irqsave/irqrestore variants for the locks in this callchain
so that the caller's IRQ state is preserved.

Co-developed-by: Zqiang &lt;qiang.zhang@linux.dev&gt;
Signed-off-by: Zqiang &lt;qiang.zhang@linux.dev&gt;
Signed-off-by: Kunwu Chan &lt;kunwu.chan@gmail.com&gt;
Acked-by: Boqun Feng &lt;boqun@kernel.org&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>srcutiny: Add lockdep and early-boot checks to synchronize_srcu_atomic()</title>
<updated>2026-10-12T23:50:40+00:00</updated>
<author>
<name>Kunwu Chan</name>
<email>kunwu.chan@gmail.com</email>
</author>
<published>2026-09-11T16:09:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8d99291b14f1cb441279ba800ad7535e0e760b63'/>
<id>8d99291b14f1cb441279ba800ad7535e0e760b63</id>
<content type='text'>
Add the RCU_LOCKDEP_WARN and early-boot check that the Tree version
gained, srcu_lock_sync() was already present.

Suggested-by: Zqiang &lt;qiang.zhang@linux.dev&gt;
Signed-off-by: Kunwu Chan &lt;kunwu.chan@gmail.com&gt;
Reviewed-by: Bradley Morgan &lt;brads@mainlining.org&gt;
Reviewed-by: Joel Fernandes &lt;joelagnelf@nvidia.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add the RCU_LOCKDEP_WARN and early-boot check that the Tree version
gained, srcu_lock_sync() was already present.

Suggested-by: Zqiang &lt;qiang.zhang@linux.dev&gt;
Signed-off-by: Kunwu Chan &lt;kunwu.chan@gmail.com&gt;
Reviewed-by: Bradley Morgan &lt;brads@mainlining.org&gt;
Reviewed-by: Joel Fernandes &lt;joelagnelf@nvidia.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>srcutree: Add lockdep and early-boot checks to synchronize_srcu_atomic()</title>
<updated>2026-10-12T23:50:40+00:00</updated>
<author>
<name>Kunwu Chan</name>
<email>kunwu.chan@gmail.com</email>
</author>
<published>2026-09-11T09:35:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=91d2ab160c7c3f001847fe56126eb2f65d681f1e'/>
<id>91d2ab160c7c3f001847fe56126eb2f65d681f1e</id>
<content type='text'>
Add the lockdep annotation, same-type SRCU nesting warning, and
early-boot check used by __synchronize_srcu().

Suggested-by: Zqiang &lt;qiang.zhang@linux.dev&gt;
Signed-off-by: Kunwu Chan &lt;kunwu.chan@gmail.com&gt;
Reviewed-by: Joel Fernandes &lt;joelagnelf@nvidia.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add the lockdep annotation, same-type SRCU nesting warning, and
early-boot check used by __synchronize_srcu().

Suggested-by: Zqiang &lt;qiang.zhang@linux.dev&gt;
Signed-off-by: Kunwu Chan &lt;kunwu.chan@gmail.com&gt;
Reviewed-by: Joel Fernandes &lt;joelagnelf@nvidia.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>srcutree: Skip torture to-big transition for atomic SRCU</title>
<updated>2026-10-12T23:50:40+00:00</updated>
<author>
<name>Kunwu Chan</name>
<email>kunwu.chan@gmail.com</email>
</author>
<published>2026-09-11T04:02:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=0150a00d829e866931775d9503969402d2274251'/>
<id>0150a00d829e866931775d9503969402d2274251</id>
<content type='text'>
Atomic SRCU does not use the srcu_node combining tree. Exclude it
from the SRCU_SIZING_IS_TORTURE() transition in
srcu_torture_stats_print(), and warn if such a transition is requested.

Signed-off-by: Kunwu Chan &lt;kunwu.chan@gmail.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Atomic SRCU does not use the srcu_node combining tree. Exclude it
from the SRCU_SIZING_IS_TORTURE() transition in
srcu_torture_stats_print(), and warn if such a transition is requested.

Signed-off-by: Kunwu Chan &lt;kunwu.chan@gmail.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>srcutree: Don't transition atomic SRCU to big in srcu_gp_end()</title>
<updated>2026-10-12T23:50:40+00:00</updated>
<author>
<name>Kunwu Chan</name>
<email>kunwu.chan@gmail.com</email>
</author>
<published>2026-09-11T07:21:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=378ee30c813edf9e015eb1493cf2188f25682a31'/>
<id>378ee30c813edf9e015eb1493cf2188f25682a31</id>
<content type='text'>
Atomic SRCU must remain in the small size state. Warn if this
invariant is violated and avoid transitioning to big in that case.

[ paulmck: Folded "if" onto one line for 100-character limit. ]

Signed-off-by: Kunwu Chan &lt;kunwu.chan@gmail.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Reviewed-by: Bradley Morgan &lt;brads@mainlining.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Atomic SRCU must remain in the small size state. Warn if this
invariant is violated and avoid transitioning to big in that case.

[ paulmck: Folded "if" onto one line for 100-character limit. ]

Signed-off-by: Kunwu Chan &lt;kunwu.chan@gmail.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Reviewed-by: Bradley Morgan &lt;brads@mainlining.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
