aboutsummaryrefslogtreecommitdiff
path: root/trace
diff options
context:
space:
mode:
authorJamie Iles <quic_jiles@quicinc.com>2023-04-27 03:09:24 +0100
committerRichard Henderson <richard.henderson@linaro.org>2023-05-11 09:53:41 +0100
commit370ed600296982a0248b091915c8e8893508d8a3 (patch)
tree62fb415ac26083490ed6fe112ffe904662211e5d /trace
parenteb0153efa6fa58b2c9d891b17766dbedc10e31b5 (diff)
cpu: expose qemu_cpu_list_lock for lock-guard use
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 <quic_jiles@quicinc.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230427020925.51003-2-quic_jiles@quicinc.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'trace')
-rw-r--r--trace/control-target.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/trace/control-target.c b/trace/control-target.c
index 232c97a4a1..c0c1e2310a 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)