mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gabriele Monaco <gmonaco@redhat.com>
To: Karl Mehltretter <kmehltretter@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers	 <mathieu.desnoyers@efficios.com>,
	Thomas Gleixner <tglx@kernel.org>,
	 Sebastian Andrzej Siewior	 <bigeasy@linutronix.de>,
	Clark Williams <clrkwllms@kernel.org>,
	Ingo Molnar	 <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Andy Lutomirski	 <luto@kernel.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot	 <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	 Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	 K Prateek Nayak <kprateek.nayak@amd.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	 Randy Dunlap <rdunlap@infradead.org>,
	Wen Yang <wen.yang@linux.dev>,
	linux-trace-kernel@vger.kernel.org,
		linux-rt-devel@lists.linux.dev, linux-doc@vger.kernel.org,
		linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v2 0/9] rv: Verify generic IRQ context transitions
Date: Sat, 21 Nov 2026 15:23:08 +0100	[thread overview]
Message-ID: <9419fa94de8acc8f1ae445004b77d20d0be3e98e.camel@redhat.com> (raw)
In-Reply-To: <20261107171252.25090-1-kmehltretter@gmail.com>

On Sat, 2026-11-07 at 18:12 +0100, Karl Mehltretter wrote:
> Questions still open from v1:
> 
>   1. Are dedicated scheduler tracepoints the right way to follow
>      preempt_schedule_irq() across task switches and migration?

So I'm not quite sure you care about running outside or inside the exception
context tracking. If you don't, an fentry/fexit in BPF (or fprobe in the kernel,
not supported) could work for you.

That said, we do roughly the same in __schedule(), so I don't see anything wrong
with what you're doing, as long as Peter is fine with it.


Maybe, you could somehow reuse the __schedule() tracepoints and understand you
came from interrupt context, but that would obviously not match the
interrupt/preemption counts, although they are (now) guarded by a BUG so you
don't really need them.
The loop should work fairly well anyway.

The nrp model does something similar with the nested_preempt, flagging a
schedule entry after irq as an irq preemption. You may look into that, I don't
exactly remember but it probably isn't really accurate and you might need
something else.

>   2. Is the KUnit-only hook for an empty ksoftirqd invocation
>      acceptable? Outside a KUnit run, its worker checks take a disabled
>      static-key path.

I mentioned it briefly in another email, but I don't think you should touch
softirq code at all. Just simulate events, don't cause them.
As a rule of thumb, if your RV unit test creeps into other subsystems, you're
doing something wrong.

Another story is if you want to write softirq KUnit tests, but that's beyond the
scope of this series and I'm not the one to answer it.

Thanks,
Gabriele

