[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 01/43] spapr: cpu core: separate child threads destru
From: |
David Gibson |
Subject: |
[Qemu-devel] [PULL 01/43] spapr: cpu core: separate child threads destruction from machine state operations |
Date: |
Wed, 22 Feb 2017 17:33:06 +1100 |
From: Igor Mammedov <address@hidden>
Split off destroying VCPU threads from drc callback
spapr_core_release() into new spapr_cpu_core_unrealizefn()
which takes care of internal cpu core state cleanup (i.e.
VCPU threads) and is called when object_unparent(core)
is called.
That leaves spapr_core_release() only with board mgmt
code, which will be moved to board related file in
follow up patch along with the rest on hotplug callbacks.
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Bharata B Rao <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr_cpu_core.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 9dddaeb..b9e5f80 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -111,11 +111,19 @@ char *spapr_get_cpu_core_type(const char *model)
static void spapr_core_release(DeviceState *dev, void *opaque)
{
+ sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
+ CPUCore *cc = CPU_CORE(dev);
+
+ spapr->cores[cc->core_id / smp_threads] = NULL;
+ object_unparent(OBJECT(dev));
+}
+
+static void spapr_cpu_core_unrealizefn(DeviceState *dev, Error **errp)
+{
sPAPRCPUCore *sc = SPAPR_CPU_CORE(OBJECT(dev));
sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_GET_CLASS(OBJECT(dev));
const char *typename = object_class_get_name(scc->cpu_class);
size_t size = object_type_get_instance_size(typename);
- sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
CPUCore *cc = CPU_CORE(dev);
int i;
@@ -129,11 +137,7 @@ static void spapr_core_release(DeviceState *dev, void
*opaque)
cpu_remove_sync(cs);
object_unparent(obj);
}
-
- spapr->cores[cc->core_id / smp_threads] = NULL;
-
g_free(sc->threads);
- object_unparent(OBJECT(dev));
}
void spapr_core_unplug(HotplugHandler *hotplug_dev, DeviceState *dev,
@@ -368,6 +372,7 @@ void spapr_cpu_core_class_init(ObjectClass *oc, void *data)
sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_CLASS(oc);
dc->realize = spapr_cpu_core_realize;
+ dc->unrealize = spapr_cpu_core_unrealizefn;
scc->cpu_class = cpu_class_by_name(TYPE_POWERPC_CPU, data);
g_assert(scc->cpu_class);
}
--
2.9.3
- [Qemu-devel] [PULL 00/43] ppc-for-2.9 queue 20170222, David Gibson, 2017/02/22
- [Qemu-devel] [PULL 01/43] spapr: cpu core: separate child threads destruction from machine state operations,
David Gibson <=
- [Qemu-devel] [PULL 03/43] spapr: make cpu core unplug follow expected hotunplug call flow, David Gibson, 2017/02/22
- [Qemu-devel] [PULL 16/43] target-ppc: add slbsync implementation, David Gibson, 2017/02/22
- [Qemu-devel] [PULL 18/43] target-ppc, tcg: fix usermode segfault with pthread_create(), David Gibson, 2017/02/22
- [Qemu-devel] [PULL 09/43] target-ppc: Add xsmaxcdp and xsmincdp instructions, David Gibson, 2017/02/22
- [Qemu-devel] [PULL 08/43] hw/ppc/pnv: Remove superfluous "qemu" prefix from error strings, David Gibson, 2017/02/22
- [Qemu-devel] [PULL 17/43] target-ppc: add wait instruction, David Gibson, 2017/02/22
- [Qemu-devel] [PULL 14/43] target-ppc: generate exception for copy/paste, David Gibson, 2017/02/22
- [Qemu-devel] [PULL 04/43] ppc: implement xsrqpi[x] instruction, David Gibson, 2017/02/22
- [Qemu-devel] [PULL 12/43] target-ppc: implement load atomic instruction, David Gibson, 2017/02/22
- [Qemu-devel] [PULL 05/43] ppc: implement xsrqpxp instruction, David Gibson, 2017/02/22