Skip to contentSkip to conversation

ppc-for-5.1 queue 20200727

GIT PULL Applied David Gibson 2 participants 3 messages Jul 27, 2020

lore
Share & tools
lore
#0 lore raw

The following changes since commit 194f8ca825854abef3aceca1ed7eb5a53b08751f:

Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20200725' into staging (2020-07-26 17:17:58 +0100)

are available in the Git repository at:

git://github.com/dgibson/qemu.git tags/ppc-for-5.1-20200727

for you to fetch changes up to aef92d87c59d257c0ff24ba1dc82506a03f1f522:

pseries: fix kvmppc_set_fwnmi() (2020-07-27 11:09:25 +1000)

----------------------------------------------------------------
ppc patch queue 2020-07-27

Only one patch in this batch, but it fixes a fairly important regression, so we want it in qemu-5.1

----------------------------------------------------------------
Laurent Vivier (1):
pseries: fix kvmppc_set_fwnmi()

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

[PULL 1/1] pseries: fix kvmppc_set_fwnmi()

From: Laurent Vivier <[email protected]>

QEMU issues the ioctl(KVM_CAP_PPC_FWNMI) on the first vCPU.

If the first vCPU is currently running, the vCPU mutex is held and the ioctl() cannot be done and waits until the mutex is released. This never happens and the VM is stuck.

To avoid this deadlock, issue the ioctl on the same vCPU doing the RTAS call.

The problem can be reproduced by booting a guest with several vCPUs (the probability to have the problem is (n - 1) / n, n = # of CPUs), and then by triggering a kernel crash with "echo c >/proc/sysrq-trigger".

On the reboot, the kernel hangs after:

...

[    0.000000] -----------------------------------------------------
[    0.000000] ppc64_pft_size    = 0x0
[    0.000000] phys_mem_size     = 0x48000000
[    0.000000] dcache_bsize      = 0x80
[    0.000000] icache_bsize      = 0x80
[    0.000000] cpu_features      = 0x0001c06f8f4f91a7
[    0.000000]   possible        = 0x0003fbffcf5fb1a7
[    0.000000]   always          = 0x00000003800081a1
[    0.000000] cpu_user_features = 0xdc0065c2 0xaee00000
[    0.000000] mmu_features      = 0x3c006041
[    0.000000] firmware_features = 0x00000085455a445f
[    0.000000] physical_start    = 0x8000000
[    0.000000] -----------------------------------------------------
[    0.000000] numa:   NODE_DATA [mem 0x47f33c80-0x47f3ffff]
Fixes ec010c00665b ("ppc/spapr: KVM FWNMI should not be enabled until guest requests it")

Message-Id: <[email protected]>

---
 hw/ppc/spapr_rtas.c  | 2 +-
 target/ppc/kvm.c     | 3 +--
 target/ppc/kvm_ppc.h | 4 ++--
 3 files changed, 4 insertions(+), 5 deletions(-)
hw/ppc/spapr_rtas.c +1 -1
index bcac0d00e7..513c7a8435 100644
@@ -438,7 +438,7 @@ static void rtas_ibm_nmi_register(PowerPCCPU *cpu,
     }
 
     if (kvm_enabled()) {
-        if (kvmppc_set_fwnmi() < 0) {
+        if (kvmppc_set_fwnmi(cpu) < 0) {
             rtas_st(rets, 0, RTAS_OUT_NOT_SUPPORTED);
             return;
         }
target/ppc/kvm.c +1 -2
index 2692f76130..d85ba8ffe0 100644
@@ -2071,9 +2071,8 @@ bool kvmppc_get_fwnmi(void)
     return cap_fwnmi;
 }
 
-int kvmppc_set_fwnmi(void)
+int kvmppc_set_fwnmi(PowerPCCPU *cpu)
 {
-    PowerPCCPU *cpu = POWERPC_CPU(first_cpu);
     CPUState *cs = CPU(cpu);
 
     return kvm_vcpu_enable_cap(cs, KVM_CAP_PPC_FWNMI, 0);
target/ppc/kvm_ppc.h +2 -2
index 701c0c262b..72e05f1cd2 100644
@@ -28,7 +28,7 @@ void kvmppc_set_papr(PowerPCCPU *cpu);
 int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr);
 void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy);
 bool kvmppc_get_fwnmi(void);
-int kvmppc_set_fwnmi(void);
+int kvmppc_set_fwnmi(PowerPCCPU *cpu);
 int kvmppc_smt_threads(void);
 void kvmppc_error_append_smt_possible_hint(Error *const *errp);
 int kvmppc_set_smt_threads(int smt);
@@ -169,7 +169,7 @@ static inline bool kvmppc_get_fwnmi(void)
     return false;
 }
 
-static inline int kvmppc_set_fwnmi(void)
+static inline int kvmppc_set_fwnmi(PowerPCCPU *cpu)
 {
     return -1;
 }
Signature · 1 line
2.26.2
#2 lore raw
In reply to David Gibson
Quoted 11 lines · David Gibson

The following changes since commit 194f8ca825854abef3aceca1ed7eb5a53b08751f:

Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20200725' into staging (2020-07-26 17:17:58 +0100)

are available in the Git repository at:

git://github.com/dgibson/qemu.git tags/ppc-for-5.1-20200727

for you to fetch changes up to aef92d87c59d257c0ff24ba1dc82506a03f1f522:

Quoted 8 lines

pseries: fix kvmppc_set_fwnmi() (2020-07-27 11:09:25 +1000)

----------------------------------------------------------------
ppc patch queue 2020-07-27

Only one patch in this batch, but it fixes a fairly important regression, so we want it in qemu-5.1

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.1
for any user-visible changes.

-- PMM