android_kernel_motorola_sm6375/arch/x86
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Dongli Zhang 8a7462b521 xen: delay xen_hvm_init_time_ops() if kdump is boot on vcpu>=32
[ Upstream commit eed05744322da07dd7e419432dcedf3c2e017179 ]

The sched_clock() can be used very early since commit 857baa87b6
("sched/clock: Enable sched clock early"). In addition, with commit
38669ba205 ("x86/xen/time: Output xen sched_clock time from 0"), kdump
kernel in Xen HVM guest may panic at very early stage when accessing
&__this_cpu_read(xen_vcpu)->time as in below:

setup_arch()
 -> init_hypervisor_platform()
     -> x86_init.hyper.init_platform = xen_hvm_guest_init()
         -> xen_hvm_init_time_ops()
             -> xen_clocksource_read()
                 -> src = &__this_cpu_read(xen_vcpu)->time;

This is because Xen HVM supports at most MAX_VIRT_CPUS=32 'vcpu_info'
embedded inside 'shared_info' during early stage until xen_vcpu_setup() is
used to allocate/relocate 'vcpu_info' for boot cpu at arbitrary address.

However, when Xen HVM guest panic on vcpu >= 32, since
xen_vcpu_info_reset(0) would set per_cpu(xen_vcpu, cpu) = NULL when
vcpu >= 32, xen_clocksource_read() on vcpu >= 32 would panic.

This patch calls xen_hvm_init_time_ops() again later in
xen_hvm_smp_prepare_boot_cpu() after the 'vcpu_info' for boot vcpu is
registered when the boot vcpu is >= 32.

This issue can be reproduced on purpose via below command at the guest
side when kdump/kexec is enabled:

"taskset -c 33 echo c > /proc/sysrq-trigger"

The bugfix for PVM is not implemented due to the lack of testing
environment.

[boris: xen_hvm_init_time_ops() returns on errors instead of jumping to end]

Cc: Joe Jin <[email protected]>
Signed-off-by: Dongli Zhang <[email protected]>
Reviewed-by: Boris Ostrovsky <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Boris Ostrovsky <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
2022-04-15 14:18:35 +02:00
..
boot x86/boot: Add .text.* to setup.ld 2021-06-16 11:59:38 +02:00
configs
crypto crypto: x86/aes-ni-xts - use direct calls to and 4-way stride 2021-03-20 10:39:47 +01:00
entry x86/asm/32: Add ENDs to some functions and relabel with SYM_CODE_* 2021-01-17 14:05:30 +01:00
events perf/x86/intel/pt: Fix address filter config for 32-bit kernel 2022-04-15 14:18:06 +02:00
hyperv x86/hyperv: Fix NULL deref in set_hv_tscchange_cb() if Hyper-V setup fails 2021-11-26 10:47:21 +01:00
ia32
include x86/cpu: Add hardware-enforced cache coherency as a CPUID feature 2022-03-16 13:21:48 +01:00
kernel KVM: x86: fix sending PV IPI 2022-04-15 14:18:27 +02:00
kvm KVM: x86/svm: Clear reserved bits written to PerfEvtSeln MSRs 2022-04-15 14:18:31 +02:00
lib x86/msr: Fix wr/rdmsr_safe_regs_on_cpu() prototypes 2021-05-22 11:38:27 +02:00
math-emu
mm x86/mm/pat: Don't flush cache if hardware enforces cache coherency across encryption domnains 2022-03-16 13:21:48 +01:00
net bpf: Introduce BPF nospec instruction for mitigating Spectre v4 2021-09-15 09:47:38 +02:00
oprofile
pci PCI: Add AMD RS690 quirk to enable 64-bit DMA 2021-06-30 08:47:49 -04:00
platform x86/sme: Explicitly map new EFI memmap table as encrypted 2021-12-14 14:49:02 +01:00
power x86/asm/32: Add ENDs to some functions and relabel with SYM_CODE_* 2021-01-17 14:05:30 +01:00
purgatory
ras
realmode x86/mm: Flush global TLB when switching to trampoline page-table 2022-01-27 09:19:42 +01:00
tools x86/tools: Fix objdump version check again 2021-08-18 08:57:01 +02:00
um um: registers: Rename function names to avoid conflicts and build problems 2022-01-27 09:19:45 +01:00
video
xen xen: delay xen_hvm_init_time_ops() if kdump is boot on vcpu>=32 2022-04-15 14:18:35 +02:00
.gitignore
Kbuild
Kconfig x86/sme: Explicitly map new EFI memmap table as encrypted 2021-12-14 14:49:02 +01:00
Kconfig.cpu
Kconfig.debug
Makefile x86/build: Propagate $(CLANG_FLAGS) to $(REALMODE_FLAGS) 2021-05-11 14:04:06 +02:00
Makefile.um
Makefile_32.cpu