[PATCH] powerpc/64s: Fix KVM system reset handling when CONFIG_PPC_PSERIES=y

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE2122d LANDED

Landed in mainline as 575cba20c421 on 2020-11-16.

2 messages, 2 authors, 2020-11-17 · open the first message on its own page

[PATCH] powerpc/64s: Fix KVM system reset handling when CONFIG_PPC_PSERIES=y

From: Nicholas Piggin <npiggin@gmail.com>
Date: 2020-11-14 11:52:19

pseries guest kernels have a FWNMI handler for SRESET and MCE NMIs,
which is basically the same as the regular handlers for those
interrupts.

The system reset FWNMI handler did not have a KVM guest test in it,
although it probably should have because the guest can itself run
guests.

Commit 4f50541f6703b ("powerpc/64s/exception: Move all interrupt
handlers to new style code gen macros") convert the handler faithfully
to avoid a KVM test with a "clever" trick to modify the IKVM_REAL
setting to 0 when the fwnmi handler is to be generated (PPC_PSERIES=y).
This worked when the KVM test was generated in the interrupt entry
handlers, but a later patch moved the KVM test to the common handler,
and the common handler macro is expanded below the fwnmi entry. This
prevents the KVM test from being generated even for the 0x100 entry
point as well.

The result is NMI IPIs in the host kernel when a guest is running will
use gest registers. This goes particularly badly when an HPT guest is
running and the MMU is set to guest mode.

Remove this trickery and just generate the test always.

Fixes: 9600f261acaaa ("powerpc/64s/exception: Move KVM test to common code")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kernel/exceptions-64s.S | 2 --
 1 file changed, 2 deletions(-)
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index f7d748b88705..07d64883c0b5 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -1000,8 +1000,6 @@ TRAMP_REAL_BEGIN(system_reset_idle_wake)
  * Vectors for the FWNMI option.  Share common code.
  */
 TRAMP_REAL_BEGIN(system_reset_fwnmi)
-	/* XXX: fwnmi guest could run a nested/PR guest, so why no test?  */
-	__IKVM_REAL(system_reset)=0
 	GEN_INT_ENTRY system_reset, virt=0
 
 #endif /* CONFIG_PPC_PSERIES */
-- 
2.23.0

Re: [PATCH] powerpc/64s: Fix KVM system reset handling when CONFIG_PPC_PSERIES=y

From: Michael Ellerman <hidden>
Date: 2020-11-17 10:56:34

On Sat, 14 Nov 2020 21:47:43 +1000, Nicholas Piggin wrote:
pseries guest kernels have a FWNMI handler for SRESET and MCE NMIs,
which is basically the same as the regular handlers for those
interrupts.

The system reset FWNMI handler did not have a KVM guest test in it,
although it probably should have because the guest can itself run
guests.

[...]
Applied to powerpc/fixes.

[1/1] powerpc/64s: Fix KVM system reset handling when CONFIG_PPC_PSERIES=y
      https://git.kernel.org/powerpc/c/575cba20c421ecb6b563ae352e4e0468e4ca8b3c

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help