WSL2-Linux-Kernel/arch
Nico Boehr 32a8dc8d9e KVM: s390: pv: fix external interruption loop not always detected
[ Upstream commit 21f27df854 ]

To determine whether the guest has caused an external interruption loop
upon code 20 (external interrupt) intercepts, the ext_new_psw needs to
be inspected to see whether external interrupts are enabled.

Under non-PV, ext_new_psw can simply be taken from guest lowcore. Under
PV, KVM can only access the encrypted guest lowcore and hence the
ext_new_psw must not be taken from guest lowcore.

handle_external_interrupt() incorrectly did that and hence was not able
to reliably tell whether an external interruption loop is happening or
not. False negatives cause spurious failures of my kvm-unit-test
for extint loops[1] under PV.

Since code 20 is only caused under PV if and only if the guest's
ext_new_psw is enabled for external interrupts, false positive detection
of a external interruption loop can not happen.

Fix this issue by instead looking at the guest PSW in the state
description. Since the PSW swap for external interrupt is done by the
ultravisor before the intercept is caused, this reliably tells whether
the guest is enabled for external interrupts in the ext_new_psw.

Also update the comments to explain better what is happening.

[1] https://lore.kernel.org/kvm/20220812062151.1980937-4-nrb@linux.ibm.com/

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Fixes: 201ae986ea ("KVM: s390: protvirt: Implement interrupt injection")
Link: https://lore.kernel.org/r/20230213085520.100756-2-nrb@linux.ibm.com
Message-Id: <20230213085520.100756-2-nrb@linux.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-13 16:48:17 +02:00
..
alpha alpha: fix R_ALPHA_LITERAL reloc for large modules 2023-03-17 08:49:01 +01:00
arc arc: iounmap() arg is volatile 2022-11-03 23:59:15 +09:00
arm ARM: dts: imx6sl: tolino-shine2hd: fix usbotg1 pinctrl 2023-03-30 12:47:43 +02:00
arm64 KVM: arm64: Disable interrupts while walking userspace PTs 2023-04-05 11:25:01 +02:00
csky kprobes: treewide: Cleanup the error messages for kprobes 2023-02-22 12:57:00 +01:00
h8300 h8300: Fix build errors from do_exit() to make_task_dead() transition 2023-02-01 08:27:21 +01:00
hexagon hexagon: Fix function name in die() 2023-02-01 08:27:20 +01:00
ia64 genirq: Add and use an irq_data_update_affinity helper 2023-03-11 13:57:31 +01:00
m68k m68k: Only force 030 bus error if PC not in exception table 2023-03-30 12:47:53 +02:00
microblaze exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
mips mips: bmips: BCM6358: disable RAC flush for TP1 2023-04-05 11:24:54 +02:00
nds32 exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
nios2 exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
openrisc exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
parisc genirq: Add and use an irq_data_update_affinity helper 2023-03-11 13:57:31 +01:00
powerpc powerpc: Don't try to copy PPR for task with NULL pt_regs 2023-04-05 11:25:00 +02:00
riscv riscv: Handle zicsr/zifencei issues between clang and binutils 2023-03-30 12:47:59 +02:00
s390 KVM: s390: pv: fix external interruption loop not always detected 2023-04-13 16:48:17 +02:00
sh sh: sanitize the flags on sigreturn 2023-03-30 12:47:54 +02:00
sparc sparc: allow PM configs for sparc32 COMPILE_TEST 2023-03-10 09:39:33 +01:00
um UML: define RUNTIME_DISCARD_EXIT 2023-03-17 08:49:04 +01:00
x86 x86/PVH: avoid 32-bit build warning when obtaining VGA console info 2023-04-05 11:25:02 +02:00
xtensa xtensa: fix KASAN report for show_stack 2023-04-05 11:25:00 +02:00
.gitignore
Kconfig arch: make TRACE_IRQFLAGS_NMI_SUPPORT generic 2022-08-17 14:23:00 +02:00