Re: [RFC PATCH v2 9/9] rv: Test IRQ-exit softirq provenance and handoff

From: Gabriele Monaco

Date: Sat Nov 21 2026 - 09:01:24 EST


On Sat, 2026-11-07 at 18:12 +0100, Karl Mehltretter wrote:
> IRQ-exit softirq processing preserves hardirq state until it finishes. Test
> the resulting hardirq-to-softirq-to-hardirq sequence, including a nested
> hardirq and monitor attachment during the transition.
>
> Boundary and tick-exit callbacks can themselves raise more softirq work.
> Raise work at softirq entry, softirq exit, the final hardirq boundary, and
> a full-NOHZ tick_stop event. Verify that ordinary work reaches ksoftirqd,
> forced-thread timer work reaches ktimerd, and a timer-wakeup callback which
> raises ordinary work gets the final ksoftirqd recheck.
>
> Track the synthetic owner and serving-softirq interval so unrelated nested
> interrupts do not corrupt the expected sequence. Reject the handoff setup
> while bottom halves are blocked, attach observers before waiting for
> workers, and recheck the setup with interrupts disabled.
>
> On PREEMPT_RT, verify that worker events do not report hardirq provenance.
> Do not run the synthetic inline IRQ-exit cases there. IRQ exit defers
> softirqs to workers, and serving-softirq state is task-local rather than
> encoded solely in preempt_count().
>
> Snapshot reaction counts inside synthetic IRQ-disabled and hardirq
> intervals, then evaluate the KUnit expectations after restoring normal task
> context.
>
> Signed-off-by: Karl Mehltretter <kmehltretter@xxxxxxxxx>

I still couldn't read the KUnit tests, but from what I get quickly scanning
these, it's massive. A total of almost 3k lines of KUnit tests for 2 simple
models is probably a bit much.

Keep in mind you are testing your unit, which is an RV monitor, so you may want
to stress transitions, mess around with the environment as little as you can
(e.g. disable interrupts) and use mocks/stubs where you can. It isn't always
easy, but the fact you're touching softirq.c doesn't look right. Your
unit isn't the softirq machinery, you should interact with it as least as
possible.

If you really want to test the system as a whole, you do a selftest,
which stresses from userspace, more like an integration test than a unit
tests.

Thanks,
Gabriele