* [Qemu-devel] [PATCH v0] spapr: Error out when CPU hotplug is attempted on older pseries machines
@ 2016-07-06 17:49 Bharata B Rao
2016-07-07 0:10 ` David Gibson
0 siblings, 1 reply; 2+ messages in thread
From: Bharata B Rao @ 2016-07-06 17:49 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-ppc, david, Bharata B Rao
CPU hotplug and coldplug aren't supported prior to pseries-2.7.
query-hotpluggable-cpus and coldplug on older pseries machines are crashing
the QEMU. Fix this.
- Let query_hotpluggable_cpus return NULL for pseries < 2.7
- spapr_core_pre_plug() should fail hot/cold plug attempts for pseries < 2.7
- spapr_core_plug() should never be called for pseries < 2.7, hence use
an assert.
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
---
Applies on ppc-for-2.7 branch of David's tree.
hw/ppc/spapr.c | 5 +++++
hw/ppc/spapr_cpu_core.c | 19 ++++++-------------
2 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 7f33a1b..e3a7912 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2368,9 +2368,14 @@ static HotpluggableCPUList *spapr_query_hotpluggable_cpus(MachineState *machine)
int i;
HotpluggableCPUList *head = NULL;
sPAPRMachineState *spapr = SPAPR_MACHINE(machine);
+ sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
int spapr_max_cores = max_cpus / smp_threads;
int smt = kvmppc_smt_threads();
+ if (!smc->dr_cpu_enabled) {
+ return NULL;
+ }
+
for (i = 0; i < spapr_max_cores; i++) {
HotpluggableCPUList *list_item = g_new0(typeof(*list_item), 1);
HotpluggableCPU *cpu_item = g_new0(typeof(*cpu_item), 1);
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 70b6b0b..273207c 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -162,19 +162,12 @@ void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
int index;
int smt = kvmppc_smt_threads();
+ g_assert(smc->dr_cpu_enabled);
+
drc = spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_CPU, cc->core_id);
index = cc->core_id / smt;
spapr->cores[index] = OBJECT(dev);
- if (!smc->dr_cpu_enabled) {
- /*
- * This is a cold plugged CPU core but the machine doesn't support
- * DR. So skip the hotplug path ensuring that the core is brought
- * up online with out an associated DR connector.
- */
- return;
- }
-
g_assert(drc);
/*
@@ -223,13 +216,13 @@ void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
char *base_core_type = spapr_get_cpu_core_type(machine->cpu_model);
const char *type = object_get_typename(OBJECT(dev));
- if (strcmp(base_core_type, type)) {
- error_setg(&local_err, "CPU core type should be %s", base_core_type);
+ if (!smc->dr_cpu_enabled) {
+ error_setg(&local_err, "CPU hotplug not supported for this machine");
goto out;
}
- if (!smc->dr_cpu_enabled && dev->hotplugged) {
- error_setg(&local_err, "CPU hotplug not supported for this machine");
+ if (strcmp(base_core_type, type)) {
+ error_setg(&local_err, "CPU core type should be %s", base_core_type);
goto out;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH v0] spapr: Error out when CPU hotplug is attempted on older pseries machines
2016-07-06 17:49 [Qemu-devel] [PATCH v0] spapr: Error out when CPU hotplug is attempted on older pseries machines Bharata B Rao
@ 2016-07-07 0:10 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2016-07-07 0:10 UTC (permalink / raw)
To: Bharata B Rao; +Cc: qemu-devel, qemu-ppc
[-- Attachment #1: Type: text/plain, Size: 3472 bytes --]
On Wed, Jul 06, 2016 at 11:19:30PM +0530, Bharata B Rao wrote:
> CPU hotplug and coldplug aren't supported prior to pseries-2.7.
> query-hotpluggable-cpus and coldplug on older pseries machines are crashing
> the QEMU. Fix this.
>
> - Let query_hotpluggable_cpus return NULL for pseries < 2.7
> - spapr_core_pre_plug() should fail hot/cold plug attempts for pseries < 2.7
> - spapr_core_plug() should never be called for pseries < 2.7, hence use
> an assert.
>
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> ---
> Applies on ppc-for-2.7 branch of David's tree.
Applied to ppc-for-2.7.
>
> hw/ppc/spapr.c | 5 +++++
> hw/ppc/spapr_cpu_core.c | 19 ++++++-------------
> 2 files changed, 11 insertions(+), 13 deletions(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 7f33a1b..e3a7912 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2368,9 +2368,14 @@ static HotpluggableCPUList *spapr_query_hotpluggable_cpus(MachineState *machine)
> int i;
> HotpluggableCPUList *head = NULL;
> sPAPRMachineState *spapr = SPAPR_MACHINE(machine);
> + sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
> int spapr_max_cores = max_cpus / smp_threads;
> int smt = kvmppc_smt_threads();
>
> + if (!smc->dr_cpu_enabled) {
> + return NULL;
> + }
> +
> for (i = 0; i < spapr_max_cores; i++) {
> HotpluggableCPUList *list_item = g_new0(typeof(*list_item), 1);
> HotpluggableCPU *cpu_item = g_new0(typeof(*cpu_item), 1);
> diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
> index 70b6b0b..273207c 100644
> --- a/hw/ppc/spapr_cpu_core.c
> +++ b/hw/ppc/spapr_cpu_core.c
> @@ -162,19 +162,12 @@ void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
> int index;
> int smt = kvmppc_smt_threads();
>
> + g_assert(smc->dr_cpu_enabled);
> +
> drc = spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_CPU, cc->core_id);
> index = cc->core_id / smt;
> spapr->cores[index] = OBJECT(dev);
>
> - if (!smc->dr_cpu_enabled) {
> - /*
> - * This is a cold plugged CPU core but the machine doesn't support
> - * DR. So skip the hotplug path ensuring that the core is brought
> - * up online with out an associated DR connector.
> - */
> - return;
> - }
> -
> g_assert(drc);
>
> /*
> @@ -223,13 +216,13 @@ void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
> char *base_core_type = spapr_get_cpu_core_type(machine->cpu_model);
> const char *type = object_get_typename(OBJECT(dev));
>
> - if (strcmp(base_core_type, type)) {
> - error_setg(&local_err, "CPU core type should be %s", base_core_type);
> + if (!smc->dr_cpu_enabled) {
> + error_setg(&local_err, "CPU hotplug not supported for this machine");
> goto out;
> }
>
> - if (!smc->dr_cpu_enabled && dev->hotplugged) {
> - error_setg(&local_err, "CPU hotplug not supported for this machine");
> + if (strcmp(base_core_type, type)) {
> + error_setg(&local_err, "CPU core type should be %s", base_core_type);
> goto out;
> }
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-07-07 0:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-06 17:49 [Qemu-devel] [PATCH v0] spapr: Error out when CPU hotplug is attempted on older pseries machines Bharata B Rao
2016-07-07 0:10 ` David Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).