Skip to contentSkip to conversation

pseries: Restore support for total vcpus not a multiple of threads-per-core for old machine types

PATCH In review David Gibson 3 participants 3 messages May 23, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pseries: Restore support for total vcpus not a multiple of threads-per-core for old machine types

As of pseries-2.7 and later, we require the total number of guest vcpus to be a multiple of the threads-per-core. pseries-2.6 and earlier machine types, however, are supposed to allow this for the sake of migration from old qemu versions which allowed this.

Unfortunately, 8149e29 "pseries: Enforce homogeneous threads-per-core" broke this by not considering the old machine type case. This fixes it by only applying the check when the machine type supports hotpluggable cpus. By not-entirely-coincidence, that corresponds to the same time when we started enforcing total threads being a multiple of threads-per-core.

Fixes 8149e2992f7811355cc34721b79d69d1a3a667dd
---
 hw/ppc/spapr.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +7 -1
index c92d269..bcb0e18 100644
@@ -2863,7 +2863,13 @@ static void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
         goto out;
     }
 
-    if (cc->nr_threads != smp_threads) {
+    /*
+     * In general we should have homogeneous threads-per-core, but old
+     * (pre hotplug support) machine types allow the last core to have
+     * reduced threads as a compatibility hack for when we allowed
+     * total vcpus not a multiple of threads-per-core.
+     */
+    if (mc->has_hotpluggable_cpus && (cc->nr_threads != smp_threads)) {
         error_setg(errp, "invalid nr-threads %d, must be %d",
                    cc->nr_threads, smp_threads);
         return;
Signature · 1 line
2.9.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 28 lines · David Gibson

As of pseries-2.7 and later, we require the total number of guest vcpus to be a multiple of the threads-per-core. pseries-2.6 and earlier machine types, however, are supposed to allow this for the sake of migration from old qemu versions which allowed this.

Unfortunately, 8149e29 "pseries: Enforce homogeneous threads-per-core" broke this by not considering the old machine type case. This fixes it by only applying the check when the machine type supports hotpluggable cpus. By not-entirely-coincidence, that corresponds to the same time when we started enforcing total threads being a multiple of threads-per-core.

Fixes 8149e2992f7811355cc34721b79d69d1a3a667dd
---
 hw/ppc/spapr.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +0 -1
index c92d269..bcb0e18 100644
@@ -2863,7 +2863,13 @@ static void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
         goto out;
     }
 
-    if (cc->nr_threads != smp_threads) {

hw/ppc/spapr.c static void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, · line 2875

Quoted 10 lines
hw/ppc/spapr.c +7 -0
+    /*
+     * In general we should have homogeneous threads-per-core, but old
+     * (pre hotplug support) machine types allow the last core to have
+     * reduced threads as a compatibility hack for when we allowed
+     * total vcpus not a multiple of threads-per-core.
+     */
+    if (mc->has_hotpluggable_cpus && (cc->nr_threads != smp_threads)) {
         error_setg(errp, "invalid nr-threads %d, must be %d",
                    cc->nr_threads, smp_threads);
         return;
Reviewed-by Tested-by on v1 1/1
#2 lore raw
In reply to David Gibson
Quoted 11 lines · On Tue, 23 May 2017 16:36:45 +1000 David Gibson <[email protected]>…

As of pseries-2.7 and later, we require the total number of guest vcpus to be a multiple of the threads-per-core. pseries-2.6 and earlier machine types, however, are supposed to allow this for the sake of migration from old qemu versions which allowed this.

Unfortunately, 8149e29 "pseries: Enforce homogeneous threads-per-core" broke this by not considering the old machine type case. This fixes it by only applying the check when the machine type supports hotpluggable cpus. By not-entirely-coincidence, that corresponds to the same time when we started enforcing total threads being a multiple of threads-per-core.

Quoted 4 lines
Fixes 8149e2992f7811355cc34721b79d69d1a3a667dd

---

and

Quoted 22 lines
 hw/ppc/spapr.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +7 -1
index c92d269..bcb0e18 100644
@@ -2863,7 +2863,13 @@ static void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
         goto out;
     }
 
-    if (cc->nr_threads != smp_threads) {
+    /*
+     * In general we should have homogeneous threads-per-core, but old
+     * (pre hotplug support) machine types allow the last core to have
+     * reduced threads as a compatibility hack for when we allowed
+     * total vcpus not a multiple of threads-per-core.
+     */
+    if (mc->has_hotpluggable_cpus && (cc->nr_threads != smp_threads)) {
         error_setg(errp, "invalid nr-threads %d, must be %d",
                    cc->nr_threads, smp_threads);
         return;