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.
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
---
Documentation/trace/rv/monitor_sched.rst | 48 +++++++
kernel/trace/rv/Kconfig | 1 +
kernel/trace/rv/Makefile | 1 +
kernel/trace/rv/monitors/opid/Kconfig | 17 +++
kernel/trace/rv/monitors/opid/opid.c | 151 +++++++++++++++++++++
kernel/trace/rv/monitors/opid/opid.h | 64 +++++++++
kernel/trace/rv/monitors/opid/opid_trace.h | 15 ++
kernel/trace/rv/rv_trace.h | 1 +
tools/verification/models/sched/opid.dot | 35 +++++
9 files changed, 333 insertions(+)
create mode 100644 kernel/trace/rv/monitors/opid/Kconfig
create mode 100644 kernel/trace/rv/monitors/opid/opid.c
create mode 100644 kernel/trace/rv/monitors/opid/opid.h
create mode 100644 kernel/trace/rv/monitors/opid/opid_trace.h
create mode 100644 tools/verification/models/sched/opid.dot
diff --git a/Documentation/trace/rv/monitor_sched.rst b/Documentation/trace/rv/monitor_sched.rst
index 97f0f1a10f43..f044bca7ac31 100644
--- a/Documentation/trace/rv/monitor_sched.rst
+++ b/Documentation/trace/rv/monitor_sched.rst
@@ -315,6 +315,54 @@ after the task got to ``sleeping`` until a ``wakeup``::
| |
+----------------------------+
+Monitor opid
+------------
+
+The operations with preemption and irq disabled (opid) monitor ensures
+operations like ``wakeup`` and ``need_resched`` occur with interrupts and
+preemption disabled or during IRQs, in such case preemption may not be disabled
+explicitly.
+``need_resched`` can be set by some RCU internals functions, in which case it
+doesn't match a task wakeup and might occur with only interrupts disabled::
+
+ | sched_need_resched
+ | sched_waking
+ | irq_entry
+ | +--------------------+
+ v v |
+ +------------------------------------------------------+
+ +----------- | disabled | <+
+ | +------------------------------------------------------+ |
+ | | ^ |
+ | | preempt_disable sched_need_resched |
+ | preempt_enable | +--------------------+ |
+ | v | v | |
+ | +------------------------------------------------------+ |
+ | | irq_disabled | |
+ | +------------------------------------------------------+ |
+ | | | ^ |
+ | irq_entry | | |
+ | sched_need_resched v | irq_disable |
+ | sched_waking +--------------+ | | |
+ | +----- | | irq_enable | |
+ | | | in_irq | | | |
+ | +----> | | | | |
+ | +--------------+ | | irq_disable
+ | | | | |
+ | irq_enable | irq_enable | | |
+ | v v | |
+ | #======================================================# |
+ | H enabled H |
+ | #======================================================# |
+ | | ^ ^ preempt_enable | |
+ | preempt_disable preempt_enable +--------------------+ |
+ | v | |
+ | +------------------+ | |
+ +----------> | preempt_disabled | -+ |
+ +------------------+ |
+ | |
+ +-------------------------------------------------------+
+
References
----------
diff --git a/kernel/trace/rv/Kconfig b/kernel/trace/rv/Kconfig
index f106cf7b2fd3..9ebb80931a9f 100644
--- a/kernel/trace/rv/Kconfig
+++ b/kernel/trace/rv/Kconfig
@@ -36,6 +36,7 @@ source "kernel/trace/rv/monitors/sncid/Kconfig"
source "kernel/trace/rv/monitors/sts/Kconfig"
source "kernel/trace/rv/monitors/nrp/Kconfig"
source "kernel/trace/rv/monitors/sssw/Kconfig"
+source "kernel/trace/rv/monitors/opid/Kconfig"
# Add new monitors here
config RV_REACTORS
diff --git a/kernel/trace/rv/Makefile b/kernel/trace/rv/Makefile
index c076cf48af18..0eca5e77d0d2 100644
--- a/kernel/trace/rv/Makefile
+++ b/kernel/trace/rv/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_RV_MON_SNCID) += monitors/sncid/sncid.o
obj-$(CONFIG_RV_MON_STS) += monitors/sts/sts.o
obj-$(CONFIG_RV_MON_NRP) += monitors/nrp/nrp.o
obj-$(CONFIG_RV_MON_SSSW) += monitors/sssw/sssw.o
+obj-$(CONFIG_RV_MON_OPID) += monitors/opid/opid.o
# Add new monitors here
obj-$(CONFIG_RV_REACTORS) += rv_reactors.o
obj-$(CONFIG_RV_REACT_PRINTK) += reactor_printk.o
diff --git a/kernel/trace/rv/monitors/opid/Kconfig b/kernel/trace/rv/monitors/opid/Kconfig
new file mode 100644
index 000000000000..c59d51654cd1
--- /dev/null
+++ b/kernel/trace/rv/monitors/opid/Kconfig
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+config RV_MON_OPID
+ depends on RV
+ depends on IRQSOFF_TRACER
+ depends on PREEMPT_TRACER
+ depends on RV_MON_SCHED
+ default y
+ select DA_MON_EVENTS_IMPLICIT
+ bool "opid monitor"
+ help
+ Monitor to ensure operations like wakeup and need resched occur with
+ interrupts and preemption disabled or during IRQs, where preemption
+ may not be disabled explicitly.
+
+ For further information, see:
+ Documentation/trace/rv/monitor_sched.rst
diff --git a/kernel/trace/rv/monitors/opid/opid.c b/kernel/trace/rv/monitors/opid/opid.c
new file mode 100644
index 000000000000..d8732d681753
--- /dev/null
+++ b/kernel/trace/rv/monitors/opid/opid.c
@@ -0,0 +1,151 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/ftrace.h>
+#include <linux/tracepoint.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/rv.h>
+#include <rv/instrumentation.h>
+#include <rv/da_monitor.h>
+
+#define MODULE_NAME "opid"
+
+#include <trace/events/sched.h>
+#include <trace/events/irq.h>
+#include <trace/events/preemptirq.h>
+#include <rv_trace.h>
+#include <monitors/sched/sched.h>
+
+#include "opid.h"
+
+static struct rv_monitor rv_opid;
+DECLARE_DA_MON_PER_CPU(opid, unsigned char);
+
+#ifdef CONFIG_X86_LOCAL_APIC
+#include <asm/trace/irq_vectors.h>
+
+static void handle_vector_irq_entry(void *data, int vector)
+{
+ da_handle_event_opid(irq_entry_opid);
+}
+
+static void attach_vector_irq(void) {
+ rv_attach_trace_probe("opid", local_timer_entry, handle_vector_irq_entry);
+}
+
+static void detach_vector_irq(void) {
+ rv_detach_trace_probe("opid", local_timer_entry, handle_vector_irq_entry);
+}
+
+#else
+/* We assume irq_entry tracepoints are sufficient on other architectures */
+static void attach_vector_irq() { }
+static void detach_vector_irq() { }
+#endif
+
+static void handle_irq_disable(void *data, unsigned long ip, unsigned long parent_ip)
+{
+ da_handle_event_opid(irq_disable_opid);
+}
+
+static void handle_irq_enable(void *data, unsigned long ip, unsigned long parent_ip)
+{
+ da_handle_event_opid(irq_enable_opid);
+}
+
+static void handle_irq_entry(void *data, int irq, struct irqaction *action)
+{
+ da_handle_event_opid(irq_entry_opid);
+}
+
+static void handle_preempt_disable(void *data, unsigned long ip, unsigned long parent_ip)
+{
+ da_handle_event_opid(preempt_disable_opid);
+}
+
+static void handle_preempt_enable(void *data, unsigned long ip, unsigned long parent_ip)
+{
+ da_handle_event_opid(preempt_enable_opid);
+}
+
+static void handle_sched_need_resched(void *data, struct task_struct *tsk, int cpu, int tif)
+{
+ if(in_irq())
+ da_handle_event_opid(sched_need_resched_opid);
+ else
+ da_handle_start_event_opid(sched_need_resched_opid);
+}
+
+static void handle_sched_waking(void *data, struct task_struct *p)
+{
+ if(in_irq())
+ da_handle_event_opid(sched_waking_opid);
+ else
+ da_handle_start_event_opid(sched_waking_opid);
+}
+
+static int enable_opid(void)
+{
+ int retval;
+
+ retval = da_monitor_init_opid();
+ if (retval)
+ return retval;
+
+ rv_attach_trace_probe("opid", irq_disable, handle_irq_disable);
+ rv_attach_trace_probe("opid", irq_enable, handle_irq_enable);
+ rv_attach_trace_probe("opid", irq_handler_entry, handle_irq_entry);
+ rv_attach_trace_probe("opid", preempt_disable, handle_preempt_disable);
+ rv_attach_trace_probe("opid", preempt_enable, handle_preempt_enable);
+ rv_attach_trace_probe("opid", sched_set_need_resched_tp, handle_sched_need_resched);
+ rv_attach_trace_probe("opid", sched_waking, handle_sched_waking);
+ attach_vector_irq();
+
+ return 0;
+}
+
+static void disable_opid(void)
+{
+ rv_opid.enabled = 0;
+
+ rv_detach_trace_probe("opid", irq_disable, handle_irq_disable);
+ rv_detach_trace_probe("opid", irq_enable, handle_irq_enable);
+ rv_detach_trace_probe("opid", irq_handler_entry, handle_irq_entry);
+ rv_detach_trace_probe("opid", preempt_disable, handle_preempt_disable);
+ rv_detach_trace_probe("opid", preempt_enable, handle_preempt_enable);
+ rv_detach_trace_probe("opid", sched_set_need_resched_tp, handle_sched_need_resched);
+ rv_detach_trace_probe("opid", sched_waking, handle_sched_waking);
+ detach_vector_irq();
+
+ da_monitor_destroy_opid();
+}
+
+/*
+ * This is the monitor register section.
+ */
+static struct rv_monitor rv_opid = {
+ .name = "opid",
+ .description = "operations with preemption and irq disabled.",
+ .enable = enable_opid,
+ .disable = disable_opid,
+ .reset = da_monitor_reset_all_opid,
+ .enabled = 0,
+};
+
+static int __init register_opid(void)
+{
+ rv_register_monitor(&rv_opid, &rv_sched);
+ return 0;
+}
+
+static void __exit unregister_opid(void)
+{
+ rv_unregister_monitor(&rv_opid);
+}
+
+module_init(register_opid);
+module_exit(unregister_opid);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Gabriele Monaco <gmonaco@redhat.com>");
+MODULE_DESCRIPTION("opid: operations with preemption and irq disabled.");
diff --git a/kernel/trace/rv/monitors/opid/opid.h b/kernel/trace/rv/monitors/opid/opid.h
new file mode 100644
index 000000000000..4c6d4a3964c5
--- /dev/null
+++ b/kernel/trace/rv/monitors/opid/opid.h
@@ -0,0 +1,64 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Automatically generated C representation of opid automaton
+ * For further information about this format, see kernel documentation:
+ * Documentation/trace/rv/deterministic_automata.rst
+ */
+
+enum states_opid {
+ disabled_opid = 0,
+ enabled_opid,
+ in_irq_opid,
+ irq_disabled_opid,
+ preempt_disabled_opid,
+ state_max_opid
+};
+
+#define INVALID_STATE state_max_opid
+
+enum events_opid {
+ irq_disable_opid = 0,
+ irq_enable_opid,
+ irq_entry_opid,
+ preempt_disable_opid,
+ preempt_enable_opid,
+ sched_need_resched_opid,
+ sched_waking_opid,
+ event_max_opid
+};
+
+struct automaton_opid {
+ char *state_names[state_max_opid];
+ char *event_names[event_max_opid];
+ unsigned char function[state_max_opid][event_max_opid];
+ unsigned char initial_state;
+ bool final_states[state_max_opid];
+};
+
+static const struct automaton_opid automaton_opid = {
+ .state_names = {
+ "disabled",
+ "enabled",
+ "in_irq",
+ "irq_disabled",
+ "preempt_disabled"
+ },
+ .event_names = {
+ "irq_disable",
+ "irq_enable",
+ "irq_entry",
+ "preempt_disable",
+ "preempt_enable",
+ "sched_need_resched",
+ "sched_waking"
+ },
+ .function = {
+ { INVALID_STATE, preempt_disabled_opid, disabled_opid, INVALID_STATE, irq_disabled_opid, disabled_opid, disabled_opid },
+ { irq_disabled_opid, INVALID_STATE, INVALID_STATE, preempt_disabled_opid, enabled_opid, INVALID_STATE, INVALID_STATE },
+ { INVALID_STATE, enabled_opid, INVALID_STATE, INVALID_STATE, INVALID_STATE, in_irq_opid, in_irq_opid },
+ { INVALID_STATE, enabled_opid, in_irq_opid, disabled_opid, INVALID_STATE, irq_disabled_opid, INVALID_STATE },
+ { disabled_opid, INVALID_STATE, INVALID_STATE, INVALID_STATE, enabled_opid, INVALID_STATE, INVALID_STATE },
+ },
+ .initial_state = disabled_opid,
+ .final_states = { 0, 1, 0, 0, 0 },
+};
diff --git a/kernel/trace/rv/monitors/opid/opid_trace.h b/kernel/trace/rv/monitors/opid/opid_trace.h
new file mode 100644
index 000000000000..3df6ff955c30
--- /dev/null
+++ b/kernel/trace/rv/monitors/opid/opid_trace.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+/*
+ * Snippet to be included in rv_trace.h
+ */
+
+#ifdef CONFIG_RV_MON_OPID
+DEFINE_EVENT(event_da_monitor, event_opid,
+ TP_PROTO(char *state, char *event, char *next_state, bool final_state),
+ TP_ARGS(state, event, next_state, final_state));
+
+DEFINE_EVENT(error_da_monitor, error_opid,
+ TP_PROTO(char *state, char *event),
+ TP_ARGS(state, event));
+#endif /* CONFIG_RV_MON_OPID */
diff --git a/kernel/trace/rv/rv_trace.h b/kernel/trace/rv/rv_trace.h
index d12ab74dcabc..5d3c5c3f7545 100644
--- a/kernel/trace/rv/rv_trace.h
+++ b/kernel/trace/rv/rv_trace.h
@@ -63,6 +63,7 @@ DECLARE_EVENT_CLASS(error_da_monitor,
#include <monitors/snep/snep_trace.h>
#include <monitors/sncid/sncid_trace.h>
#include <monitors/sts/sts_trace.h>
+#include <monitors/opid/opid_trace.h>
// Add new monitors based on CONFIG_DA_MON_EVENTS_IMPLICIT here
#endif /* CONFIG_DA_MON_EVENTS_IMPLICIT */
diff --git a/tools/verification/models/sched/opid.dot b/tools/verification/models/sched/opid.dot
new file mode 100644
index 000000000000..2d5e1df3405f
--- /dev/null
+++ b/tools/verification/models/sched/opid.dot
@@ -0,0 +1,35 @@
+digraph state_automaton {
+ center = true;
+ size = "7,11";
+ {node [shape = plaintext, style=invis, label=""] "__init_disabled"};
+ {node [shape = circle] "disabled"};
+ {node [shape = doublecircle] "enabled"};
+ {node [shape = circle] "enabled"};
+ {node [shape = circle] "in_irq"};
+ {node [shape = circle] "irq_disabled"};
+ {node [shape = circle] "preempt_disabled"};
+ "__init_disabled" -> "disabled";
+ "disabled" [label = "disabled"];
+ "disabled" -> "disabled" [ label = "sched_need_resched\nsched_waking\nirq_entry" ];
+ "disabled" -> "irq_disabled" [ label = "preempt_enable" ];
+ "disabled" -> "preempt_disabled" [ label = "irq_enable" ];
+ "enabled" [label = "enabled", color = green3];
+ "enabled" -> "enabled" [ label = "preempt_enable" ];
+ "enabled" -> "irq_disabled" [ label = "irq_disable" ];
+ "enabled" -> "preempt_disabled" [ label = "preempt_disable" ];
+ "in_irq" [label = "in_irq"];
+ "in_irq" -> "enabled" [ label = "irq_enable" ];
+ "in_irq" -> "in_irq" [ label = "sched_need_resched\nsched_waking" ];
+ "irq_disabled" [label = "irq_disabled"];
+ "irq_disabled" -> "disabled" [ label = "preempt_disable" ];
+ "irq_disabled" -> "enabled" [ label = "irq_enable" ];
+ "irq_disabled" -> "in_irq" [ label = "irq_entry" ];
+ "irq_disabled" -> "irq_disabled" [ label = "sched_need_resched" ];
+ "preempt_disabled" [label = "preempt_disabled"];
+ "preempt_disabled" -> "disabled" [ label = "irq_disable" ];
+ "preempt_disabled" -> "enabled" [ label = "preempt_enable" ];
+ { rank = min ;
+ "__init_disabled";
+ "disabled";
+ }
+}
--
2.49.0
On Wed, May 14, 2025 at 10:43:14AM +0200, Gabriele Monaco wrote: > 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. This monitor reports some warnings: $ perf record -e rv:error_opid --call-graph dwarf -a -- ./stress-epoll (stress-epoll program from https://github.com/rouming/test-tools/blob/master/stress-epoll.c) $ perf script stress-epoll 315 [003] 527.674724: rv:error_opid: event preempt_disable not expected in the state preempt_disabled ffffffff9fdfb34f da_event_opid+0x10f ([kernel.kallsyms]) ffffffff9fdfb34f da_event_opid+0x10f ([kernel.kallsyms]) ffffffff9fdfba0d handle_preempt_disable+0x3d ([kernel.kallsyms]) ffffffff9fdd32d0 __traceiter_preempt_disable+0x30 ([kernel.kallsyms]) ffffffff9fdd38fe trace_preempt_off+0x4e ([kernel.kallsyms]) ffffffff9fee6c1c vfs_write+0x12c ([kernel.kallsyms]) ffffffff9fee7128 ksys_write+0x68 ([kernel.kallsyms]) ffffffffa0bdbd92 do_syscall_64+0xb2 ([kernel.kallsyms]) ffffffff9fa00130 entry_SYSCALL_64_after_hwframe+0x77 ([kernel.kallsyms]) f833f __GI___libc_write+0x4f (/usr/lib/x86_64-linux-gnu/libc.so.6) f833f __GI___libc_write+0x4f (/usr/lib/x86_64-linux-gnu/libc.so.6) 1937 thread_work+0x47 (/root/test-tools/stress-epoll) 891f4 start_thread+0x304 (/usr/lib/x86_64-linux-gnu/libc.so.6) 10989b clone3+0x2b (/usr/lib/x86_64-linux-gnu/libc.so.6) stress-epoll 318 [002] 527.674759: rv:error_opid: event preempt_disable not expected in the state disabled ffffffff9fdfb34f da_event_opid+0x10f ([kernel.kallsyms]) ffffffff9fdfb34f da_event_opid+0x10f ([kernel.kallsyms]) ffffffff9fdfba0d handle_preempt_disable+0x3d ([kernel.kallsyms]) ffffffff9fdd32d0 __traceiter_preempt_disable+0x30 ([kernel.kallsyms]) ffffffff9fdd38fe trace_preempt_off+0x4e ([kernel.kallsyms]) ffffffffa0bec1aa _raw_spin_lock_irq+0x1a ([kernel.kallsyms]) ffffffff9ff4fe73 eventfd_write+0x63 ([kernel.kallsyms]) ffffffff9fee6be5 vfs_write+0xf5 ([kernel.kallsyms]) ffffffff9fee7128 ksys_write+0x68 ([kernel.kallsyms]) ffffffffa0bdbd92 do_syscall_64+0xb2 ([kernel.kallsyms]) ffffffff9fa00130 entry_SYSCALL_64_after_hwframe+0x77 ([kernel.kallsyms]) f833f __GI___libc_write+0x4f (/usr/lib/x86_64-linux-gnu/libc.so.6) f833f __GI___libc_write+0x4f (/usr/lib/x86_64-linux-gnu/libc.so.6) 1937 thread_work+0x47 (/root/test-tools/stress-epoll) 891f4 start_thread+0x304 (/usr/lib/x86_64-linux-gnu/libc.so.6) 10989b clone3+0x2b (/usr/lib/x86_64-linux-gnu/libc.so.6) I'm not sure what I'm looking at here. Do you think these are kernel bugs, or the monitor is missing some corner cases? Best regards, Nam
On Tue, 2025-05-27 at 15:37 +0200, Nam Cao wrote: > On Wed, May 14, 2025 at 10:43:14AM +0200, Gabriele Monaco wrote: > > 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. > > This monitor reports some warnings: > > $ perf record -e rv:error_opid --call-graph dwarf -a -- ./stress- > epoll > (stress-epoll program from > https://github.com/rouming/test-tools/blob/master/stress-epoll.c) > Thanks for trying it out, and good to know about this stressor. Unfortunately it's a bit hard to understand from this stack trace, but that's very likely a problem in the model. I have a few ideas where that could be but I believe it's something visible only on a physical machine (haven't tested much on x86 bare metal, only VM). You're running on bare metal right? > $ perf script > stress-epoll 315 [003] 527.674724: rv:error_opid: event > preempt_disable not expected in the state preempt_disabled > ffffffff9fdfb34f da_event_opid+0x10f ([kernel.kallsyms]) > ffffffff9fdfb34f da_event_opid+0x10f ([kernel.kallsyms]) > ffffffff9fdfba0d handle_preempt_disable+0x3d > ([kernel.kallsyms]) > ffffffff9fdd32d0 __traceiter_preempt_disable+0x30 > ([kernel.kallsyms]) > ffffffff9fdd38fe trace_preempt_off+0x4e ([kernel.kallsyms]) > ffffffff9fee6c1c vfs_write+0x12c ([kernel.kallsyms]) > ffffffff9fee7128 ksys_write+0x68 ([kernel.kallsyms]) > ffffffffa0bdbd92 do_syscall_64+0xb2 ([kernel.kallsyms]) > ffffffff9fa00130 entry_SYSCALL_64_after_hwframe+0x77 > ([kernel.kallsyms]) > f833f __GI___libc_write+0x4f (/usr/lib/x86_64- > linux-gnu/libc.so.6) > f833f __GI___libc_write+0x4f (/usr/lib/x86_64- > linux-gnu/libc.so.6) > 1937 thread_work+0x47 (/root/test-tools/stress- > epoll) > 891f4 start_thread+0x304 (/usr/lib/x86_64-linux- > gnu/libc.so.6) > 10989b clone3+0x2b (/usr/lib/x86_64-linux- > gnu/libc.so.6) > > stress-epoll 318 [002] 527.674759: rv:error_opid: event > preempt_disable not expected in the state disabled > ffffffff9fdfb34f da_event_opid+0x10f ([kernel.kallsyms]) > ffffffff9fdfb34f da_event_opid+0x10f ([kernel.kallsyms]) > ffffffff9fdfba0d handle_preempt_disable+0x3d > ([kernel.kallsyms]) > ffffffff9fdd32d0 __traceiter_preempt_disable+0x30 > ([kernel.kallsyms]) > ffffffff9fdd38fe trace_preempt_off+0x4e ([kernel.kallsyms]) > ffffffffa0bec1aa _raw_spin_lock_irq+0x1a ([kernel.kallsyms]) > ffffffff9ff4fe73 eventfd_write+0x63 ([kernel.kallsyms]) > ffffffff9fee6be5 vfs_write+0xf5 ([kernel.kallsyms]) > ffffffff9fee7128 ksys_write+0x68 ([kernel.kallsyms]) > ffffffffa0bdbd92 do_syscall_64+0xb2 ([kernel.kallsyms]) > ffffffff9fa00130 entry_SYSCALL_64_after_hwframe+0x77 > ([kernel.kallsyms]) > f833f __GI___libc_write+0x4f (/usr/lib/x86_64- > linux-gnu/libc.so.6) > f833f __GI___libc_write+0x4f (/usr/lib/x86_64- > linux-gnu/libc.so.6) > 1937 thread_work+0x47 (/root/test-tools/stress- > epoll) > 891f4 start_thread+0x304 (/usr/lib/x86_64-linux- > gnu/libc.so.6) > 10989b clone3+0x2b (/usr/lib/x86_64-linux- > gnu/libc.so.6) > > I'm not sure what I'm looking at here. Do you think these are kernel > bugs, > or the monitor is missing some corner cases? > As said, likely a missing corner case, I believe it has to do with IRQs (which is what makes this monitor more complex than it could be). Thanks for the pointers, I'll try reproduce it this way. Gabriele
On Tue, May 27, 2025 at 04:35:04PM +0200, Gabriele Monaco wrote:
> Thanks for trying it out, and good to know about this stressor.
> Unfortunately it's a bit hard to understand from this stack trace, but
> that's very likely a problem in the model. I have a few ideas where that
> could be but I believe it's something visible only on a physical machine
> (haven't tested much on x86 bare metal, only VM).
>
> You're running on bare metal right?
No, it's QEMU:
qemu-system-x86_64 -enable-kvm -m 2048 -smp 4 \
-nographic \
-drive if=virtio,format=raw,file=bookworm.img \
-kernel /srv/work/namcao/linux/arch/x86/boot/bzImage \
-append "console=ttyS0 root=/dev/vda rw" \
The kernel is just x86 defconfig + the monitors.
Nam
On Tue, 2025-05-27 at 16:50 +0200, Nam Cao wrote: > On Tue, May 27, 2025 at 04:35:04PM +0200, Gabriele Monaco wrote: > > Thanks for trying it out, and good to know about this stressor. > > Unfortunately it's a bit hard to understand from this stack trace, > > but > > that's very likely a problem in the model. I have a few ideas > > where that > > could be but I believe it's something visible only on a physical > > machine > > (haven't tested much on x86 bare metal, only VM). > > > > You're running on bare metal right? > > No, it's QEMU: > > qemu-system-x86_64 -enable-kvm -m 2048 -smp 4 \ > -nographic \ > -drive if=virtio,format=raw,file=bookworm.img \ > -kernel /srv/work/namcao/linux/arch/x86/boot/bzImage \ > -append "console=ttyS0 root=/dev/vda rw" \ > > The kernel is just x86 defconfig + the monitors. > Apparently the error is visible on non-PREEMPT_RT only, the models are designed for preempt-rt and I didn't really test them elsewhere. Not sure if it's worth tailoring them for non RT kernels, but for now I can just mark those monitors as RT-only via Kconfig. Especially this type of monitors is describing very accurately the preemptiveness of some events, I wouldn't be too surprised if some rules don't hold in all preempt configurations. The idea is that, as long as the models stand true, some assumptions about latency can be made, on the long run this type of assumptions is likely different across preemption models. That said, it might be a stupid mistake as well, so I'd look into that more closely ;) Thanks again, Gabriele
© 2016 - 2026 Red Hat, Inc.