From 370ed600296982a0248b091915c8e8893508d8a3 Mon Sep 17 00:00:00 2001 From: Jamie Iles Date: Thu, 27 Apr 2023 03:09:24 +0100 Subject: cpu: expose qemu_cpu_list_lock for lock-guard use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Expose qemu_cpu_list_lock globally so that we can use WITH_QEMU_LOCK_GUARD and QEMU_LOCK_GUARD to simplify a few code paths now and in future. Signed-off-by: Jamie Iles Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20230427020925.51003-2-quic_jiles@quicinc.com> Signed-off-by: Richard Henderson --- trace/control-target.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'trace') diff --git a/trace/control-target.c b/trace/control-target.c index 232c97a..c0c1e23 100644 --- a/trace/control-target.c +++ b/trace/control-target.c @@ -8,6 +8,7 @@ */ #include "qemu/osdep.h" +#include "qemu/lockable.h" #include "cpu.h" #include "trace/trace-root.h" #include "trace/control.h" @@ -116,11 +117,9 @@ static bool adding_first_cpu1(void) static bool adding_first_cpu(void) { - bool res; - cpu_list_lock(); - res = adding_first_cpu1(); - cpu_list_unlock(); - return res; + QEMU_LOCK_GUARD(&qemu_cpu_list_lock); + + return adding_first_cpu1(); } void trace_init_vcpu(CPUState *vcpu) -- cgit v1.1