Skip to contentSkip to conversation

Reset per-task monitors also for idle tasks

PATCH New Gabriele Monaco 1 participant 1 message Jan 15, 2025

Subsystems (2)
lore
Share & tools
lore

Gabriele Monaco

author maintainer
#0 lore raw

PATCH 1/1 Reset per-task monitors also for idle tasks

RV per-task monitors are implemented through a monitor structure available for each task_struct. This structure is reset every time the monitor is (re-)started, to avoid inconsistencies if the monitor was activated previously.
To do so, we reset the monitor on all threads using the macro for_each_process_thread. However, this macro excludes the idle tasks on each CPU. Idle tasks could be considered tasks on their own right and it should be up to the model whether to ignore them or not.

Reset monitors also on the idle tasks for each present CPU whenever we reset all per-task monitors.

Fixes 792575348ff7 ("rv/include: Add deterministic automata monitor definition via C macros")
---
 include/rv/da_monitor.h | 4 ++++
 1 file changed, 4 insertions(+)
include/rv/da_monitor.h +4 -0
index 9705b2a98e49e..510c88bfabd43 100644
@@ -14,6 +14,7 @@
 #include <rv/automata.h>
 #include <linux/rv.h>
 #include <linux/bug.h>
+#include <linux/sched.h>
 
 #ifdef CONFIG_RV_REACTORS
 
@@ -324,10 +325,13 @@ static inline struct da_monitor *da_get_monitor_##name(struct task_struct *tsk)
 static void da_monitor_reset_all_##name(void)							\
 {												\
 	struct task_struct *g, *p;								\
+	int cpu;										\
 												\
 	read_lock(&tasklist_lock);								\
 	for_each_process_thread(g, p)								\
 		da_monitor_reset_##name(da_get_monitor_##name(p));				\
+	for_each_present_cpu(cpu)								\
+		da_monitor_reset_##name(da_get_monitor_##name(idle_task(cpu)));			\
 	read_unlock(&tasklist_lock);								\
 }												\
 												\

base-commit: 619f0b6fad524f08d493a98d55bac9ab8895e3a6

Signature · 1 line
2.47.1