forked from mirrors/linux
		
	rv: Simplify manual steps in monitor creation
While creating a new monitor in RV, besides generating code from dot2k, there are a few manual steps which can be tedious and error prone, like adding the tracepoints, makefile lines and kconfig. This patch restructures the existing monitors to keep some files in the monitor's folder itself, which can be automatically generated by future versions of dot2k. Monitors have now their own Kconfig and tracepoint snippets. For simplicity, the main tracepoint definition, is moved to the RV directory, it defines only the tracepoint classes and includes the monitor-specific tracepoints, which reside in the monitor directory. Tracepoints and Kconfig no longer need to be copied and adapted from existing ones but only need to be included in the main files. The Makefile remains untouched since there's little advantage in having a separated Makefile for each monitor with a single line and including it in the main RV Makefile. Cc: Juri Lelli <juri.lelli@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: John Kacur <jkacur@redhat.com> Link: https://lore.kernel.org/20241227144752.362911-6-gmonaco@redhat.com Signed-off-by: Gabriele Monaco <gmonaco@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
This commit is contained in:
		
							parent
							
								
									64b3e5f0d4
								
							
						
					
					
						commit
						bc3d482dcc
					
				
					 10 changed files with 65 additions and 44 deletions
				
			
		|  | @ -25,30 +25,9 @@ menuconfig RV | ||||||
| 	  For further information, see: | 	  For further information, see: | ||||||
| 	    Documentation/trace/rv/runtime-verification.rst | 	    Documentation/trace/rv/runtime-verification.rst | ||||||
| 
 | 
 | ||||||
| config RV_MON_WIP | source "kernel/trace/rv/monitors/wip/Kconfig" | ||||||
| 	depends on RV |  | ||||||
| 	depends on PREEMPT_TRACER |  | ||||||
| 	select DA_MON_EVENTS_IMPLICIT |  | ||||||
| 	bool "wip monitor" |  | ||||||
| 	help |  | ||||||
| 	  Enable wip (wakeup in preemptive) sample monitor that illustrates |  | ||||||
| 	  the usage of per-cpu monitors, and one limitation of the |  | ||||||
| 	  preempt_disable/enable events. |  | ||||||
| 
 | 
 | ||||||
| 	  For further information, see: | source "kernel/trace/rv/monitors/wwnr/Kconfig" | ||||||
| 	    Documentation/trace/rv/monitor_wip.rst |  | ||||||
| 
 |  | ||||||
| config RV_MON_WWNR |  | ||||||
| 	depends on RV |  | ||||||
| 	select DA_MON_EVENTS_ID |  | ||||||
| 	bool "wwnr monitor" |  | ||||||
| 	help |  | ||||||
| 	  Enable wwnr (wakeup while not running) sample monitor, this is a |  | ||||||
| 	  sample monitor that illustrates the usage of per-task monitor. |  | ||||||
| 	  The model is borken on purpose: it serves to test reactors. |  | ||||||
| 
 |  | ||||||
| 	  For further information, see: |  | ||||||
| 	    Documentation/trace/rv/monitor_wwnr.rst |  | ||||||
| 
 | 
 | ||||||
| config RV_REACTORS | config RV_REACTORS | ||||||
| 	bool "Runtime verification reactors" | 	bool "Runtime verification reactors" | ||||||
|  |  | ||||||
|  | @ -1,5 +1,7 @@ | ||||||
| # SPDX-License-Identifier: GPL-2.0
 | # SPDX-License-Identifier: GPL-2.0
 | ||||||
| 
 | 
 | ||||||
|  | ccflags-y += -I $(src)		# needed for trace events | ||||||
|  | 
 | ||||||
