Skip to contentSkip to conversation

ppc-for-2.7 queue 20160729

GIT PULL Applied David Gibson 2 participants 8 messages Jul 29, 2016

lore
Share & tools
lore
#0 lore raw

The following changes since commit 21a21b853a1bb606358af61e738abfb9aecbd720:

Merge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging (2016-07-27 18:18:21 +0100)

are available in the git repository at:

git://github.com/dgibson/qemu.git tags/ppc-for-2.7-20160729

for you to fetch changes up to 059ce0f00af0124740bcb9991d160f93c92ae174:

tests: add drive_del-test to ppc/ppc64 (2016-07-29 14:14:15 +1000)

----------------------------------------------------------------
ppc patch queue 2016-07-29

Here are the current pending ppc and spapr related patches for qemu-2.7. Given the freeze status, these are all bugfixes, with two exceptions:

* There's some final rework of the vcpu hotplug model. Specifically we add spapr specific code on the generic basis Igor established to make cpu_index stable for pseries-2.7 and later machine types.
- This allows us to remove the limitation that cpu cores had to be inserted in linear order, and removed in LIFO order.
- This is worth merging this late in 2.7 because it will avoid considerable future grief with management layers needing to discover whether out-of-order hotplug is possible, amongst other things.
- For now we do add a constraint that the initial cpu cannot be unplugged.
* We add two extra testcases to make check, for postcopy and drive_del on ppc64.
- Not strictly bugfixes, but safe, because they don't affect the actual code, and increase test coverage.

----------------------------------------------------------------
Benjamin Herrenschmidt (1):
ppc: Fix fault PC reporting for lve*/stve* VMX instructions

Bharata B Rao (1):
spapr: Prevent boot CPU core removal

David Gibson (1):
Revert "spapr: Ensure CPU cores are added contiguously and removed in LIFO order"

Igor Mammedov (1):

      spapr: init CPUState->cpu_index with index relative to core-id

Laurent Vivier (1):
tests: add drive_del-test to ppc/ppc64

[email protected] (1):
test: port postcopy test to ppc64

 hw/ppc/spapr_cpu_core.c |  27 ++++-------
 target-ppc/mem_helper.c |  21 ++++-----
 tests/Makefile.include  |   3 ++
 tests/drive_del-test.c  |   3 +-
 tests/postcopy-test.c   | 116 ++++++++++++++++++++++++++++++++++++++++--------
 5 files changed, 122 insertions(+), 48 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 1/6] spapr: init CPUState->cpu_index with index relative to core-id

From: Igor Mammedov <[email protected]>

It will enshure that cpu_index for a given cpu stays the same regardless of the order cpus has been created/deleted and so it would be possible to migrate QEMU instance with out of order created CPU.

---
 hw/ppc/spapr_cpu_core.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/ppc/spapr_cpu_core.c +4 -0
