android_kernel_xiaomi_sm8450/arch/powerpc
Laurent Vivier 9230af9188 KVM: PPC: Tick accounting should defer vtime accounting 'til after IRQ handling
[ Upstream commit 235cee162459d96153d63651ce7ff51752528c96 ]

Commit 112665286d08 ("KVM: PPC: Book3S HV: Context tracking exit guest
context before enabling irqs") moved guest_exit() into the interrupt
protected area to avoid wrong context warning (or worse). The problem is
that tick-based time accounting has not yet been updated at this point
(because it depends on the timer interrupt firing), so the guest time
gets incorrectly accounted to system time.

To fix the problem, follow the x86 fix in commit 160457140187 ("Defer
vtime accounting 'til after IRQ handling"), and allow host IRQs to run
before accounting the guest exit time.

In the case vtime accounting is enabled, this is not required because TB
is used directly for accounting.

Before this patch, with CONFIG_TICK_CPU_ACCOUNTING=y in the host and a
guest running a kernel compile, the 'guest' fields of /proc/stat are
stuck at zero. With the patch they can be observed increasing roughly as
expected.

Fixes: e233d54d4d ("KVM: booke: use __kvm_guest_exit")
Fixes: 112665286d08 ("KVM: PPC: Book3S HV: Context tracking exit guest context before enabling irqs")
Cc: stable@vger.kernel.org # 5.12+
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
[np: only required for tick accounting, add Book3E fix, tweak changelog]
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211027142150.3711582-1-npiggin@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-09-23 14:16:55 +02:00
..
boot powerpc: dts: t104xrdb: fix phy type for FMAN 4/5 2022-04-13 21:00:55 +02:00
configs powerpc/config: Renable MTD_PHYSMAP_OF 2021-09-18 13:40:14 +02:00
crypto crypto: powerpc/crc-vpmsum_test - Fix sparse endianness warning 2020-09-04 17:57:15 +10:00
include powerpc/bpf: Fix use of user_pt_regs in uapi 2022-07-07 17:52:15 +02:00
kernel powerpc: align syscall table for ppc32 2022-09-08 11:11:37 +02:00
kexec powerpc: Set crashkernel offset to mid of RMA region 2022-04-13 21:00:56 +02:00
kvm KVM: PPC: Tick accounting should defer vtime accounting 'til after IRQ handling 2022-09-23 14:16:55 +02:00
lib powerpc/lib/sstep: Fix build errors with newer binutils 2022-04-08 14:40:36 +02:00
math-emu
mm powerpc/ptdump: Fix display of RW pages on FSL_BOOK3E 2022-08-21 15:15:26 +02:00
net powerpc64/bpf: Limit 'ldbrx' to processors compliant with ISA v2.06 2022-02-01 17:25:45 +01:00
oprofile powerpc/oprofile: fix spelling mistake "contex" -> "context" 2020-08-25 01:31:33 +10:00
perf powerpc/perf: Optimize clearing the pending PMI and remove WARN_ON for PMI check in power_pmu_disable 2022-08-21 15:16:06 +02:00
platforms powerpc/32: Don't always pass -mcpu=powerpc to the compiler 2022-08-25 11:38:20 +02:00
purgatory powerpc/kexec_file: Enable early kernel OPAL calls 2020-07-29 23:47:55 +10:00
sysdev powerpc/xive: Fix refcount leak in xive_get_max_prio 2022-08-21 15:16:11 +02:00
tools powerpc/tools: Remove 90 line limit in checkpatch script 2020-09-08 22:57:11 +10:00
xmon powerpc/xmon: Change printk() to pr_cont() 2020-12-30 11:54:16 +01:00
Kbuild powerpc/kexec: Move kexec files into a dedicated subdir. 2019-11-21 15:41:34 +11:00
Kconfig powerpc/kasan: Force thread size increase with KASAN 2022-06-14 18:32:39 +02:00
Kconfig.debug powerpc: iommu: fix build when neither PCI or IBMVIO is set 2021-05-14 09:50:34 +02:00
Makefile powerpc/32: Don't always pass -mcpu=powerpc to the compiler 2022-08-25 11:38:20 +02:00
Makefile.postlink powerpc: unrel_branch_check.sh: use nm to find symbol value 2020-09-02 11:00:22 +10:00