> 
> Patches 1-5 add the tracepoints, monitors and documentation. Patches 6-9
> add KUnit coverage.
> 
> The series is based on v7.4-rc1, which contains the v1 prerequisite and
> Wen Yang's reactor lockdep fix:
> 
>   commit feb5c9a2447a ("softirq: Preserve interrupt context on return from
> interrupt")
>   commit 39ccedfd9e55 ("rv: Use LD_WAIT_SPIN as the reactor lockdep wait
> type")
> 
> The series is independent of the early-hardirq series [2], which
> installs hardirq state before entry tracing. Both change
> kernel/softirq.c, so applying one on top of the other needs a small
> conflict resolution in __irq_exit_rcu().
> 
> Changes since v1:
> 
>   - Use bare DECLARE_TRACE() tracepoints instead of trace events
>     (Gabriele)
>   - Rename the irqentry container to irq (Gabriele)
>   - Add text schematics of both models to the documentation (Gabriele)
>   - Document why irqstate and irqexit are separate automata
>   - Rebase onto v7.4-rc1
> 
> Testing on v7.4-rc1 with Clang 23.1.5, GCC 14.2 (x86) and GCC 16.2
> (cross), and QEMU 10.0 TCG, with lockdep and the locking selftests:
> 
>   - Each patch builds with W=1 on x86_64 without new warnings.
>     RV_MONITORS_KUNIT_TEST=m builds on x86_64 and arm64. kernel-doc
>     reports no warnings for the changed headers.
>   - The rv_mon KUnit suite and the reactor suites passed without
>     failures on:
> 
>       x86_64   PREEMPT SMP4 and UP, PREEMPT with nohz_full=1-3 and
>                threadirqs, PREEMPT_RT SMP4, PREEMPT_RT SMP8 with
>                nohz_full=1-3
>       arm64    PREEMPT, PREEMPT with nohz_full=1-3 and threadirqs,
>                PREEMPT_RT, PREEMPT_RT SMP8 with nohz_full=1-3
>       riscv64  PREEMPT
>       ARMv7    UP
> 
>     Each configuration ran 13 to 21 of the 29 rv_mon cases. The others
>     are skipped because they need a different configuration.
>   - RV=n kernels boot on x86_64 and arm64.
>   - On top of the early-hardirq series, the same suites passed on
>     x86_64 (PREEMPT, PREEMPT_RT), arm64 (PREEMPT, PREEMPT_RT) and
>     riscv64.
> 
> An LLM assisted with the patches and the testing.
> 
> v1: https://lore.kernel.org/all/20261022050712.75035-1-kmehltretter@gmail.com/
> 
> [1]
> https://lore.kernel.org/all/FACA54EC-F846-4051-9ADD-DB46E7665FAD@redhat.com/
> [2] https://lore.kernel.org/all/20261028033127.82193-1-kmehltretter@gmail.com/
> 
> Karl Mehltretter (9):
>   tracing/irq: Add generic IRQ context boundary tracepoints
>   tracing/sched: Add IRQ preemption lifecycle tracepoints
>   rv: Add a monitor for generic IRQ context transitions
>   rv: Add a monitor for IRQ-exit scheduling ownership
>   docs/rv: Document the IRQ 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_irq.rst        |  475 ++++
>  include/linux/interrupt.h                     |    8 +
>  include/rv/kunit.h                            |   34 +-
>  include/trace/events/irq.h                    |   56 +
>  include/trace/events/sched.h                  |   26 +
>  kernel/sched/core.c                           |    6 +
>  kernel/softirq.c                              |  324 ++-
>  kernel/trace/rv/Kconfig                       |   11 +-
>  kernel/trace/rv/Makefile                      |    3 +
>  kernel/trace/rv/monitors/irq/Kconfig          |   13 +
>  kernel/trace/rv/monitors/irq/irq.c            |   35 +
>  kernel/trace/rv/monitors/irq/irq.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 |  540 ++++
>  .../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     | 2339 +++++++++++++++++
>  .../rv/monitors/irqstate/irqstate_kunit.h     |   25 +
>  .../rv/monitors/irqstate/irqstate_trace.h     |   15 +
>  kernel/trace/rv/rv_monitors_test.c            |   30 +
>  kernel/trace/rv/rv_trace.h                    |    2 +
>  tools/verification/models/irq/irqexit.dot     |   21 +
>  tools/verification/models/irq/irqstate.dot    |   32 +
>  29 files changed, 4737 insertions(+), 15 deletions(-)
>  create mode 100644 Documentation/trace/rv/monitor_irq.rst
>  create mode 100644 kernel/trace/rv/monitors/irq/Kconfig
>  create mode 100644 kernel/trace/rv/monitors/irq/irq.c
>  create mode 100644 kernel/trace/rv/monitors/irq/irq.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/irq/irqexit.dot
>  create mode 100644 tools/verification/models/irq/irqstate.dot
> 
> 
> base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4

      parent reply	other threads:[~2026-11-21 14:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-07 17:12 Karl Mehltretter
2026-11-07 17:12 ` [RFC PATCH v2 1/9] tracing/irq: Add generic IRQ context boundary tracepoints Karl Mehltretter
2026-11-21 10:26   ` Gabriele Monaco
2026-11-07 17:12 ` [RFC PATCH v2 2/9] tracing/sched: Add IRQ preemption lifecycle tracepoints Karl Mehltretter
2026-11-21 10:35   ` Gabriele Monaco
2026-11-07 17:12 ` [RFC PATCH v2 3/9] rv: Add a monitor for generic IRQ context transitions Karl Mehltretter
2026-11-07 17:12 ` [RFC PATCH v2 4/9] rv: Add a monitor for IRQ-exit scheduling ownership Karl Mehltretter
2026-11-07 17:12 ` [RFC PATCH v2 5/9] docs/rv: Document the IRQ monitors Karl Mehltretter
2026-11-21 13:59   ` Gabriele Monaco
2026-11-07 17:12 ` [RFC PATCH v2 6/9] rv: Add KUnit coverage for IRQ context transitions Karl Mehltretter
2026-11-07 17:12 ` [RFC PATCH v2 7/9] rv: Add KUnit coverage for IRQ-exit scheduling Karl Mehltretter
2026-11-07 17:12 ` [RFC PATCH v2 8/9] rv: Test empty PREEMPT_RT softirq worker intervals Karl Mehltretter
2026-11-07 17:12 ` [RFC PATCH v2 9/9] rv: Test IRQ-exit softirq provenance and handoff Karl Mehltretter
2026-11-21 14:01   ` Gabriele Monaco
2026-11-21 14:23 ` Gabriele Monaco [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9419fa94de8acc8f1ae445004b77d20d0be3e98e.camel@redhat.com \
    --to=gmonaco@redhat.com \
    --cc=bigeasy@linutronix.de \
    --cc=bsegall@google.com \
    --cc=clrkwllms@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kmehltretter@gmail.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mgorman@suse.de \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rdunlap@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tglx@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=wen.yang@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®