Re: [PATCH RFC -rcu/dev] hazptr: Record per-CPU slot owner after claiming the slot

From: Andrea Parri

Date: Wed Oct 21 2026 - 05:08:58 EST


On Tue, Oct 20, 2026 at 02:12:09PM -0700, Paul E. McKenney wrote:

[...]

> Thank you all! Queued for testing and further review.

Thank you!

> Andrea, on your KUNIT reproducer, is there any chance that this code
> can be folded into the existing hazptrtorture.c work so that it just
> gets tested automatically?

Yes, though not as it is: the KUnit test relies on a test-only hook
in __hazptr_try_acquire(), which I would rather not add to hazptr.h.
hazptrtorture already has the interrupt side, in
hazptr_torture_acquire(), but its readers rarely reach
__hazptr_acquire(), where the race is.

So v1 of the hazptrtorture series will add, as patches 2 and 3:

- two CONFIG_HAZPTR_DEBUG checks of the recorded slot owner, in
hazptr_release_debug() and hazptr_note_context_switch(), and

- a nest_acquire module parameter (default 2) that makes readers
take a second, nested hazard pointer through __hazptr_acquire().

Without the fix, PREEMPT and NOPREEMPT then report the race about 6
seconds after boot; with nest_acquire=0, they run 10 minutes without
a report. The nesting costs about 30% of the readers' loop
iterations, so it could instead default to zero and be enabled from
the scenario files, if you prefer.

Thanks,
Andrea