From 6d60f89691fc979e55b88508f4cfa8f6b4c56eac Mon Sep 17 00:00:00 2001 From: Daniel Bristot de Oliveira Date: Fri, 11 Nov 2022 16:53:06 +0100 Subject: tools/rv: Add in-kernel monitor interface Add the ability to control and trace in-kernel monitors. This is a generic interface, it will check for existing monitors and enable standard setup, like enabling reactors. For example: # rv list wip wakeup in preemptive per-cpu testing monitor. [OFF] wwnr wakeup while not running per-task testing model. [OFF] # rv mon wwnr --help rv version 6.1.0-rc4: help usage: rv mon wwnr [-h] [-q] [-r reactor] [-s] [-v] -h/--help: print this menu and the reactor list -r/--reactor 'reactor': enables the 'reactor' -s/--self: when tracing (-t), also trace rv command -t/--trace: trace monitor's event -v/--verbose: print debug messages available reactors: nop printk panic # rv mon wwnr --trace -PID [CPU] TYPE ID STATE x EVENT -> NEXT_STATE FINAL | | | | | | | | | rv-3613 [001] event 3613 running x switch_out -> not_running Y sshd-1248 [005] event 1248 running x switch_out -> not_running Y -0 [005] event 71 not_running x wakeup -> not_running Y -0 [005] event 71 not_running x switch_in -> running N kcompactd0-71 [005] event 71 running x switch_out -> not_running Y -0 [000] event 860 not_running x wakeup -> not_running Y -0 [000] event 860 not_running x switch_in -> running N systemd-oomd-860 [000] event 860 running x switch_out -> not_running Y -0 [000] event 860 not_running x wakeup -> not_running Y -0 [000] event 860 not_running x switch_in -> running N systemd-oomd-860 [000] event 860 running x switch_out -> not_running Y -0 [005] event 71 not_running x wakeup -> not_running Y -0 [005] event 71 not_running x switch_in -> running N kcompactd0-71 [005] event 71 running x switch_out -> not_running Y -0 [000] event 860 not_running x wakeup -> not_running Y -0 [000] event 860 not_running x switch_in -> running N systemd-oomd-860 [000] event 860 running x switch_out -> not_running Y -0 [001] event 3613 not_running x wakeup -> not_running Y Link: https://lkml.kernel.org/r/1e57547e3acadda6e23949b2672c89e76ec2ec42.1668180100.git.bristot@kernel.org Cc: Jonathan Corbet Signed-off-by: Daniel Bristot de Oliveira Signed-off-by: Steven Rostedt (Google) --- tools/verification/rv/src/rv.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools/verification/rv/src/rv.c') diff --git a/tools/verification/rv/src/rv.c b/tools/verification/rv/src/rv.c index a9ea1c891ce0..e601cd9c411e 100644 --- a/tools/verification/rv/src/rv.c +++ b/tools/verification/rv/src/rv.c @@ -12,6 +12,7 @@ #include #include +#include static int stop_session; @@ -63,6 +64,7 @@ static void rv_list(int argc, char **argv) exit(1); } + ikm_list_monitors(); exit(0); } @@ -109,6 +111,7 @@ static void rv_mon(int argc, char **argv) * Call all possible monitor implementations, looking * for the [monitor]. */ + run += ikm_run_monitor(monitor_name, argc-1, &argv[1]); if (!run) err_msg("rv: monitor %s does not exist\n", monitor_name); -- cgit v1.2.3