Re: [RFC PATCH 0/9] rv: Verify generic IRQ context transitions

From: Gabriele Monaco

Date: Sat Oct 24 2026 - 08:17:08 EST




Il 22 ottobre 2026 05:07:03 UTC, Karl Mehltretter <kmehltretter@xxxxxxxxx> ha scritto:
>I would especially appreciate feedback on:
>
> 1. Should the context boundaries be trace events or private RV
> instrumentation?

There aren't any RV-specific instrumentation sites. Now you used trace events, for these you usually need a broad acceptance because they are visible to user space. Have a look at tracepoints (the last ones added to events/sched.h are good examples).

Otherwise you may have a look at my BPF series and use other BPF-specific probes (fentry/fexit), these won't need any kernel addition. Just mind that the series in an early stage. [1]

> 2. Are dedicated scheduler events the right way to follow
> preempt_schedule_irq() across task switches and migration?
> 3. Should irqstate and irqexit remain separate monitors?

Feel free to merge them unless you see a use case where one would launch them separately and allow violations from one but not the other.

Also the irqentry collection with an irqexit monitor is mildly confusing name-wise.

Gabriele

[1] - https://lore.kernel.org/lkml/20261001152042.124445-1-gmonaco@xxxxxxxxxx



> 4. Is the KUnit-only hook for an empty ksoftirqd invocation acceptable?
> Outside a KUnit run, its worker checks take a disabled static-key
> path.
>
>Patches 1-5 add the events, monitors, and documentation. Patches 6-9 add
>KUnit coverage.
>
>This series is based on v7.3 (c03c1a14507d) and depends on the following
>accepted change, which is not included:
>
> softirq: Preserve interrupt context on return from interrupt
> https://lore.kernel.org/r/20261011060742.30584-1-kmehltretter@xxxxxxxxx
>
>A pre-existing issue can make rv_test_dummy intermittently report a
>false-positive invalid-wait-context warning under lockdep. Wen Yang has
>posted a fix:
>
> https://lore.kernel.org/lkml/5586dd00789a0f904cc299cd8889744b8c6f8dc9.1789412799.git.wen.yang@xxxxxxxxx/
>
>This series does not include that fix.
>
>Karl Mehltretter (9):
> tracing/irq: Add generic IRQ context boundary events
> tracing/sched: Add IRQ preemption lifecycle events
> rv: Add a monitor for generic IRQ context transitions
> rv: Add a monitor for IRQ-exit scheduling ownership
> docs/rv: Document the IRQ-entry monitors
> rv: Add KUnit coverage for IRQ context transitions
> rv: Add KUnit coverage for IRQ-exit scheduling
> rv: Test empty PREEMPT_RT softirq worker intervals
> rv: Test IRQ-exit softirq provenance and handoff
>
> Documentation/trace/rv/index.rst | 1 +
> Documentation/trace/rv/monitor_irqentry.rst | 398 ++++
> include/linux/interrupt.h | 7 +
> include/rv/kunit.h | 34 +-
> include/trace/events/irq.h | 70 +
> include/trace/events/sched.h | 51 +
> kernel/sched/core.c | 6 +
> kernel/softirq.c | 308 ++-
> kernel/trace/rv/Kconfig | 5 +
> kernel/trace/rv/Makefile | 3 +
> kernel/trace/rv/monitors/irqentry/Kconfig | 13 +
> kernel/trace/rv/monitors/irqentry/irqentry.c | 35 +
> kernel/trace/rv/monitors/irqentry/irqentry.h | 3 +
> kernel/trace/rv/monitors/irqexit/Kconfig | 14 +
> kernel/trace/rv/monitors/irqexit/irqexit.c | 172 ++
> kernel/trace/rv/monitors/irqexit/irqexit.h | 85 +
> .../trace/rv/monitors/irqexit/irqexit_kunit.c | 537 +++++
> .../trace/rv/monitors/irqexit/irqexit_kunit.h | 21 +
> .../trace/rv/monitors/irqexit/irqexit_trace.h | 19 +
> kernel/trace/rv/monitors/irqstate/Kconfig | 14 +
> kernel/trace/rv/monitors/irqstate/irqstate.c | 289 +++
> kernel/trace/rv/monitors/irqstate/irqstate.h | 139 ++
> .../rv/monitors/irqstate/irqstate_kunit.c | 2062 +++++++++++++++++
> .../rv/monitors/irqstate/irqstate_kunit.h | 25 +
> .../rv/monitors/irqstate/irqstate_trace.h | 15 +
> kernel/trace/rv/rv_monitors_test.c | 29 +
> kernel/trace/rv/rv_trace.h | 2 +
> .../verification/models/irqentry/irqexit.dot | 21 +
> .../verification/models/irqentry/irqstate.dot | 32 +
> 29 files changed, 4397 insertions(+), 13 deletions(-)
> create mode 100644 Documentation/trace/rv/monitor_irqentry.rst
> create mode 100644 kernel/trace/rv/monitors/irqentry/Kconfig
> create mode 100644 kernel/trace/rv/monitors/irqentry/irqentry.c
> create mode 100644 kernel/trace/rv/monitors/irqentry/irqentry.h
> create mode 100644 kernel/trace/rv/monitors/irqexit/Kconfig
> create mode 100644 kernel/trace/rv/monitors/irqexit/irqexit.c
> create mode 100644 kernel/trace/rv/monitors/irqexit/irqexit.h
> create mode 100644 kernel/trace/rv/monitors/irqexit/irqexit_kunit.c
> create mode 100644 kernel/trace/rv/monitors/irqexit/irqexit_kunit.h
> create mode 100644 kernel/trace/rv/monitors/irqexit/irqexit_trace.h
> create mode 100644 kernel/trace/rv/monitors/irqstate/Kconfig
> create mode 100644 kernel/trace/rv/monitors/irqstate/irqstate.c
> create mode 100644 kernel/trace/rv/monitors/irqstate/irqstate.h
> create mode 100644 kernel/trace/rv/monitors/irqstate/irqstate_kunit.c
> create mode 100644 kernel/trace/rv/monitors/irqstate/irqstate_kunit.h
> create mode 100644 kernel/trace/rv/monitors/irqstate/irqstate_trace.h
> create mode 100644 tools/verification/models/irqentry/irqexit.dot
> create mode 100644 tools/verification/models/irqentry/irqstate.dot
>
>base-commit: c03c1a14507dfaf8b856c2608f9ac216021fc222
>prerequisite-patch-id: 6ac7167f0aa7c5319dac78bf5b06a989fd7dfac5