[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 12/21] target/ppc: Proper cleanup when ppc_cpu_realiz
From: |
David Gibson |
Subject: |
[Qemu-devel] [PULL 12/21] target/ppc: Proper cleanup when ppc_cpu_realizefn fails |
Date: |
Fri, 30 Jun 2017 20:46:23 +1000 |
From: Bharata B Rao <address@hidden>
If ppc_cpu_realizefn() fails after cpu_exec_realizefn() has been
called, we will have to undo whatever cpu_exec_realizefn() did
by explicitly calling cpu_exec_unrealizeffn() which is currently
missing. Failure to do this proper cleanup will result in CPU
which was never fully realized to linger on the cpus list causing
SIGSEGV later (for eg when running "info cpus").
Signed-off-by: Bharata B Rao <address@hidden>
Reviewed-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
target/ppc/translate_init.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c
index ee84044..783bf98 100644
--- a/target/ppc/translate_init.c
+++ b/target/ppc/translate_init.c
@@ -9825,14 +9825,14 @@ static void ppc_cpu_realizefn(DeviceState *dev, Error
**errp)
error_append_hint(errp, "Adjust the number of cpus to %d "
"or try to raise the number of threads per core\n",
cpu->cpu_dt_id * smp_threads / max_smt);
- return;
+ goto unrealize;
}
#endif
if (tcg_enabled()) {
if (ppc_fixup_cpu(cpu) != 0) {
error_setg(errp, "Unable to emulate selected CPU with TCG");
- return;
+ goto unrealize;
}
}
@@ -9841,14 +9841,14 @@ static void ppc_cpu_realizefn(DeviceState *dev, Error
**errp)
error_setg(errp, "CPU does not possess a BookE or 4xx MMU. "
"Please use qemu-system-ppc or qemu-system-ppc64 instead "
"or choose another CPU model.");
- return;
+ goto unrealize;
}
#endif
create_ppc_opcodes(cpu, &local_err);
if (local_err != NULL) {
error_propagate(errp, local_err);
- return;
+ goto unrealize;
}
init_ppc_proc(cpu);
@@ -10033,6 +10033,10 @@ static void ppc_cpu_realizefn(DeviceState *dev, Error
**errp)
fflush(stdout);
}
#endif
+ return;
+
+unrealize:
+ cpu_exec_unrealizefn(cs);
}
static void ppc_cpu_unrealizefn(DeviceState *dev, Error **errp)
--
2.9.4
- [Qemu-devel] [PULL 20/21] spapr: Clean up DRC set_allocation_state path, (continued)
- [Qemu-devel] [PULL 20/21] spapr: Clean up DRC set_allocation_state path, David Gibson, 2017/06/30
- [Qemu-devel] [PULL 11/21] spapr: fix migration of ICPState objects from/to older QEMU, David Gibson, 2017/06/30
- [Qemu-devel] [PULL 10/21] xics: directly register ICPState objects to vmstate, David Gibson, 2017/06/30
- [Qemu-devel] [PULL 05/21] ppc: Rework CPU compatibility testing across migration, David Gibson, 2017/06/30
- [Qemu-devel] [PULL 07/21] spapr: Fix migration of Radix guests, David Gibson, 2017/06/30
- [Qemu-devel] [PULL 08/21] target/ppc/excp_helper: Take BQL before calling cpu_interrupt(), David Gibson, 2017/06/30
- [Qemu-devel] [PULL 04/21] pseries: Reset CPU compatibility mode, David Gibson, 2017/06/30
- [Qemu-devel] [PULL 14/21] hw/ppc/spapr.c: consecutive 'spapr->patb_entry = 0' statements, David Gibson, 2017/06/30
- [Qemu-devel] [PULL 13/21] spapr: prevent QEMU crash when CPU realization fails, David Gibson, 2017/06/30
- [Qemu-devel] [PULL 16/21] spapr: Start hotplugged PCI devices in ISOLATED state, David Gibson, 2017/06/30
- [Qemu-devel] [PULL 12/21] target/ppc: Proper cleanup when ppc_cpu_realizefn fails,
David Gibson <=
- [Qemu-devel] [PULL 03/21] pseries: Move CPU compatibility property to machine, David Gibson, 2017/06/30
- [Qemu-devel] [PULL 19/21] spapr: Make DRC reset force DRC into known state, David Gibson, 2017/06/30
- [Qemu-devel] [PULL 15/21] target-ppc: Enable open-pic timers to count and generate interrupts, David Gibson, 2017/06/30
- [Qemu-devel] [PULL 21/21] spapr: Clean up DRC set_isolation_state() path, David Gibson, 2017/06/30
- [Qemu-devel] [PULL 18/21] spapr: Split DRC release from DRC detach, David Gibson, 2017/06/30
- [Qemu-devel] [PULL 17/21] spapr: Eliminate DRC 'signalled' state variable, David Gibson, 2017/06/30
- Re: [Qemu-devel] [PULL 00/21] ppc-for-2.10 queue 20170730, Greg Kurz, 2017/06/30
- Re: [Qemu-devel] [PULL 00/21] ppc-for-2.10 queue 20170730, Peter Maydell, 2017/06/30