Skip to contentSkip to conversation

ppc-for-2.11 queue 20171127

GIT PULL Applied David Gibson 3 participants 5 messages Nov 27, 2017

lore
Share & tools
lore
#0 lore raw

The following changes since commit e7b47c22e2df14d55e3e4426688c929bf8e3f7fb:

osdep.h: Make TIME_MAX handle different time_t types (2017-11-24 13:23:36 +0000)

are available in the Git repository at:

git://github.com/dgibson/qemu.git tags/ppc-for-2.11-20171127

for you to fetch changes up to e07cc1929515cfb808b5c2fcc60c079e6be110cf:

target/ppc: Fix setting of cpu->compat_pvr on incoming migration (2017-11-27 12:20:11 +1100)

----------------------------------------------------------------
ppc patch queue 2017-11-27

This series contains a couple of migration fixes for hash guests on POWER9 radix MMU hosts.

----------------------------------------------------------------
Suraj Jitindar Singh (2):
target/ppc: Move setting of patb_entry on hash table init target/ppc: Fix setting of cpu->compat_pvr on incoming migration

 hw/ppc/spapr.c       | 4 ++--
 target/ppc/machine.c | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 1/2] target/ppc: Move setting of patb_entry on hash table init

From: Suraj Jitindar Singh <[email protected]>

The patb_entry is used to store the location of the process table in guest memory. The msb is also used to indicate the mmu mode of the guest, that is patb_entry & 1 << 63 ? radix_mode : hash_mode.

Currently we set this to zero in spapr_setup_hpt_and_vrma() since if this function gets called then we know we're hash. However some code paths, such as setting up the hpt on incoming migration of a hash guest, call spapr_reallocate_hpt() directly bypassing this higher level function. Since we assume radix if the host is capable this results in the msb in patb_entry being left set so in spapr_post_load() we call kvmppc_configure_v3_mmu() and tell the host we're radix which as expected means addresses cannot be translated once we actually run the cpu.

To fix this move the zeroing of patb_entry into spapr_reallocate_hpt().

---
 hw/ppc/spapr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/spapr.c +2 -2
index 4d0a84f3ec..9efddeaee5 100644
@@ -1373,6 +1373,8 @@ void spapr_reallocate_hpt(sPAPRMachineState *spapr, int shift,
             DIRTY_HPTE(HPTE(spapr->htab, i));
         }
     }
+    /* We're setting up a hash table, so that means we're not radix */
+    spapr->patb_entry = 0;
 }
 
 void spapr_setup_hpt_and_vrma(sPAPRMachineState *spapr)
@@ -1392,8 +1394,6 @@ void spapr_setup_hpt_and_vrma(sPAPRMachineState *spapr)
         spapr->rma_size = kvmppc_rma_size(spapr_node0_size(MACHINE(spapr)),
                                           spapr->htab_shift);
     }
-    /* We're setting up a hash table, so that means we're not radix */
-    spapr->patb_entry = 0;
 }
 
 static void find_unknown_sysbus_device(SysBusDevice *sbdev, void *opaque)
Signature · 1 line
2.14.3
#2 lore raw

[Qemu-devel] [PULL 2/2] target/ppc: Fix setting of cpu->compat_pvr on incoming migration

In reply to David Gibson

From: Suraj Jitindar Singh <[email protected]>

cpu->compat_pvr is used to store the current compat mode of the cpu.

On the receiving side during incoming migration we check compatibility with the compat mode by calling ppc_set_compat(). However we fail to set the compat mode with the hypervisor since the "new" compat mode doesn't differ from the current (due to a "cpu->compat_pvr != compat_pvr" check). This means that kvm runs the vcpus without a compat mode, which is the incorrect behaviour. The implication being that a compatibility mode will never be in effect after migration.

To fix this so that the compat mode is correctly set with the hypervisor, store the desired compat mode and reset cpu->compat_pvr to zero before calling ppc_set_compat().

Fixes 5dfaa532 ("ppc: fix ppc_set_compat() with KVM PR")
---
 target/ppc/machine.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
target/ppc/machine.c +3 -1
index 384caee800..24117e8f31 100644
@@ -237,9 +237,11 @@ static int cpu_post_load(void *opaque, int version_id)
 
 #if defined(TARGET_PPC64)
     if (cpu->compat_pvr) {
+        uint32_t compat_pvr = cpu->compat_pvr;
         Error *local_err = NULL;
 
-        ppc_set_compat(cpu, cpu->compat_pvr, &local_err);
+        cpu->compat_pvr = 0;
+        ppc_set_compat(cpu, compat_pvr, &local_err);
         if (local_err) {
             error_report_err(local_err);
             return -1;
Signature · 1 line
2.14.3
#3 lore raw

Re: [Qemu-devel] [PULL 2/2] target/ppc: Fix setting of cpu->compat_pvr on incoming migration

Quoted 12 lines · On Mon, 27 Nov 2017 15:30:03 +1100 David Gibson <[email protected]>…

From: Suraj Jitindar Singh <[email protected]>

cpu->compat_pvr is used to store the current compat mode of the cpu.

On the receiving side during incoming migration we check compatibility with the compat mode by calling ppc_set_compat(). However we fail to set the compat mode with the hypervisor since the "new" compat mode doesn't differ from the current (due to a "cpu->compat_pvr != compat_pvr" check). This means that kvm runs the vcpus without a compat mode, which is the incorrect behaviour. The implication being that a compatibility mode will never be in effect after migration.

Quoted 6 lines

To fix this so that the compat mode is correctly set with the hypervisor, store the desired compat mode and reset cpu->compat_pvr to zero before calling ppc_set_compat().

Fixes 5dfaa532 ("ppc: fix ppc_set_compat() with KVM PR")

Cc'ing stable since 5dfaa532 was shipped with QEMU 2.10

Quoted 23 lines
---
 target/ppc/machine.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
target/ppc/machine.c +3 -1
index 384caee800..24117e8f31 100644
@@ -237,9 +237,11 @@ static int cpu_post_load(void *opaque, int version_id)
 
 #if defined(TARGET_PPC64)
     if (cpu->compat_pvr) {
+        uint32_t compat_pvr = cpu->compat_pvr;
         Error *local_err = NULL;
 
-        ppc_set_compat(cpu, cpu->compat_pvr, &local_err);
+        cpu->compat_pvr = 0;
+        ppc_set_compat(cpu, compat_pvr, &local_err);
         if (local_err) {
             error_report_err(local_err);
             return -1;
#4 lore raw
In reply to David Gibson
Quoted 18 lines · David Gibson

The following changes since commit e7b47c22e2df14d55e3e4426688c929bf8e3f7fb:

osdep.h: Make TIME_MAX handle different time_t types (2017-11-24 13:23:36 +0000)

are available in the Git repository at:

git://github.com/dgibson/qemu.git tags/ppc-for-2.11-20171127

for you to fetch changes up to e07cc1929515cfb808b5c2fcc60c079e6be110cf:

target/ppc: Fix setting of cpu->compat_pvr on incoming migration (2017-11-27 12:20:11 +1100)

----------------------------------------------------------------
ppc patch queue 2017-11-27

This series contains a couple of migration fixes for hash guests on POWER9 radix MMU hosts.

Quoted 8 lines

----------------------------------------------------------------
Suraj Jitindar Singh (2):
target/ppc: Move setting of patb_entry on hash table init target/ppc: Fix setting of cpu->compat_pvr on incoming migration

 hw/ppc/spapr.c       | 4 ++--
 target/ppc/machine.c | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

Applied, thanks.

-- PMM