Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rv: Add explicit lockdep context for reactors

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 <thomas.weissschuh@linutronix.de>
Acked-by: Nam Cao <namcao@linutronix.de>
Link: https://lore.kernel.org/r/20251014-rv-lockdep-v1-3-0b9e51919ea8@linutronix.de
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>

authored by

Thomas Weißschuh and committed by
Gabriele Monaco
69d8895c 68f63cea

+4
+4
kernel/trace/rv/rv_reactors.c
··· 61 61 * printk 62 62 */ 63 63 64 + #include <linux/lockdep.h> 64 65 #include <linux/slab.h> 65 66 66 67 #include "rv.h" ··· 481 480 482 481 void rv_react(struct rv_monitor *monitor, const char *msg, ...) 483 482 { 483 + static DEFINE_WAIT_OVERRIDE_MAP(rv_react_map, LD_WAIT_FREE); 484 484 va_list args; 485 485 486 486 if (!rv_reacting_on() || !monitor->react) ··· 489 487 490 488 va_start(args, msg); 491 489 490 + lock_map_acquire_try(&rv_react_map); 492 491 monitor->react(msg, args); 492 + lock_map_release(&rv_react_map); 493 493 494 494 va_end(args); 495 495 }