Skip to content

Commit 69d8895

Browse files
t-8chglemco
authored andcommitted
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>
1 parent 68f63ce commit 69d8895

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

kernel/trace/rv/rv_reactors.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
* printk
6262
*/
6363

64+
#include <linux/lockdep.h>
6465
#include <linux/slab.h>
6566

6667
#include "rv.h"
@@ -480,14 +481,17 @@ int init_rv_reactors(struct dentry *root_dir)
480481

481482
void rv_react(struct rv_monitor *monitor, const char *msg, ...)
482483
{
484+
static DEFINE_WAIT_OVERRIDE_MAP(rv_react_map, LD_WAIT_FREE);
483485
va_list args;
484486

485487
if (!rv_reacting_on() || !monitor->react)
486488
return;
487489

488490
va_start(args, msg);
489491

492+
lock_map_acquire_try(&rv_react_map);
490493
monitor->react(msg, args);
494+
lock_map_release(&rv_react_map);
491495

492496
va_end(args);
493497
}

0 commit comments

Comments
 (0)