On 6/6/25 17:44, Philippe Mathieu-Daudé wrote:
As an optimization, avoid kicking stopped vCPUs.

Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
  system/cpus.c | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/system/cpus.c b/system/cpus.c
index d16b0dff989..4835e5ced48 100644
--- a/system/cpus.c
+++ b/system/cpus.c
@@ -494,6 +494,11 @@ void cpus_kick_thread(CPUState *cpu)
  void qemu_cpu_kick(CPUState *cpu)
  {
      qemu_cond_broadcast(cpu->halt_cond);
+
+    if (!cpu_can_run(cpu)) {
+        return;
+    }
+

This would appear to be a race condition. The evaluation of cpu_can_run should be done within the context of 'cpu', not here, and not *after* we've already woken 'cpu' via the broadcast.


r~



Reply via email to