[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 05/13] accel/tcg: Init TCG cflags in vCPU thread handler
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v4 05/13] accel/tcg: Init TCG cflags in vCPU thread handler |
Date: |
Wed, 23 Mar 2022 18:17:43 +0100 |
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
Move TCG cflags initialization to thread handler.
Remove the duplicated assert checks.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
accel/tcg/tcg-accel-ops-mttcg.c | 5 ++---
accel/tcg/tcg-accel-ops-rr.c | 7 +++----
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/accel/tcg/tcg-accel-ops-mttcg.c b/accel/tcg/tcg-accel-ops-mttcg.c
index ea2b741deb..80609964a6 100644
--- a/accel/tcg/tcg-accel-ops-mttcg.c
+++ b/accel/tcg/tcg-accel-ops-mttcg.c
@@ -71,6 +71,8 @@ static void *mttcg_cpu_thread_fn(void *arg)
assert(tcg_enabled());
g_assert(!icount_enabled());
+ tcg_cpu_init_cflags(cpu, current_machine->smp.max_cpus > 1);
+
rcu_register_thread();
force_rcu.notifier.notify = mttcg_force_rcu;
force_rcu.cpu = cpu;
@@ -140,9 +142,6 @@ void mttcg_start_vcpu_thread(CPUState *cpu)
{
char thread_name[VCPU_THREAD_NAME_SIZE];
- g_assert(tcg_enabled());
- tcg_cpu_init_cflags(cpu, current_machine->smp.max_cpus > 1);
-
cpu->thread = g_new0(QemuThread, 1);
cpu->halt_cond = g_malloc0(sizeof(QemuCond));
qemu_cond_init(cpu->halt_cond);
diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c
index b287110766..de8af32af7 100644
--- a/accel/tcg/tcg-accel-ops-rr.c
+++ b/accel/tcg/tcg-accel-ops-rr.c
@@ -153,7 +153,9 @@ static void *rr_cpu_thread_fn(void *arg)
Notifier force_rcu;
CPUState *cpu = arg;
- assert(tcg_enabled());
+ g_assert(tcg_enabled());
+ tcg_cpu_init_cflags(cpu, false);
+
rcu_register_thread();
force_rcu.notify = rr_force_rcu;
rcu_add_force_rcu_notifier(&force_rcu);
@@ -276,9 +278,6 @@ void rr_start_vcpu_thread(CPUState *cpu)
static QemuCond *single_tcg_halt_cond;
static QemuThread *single_tcg_cpu_thread;
- g_assert(tcg_enabled());
- tcg_cpu_init_cflags(cpu, false);
-
if (!single_tcg_cpu_thread) {
cpu->thread = g_new0(QemuThread, 1);
cpu->halt_cond = g_new0(QemuCond, 1);
--
2.35.1
- [PATCH v4 00/13] accel: Fix vCPU memory leaks, Philippe Mathieu-Daudé, 2022/03/23
- [PATCH v4 01/13] cpu: Free cpu->cpu_ases in cpu_address_space_destroy(), Philippe Mathieu-Daudé, 2022/03/23
- [PATCH v4 02/13] target/i386/kvm: Free xsave_buf when destroying vCPU, Philippe Mathieu-Daudé, 2022/03/23
- [PATCH v4 03/13] target/i386/hvf: Free resources when vCPU is destroyed, Philippe Mathieu-Daudé, 2022/03/23
- [PATCH v4 04/13] accel/hvf: Remove pointless assertion, Philippe Mathieu-Daudé, 2022/03/23
- [PATCH v4 05/13] accel/tcg: Init TCG cflags in vCPU thread handler,
Philippe Mathieu-Daudé <=
- [PATCH v4 06/13] accel/tcg: Reorganize tcg_accel_ops_init(), Philippe Mathieu-Daudé, 2022/03/23
- [PATCH v4 07/13] accel-ops: Introduce create_vcpu_thread_precheck / postcheck handlers, Philippe Mathieu-Daudé, 2022/03/23
- [PATCH v4 08/13] accel/tcg: Extract rr_create_vcpu_thread_precheck(), Philippe Mathieu-Daudé, 2022/03/23
- [PATCH v4 09/13] accel/all: Extract common_vcpu_thread_create(), Philippe Mathieu-Daudé, 2022/03/23
- [PATCH v4 10/13] accel-ops: Introduce common_vcpu_thread_destroy() and .precheck handler, Philippe Mathieu-Daudé, 2022/03/23