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.

verification/rvgen: Adapt dot2k and templates after refactoring da_monitor.h

Previous changes refactored the da_monitor header file to avoid using
macros. This implies a few changes in how to import and use da_monitor
helpers:

DECLARE_DA_MON_<TYPE>(name, type) is substituted by
#define RV_MON_TYPE RV_MON_<TYPE>

Update the rvgen templates to reflect the changes.

Reviewed-by: Nam Cao <namcao@linutronix.de>
Link: https://lore.kernel.org/r/20251126104241.291258-5-gmonaco@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>

+13 -18
+4 -2
tools/verification/rvgen/rvgen/dot2k.py
··· 38 38 handle = "handle_start_run_event" 39 39 if self.monitor_type == "per_task": 40 40 buff.append("\tstruct task_struct *p = /* XXX: how do I get p? */;"); 41 - buff.append("\tda_%s_%s(p, %s%s);" % (handle, self.name, event, self.enum_suffix)); 41 + buff.append("\tda_%s(p, %s%s);" % (handle, event, self.enum_suffix)); 42 42 else: 43 - buff.append("\tda_%s_%s(%s%s);" % (handle, self.name, event, self.enum_suffix)); 43 + buff.append("\tda_%s(%s%s);" % (handle, event, self.enum_suffix)); 44 44 buff.append("}") 45 45 buff.append("") 46 46 return '\n'.join(buff) ··· 65 65 buff.append(" * For further information about this format, see kernel documentation:") 66 66 buff.append(" * Documentation/trace/rv/deterministic_automata.rst") 67 67 buff.append(" */") 68 + buff.append("") 69 + buff.append("#define MONITOR_NAME %s" % (self.name)) 68 70 buff.append("") 69 71 70 72 return buff
+9 -16
tools/verification/rvgen/rvgen/templates/dot2k/main.c
··· 6 6 #include <linux/init.h> 7 7 #include <linux/rv.h> 8 8 #include <rv/instrumentation.h> 9 - #include <rv/da_monitor.h> 10 9 11 10 #define MODULE_NAME "%%MODEL_NAME%%" 12 11 ··· 19 20 * This is the self-generated part of the monitor. Generally, there is no need 20 21 * to touch this section. 21 22 */ 23 + #define RV_MON_TYPE RV_MON_%%MONITOR_TYPE%% 22 24 #include "%%MODEL_NAME%%.h" 23 - 24 - /* 25 - * Declare the deterministic automata monitor. 26 - * 27 - * The rv monitor reference is needed for the monitor declaration. 28 - */ 29 - static struct rv_monitor rv_%%MODEL_NAME%%; 30 - DECLARE_DA_MON_%%MONITOR_TYPE%%(%%MODEL_NAME%%, %%MIN_TYPE%%); 25 + #include <rv/da_monitor.h> 31 26 32 27 /* 33 28 * This is the instrumentation part of the monitor. ··· 35 42 { 36 43 int retval; 37 44 38 - retval = da_monitor_init_%%MODEL_NAME%%(); 45 + retval = da_monitor_init(); 39 46 if (retval) 40 47 return retval; 41 48 ··· 46 53 47 54 static void disable_%%MODEL_NAME%%(void) 48 55 { 49 - rv_%%MODEL_NAME%%.enabled = 0; 56 + rv_this.enabled = 0; 50 57 51 58 %%TRACEPOINT_DETACH%% 52 59 53 - da_monitor_destroy_%%MODEL_NAME%%(); 60 + da_monitor_destroy(); 54 61 } 55 62 56 63 /* 57 64 * This is the monitor register section. 58 65 */ 59 - static struct rv_monitor rv_%%MODEL_NAME%% = { 66 + static struct rv_monitor rv_this = { 60 67 .name = "%%MODEL_NAME%%", 61 68 .description = "%%DESCRIPTION%%", 62 69 .enable = enable_%%MODEL_NAME%%, 63 70 .disable = disable_%%MODEL_NAME%%, 64 - .reset = da_monitor_reset_all_%%MODEL_NAME%%, 71 + .reset = da_monitor_reset_all, 65 72 .enabled = 0, 66 73 }; 67 74 68 75 static int __init register_%%MODEL_NAME%%(void) 69 76 { 70 - return rv_register_monitor(&rv_%%MODEL_NAME%%, %%PARENT%%); 77 + return rv_register_monitor(&rv_this, %%PARENT%%); 71 78 } 72 79 73 80 static void __exit unregister_%%MODEL_NAME%%(void) 74 81 { 75 - rv_unregister_monitor(&rv_%%MODEL_NAME%%); 82 + rv_unregister_monitor(&rv_this); 76 83 } 77 84 78 85 module_init(register_%%MODEL_NAME%%);