Skip to content

Commit

Permalink
Revert "spapr: Ensure CPU cores are added contiguously and removed in…
Browse files Browse the repository at this point in the history
… LIFO order"

This reverts commit 5cbc64d.

Now that we have stable cpu_index values for pseries-2.7 (and future)
machine types, we can now safely allow hotplug and unplug in any order.

Conflicts:
	hw/ppc/spapr_cpu_core.c

Some conflicts on revert due to some small changes in the inserted
code since the original commit.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
  • Loading branch information
dgibson committed Jul 29, 2016
1 parent b63578b commit 7cdd761
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions hw/ppc/spapr_cpu_core.c
Expand Up @@ -125,24 +125,14 @@ static void spapr_core_release(DeviceState *dev, void *opaque)
void spapr_core_unplug(HotplugHandler *hotplug_dev, DeviceState *dev,
Error **errp)
{
sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(hotplug_dev));
CPUCore *cc = CPU_CORE(dev);
int smt = kvmppc_smt_threads();
int index = cc->core_id / smp_threads;
sPAPRDRConnector *drc =
spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_CPU, index * smt);
sPAPRDRConnectorClass *drck;
Error *local_err = NULL;
int spapr_max_cores = max_cpus / smp_threads;
int i;

for (i = spapr_max_cores - 1; i > index; i--) {
if (spapr->cores[i]) {
error_setg(errp, "core-id %d should be removed first",
i * smp_threads);
return;
}
}
g_assert(drc);

drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
Expand Down Expand Up @@ -224,7 +214,7 @@ void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(OBJECT(hotplug_dev));
sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(hotplug_dev));
int spapr_max_cores = max_cpus / smp_threads;
int index, i;
int index;
Error *local_err = NULL;
CPUCore *cc = CPU_CORE(dev);
char *base_core_type = spapr_get_cpu_core_type(machine->cpu_model);
Expand Down Expand Up @@ -261,14 +251,6 @@ void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
goto out;
}

for (i = 0; i < index; i++) {
if (!spapr->cores[i]) {
error_setg(&local_err, "core-id %d should be added first",
i * smp_threads);
goto out;
}
}

out:
g_free(base_core_type);
error_propagate(errp, local_err);
Expand Down

0 comments on commit 7cdd761

Please sign in to comment.