[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/22] exec/cpu: RFC Destroy vCPU address spaces in cpu_common_un
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 08/22] exec/cpu: RFC Destroy vCPU address spaces in cpu_common_unrealize() |
Date: |
Mon, 18 Sep 2023 18:02:41 +0200 |
We create at least one vCPU address space by default in
qemu_init_vcpu(), itself called in cpu_common_realizefn().
Since we don't have qemu_deinit_vcpu() helper (we probably
don't need any), simply destroy all the address spaces in
cpu_common_unrealizefn(), *after* the thread is destroyed.
Note: all targets were leaking the vCPU address spaces upon
vCPU unrealize (like hot-unplugged actions).
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/core/cpu-common.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index e5841c59df..35c0cc4dad 100644
--- a/hw/core/cpu-common.c
+++ b/hw/core/cpu-common.c
@@ -224,6 +224,11 @@ static void cpu_common_unrealizefn(DeviceState *dev)
/* Destroy vCPU thread */
cpu_remove_sync(cpu);
+
+ /* Destroy CPU address space */
+ for (unsigned idx = 0; idx < cpu->num_ases; idx++) {
+ cpu_address_space_destroy(cpu, idx);
+ }
}
static void cpu_common_initfn(Object *obj)
--
2.41.0
- [PATCH 00/22] exec/cpu: Call cpu_exec_realizefn() once in cpu_common_realize(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 01/22] target/i386: Only realize existing APIC device, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 02/22] hw/intc/apic: Pass CPU using QOM link property, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 03/22] target/i386/kvm: Correct comment in kvm_cpu_realize(), Philippe Mathieu-Daudé, 2023/09/18
- [RFC PATCH 04/22] exec/cpu: Never call cpu_reset() before cpu_realize(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 05/22] exec/cpu: Call qemu_init_vcpu() once in cpu_common_realize(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 06/22] exec/cpu: Call cpu_remove_sync() once in cpu_common_unrealize(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 07/22] exec/cpu: Introduce the CPU address space destruction function, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 10/22] target/hppa: Create timer *after* accelerator vCPU is realized, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 12/22] target/mips: Create clock *after* accelerator vCPU is realized, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 08/22] exec/cpu: RFC Destroy vCPU address spaces in cpu_common_unrealize(),
Philippe Mathieu-Daudé <=
- [PATCH 09/22] target/arm: Create timers *after* accelerator vCPU is realized, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 11/22] target/nios2: Create IRQs *after* accelerator vCPU is realized, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 13/22] target/xtensa: Create IRQs *after* accelerator vCPU is realized, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 14/22] target/sparc: Init CPU environment *after* accelerator vCPU is realized, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 15/22] exec/cpu: Introduce CPUClass::verify_accel_features(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 16/22] target/arm: Extract verify_accel_features() from cpu_realize(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 17/22] target/i386: Extract verify_accel_features() from cpu_realize(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 18/22] target/s390x: Call s390_cpu_realize_sysemu from s390_realize_cpu_model, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 19/22] target/s390x: Have s390_realize_cpu_model() return a boolean, Philippe Mathieu-Daudé, 2023/09/18