| obj-$(CONFIG_RV) += rv.o | obj-$(CONFIG_RV) += rv.o | ||||||
| obj-$(CONFIG_RV_MON_WIP) += monitors/wip/wip.o | obj-$(CONFIG_RV_MON_WIP) += monitors/wip/wip.o | ||||||
| obj-$(CONFIG_RV_MON_WWNR) += monitors/wwnr/wwnr.o | obj-$(CONFIG_RV_MON_WWNR) += monitors/wwnr/wwnr.o | ||||||
|  |  | ||||||
							
								
								
									
										12
									
								
								kernel/trace/rv/monitors/wip/Kconfig
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								kernel/trace/rv/monitors/wip/Kconfig
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | ||||||
|  | config RV_MON_WIP | ||||||
|  | 	depends on RV | ||||||
|  | 	depends on PREEMPT_TRACER | ||||||
|  | 	select DA_MON_EVENTS_IMPLICIT | ||||||
|  | 	bool "wip monitor" | ||||||
|  | 	help | ||||||
|  | 	  Enable wip (wakeup in preemptive) sample monitor that illustrates | ||||||
|  | 	  the usage of per-cpu monitors, and one limitation of the | ||||||
|  | 	  preempt_disable/enable events. | ||||||
|  | 
 | ||||||
|  | 	  For further information, see: | ||||||
|  | 	    Documentation/trace/rv/monitor_wip.rst | ||||||
|  | @ -10,7 +10,7 @@ | ||||||
| 
 | 
 | ||||||
| #define MODULE_NAME "wip" | #define MODULE_NAME "wip" | ||||||
| 
 | 
 | ||||||
| #include <trace/events/rv.h> | #include <rv_trace.h> | ||||||
| #include <trace/events/sched.h> | #include <trace/events/sched.h> | ||||||
| #include <trace/events/preemptirq.h> | #include <trace/events/preemptirq.h> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										15
									
								
								kernel/trace/rv/monitors/wip/wip_trace.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								kernel/trace/rv/monitors/wip/wip_trace.h
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | ||||||
|  | /* SPDX-License-Identifier: GPL-2.0 */ | ||||||
|  | 
 | ||||||
|  | /*
 | ||||||
|  |  * Snippet to be included in rv_trace.h | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #ifdef CONFIG_RV_MON_WIP | ||||||
|  | DEFINE_EVENT(event_da_monitor, event_wip, | ||||||
|  | 	     TP_PROTO(char *state, char *event, char *next_state, bool final_state), | ||||||
|  | 	     TP_ARGS(state, event, next_state, final_state)); | ||||||
|  | 
 | ||||||
|  | DEFINE_EVENT(error_da_monitor, error_wip, | ||||||
|  | 	     TP_PROTO(char *state, char *event), | ||||||
|  | 	     TP_ARGS(state, event)); | ||||||
|  | #endif /* CONFIG_RV_MON_WIP */ | ||||||
							
								
								
									
										11
									
								
								kernel/trace/rv/monitors/wwnr/Kconfig
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								kernel/trace/rv/monitors/wwnr/Kconfig
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | config RV_MON_WWNR | ||||||
|  | 	depends on RV | ||||||
|  | 	select DA_MON_EVENTS_ID | ||||||
|  | 	bool "wwnr monitor" | ||||||
|  | 	help | ||||||
|  | 	  Enable wwnr (wakeup while not running) sample monitor, this is a | ||||||
|  | 	  sample monitor that illustrates the usage of per-task monitor. | ||||||
|  | 	  The model is borken on purpose: it serves to test reactors. | ||||||
|  | 
 | ||||||
|  | 	  For further information, see: | ||||||
|  | 	    Documentation/trace/rv/monitor_wwnr.rst | ||||||
|  | @ -10,7 +10,7 @@ | ||||||
| 
 | 
 | ||||||
| #define MODULE_NAME "wwnr" | #define MODULE_NAME "wwnr" | ||||||
| 
 | 
 | ||||||
| #include <trace/events/rv.h> | #include <rv_trace.h> | ||||||
| #include <trace/events/sched.h> | #include <trace/events/sched.h> | ||||||
| 
 | 
 | ||||||
| #include "wwnr.h" | #include "wwnr.h" | ||||||
|  |  | ||||||
							
								
								
									
										16
									
								
								kernel/trace/rv/monitors/wwnr/wwnr_trace.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								kernel/trace/rv/monitors/wwnr/wwnr_trace.h
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | ||||||
|  | /* SPDX-License-Identifier: GPL-2.0 */ | ||||||
|  | 
 | ||||||
