qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC PATCH] cpus: Don't kick un-inited cpus.


From: Peter Crosthwaite
Subject: [Qemu-devel] [RFC PATCH] cpus: Don't kick un-inited cpus.
Date: Wed, 18 Mar 2015 05:53:52 -0700

following a464982499b2f637f6699e3d03e0a9d2e0b5288b, it's now possible for
there to be attempts to take the BQL before CPUs have been realized in
cases where a machine model inits peripherals before the first CPU.

BQL lock aquisition kicks the first_cpu, leading to a segfault if this
happens pre-realize. Guard the CPU kick routine to perform no action for
a CPU that doesn't exist or doesn't have a thread yet.

Signed-off-by: Peter Crosthwaite <address@hidden>
---
 cpus.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cpus.c b/cpus.c
index 1ce90a1..c90dfa8 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1046,6 +1046,10 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
 
 static void qemu_cpu_kick_thread(CPUState *cpu)
 {
+    if (!cpu || !cpu->thread) {
+        return;
+    }
+
 #ifndef _WIN32
     int err;
 
-- 
2.3.1.2.g90df61e.dirty




reply via email to

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