mirror of
https://github.com/torvalds/linux.git
synced 2026-10-16 21:00:02 +02:00
The rtapp/sleep monitor's primary purpose is detecting common mistakes
with user-space real-time design. Monitoring real-time issues with
kernel threads is a bonus.
However, accomodating kernel threads complicates the monitor due to
the edge cases which is seen by the monitor as lower-priority task
waking higher-priority task:
- kthread_stop() wakes up the task in order to stop it.
- The rcu thread and migration thread can be woken by any task.
- The ktimerd thread is woken near the end of irq_exit_rcu(), where
the preempt counter is "broken" and falsely says this is task
context. This requires the monitor to use the hardirq_context flag
instead of the preempt counter.
Beside complicating the monitor, the final case also requires enabling
CONFIG_TRACE_IRQFLAGS (so that "hardirq_context" can be used). This
adds overhead to the kernel even when the monitor is not active. This
may be an obstacle to enabling this monitor in distros' kernels.
Furthermore, kernel threads usually are started before the monitor is
enabled. Consequently, the threads' states (i.o.w. the monitor's
atomic propositions for the threads) are not fully known to the
monitor. As a result, the kernel threads mostly cannot be monitored.
Overall, the downsides of accomodating kernel threads outweights the
benefits. Thus, exclude kernel threads to simplify the monitor.
Signed-off-by: Nam Cao <namcao@linutronix.de>
Reviewed-by: Gabriele Monaco <gmonaco@redhat.com>
Link: https://lore.kernel.org/r/eec2ca5224bcdacc45b8e1eb2f0e68109e1cae7a.1781852967.git.namcao@linutronix.de
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
22 lines
635 B
Plaintext
22 lines
635 B
Plaintext
# SPDX-License-Identifier: GPL-2.0-only
|
|
#
|
|
config RV_MON_SLEEP
|
|
depends on RV
|
|
select RV_LTL_MONITOR
|
|
depends on HAVE_SYSCALL_TRACEPOINTS
|
|
depends on RV_MON_RTAPP
|
|
default y
|
|
select LTL_MON_EVENTS_ID
|
|
bool "sleep monitor"
|
|
help
|
|
Monitor that real-time tasks do not sleep in a manner that may
|
|
cause undesirable latency.
|
|
|
|
If you are developing a real-time system and not entirely sure whether
|
|
the applications are designed correctly for real-time, you want to say
|
|
Y here.
|
|
|
|
Enabling this monitor may have performance impact (due to select
|
|
TRACE_IRQFLAGS). Therefore, you probably should say N for
|
|
production kernel.
|