mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-25 04:30:02 +00:00
spapr: cpu core: separate child threads destruction from machine state operations
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 <imammedo@redhat.com> Reviewed-by: Bharata B Rao <bharata@linux.vnet.ibm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
796b288f7b
commit
f844616bf6
@ -110,12 +110,20 @@ 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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user