From 7ed514fbe404a07d773ad7b335b83251839595e3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Fri, 22 Aug 2025 13:42:41 +0200 Subject: [PATCH] cpus: Access CPUState::thread_kicked atomically MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit cpus_kick_thread() is called via cpu_exit() -> qemu_cpu_kick(), and also via gdb_syscall_handling(). Access the CPUState field using atomic accesses. See commit 8ac2ca02744 ("accel: use atomic accesses for exit_request") for rationale. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Message-Id: <20250925025520.71805-3-philmd@linaro.org> --- system/cpus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/cpus.c b/system/cpus.c index aa7bfcf56e..74f5a5bd4e 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -480,10 +480,10 @@ void qemu_process_cpu_events(CPUState *cpu) void cpus_kick_thread(CPUState *cpu) { - if (cpu->thread_kicked) { + if (qatomic_read(&cpu->thread_kicked)) { return; } - cpu->thread_kicked = true; + qatomic_set(&cpu->thread_kicked, true); #ifndef _WIN32 int err = pthread_kill(cpu->thread->thread, SIG_IPI); -- 2.47.3