[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 2/4] trace: Lock vCPU list when initializing dynamic
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 2/4] trace: Lock vCPU list when initializing dynamic tracing state |
Date: |
Mon, 16 Jan 2017 13:44:53 +0000 |
From: Lluís Vilanova <address@hidden>
Fixes potential corruption when a vCPU is hot-(un)plugged while
initializing the current one.
Signed-off-by: Lluís Vilanova <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
trace/control-target.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/trace/control-target.c b/trace/control-target.c
index 7ebf6e0..e2e138a 100644
--- a/trace/control-target.c
+++ b/trace/control-target.c
@@ -79,7 +79,7 @@ void trace_event_set_vcpu_state_dynamic(CPUState *vcpu,
}
}
-static bool adding_first_cpu(void)
+static bool adding_first_cpu1(void)
{
CPUState *cpu;
size_t count = 0;
@@ -92,6 +92,15 @@ static bool adding_first_cpu(void)
return true;
}
+static bool adding_first_cpu(void)
+{
+ bool res;
+ cpu_list_lock();
+ res = adding_first_cpu1();
+ cpu_list_unlock();
+ return res;
+}
+
void trace_init_vcpu(CPUState *vcpu)
{
TraceEventIter iter;
--
2.9.3