File tree Expand file tree Collapse file tree 3 files changed +52
-1
lines changed Expand file tree Collapse file tree 3 files changed +52
-1
lines changed Original file line number Diff line number Diff line change @@ -60,3 +60,11 @@ config RV_REACTORS
60
60
on the model's execution. By default, the monitors have
61
61
tracing reactions, printing the monitor output via tracepoints,
62
62
but other reactions can be added (on-demand) via this interface.
63
+
64
+ config RV_REACT_PRINTK
65
+ bool "Printk reactor"
66
+ depends on RV_REACTORS
67
+ default y
68
+ help
69
+ Enables the printk reactor. The printk reactor emits a printk()
70
+ message if an exception is found.
Original file line number Diff line number Diff line change 1
1
# SPDX-License-Identifier: GPL-2.0
2
2
3
3
obj-$(CONFIG_RV) += rv.o
4
- obj-$(CONFIG_RV_REACTORS) += rv_reactors.o
5
4
obj-$(CONFIG_RV_MON_WIP) += monitors/wip/wip.o
6
5
obj-$(CONFIG_RV_MON_WWNR) += monitors/wwnr/wwnr.o
6
+ obj-$(CONFIG_RV_REACTORS) += rv_reactors.o
7
+ obj-$(CONFIG_RV_REACT_PRINTK) += reactor_printk.o
Original file line number Diff line number Diff line change
1
+ // SPDX-License-Identifier: GPL-2.0
2
+ /*
3
+ * Copyright (C) 2019-2022 Red Hat, Inc. Daniel Bristot de Oliveira <[email protected] >
4
+ *
5
+ * Printk RV reactor:
6
+ * Prints the exception msg to the kernel message log.
7
+ */
8
+ #include <linux/ftrace.h>
9
+ #include <linux/tracepoint.h>
10
+ #include <linux/kernel.h>
11
+ #include <linux/module.h>
12
+ #include <linux/init.h>
13
+ #include <linux/rv.h>
14
+
15
+ static void rv_printk_reaction (char * msg )
16
+ {
17
+ printk_deferred (msg );
18
+ }
19
+
20
+ static struct rv_reactor rv_printk = {
21
+ .name = "printk" ,
22
+ .description = "prints the exception msg to the kernel message log." ,
23
+ .react = rv_printk_reaction
24
+ };
25
+
26
+ static int register_react_printk (void )
27
+ {
28
+ rv_register_reactor (& rv_printk );
29
+ return 0 ;
30
+ }
31
+
32
+ static void unregister_react_printk (void )
33
+ {
34
+ rv_unregister_reactor (& rv_printk );
35
+ }
36
+
37
+ module_init (register_react_printk );
38
+ module_exit (unregister_react_printk );
39
+
40
+ MODULE_LICENSE ("GPL" );
41
+ MODULE_AUTHOR ("Daniel Bristot de Oliveira" );
42
+ MODULE_DESCRIPTION ("printk rv reactor: printk if an exception is hit." );
You can’t perform that action at this time.
0 commit comments