diff options
author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2023-04-05 09:15:26 +0200 |
---|---|---|
committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2023-06-28 13:55:35 +0200 |
commit | 83d0f7f95cc88bbf31ba000d1d2f05e8563f9d97 (patch) | |
tree | b2a44bf9807c44607e124008803b354ad101310f | |
parent | 43477340c38c7980d4f4d5bfedf1bd0146ccb577 (diff) | |
download | qemu-83d0f7f95cc88bbf31ba000d1d2f05e8563f9d97.zip qemu-83d0f7f95cc88bbf31ba000d1d2f05e8563f9d97.tar.gz qemu-83d0f7f95cc88bbf31ba000d1d2f05e8563f9d97.tar.bz2 |
accel: Destroy HAX vCPU threads once done
When the vCPU thread finished its processing, destroy
it and signal its destruction to generic vCPU management
layer.
Add a sanity check for the vCPU accelerator context.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230624174121.11508-6-philmd@linaro.org>
-rw-r--r-- | target/i386/hax/hax-accel-ops.c | 3 | ||||
-rw-r--r-- | target/i386/hax/hax-all.c | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/target/i386/hax/hax-accel-ops.c b/target/i386/hax/hax-accel-ops.c index 18114fe..0157a62 100644 --- a/target/i386/hax/hax-accel-ops.c +++ b/target/i386/hax/hax-accel-ops.c @@ -53,6 +53,8 @@ static void *hax_cpu_thread_fn(void *arg) qemu_wait_io_event(cpu); } while (!cpu->unplug || cpu_can_run(cpu)); + hax_vcpu_destroy(cpu); + cpu_thread_signal_destroyed(cpu); rcu_unregister_thread(); return NULL; } @@ -69,6 +71,7 @@ static void hax_start_vcpu_thread(CPUState *cpu) cpu->cpu_index); qemu_thread_create(cpu->thread, thread_name, hax_cpu_thread_fn, cpu, QEMU_THREAD_JOINABLE); + assert(cpu->hax_vcpu); #ifdef _WIN32 cpu->hThread = qemu_thread_get_handle(cpu->thread); #endif diff --git a/target/i386/hax/hax-all.c b/target/i386/hax/hax-all.c index a2321a1..38a4323 100644 --- a/target/i386/hax/hax-all.c +++ b/target/i386/hax/hax-all.c @@ -209,6 +209,7 @@ int hax_vcpu_destroy(CPUState *cpu) CloseHandle(cpu->hThread); #endif g_free(vcpu); + cpu->hax_vcpu = NULL; return 0; } |