Skip to content

Commit 90ab211

Browse files
committed
Merge tag 'trace-rv-v6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull runtime verifier and osnoise fixes from Steven Rostedt: - Reset idle tasks on reset for runtime verifier When the runtime verifier is reset, it resets the task's data that is being monitored. But it only iterates for_each_process() which does not include the idle tasks. As the idle tasks can be monitored, they need to be reset as well. - Fix the enabling and disabling of tracepoints in osnoise If timerlat is enabled and the WORKLOAD flag is not set, then the osnoise tracer will enable the migrate task tracepoint to monitor it for its own workload. The test to enable the tracepoint is done against user space modifiable parameters. On disabling of the tracer, those same parameters are used to determine if the tracepoint should be disabled. The problem is if user space were to modify the parameters after it enables the tracer then it may not disable the tracepoint. Instead, a static variable is used to keep track if the tracepoint was enabled or not. Then when the tracer shuts down, it will use this variable to decide to disable the tracepoint or not, instead of looking at the user space parameters. * tag 'trace-rv-v6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: tracing/osnoise: Fix resetting of tracepoints rv: Reset per-task monitors also for idle tasks
2 parents 5fb4088 + e3ff424 commit 90ab211

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

include/rv/da_monitor.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <rv/automata.h>
1515
#include <linux/rv.h>
1616
#include <linux/bug.h>
17+
#include <linux/sched.h>
1718

1819
#ifdef CONFIG_RV_REACTORS
1920

@@ -324,10 +325,13 @@ static inline struct da_monitor *da_get_monitor_##name(struct task_struct *tsk)
324325
static void da_monitor_reset_all_##name(void) \
325326
{ \
326327
struct task_struct *g, *p; \
328+
int cpu; \
327329
\
328330
read_lock(&tasklist_lock); \
329331
for_each_process_thread(g, p) \
330332
da_monitor_reset_##name(da_get_monitor_##name(p)); \
333+
for_each_present_cpu(cpu) \
334+
da_monitor_reset_##name(da_get_monitor_##name(idle_task(cpu))); \
331335
read_unlock(&tasklist_lock); \
332336
} \
333337
\

kernel/trace/trace_osnoise.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,8 @@ static void trace_sched_migrate_callback(void *data, struct task_struct *p, int
12291229
}
12301230
}
12311231

1232+
static bool monitor_enabled;
1233+
12321234
static int register_migration_monitor(void)
12331235
{
12341236
int ret = 0;
@@ -1237,16 +1239,25 @@ static int register_migration_monitor(void)
12371239
* Timerlat thread migration check is only required when running timerlat in user-space.
12381240
* Thus, enable callback only if timerlat is set with no workload.
12391241
*/
1240-
if (timerlat_enabled() && !test_bit(OSN_WORKLOAD, &osnoise_options))
1242+
if (timerlat_enabled() && !test_bit(OSN_WORKLOAD, &osnoise_options)) {
1243+
if (WARN_ON_ONCE(monitor_enabled))
1244+
return 0;
1245+
12411246
ret = register_trace_sched_migrate_task(trace_sched_migrate_callback, NULL);
1247+
if (!ret)
1248+
monitor_enabled = true;
1249+
}
12421250

12431251
return ret;
12441252
}
12451253

12461254
static void unregister_migration_monitor(void)
12471255
{
1248-
if (timerlat_enabled() && !test_bit(OSN_WORKLOAD, &osnoise_options))
1249-
unregister_trace_sched_migrate_task(trace_sched_migrate_callback, NULL);
1256+
if (!monitor_enabled)
1257+
return;
1258+
1259+
unregister_trace_sched_migrate_task(trace_sched_migrate_callback, NULL);
1260+
monitor_enabled = false;
12501261
}
12511262
#else
12521263
static int register_migration_monitor(void)

0 commit comments

Comments
 (0)