From d866dbfa78ac8b535d404bab8d88a5d5e0ba142f Mon Sep 17 00:00:00 2001 From: Adrian Bonislawski Date: Mon, 22 Sep 2025 11:09:56 +0200 Subject: [PATCH] audio: base_fw: fix race condition in perf counters reset operation Change the order of operations in the performance measurement initialization sequence to avoid a race condition. Previously, the performance counters were reset before setting the state to STOPPED, which created a window where an LL task could preempt the execution and record new measurements between these operations. Signed-off-by: Adrian Bonislawski --- src/audio/base_fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/base_fw.c b/src/audio/base_fw.c index f808ee4cff8f..ed7f131d04e4 100644 --- a/src/audio/base_fw.c +++ b/src/audio/base_fw.c @@ -439,8 +439,8 @@ __cold int set_perf_meas_state(const char *data) break; case IPC4_PERF_MEASUREMENTS_STOPPED: enable_performance_counters(); - reset_performance_counters(); perf_meas_set_state(IPC4_PERF_MEASUREMENTS_STOPPED); + reset_performance_counters(); break; case IPC4_PERF_MEASUREMENTS_STARTED: enable_performance_counters();