]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
verification/rvgen: Adapt dot2k and templates after refactoring da_monitor.h
authorGabriele Monaco <gmonaco@redhat.com>
Wed, 26 Nov 2025 10:42:35 +0000 (11:42 +0100)
committerGabriele Monaco <gmonaco@redhat.com>
Mon, 12 Jan 2026 06:43:50 +0000 (07:43 +0100)
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>
tools/verification/rvgen/rvgen/dot2k.py
tools/verification/rvgen/rvgen/templates/dot2k/main.c

index ed0a3c9011069bdfeb07bb14dceaef9f7be1f904..d618a842fc527609bb1e233d4786f19aaf4bfcb1 100644 (file)
@@ -38,9 +38,9 @@ class dot2k(Monitor, Dot2c):
                 handle = "handle_start_run_event"
             if self.monitor_type == "per_task":
                 buff.append("\tstruct task_struct *p = /* XXX: how do I get p? */;");
-                buff.append("\tda_%s_%s(p, %s%s);" % (handle, self.name, event, self.enum_suffix));
+                buff.append("\tda_%s(p, %s%s);" % (handle, event, self.enum_suffix));
             else:
-                buff.append("\tda_%s_%s(%s%s);" % (handle, self.name, event, self.enum_suffix));
+                buff.append("\tda_%s(%s%s);" % (handle, event, self.enum_suffix));
             buff.append("}")
             buff.append("")
         return '\n'.join(buff)
@@ -66,6 +66,8 @@ class dot2k(Monitor, Dot2c):
         buff.append(" *   Documentation/trace/rv/deterministic_automata.rst")
         buff.append(" */")
         buff.append("")
+        buff.append("#define MONITOR_NAME %s" % (self.name))
+        buff.append("")
 
         return buff
 
index e0fd1134bd8584309fe2b7e441781cea54728406..a14e4f0883db31bdb3238f41b88c3295221e0a79 100644 (file)
@@ -6,7 +6,6 @@
 #include <linux/init.h>
 #include <linux/rv.h>
 #include <rv/instrumentation.h>
-#include <rv/da_monitor.h>
 
 #define MODULE_NAME "%%MODEL_NAME%%"
 
  * This is the self-generated part of the monitor. Generally, there is no need
  * to touch this section.
  */
+#define RV_MON_TYPE RV_MON_%%MONITOR_TYPE%%
 #include "%%MODEL_NAME%%.h"
-
-/*
- * Declare the deterministic automata monitor.
- *
- * The rv monitor reference is needed for the monitor declaration.
- */
-static struct rv_monitor rv_%%MODEL_NAME%%;
-DECLARE_DA_MON_%%MONITOR_TYPE%%(%%MODEL_NAME%%, %%MIN_TYPE%%);
+#include <rv/da_monitor.h>
 
 /*
  * This is the instrumentation part of the monitor.
@@ -42,7 +35,7 @@ static int enable_%%MODEL_NAME%%(void)
 {
        int retval;
 
-       retval = da_monitor_init_%%MODEL_NAME%%();
+       retval = da_monitor_init();
        if (retval)
                return retval;
 
@@ -53,33 +46,33 @@ static int enable_%%MODEL_NAME%%(void)
 
 static void disable_%%MODEL_NAME%%(void)
 {
-       rv_%%MODEL_NAME%%.enabled = 0;
+       rv_this.enabled = 0;
 
 %%TRACEPOINT_DETACH%%
 
-       da_monitor_destroy_%%MODEL_NAME%%();
+       da_monitor_destroy();
 }
 
 /*
  * This is the monitor register section.
  */
-static struct rv_monitor rv_%%MODEL_NAME%% = {
+static struct rv_monitor rv_this = {
        .name = "%%MODEL_NAME%%",
        .description = "%%DESCRIPTION%%",
        .enable = enable_%%MODEL_NAME%%,
        .disable = disable_%%MODEL_NAME%%,
-       .reset = da_monitor_reset_all_%%MODEL_NAME%%,
+       .reset = da_monitor_reset_all,
        .enabled = 0,
 };
 
 static int __init register_%%MODEL_NAME%%(void)
 {
-       return rv_register_monitor(&rv_%%MODEL_NAME%%, %%PARENT%%);
+       return rv_register_monitor(&rv_this, %%PARENT%%);
 }
 
 static void __exit unregister_%%MODEL_NAME%%(void)
 {
-       rv_unregister_monitor(&rv_%%MODEL_NAME%%);
+       rv_unregister_monitor(&rv_this);
 }
 
 module_init(register_%%MODEL_NAME%%);