From 69d8895cb9a9f6450374577af8584c2e21cb5a9f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Tue, 14 Oct 2025 07:51:58 +0200 Subject: [PATCH] rv: Add explicit lockdep context for reactors MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reactors can be called from any context through tracepoints. When developing reactors care needs to be taken to only call APIs which are safe. As the tracepoints used during testing may not actually be called from restrictive contexts lockdep may not be helpful. Add explicit overrides to help lockdep find invalid code patterns. The usage of LD_WAIT_FREE will trigger lockdep warnings in the panic reactor. These are indeed valid warnings but they are out of scope for RV and will instead be fixed by the printk subsystem. Signed-off-by: Thomas Weißschuh Acked-by: Nam Cao Link: https://lore.kernel.org/r/20251014-rv-lockdep-v1-3-0b9e51919ea8@linutronix.de Signed-off-by: Gabriele Monaco --- kernel/trace/rv/rv_reactors.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/trace/rv/rv_reactors.c b/kernel/trace/rv/rv_reactors.c index 8c02426bc3bd9..d9d335ae9bada 100644 --- a/kernel/trace/rv/rv_reactors.c +++ b/kernel/trace/rv/rv_reactors.c @@ -61,6 +61,7 @@ * printk */ +#include #include #include "rv.h" @@ -480,6 +481,7 @@ out_err: void rv_react(struct rv_monitor *monitor, const char *msg, ...) { + static DEFINE_WAIT_OVERRIDE_MAP(rv_react_map, LD_WAIT_FREE); va_list args; if (!rv_reacting_on() || !monitor->react) @@ -487,7 +489,9 @@ void rv_react(struct rv_monitor *monitor, const char *msg, ...) va_start(args, msg); + lock_map_acquire_try(&rv_react_map); monitor->react(msg, args); + lock_map_release(&rv_react_map); va_end(args); } -- 2.47.3