[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 05/16] accel: Destroy HAX vCPU threads once done
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v3 05/16] accel: Destroy HAX vCPU threads once done |
Date: |
Sat, 24 Jun 2023 19:41:10 +0200 |
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>
---
target/i386/hax/hax-accel-ops.c | 3 +++
target/i386/hax/hax-all.c | 1 +
2 files changed, 4 insertions(+)
diff --git a/target/i386/hax/hax-accel-ops.c b/target/i386/hax/hax-accel-ops.c
index 18114fe34d..0157a628a3 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 a2321a1eff..38a4323a3c 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;
}
--
2.38.1
- [PATCH v3 00/16] accel: Share CPUState accel context (HAX/NVMM/WHPX/HVF), Philippe Mathieu-Daudé, 2023/06/24
- [PATCH v3 01/16] MAINTAINERS: Update Roman Bolshakov email address, Philippe Mathieu-Daudé, 2023/06/24
- [PATCH v3 02/16] accel: Document generic accelerator headers, Philippe Mathieu-Daudé, 2023/06/24
- [PATCH v3 03/16] accel: Remove unused hThread variable on TCG/WHPX, Philippe Mathieu-Daudé, 2023/06/24
- [PATCH v3 04/16] accel: Fix a leak on Windows HAX, Philippe Mathieu-Daudé, 2023/06/24
- [PATCH v3 05/16] accel: Destroy HAX vCPU threads once done,
Philippe Mathieu-Daudé <=
- [PATCH v3 06/16] accel: Rename 'hax_vcpu' as 'accel' in CPUState, Philippe Mathieu-Daudé, 2023/06/24
- [PATCH v3 07/16] accel: Rename HAX 'struct hax_vcpu_state' -> AccelCPUState, Philippe Mathieu-Daudé, 2023/06/24
- [PATCH v3 08/16] accel: Move HAX hThread to accelerator context, Philippe Mathieu-Daudé, 2023/06/24
- [PATCH v3 09/16] accel: Remove NVMM unreachable error path, Philippe Mathieu-Daudé, 2023/06/24
- [PATCH v3 10/16] accel: Rename NVMM 'struct qemu_vcpu' -> AccelCPUState, Philippe Mathieu-Daudé, 2023/06/24
- [PATCH v3 11/16] accel: Inline NVMM get_qemu_vcpu(), Philippe Mathieu-Daudé, 2023/06/24
- [PATCH v3 12/16] accel: Remove WHPX unreachable error path, Philippe Mathieu-Daudé, 2023/06/24
- [PATCH v3 13/16] accel: Rename WHPX 'struct whpx_vcpu' -> AccelCPUState, Philippe Mathieu-Daudé, 2023/06/24
- [PATCH v3 14/16] accel: Inline WHPX get_whpx_vcpu(), Philippe Mathieu-Daudé, 2023/06/24