qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH 02/19] system/cpus: Only kick running vCPUs


From: Philippe Mathieu-Daudé
Subject: [RFC PATCH 02/19] system/cpus: Only kick running vCPUs
Date: Fri, 6 Jun 2025 18:44:01 +0200

As an optimization, avoid kicking stopped vCPUs.

Signed-off-by: Philippe Mathieu-Daudé <philmd@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;
+    }
+
     if (cpus_accel->kick_vcpu_thread) {
         cpus_accel->kick_vcpu_thread(cpu);
     } else { /* default */
-- 
2.49.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]