linux-kernelorg-stable/arch/mips
Mark Rutland 72e3244512 kvm/mips: rework guest entry logic
In kvm_arch_vcpu_ioctl_run() we use guest_enter_irqoff() and
guest_exit_irqoff() directly, with interrupts masked between these. As
we don't handle any timer ticks during this window, we will not account
time spent within the guest as guest time, which is unfortunate.

Additionally, we do not inform lockdep or tracing that interrupts will
be enabled during guest execution, which caan lead to misleading traces
and warnings that interrupts have been enabled for overly-long periods.

This patch fixes these issues by using the new timing and context
entry/exit helpers to ensure that interrupts are handled during guest
vtime but with RCU watching, with a sequence:

	guest_timing_enter_irqoff();

	guest_state_enter_irqoff();
	< run the vcpu >
	guest_state_exit_irqoff();

	< take any pending IRQs >

	guest_timing_exit_irqoff();

In addition, as guest exits during the "run the vcpu" step are handled
by kvm_mips_handle_exit(), a wrapper function is added which ensures
that such exists are handled with a sequence:

	guest_state_exit_irqoff();
	< handle the exit >
	guest_state_enter_irqoff();

This means that exits which stop the vCPU running will have a redundant
guest_state_enter_irqoff() .. guest_state_exit_irqoff() sequence, which
can be addressed with future rework.

Since instrumentation may make use of RCU, we must also ensure that no
instrumented code is run during the EQS. I've split out the critical
section into a new kvm_mips_enter_exit_vcpu() helper which is marked
noinstr.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Paul E. McKenney <paulmck@kernel.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Message-Id: <20220201132926.3301912-6-mark.rutland@arm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-02-01 08:51:53 -05:00
..
alchemy
ar7
ath25
ath79
bcm47xx
bcm63xx mips: bcm63xx: add support for clk_get_parent() 2021-11-16 09:27:28 +01:00
bmips
boot MIPS: boot/compressed/: add __ashldi3 to target for ZSTD compression 2021-11-25 10:13:41 +01:00
cavium-octeon - added printing of CPU options for /proc/cpuinfo 2021-11-05 08:13:19 -07:00
cobalt
configs MIPS: Update bmips_stb_defconfig 2021-11-09 16:08:24 +01:00
crypto
dec MIPS: Allow modules to set board_be_handler 2021-11-09 16:07:26 +01:00
fw
generic MIPS: generic/yamon-dt: fix uninitialized variable error 2021-11-16 09:27:01 +01:00
include Merge branch 'kvm-pi-raw-spinlock' into HEAD 2022-01-19 12:14:02 -05:00
ingenic
jazz
kernel MIPS: loongson64: fix FTLB configuration 2021-11-25 16:46:31 +01:00
kvm kvm/mips: rework guest entry logic 2022-02-01 08:51:53 -05:00
lantiq mips: lantiq: add support for clk_get_parent() 2021-11-16 09:27:40 +01:00
lib
loongson2ef
loongson32
loongson64 Merge branch 'akpm' (patches from Andrew) 2021-11-06 14:08:17 -07:00
math-emu
mm Merge branch 'akpm' (patches from Andrew) 2021-11-06 14:08:17 -07:00
mti-malta
n64
net mips, bpf: Fix reference to non-existing Kconfig symbol 2021-11-30 17:19:36 +01:00
pci MIPS: Only define pci_remap_iospace() for Ralink 2021-12-09 10:22:24 +01:00
pic32
power
ralink
rb532
sgi-ip22 MIPS: Allow modules to set board_be_handler 2021-11-09 16:07:26 +01:00
sgi-ip27 - Config updates for BMIPS platform 2021-11-13 09:11:33 -08:00
sgi-ip30 memblock: rename memblock_free to memblock_phys_free 2021-11-06 13:30:41 -07:00
sgi-ip32 MIPS: Allow modules to set board_be_handler 2021-11-09 16:07:26 +01:00
sibyte - Config updates for BMIPS platform 2021-11-13 09:11:33 -08:00
sni
tools
txx9 MIPS: Allow modules to set board_be_handler 2021-11-09 16:07:26 +01:00
vdso MIPS: VDSO: remove -nostdlib compiler flag 2021-11-09 16:09:37 +01:00
vr41xx
Kbuild
Kbuild.platforms MIPS: fix duplicated slashes for Platform file path 2021-11-09 16:11:52 +01:00
Kconfig MIPS: use 3-level pgtable for 64KB page size on MIPS_VA_BITS_48 2021-11-25 16:52:11 +01:00
Kconfig.debug
Makefile - Config updates for BMIPS platform 2021-11-13 09:11:33 -08:00
Makefile.postlink