index c04aaa4..1f3f4dd 100644
@@ -307,9 +307,13 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)
     sc->threads = g_malloc0(size * cc->nr_threads);
     for (i = 0; i < cc->nr_threads; i++) {
         char id[32];
+        CPUState *cs;
+
         obj = sc->threads + i * size;
 
         object_initialize(obj, size, typename);
+        cs = CPU(obj);
+        cs->cpu_index = cc->core_id + i;
         snprintf(id, sizeof(id), "thread[%d]", i);
         object_property_add_child(OBJECT(sc), id, obj, &local_err);
         if (local_err) {
Signature · 1 line
2.7.4
#2 lore raw

[Qemu-devel] [PULL 6/6] tests: add drive_del-test to ppc/ppc64

In reply to David Gibson

From: Laurent Vivier <[email protected]>

---
 tests/Makefile.include | 2 ++
 tests/drive_del-test.c | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
tests/Makefile.include +2 -0
index 4b5123b..ebecfa4 100644
@@ -259,6 +259,8 @@ check-qtest-arm-y += tests/virtio-blk-test$(EXESUF)
 gcov-files-arm-y += arm-softmmu/hw/block/virtio-blk.c
 check-qtest-ppc-y += tests/boot-order-test$(EXESUF)
 check-qtest-ppc64-y += tests/boot-order-test$(EXESUF)
+check-qtest-ppc-y += tests/drive_del-test$(EXESUF)
+check-qtest-ppc64-y += tests/drive_del-test$(EXESUF)
 check-qtest-ppc64-y += tests/spapr-phb-test$(EXESUF)
 gcov-files-ppc64-y += ppc64-softmmu/hw/ppc/spapr_pci.c
 check-qtest-ppc-y += tests/prom-env-test$(EXESUF)
tests/drive_del-test.c +2 -1
index 74e43c2..121b9c9 100644
@@ -115,7 +115,8 @@ int main(int argc, char **argv)
     qtest_add_func("/drive_del/without-dev", test_drive_without_dev);
 
     /* TODO I guess any arch with PCI would do */
-    if (!strcmp(arch, "i386") || !strcmp(arch, "x86_64")) {
+    if (!strcmp(arch, "i386") || !strcmp(arch, "x86_64") ||
+        !strcmp(arch, "ppc") || !strcmp(arch, "ppc64")) {
         qtest_add_func("/drive_del/after_failed_device_add",
                        test_after_failed_device_add);
         qtest_add_func("/blockdev/drive_del_device_del",
Signature · 1 line
2.7.4
#3 lore raw

[Qemu-devel] [PULL 2/6] Revert "spapr: Ensure CPU cores are added contiguously and removed in LIFO order"

In reply to David Gibson

This reverts commit 5cbc64de25973e9129c5a7897734a06ac64b9aff.

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.

---
 hw/ppc/spapr_cpu_core.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)
hw/ppc/spapr_cpu_core.c +1 -19
index 1f3f4dd..5a132bf 100644
@@ -125,7 +125,6 @@ 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;
@@ -133,16 +132,7 @@ void spapr_core_unplug(HotplugHandler *hotplug_dev, DeviceState *dev,
         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);
@@ -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);
@@ -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);
Signature · 1 line
2.7.4
#4 lore raw

[Qemu-devel] [PULL 3/6] test: port postcopy test to ppc64

In reply to David Gibson

From: "[email protected]" <[email protected]>

As userfaultfd syscall is available on powerpc, migration postcopy can be used.

This patch adds the support needed to test this on powerpc, instead of using a bootsector to run code to modify memory, we use a FORTH script in "boot-command" property.

As spapr machine doesn't support "-prom-env" argument (the nvram is initialized by SLOF and not by QEMU), "boot-command" is provided to SLOF via a file mapped nvram (with "-drive file=...,if=pflash")

---
 tests/Makefile.include |   1 +
 tests/postcopy-test.c  | 116 +++++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 98 insertions(+), 19 deletions(-)
tests/Makefile.include +1 -0
index 9286148..4b5123b 100644
@@ -268,6 +268,7 @@ check-qtest-sparc-y += tests/prom-env-test$(EXESUF)
 #check-qtest-sparc64-y += tests/prom-env-test$(EXESUF)
 check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
 check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
+check-qtest-ppc64-y += tests/postcopy-test$(EXESUF)
 
 check-qtest-generic-y += tests/qom-test$(EXESUF)
 
tests/postcopy-test.c +97 -19

157 lines not on this page · raw message

Signature · 1 line
2.7.4
#5 lore raw

[Qemu-devel] [PULL 4/6] ppc: Fix fault PC reporting for lve*/stve* VMX instructions

In reply to David Gibson

From: Benjamin Herrenschmidt <[email protected]>

We forgot to do gen_update_nip() for these like we do with other helpers. Fix this, but in a more efficient way by passing the RA to the accessors instead so the overhead is only taken on faults.

---
 target-ppc/mem_helper.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
target-ppc/mem_helper.c +11 -10
index e4de86b..e4ed377 100644
@@ -232,16 +232,16 @@ target_ulong helper_lscbx(CPUPPCState *env, target_ulong addr, uint32_t reg,
                                                                 \
         if (needs_byteswap(env)) {                              \
             r->element[LO_IDX ? index : (adjust - index)] =     \
-                swap(access(env, addr));                        \
+                swap(access(env, addr, GETPC()));               \
         } else {                                                \
             r->element[LO_IDX ? index : (adjust - index)] =     \
-                access(env, addr);                              \
+                access(env, addr, GETPC());                     \
         }                                                       \
     }
 #define I(x) (x)
-LVE(lvebx, cpu_ldub_data, I, u8)
-LVE(lvehx, cpu_lduw_data, bswap16, u16)
-LVE(lvewx, cpu_ldl_data, bswap32, u32)
+LVE(lvebx, cpu_ldub_data_ra, I, u8)
+LVE(lvehx, cpu_lduw_data_ra, bswap16, u16)
+LVE(lvewx, cpu_ldl_data_ra, bswap32, u32)
 #undef I
 #undef LVE
 
@@ -259,16 +259,17 @@ LVE(lvewx, cpu_ldl_data, bswap32, u32)
                                                                         \
         if (needs_byteswap(env)) {                                      \
             access(env, addr, swap(r->element[LO_IDX ? index :          \
-                                              (adjust - index)]));      \
+                                              (adjust - index)]),       \
+                        GETPC());                                       \
         } else {                                                        \
             access(env, addr, r->element[LO_IDX ? index :               \
-                                         (adjust - index)]);            \
+                                         (adjust - index)], GETPC());   \
         }                                                               \
     }
 #define I(x) (x)
