Re: [PATCH v2 5/9] tracing/osnoise: start_kthread: Always check OSN_WORKLOAD
flat view
From: sashiko-bot@kernel.org
Date: 2026-10-10 02:34:25
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] tracing/osnoise: WARN_ON triggered on restart with NO_OSNOISE_WORKLOAD -- commit 0c861cff53ad6b5caf50d13aaff67f66512d0646 Author: Crystal Wood [off-list ref] tracing/osnoise: start_kthread: Always check OSN_WORKLOAD This commit modifies start_kthread() to check OSN_WORKLOAD up front and return early if it is not set, instead of only checking it inside the non-timerlat branch.
quoted hunk ↗ jump to hunk
diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c --- a/kernel/trace/trace_osnoise.c +++ b/kernel/trace/trace_osnoise.c@@ -2077,16 +2077,17 @@ static int start_kthread(unsigned int cpu) if (osn->kthread) goto out; + /* Can still happen with timerlat via cpu hotplug */ + if (!test_bit(OSN_WORKLOAD, &osnoise_options)) { + if (!timerlat_enabled()) + osn->sampling = true; + goto out;
[Severity: Medium]
If OSN_WORKLOAD is not set, this code sets osn->sampling to true and
returns without creating a kthread. Later, when the tracer is stopped,
stop_kthread() does nothing because osn_var->kthread is NULL:
stop_kthread() {
...
} else if (osn_var->kthread) {
...
osn_reset_cpu(cpu);
}
}
Because osn_reset_cpu() is skipped, the sampling state is leaked. When the
tracer is subsequently restarted, osn_var_reset() checks the state and
triggers a kernel warning:
osn_var_reset() {
...
WARN_ON(osn->sampling);
...
}
Could this leave a stale sampling state that persists across tracer
stop/start, triggering a WARN_ON in osn_var_reset() and breaking the
restartability of the tracer without a workload?
quoted hunk ↗ jump to hunk
+ } + if (timerlat_enabled()) { snprintf(comm, 24, "timerlat/%d", cpu); main = timerlat_main; } else {
-- Sashiko AI review · https://sashiko.dev/#/patchset/20261010022338.2507589-1-crwood@redhat.com?part=5