Nam Cao
00f0dadde8
rv: Allow epoll in rtapp-sleep monitor
...
Since commit 0c43094f8c ("eventpoll: Replace rwlock with spinlock"),
epoll_wait is real-time-safe syscall for sleeping.
Add epoll_wait to the list of rt-safe sleeping APIs.
Signed-off-by: Nam Cao <namcao@linutronix.de >
Reviewed-by: Gabriele Monaco <gmonaco@redhat.com >
Link: https://lore.kernel.org/r/20260401130828.3115428-1-namcao@linutronix.de
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com >
2026-04-01 15:18:30 +02:00
Gabriele Monaco
b133207deb
rv: Add nomiss deadline monitor
...
Add the deadline monitors collection to validate the deadline scheduler,
both for deadline tasks and servers.
The currently implemented monitors are:
* nomiss:
validate dl entities run to completion before their deadiline
Reviewed-by: Nam Cao <namcao@linutronix.de >
Reviewed-by: Juri Lelli <juri.lelli@redhat.com >
Link: https://lore.kernel.org/r/20260330111010.153663-13-gmonaco@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com >
2026-03-31 16:47:18 +02:00
Gabriele Monaco
2b406fdb33
rv: Convert the opid monitor to a hybrid automaton
...
The opid monitor validates that wakeup and need_resched events only
occur with interrupts and preemption disabled by following the
preemptirq tracepoints.
As reported in [1], those tracepoints might be inaccurate in some
situations (e.g. NMIs).
Since the monitor doesn't validate other ordering properties, remove the
dependency on preemptirq tracepoints and convert the monitor to a hybrid
automaton to validate the constraint during event handling.
This makes the monitor more robust by also removing the workaround for
interrupts missing the preemption tracepoints, which was working on
PREEMPT_RT only and allows the monitor to be built on kernels without
the preemptirqs tracepoints.
[1] - https://lore.kernel.org/lkml/20250625120823.60600-1-gmonaco@redhat.com
Reviewed-by: Nam Cao <namcao@linutronix.de >
Link: https://lore.kernel.org/r/20260330111010.153663-8-gmonaco@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com >
2026-03-31 16:47:17 +02:00
Gabriele Monaco
13578a0871
rv: Add sample hybrid monitor stall
...
Add a sample monitor to showcase hybrid/timed automata.
The stall monitor identifies tasks stalled for longer than a threshold
and reacts when that happens.
Reviewed-by: Nam Cao <namcao@linutronix.de >
Link: https://lore.kernel.org/r/20260330111010.153663-7-gmonaco@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com >
2026-03-31 16:47:17 +02:00
Gabriele Monaco
614384533d
rv: Add opid per-cpu monitor
...
Add a per-cpu monitor as part of the sched model:
* opid: operations with preemption and irq disabled
Monitor to ensure wakeup and need_resched occur with irq and
preemption disabled or in irq handlers.
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Tomas Glozar <tglozar@redhat.com >
Cc: Juri Lelli <jlelli@redhat.com >
Cc: Clark Williams <williams@redhat.com >
Cc: John Kacur <jkacur@redhat.com >
Link: https://lore.kernel.org/20250728135022.255578-10-gmonaco@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com >
Acked-by: Nam Cao <namcao@linutronix.de >
Tested-by: Nam Cao <namcao@linutronix.de >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
2025-07-28 16:47:35 -04:00
Gabriele Monaco
e8440a88e5
rv: Add nrp and sssw per-task monitors
...
Add 2 per-task monitors as part of the sched model:
* nrp: need-resched preempts
Monitor to ensure preemption requires need resched.
* sssw: set state sleep and wakeup
Monitor to ensure sched_set_state to sleepable leads to sleeping and
sleeping tasks require wakeup.
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Tomas Glozar <tglozar@redhat.com >
Cc: Juri Lelli <jlelli@redhat.com >
Cc: Clark Williams <williams@redhat.com >
Cc: John Kacur <jkacur@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: https://lore.kernel.org/20250728135022.255578-9-gmonaco@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com >
Acked-by: Nam Cao <namcao@linutronix.de >
Tested-by: Nam Cao <namcao@linutronix.de >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
2025-07-28 16:47:34 -04:00
Gabriele Monaco
d0096c2f9c
rv: Replace tss and sncid monitors with more complete sts
...
The tss monitor currently guarantees task switches can happen only while
scheduling, whereas the sncid monitor enforces scheduling occurs with
interrupt disabled.
Replace the monitors with a more comprehensive specification which
implies both but also ensures that:
* each scheduler call disable interrupts to switch
* each task switch happens with interrupts disabled
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Nam Cao <namcao@linutronix.de >
Cc: Tomas Glozar <tglozar@redhat.com >
Cc: Juri Lelli <jlelli@redhat.com >
Cc: Clark Williams <williams@redhat.com >
Cc: John Kacur <jkacur@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: https://lore.kernel.org/20250728135022.255578-8-gmonaco@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
2025-07-28 16:47:34 -04:00
Nam Cao
f74f8bb246
rv: Add rtapp_sleep monitor
...
Add a monitor for checking that real-time tasks do not go to sleep in a
manner that may cause undesirable latency.
Also change
RV depends on TRACING
to
RV select TRACING
to avoid the following recursive dependency:
error: recursive dependency detected!
symbol TRACING is selected by PREEMPTIRQ_TRACEPOINTS
symbol PREEMPTIRQ_TRACEPOINTS depends on TRACE_IRQFLAGS
symbol TRACE_IRQFLAGS is selected by RV_MON_SLEEP
symbol RV_MON_SLEEP depends on RV
symbol RV depends on TRACING
Cc: John Ogness <john.ogness@linutronix.de >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com >
Link: https://lore.kernel.org/75bc5bcc741d153aa279c95faf778dff35c5c8ad.1752088709.git.namcao@linutronix.de
Reviewed-by: Gabriele Monaco <gmonaco@redhat.com >
Signed-off-by: Nam Cao <namcao@linutronix.de >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
2025-07-09 15:27:01 -04:00
Nam Cao
9162620eb6
rv: Add rtapp_pagefault monitor
...
Userspace real-time applications may have design flaws that they raise
page faults in real-time threads, and thus have unexpected latencies.
Add an linear temporal logic monitor to detect this scenario.
Cc: John Ogness <john.ogness@linutronix.de >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com >
Link: https://lore.kernel.org/78fea8a2de6d058241d3c6502c1a92910772b0ed.1752088709.git.namcao@linutronix.de
Reviewed-by: Gabriele Monaco <gmonaco@redhat.com >
Signed-off-by: Nam Cao <namcao@linutronix.de >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
2025-07-09 15:27:01 -04:00
Gabriele Monaco
fbe6c09b7e
rv: Add scpd, snep and sncid per-cpu monitors
...
Add 3 per-cpu monitors as part of the sched model:
* scpd: schedule called with preemption disabled
Monitor to ensure schedule is called with preemption disabled
* snep: schedule does not enable preempt
Monitor to ensure schedule does not enable preempt
* sncid: schedule not called with interrupt disabled
Monitor to ensure schedule is not called with interrupt disabled
To: Ingo Molnar <mingo@redhat.com >
To: Peter Zijlstra <peterz@infradead.org >
Cc: Juri Lelli <juri.lelli@redhat.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: John Kacur <jkacur@redhat.com >
Cc: Clark Williams <williams@redhat.com >
Link: https://lore.kernel.org/20250305140406.350227-6-gmonaco@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
2025-03-24 17:27:39 -04:00
Gabriele Monaco
93bac9cf35
rv: Add snroc per-task monitor
...
Add a per-task monitor as part of the sched model:
* snroc: set non runnable on its own context
Monitor to ensure set_state happens only in the respective task's context
To: Ingo Molnar <mingo@redhat.com >
To: Peter Zijlstra <peterz@infradead.org >
Cc: Juri Lelli <juri.lelli@redhat.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: John Kacur <jkacur@redhat.com >
Cc: Clark Williams <williams@redhat.com >
Link: https://lore.kernel.org/20250305140406.350227-5-gmonaco@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
2025-03-24 17:27:39 -04:00
Gabriele Monaco
9fd420abc4
rv: Add sco and tss per-cpu monitors
...
Add 2 per-cpu monitors as part of the sched model:
* sco: scheduling context operations
Monitor to ensure sched_set_state happens only in thread context
* tss: task switch while scheduling
Monitor to ensure sched_switch happens only in scheduling context
To: Ingo Molnar <mingo@redhat.com >
To: Peter Zijlstra <peterz@infradead.org >
Cc: Juri Lelli <juri.lelli@redhat.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: John Kacur <jkacur@redhat.com >
Cc: Clark Williams <williams@redhat.com >
Link: https://lore.kernel.org/20250305140406.350227-4-gmonaco@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
2025-03-24 17:27:39 -04:00
Daniel Bristot de Oliveira
ccc319dcb4
rv/monitor: Add the wwnr monitor
...
Per task wakeup while not running (wwnr) monitor.
This model is broken, the reason is that a task can be running in the
processor without being set as RUNNABLE. Think about a task about to
sleep:
1: set_current_state(TASK_UNINTERRUPTIBLE);
2: schedule();
And then imagine an IRQ happening in between the lines one and two,
waking the task up. BOOM, the wakeup will happen while the task is
running.
Q: Why do we need this model, so?
A: To test the reactors.
Link: https://lkml.kernel.org/r/473c0fc39967250fdebcff8b620311c11dccad30.1659052063.git.bristot@kernel.org
Cc: Wim Van Sebroeck <wim@linux-watchdog.org >
Cc: Guenter Roeck <linux@roeck-us.net >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Will Deacon <will@kernel.org >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Marco Elver <elver@google.com >
Cc: Dmitry Vyukov <dvyukov@google.com >
Cc: "Paul E. McKenney" <paulmck@kernel.org >
Cc: Shuah Khan <skhan@linuxfoundation.org >
Cc: Gabriele Paoloni <gpaoloni@redhat.com >
Cc: Juri Lelli <juri.lelli@redhat.com >
Cc: Clark Williams <williams@redhat.com >
Cc: Tao Zhou <tao.zhou@linux.dev >
Cc: Randy Dunlap <rdunlap@infradead.org >
Cc: linux-doc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-trace-devel@vger.kernel.org
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
2022-07-30 14:01:30 -04:00
Daniel Bristot de Oliveira
10bde81c74
rv/monitor: Add the wip monitor
...
The wakeup in preemptive (wip) monitor verifies if the
wakeup events always take place with preemption disabled:
|
|
v
#==================#
H preemptive H <+
#==================# |
| |
| preempt_disable | preempt_enable
v |
sched_waking +------------------+ |
+--------------- | | |
| | non_preemptive | |
+--------------> | | -+
+------------------+
The wakeup event always takes place with preemption disabled because
of the scheduler synchronization. However, because the preempt_count
and its trace event are not atomic with regard to interrupts, some
inconsistencies might happen.
The documentation illustrates one of these cases.
Link: https://lkml.kernel.org/r/c98ca678df81115fddc04921b3c79720c836b18f.1659052063.git.bristot@kernel.org
Cc: Wim Van Sebroeck <wim@linux-watchdog.org >
Cc: Guenter Roeck <linux@roeck-us.net >
Cc: Jonathan Corbet <corbet@lwn.net >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Will Deacon <will@kernel.org >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Marco Elver <elver@google.com >
Cc: Dmitry Vyukov <dvyukov@google.com >
Cc: "Paul E. McKenney" <paulmck@kernel.org >
Cc: Shuah Khan <skhan@linuxfoundation.org >
Cc: Gabriele Paoloni <gpaoloni@redhat.com >
Cc: Juri Lelli <juri.lelli@redhat.com >
Cc: Clark Williams <williams@redhat.com >
Cc: Tao Zhou <tao.zhou@linux.dev >
Cc: Randy Dunlap <rdunlap@infradead.org >
Cc: linux-doc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-trace-devel@vger.kernel.org
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org >
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org >
2022-07-30 14:01:30 -04:00