Skip to content

Commit 28a78af

Browse files
glemcorostedt
authored andcommitted
rv: Add da_handle_start_run_event_ to per-task monitors
The RV da_monitor API allows to start monitors in two ways: da_handle_start_event_NAME and da_handle_start_run_event_NAME. The former is used when the event is followed by the initial state of the module, so we ignore the event but we know the monitor is in the initial state and can start monitoring, the latter can be used if the event can only occur in the initial state, so we do handle the event as if the monitor was in the initial state. This latter API is defined for implicit monitors but not per-task ones. Define da_handle_start_run_event_NAME macro also for per-task monitors. Cc: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Tomas Glozar <[email protected]> Cc: Juri Lelli <[email protected]> Cc: Clark Williams <[email protected]> Cc: John Kacur <[email protected]> Link: https://lore.kernel.org/[email protected] Reviewed-by: Nam Cao <[email protected]> Signed-off-by: Gabriele Monaco <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 3cfb9c1 commit 28a78af

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

include/rv/da_monitor.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,30 @@ da_handle_start_event_##name(struct task_struct *tsk, enum events_##name event)
487487
__da_handle_event_##name(da_mon, tsk, event); \
488488
\
489489
return 1; \
490+
} \
491+
\
492+
/* \
493+
* da_handle_start_run_event_##name - start monitoring and handle event \
494+
* \
495+
* This function is used to notify the monitor that the system is in the \
496+
* initial state, so the monitor can start monitoring and handling event. \
497+
*/ \
498+
static inline bool \
499+
da_handle_start_run_event_##name(struct task_struct *tsk, enum events_##name event) \
500+
{ \
501+
struct da_monitor *da_mon; \
502+
\
503+
if (!da_monitor_enabled_##name()) \
504+
return 0; \
505+
\
506+
da_mon = da_get_monitor_##name(tsk); \
507+
\
508+
if (unlikely(!da_monitoring_##name(da_mon))) \
509+
da_monitor_start_##name(da_mon); \
510+
\
511+
__da_handle_event_##name(da_mon, tsk, event); \
512+
\
513+
return 1; \
490514
}
491515

492516
/*

0 commit comments

Comments
 (0)