linux-stable/Documentation
Nico Boehr 119407dc32 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:58:17 +01:00
..
ABI iio: ABI: Fix wrong format of differential capacitance channel ABI. 2022-10-26 12:35:02 +02:00
accounting sched/psi: report zeroes for CPU full at the system level 2022-06-09 10:22:48 +02:00
admin-guide x86/bugs: Add "unknown" reporting for MMIO Stale Data 2022-08-31 17:16:47 +02:00
arm Documentation: arm: marvell: Add 88F6825 model into list 2021-08-24 13:26:32 -06:00
arm64 arm64: errata: Remove AES hwcap for COMPAT tasks 2022-10-29 10:12:53 +02:00
block Documentation: block: blk-mq: Fix small typo in multi-queue docs 2021-08-24 13:30:00 -06:00
bpf
cdrom
core-api Reinstate some of "swiotlb: rework "fix info leak with DMA_FROM_DEVICE"" 2022-04-08 14:24:13 +02:00
cpu-freq cpufreq: Remove ready() callback 2021-09-02 18:04:17 +02:00
crypto
dev-tools kfence: default to dynamic branch instead of static keys mode 2021-11-12 15:05:49 +01:00
devicetree ARM: dts: fix Moxa SDIO 'compatible', remove 'sdhci' misnomer 2022-10-12 09:53:27 +02:00
doc-guide
driver-api firmware: sysfb: Add sysfb_disable() helper function 2022-07-21 21:24:35 +02:00
fault-injection Char / Misc driver changes for 5.15-rc1 2021-09-01 08:35:06 -07:00
fb
features RISC-V Patches for the 5.15 Merge Window, Part 2 2021-09-11 14:29:42 -07:00
filesystems fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE 2022-10-26 12:34:27 +02:00
firmware-guide Documentation: ACPI: EINJ: Fix obsolete example 2022-08-25 11:40:01 +02:00
firmware_class
fpga
gpu drm/i915/display: Move DRRS code its own file 2022-03-08 19:12:40 +01:00
hid
hwmon hwmon: (lm90) Add basic support for TI TMP461 2021-12-29 12:28:48 +01:00
i2c
ia64
ide
iio
infiniband
input Input: iforce - add support for Boeder Force Feedback Wheel 2022-09-20 12:39:45 +02:00
isdn
kbuild Merge branch 'akpm' (patches from Andrew) 2021-09-08 12:55:35 -07:00
kernel-hacking docs: kernel-hacking: Remove inappropriate text 2021-09-03 15:56:45 -06:00
leds
litmus-tests
livepatch
locking Documentation/locking/locktypes: Update migrate_disable() bits. 2021-12-14 10:57:18 +01:00
m68k
maintainer
mhi
mips
misc-devices
netlabel
networking Documentation: fix sctp_wmem in ip-sysctl.rst 2022-08-03 12:03:49 +02:00
nios2
nvdimm
openrisc
parisc
PCI pci-v5.15-changes 2021-09-07 19:13:42 -07:00
pcmcia
power Documentation: power: include kernel-doc in Energy Model doc 2021-09-07 21:17:28 +02:00
powerpc powerpc/doc: Fix htmldocs errors 2021-08-27 00:56:34 +10:00
process docs: update mediator information in CoC docs 2022-10-12 09:53:26 +02:00
RCU
riscv
s390
scheduler
scsi
security
sh
sound ALSA: usb-audio: Add quirk bits for enabling/disabling generic implicit fb 2022-06-09 10:22:41 +02:00
sparc
sphinx docs: sphinx/requirements: Limit jinja2<3.1 2022-04-08 14:22:49 +02:00
sphinx-static
spi
staging
target
timers
trace tracing/histogram: Update document for KEYS_MAX size 2022-11-10 18:15:38 +01:00
translations Merge branch 'gcc-min-version-5.1' (make gcc-5.1 the minimum version) 2021-09-13 10:43:04 -07:00
tty/device_drivers serial: 8250: Add proper clock handling for OxSemi PCIe devices 2022-08-17 14:24:23 +02:00
usb
userspace-api media: hevc: Embedded indexes in RPS 2022-08-17 14:23:31 +02:00
virt KVM: s390: pv: don't allow userspace to set the clock under PV 2022-11-16 09:58:17 +01:00
vm Merge branch 'akpm' (patches from Andrew) 2021-09-08 12:55:35 -07:00
w1
watchdog
x86 Another collection of documentation patches, mostly fixes but also includes 2021-09-08 16:28:14 -07:00
xtensa
.gitignore
arch.rst
asm-annotations.rst
atomic_bitops.txt locking/atomic: Make test_and_*_bit() ordered on failure 2022-08-25 11:39:54 +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:23:30 +02:00
COPYING-logo
docutils.conf
dontdiff
index.rst
Kconfig
logo.gif
Makefile
memory-barriers.txt
SubmittingPatches
watch_queue.rst