linux/Documentation
Nico Boehr 2bf8b1c111 KVM: s390: pv: don't allow userspace to set the clock under PV
[ Upstream commit 6973091d1b ]

When running under PV, the guest's TOD clock is under control of the
ultravisor and the hypervisor isn't allowed to change it. Hence, don't
allow userspace to change the guest's TOD clock by returning
-EOPNOTSUPP.

When userspace changes the guest's TOD clock, KVM updates its
kvm.arch.epoch field and, in addition, the epoch field in all state
descriptions of all VCPUs.

But, under PV, the ultravisor will ignore the epoch field in the state
description and simply overwrite it on next SIE exit with the actual
guest epoch. This leads to KVM having an incorrect view of the guest's
TOD clock: it has updated its internal kvm.arch.epoch field, but the
ultravisor ignores the field in the state description.

Whenever a guest is now waiting for a clock comparator, KVM will
incorrectly calculate the time when the guest should wake up, possibly
causing the guest to sleep for much longer than expected.

With this change, kvm_s390_set_tod() will now take the kvm->lock to be
able to call kvm_s390_pv_is_protected(). Since kvm_s390_set_tod_clock()
also takes kvm->lock, use __kvm_s390_set_tod_clock() instead.

The function kvm_s390_set_tod_clock is now unused, hence remove it.
Update the documentation to indicate the TOD clock attr calls can now
return -EOPNOTSUPP.

Fixes: 0f30350471 ("KVM: s390: protvirt: Do only reset registers that are accessible")
Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Link: https://lore.kernel.org/r/20221011160712.928239-2-nrb@linux.ibm.com
Message-Id: <20221011160712.928239-2-nrb@linux.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-11-16 09:57:10 +01:00
..
ABI iio: ABI: Fix wrong format of differential capacitance channel ABI. 2022-10-26 13:25:30 +02:00
accounting
admin-guide x86/bugs: Add "unknown" reporting for MMIO Stale Data 2022-08-31 17:15:22 +02:00
arm
arm64 arm64: errata: Remove AES hwcap for COMPAT tasks 2022-10-30 09:41:16 +01:00
block
bpf
cdrom
core-api Revert "swiotlb: fix info leak with DMA_FROM_DEVICE" 2022-05-25 09:17:55 +02:00
cpu-freq
crypto
dev-tools
devicetree ARM: dts: fix Moxa SDIO 'compatible', remove 'sdhci' misnomer 2022-10-15 07:55:52 +02:00
doc-guide
driver-api vfio: Split creation of a vfio_device into init and register ops 2022-08-21 15:16:07 +02:00
fault-injection
fb
features
filesystems ext4, doc: fix incorrect h_reserved size 2022-04-27 13:53:57 +02:00
firmware_class
firmware-guide Documentation: ACPI: EINJ: Fix obsolete example 2022-08-25 11:37:53 +02:00
fpga
gpu
hid
hwmon
i2c
ia64
ide
iio
infiniband
input Input: iforce - add support for Boeder Force Feedback Wheel 2022-09-20 12:38:32 +02:00
isdn
kbuild
kernel-hacking
leds
litmus-tests
livepatch
locking
m68k
maintainer
mhi
mips
misc-devices
netlabel
networking Documentation: fix sctp_wmem in ip-sysctl.rst 2022-08-03 12:00:47 +02:00
nios2
nvdimm
openrisc
parisc
PCI
pcmcia
power
powerpc
process docs: update mediator information in CoC docs 2022-10-15 07:55:50 +02:00
RCU
riscv
s390
scheduler
scsi
security
sh
sound
sparc
sphinx
sphinx-static
spi
staging
target
timers
trace tracing/histogram: Update document for KEYS_MAX size 2022-11-10 18:14:26 +01:00
translations
usb
userspace-api
virt KVM: s390: pv: don't allow userspace to set the clock under PV 2022-11-16 09:57:10 +01:00
vm arm: remove CONFIG_ARCH_HAS_HOLES_MEMORYMODEL 2022-05-15 20:00:09 +02:00
w1
watchdog
x86
xtensa
.gitignore
asm-annotations.rst
atomic_bitops.txt locking/atomic: Make test_and_*_bit() ordered on failure 2022-08-25 11:38:10 +02:00
atomic_t.txt
Changes
CodingStyle
conf.py docs/conf.py: Cope with removal of language=None in Sphinx 5.0.0 2022-06-09 10:21:28 +02:00
COPYING-logo
docutils.conf
dontdiff
index.rst
Kconfig
logo.gif
Makefile
memory-barriers.txt
SubmittingPatches
watch_queue.rst