-STVE(stvebx, cpu_stb_data, I, u8)
-STVE(stvehx, cpu_stw_data, bswap16, u16)
-STVE(stvewx, cpu_stl_data, bswap32, u32)
+STVE(stvebx, cpu_stb_data_ra, I, u8)
+STVE(stvehx, cpu_stw_data_ra, bswap16, u16)
+STVE(stvewx, cpu_stl_data_ra, bswap32, u32)
 #undef I
 #undef LVE
 
Signature · 1 line
2.7.4
#6 lore raw

[Qemu-devel] [PULL 5/6] spapr: Prevent boot CPU core removal

In reply to David Gibson

From: Bharata B Rao <[email protected]>

Boot CPU is assumed to be always present in QEMU code. So until that assumptions are gone, deny removal request. In another words, QEMU won't support boot CPU core hot-unplug.

[dwg: Tweaked error message for clarity]
---
 hw/ppc/spapr_cpu_core.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/ppc/spapr_cpu_core.c +5 -0
index 5a132bf..ec81ee6 100644
@@ -133,6 +133,11 @@ void spapr_core_unplug(HotplugHandler *hotplug_dev, DeviceState *dev,
     sPAPRDRConnectorClass *drck;
     Error *local_err = NULL;
 
+    if (index == 0) {
+        error_setg(errp, "Boot CPU core may not be unplugged");
+        return;
+    }
+
     g_assert(drc);
 
     drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
Signature · 1 line
2.7.4
#7 lore raw
In reply to David Gibson
Quoted 19 lines · David Gibson

The following changes since commit 21a21b853a1bb606358af61e738abfb9aecbd720:

Merge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging (2016-07-27 18:18:21 +0100)

are available in the git repository at:

git://github.com/dgibson/qemu.git tags/ppc-for-2.7-20160729

for you to fetch changes up to 059ce0f00af0124740bcb9991d160f93c92ae174:

tests: add drive_del-test to ppc/ppc64 (2016-07-29 14:14:15 +1000)

----------------------------------------------------------------
ppc patch queue 2016-07-29

Here are the current pending ppc and spapr related patches for qemu-2.7. Given the freeze status, these are all bugfixes, with two exceptions:

Quoted 16 lines

* There's some final rework of the vcpu hotplug model. Specifically we add spapr specific code on the generic basis Igor established to make cpu_index stable for pseries-2.7 and later machine types.
- This allows us to remove the limitation that cpu cores had to be inserted in linear order, and removed in LIFO order.
- This is worth merging this late in 2.7 because it will avoid considerable future grief with management layers needing to discover whether out-of-order hotplug is possible, amongst other things.
- For now we do add a constraint that the initial cpu cannot be unplugged.
* We add two extra testcases to make check, for postcopy and drive_del on ppc64.
- Not strictly bugfixes, but safe, because they don't affect the actual code, and increase test coverage.

Applied, thanks.

-- PMM