|  | /*
 | ||||||
|  |  * Snippet to be included in rv_trace.h | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #ifdef CONFIG_RV_MON_WWNR | ||||||
|  | /* id is the pid of the task */ | ||||||
|  | DEFINE_EVENT(event_da_monitor_id, event_wwnr, | ||||||
|  | 	     TP_PROTO(int id, char *state, char *event, char *next_state, bool final_state), | ||||||
|  | 	     TP_ARGS(id, state, event, next_state, final_state)); | ||||||
|  | 
 | ||||||
|  | DEFINE_EVENT(error_da_monitor_id, error_wwnr, | ||||||
|  | 	     TP_PROTO(int id, char *state, char *event), | ||||||
|  | 	     TP_ARGS(id, state, event)); | ||||||
|  | #endif /* CONFIG_RV_MON_WWNR */ | ||||||
|  | @ -145,7 +145,7 @@ | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DA_MON_EVENTS | #ifdef CONFIG_DA_MON_EVENTS | ||||||
| #define CREATE_TRACE_POINTS | #define CREATE_TRACE_POINTS | ||||||
| #include <trace/events/rv.h> | #include <rv_trace.h> | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #include "rv.h" | #include "rv.h" | ||||||
|  |  | ||||||
|  | @ -57,15 +57,8 @@ DECLARE_EVENT_CLASS(error_da_monitor, | ||||||
| 		__entry->state) | 		__entry->state) | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_RV_MON_WIP | #include <monitors/wip/wip_trace.h> | ||||||
| DEFINE_EVENT(event_da_monitor, event_wip, |  | ||||||
| 	    TP_PROTO(char *state, char *event, char *next_state, bool final_state), |  | ||||||
| 	    TP_ARGS(state, event, next_state, final_state)); |  | ||||||
| 
 | 
 | ||||||
| DEFINE_EVENT(error_da_monitor, error_wip, |  | ||||||
| 	     TP_PROTO(char *state, char *event), |  | ||||||
| 	     TP_ARGS(state, event)); |  | ||||||
| #endif /* CONFIG_RV_MON_WIP */ |  | ||||||
| #endif /* CONFIG_DA_MON_EVENTS_IMPLICIT */ | #endif /* CONFIG_DA_MON_EVENTS_IMPLICIT */ | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DA_MON_EVENTS_ID | #ifdef CONFIG_DA_MON_EVENTS_ID | ||||||
|  | @ -123,20 +116,13 @@ DECLARE_EVENT_CLASS(error_da_monitor_id, | ||||||
| 		__entry->state) | 		__entry->state) | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_RV_MON_WWNR | #include <monitors/wwnr/wwnr_trace.h> | ||||||
| /* id is the pid of the task */ |  | ||||||
| DEFINE_EVENT(event_da_monitor_id, event_wwnr, |  | ||||||
| 	     TP_PROTO(int id, char *state, char *event, char *next_state, bool final_state), |  | ||||||
| 	     TP_ARGS(id, state, event, next_state, final_state)); |  | ||||||
| 
 |  | ||||||
| DEFINE_EVENT(error_da_monitor_id, error_wwnr, |  | ||||||
| 	     TP_PROTO(int id, char *state, char *event), |  | ||||||
| 	     TP_ARGS(id, state, event)); |  | ||||||
| #endif /* CONFIG_RV_MON_WWNR */ |  | ||||||
| 
 | 
 | ||||||
| #endif /* CONFIG_DA_MON_EVENTS_ID */ | #endif /* CONFIG_DA_MON_EVENTS_ID */ | ||||||
| #endif /* _TRACE_RV_H */ | #endif /* _TRACE_RV_H */ | ||||||
| 
 | 
 | ||||||
| /* This part ust be outside protection */ | /* This part ust be outside protection */ | ||||||
| #undef TRACE_INCLUDE_PATH | #undef TRACE_INCLUDE_PATH | ||||||
|  | #define TRACE_INCLUDE_PATH . | ||||||
|  | #define TRACE_INCLUDE_FILE rv_trace | ||||||
| #include <trace/define_trace.h> | #include <trace/define_trace.h> | ||||||
		Loading…
	
		Reference in a new issue
	
	 Gabriele Monaco
						Gabriele Monaco