Skip to content

Commit 531b50e

Browse files
committed
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>
1 parent e4a1e41 commit 531b50e

2 files changed

Lines changed: 13 additions & 18 deletions

File tree

tools/verification/rvgen/rvgen/dot2k.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def fill_tracepoint_handlers_skel(self):
3838
handle = "handle_start_run_event"
3939
if self.monitor_type == "per_task":
4040
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));
4242
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));
4444
buff.append("}")
4545
buff.append("")
4646
return '\n'.join(buff)
@@ -66,6 +66,8 @@ def fill_model_h_header(self):
6666
buff.append(" * Documentation/trace/rv/deterministic_automata.rst")
6767
buff.append(" */")
6868
buff.append("")
69+
buff.append("#define MONITOR_NAME %s" % (self.name))
70+
buff.append("")
6971

7072
return buff
7173

tools/verification/rvgen/rvgen/templates/dot2k/main.c

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <linux/init.h>
77
#include <linux/rv.h>
88
#include <rv/instrumentation.h>
9-
#include <rv/da_monitor.h>
109

1110
#define MODULE_NAME "%%MODEL_NAME%%"
1211

@@ -20,15 +19,9 @@
2019
* This is the self-generated part of the monitor. Generally, there is no need
2120
* to touch this section.
2221
*/
22+
#define RV_MON_TYPE RV_MON_%%MONITOR_TYPE%%
2323
#include "%%MODEL_NAME%%.h"
24-
25-
/*
26-
* Declare the deterministic automata monitor.
27-
*
28-
* The rv monitor reference is needed for the monitor declaration.
29-
*/
30-
static struct rv_monitor rv_%%MODEL_NAME%%;
31-
DECLARE_DA_MON_%%MONITOR_TYPE%%(%%MODEL_NAME%%, %%MIN_TYPE%%);
24+
#include <rv/da_monitor.h>
3225

3326
/*
3427
* This is the instrumentation part of the monitor.
@@ -42,7 +35,7 @@ static int enable_%%MODEL_NAME%%(void)
4235
{
4336
int retval;
4437

45-
retval = da_monitor_init_%%MODEL_NAME%%();
38+
retval = da_monitor_init();
4639
if (retval)
4740
return retval;
4841

@@ -53,33 +46,33 @@ static int enable_%%MODEL_NAME%%(void)
5346

5447
static void disable_%%MODEL_NAME%%(void)
5548
{
56-
rv_%%MODEL_NAME%%.enabled = 0;
49+
rv_this.enabled = 0;
5750

5851
%%TRACEPOINT_DETACH%%
5952

60-
da_monitor_destroy_%%MODEL_NAME%%();
53+
da_monitor_destroy();
6154
}
6255

6356
/*
6457
* This is the monitor register section.
6558
*/
66-
static struct rv_monitor rv_%%MODEL_NAME%% = {
59+
static struct rv_monitor rv_this = {
6760
.name = "%%MODEL_NAME%%",
6861
.description = "%%DESCRIPTION%%",
6962
.enable = enable_%%MODEL_NAME%%,
7063
.disable = disable_%%MODEL_NAME%%,
71-
.reset = da_monitor_reset_all_%%MODEL_NAME%%,
64+
.reset = da_monitor_reset_all,
7265
.enabled = 0,
7366
};
7467

7568
static int __init register_%%MODEL_NAME%%(void)
7669
{
77-
return rv_register_monitor(&rv_%%MODEL_NAME%%, %%PARENT%%);
70+
return rv_register_monitor(&rv_this, %%PARENT%%);
7871
}
7972

8073
static void __exit unregister_%%MODEL_NAME%%(void)
8174
{
82-
rv_unregister_monitor(&rv_%%MODEL_NAME%%);
75+
rv_unregister_monitor(&rv_this);
8376
}
8477

8578
module_init(register_%%MODEL_NAME%%);

0 commit comments

Comments
 (0)