linux/arch/x86/xen
Juergen Gross 4bc0d1b535 xen: fix setting of max_pfn in shared_info
commit 4b511d5bfa74b1926daefd1694205c7f1bcf677f upstream.

Xen PV guests are specifying the highest used PFN via the max_pfn
field in shared_info. This value is used by the Xen tools when saving
or migrating the guest.

Unfortunately this field is misnamed, as in reality it is specifying
the number of pages (including any memory holes) of the guest, so it
is the highest used PFN + 1. Renaming isn't possible, as this is a
public Xen hypervisor interface which needs to be kept stable.

The kernel will set the value correctly initially at boot time, but
when adding more pages (e.g. due to memory hotplug or ballooning) a
real PFN number is stored in max_pfn. This is done when expanding the
p2m array, and the PFN stored there is even possibly wrong, as it
should be the last possible PFN of the just added P2M frame, and not
one which led to the P2M expansion.

Fix that by setting shared_info->max_pfn to the last possible PFN + 1.

Fixes: 98dd166ea3 ("x86/xen/p2m: hint at the last populated P2M entry")
Cc: stable@vger.kernel.org
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Link: https://lore.kernel.org/r/20210730092622.9973-2-jgross@suse.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-22 12:26:20 +02:00
..
Kconfig
Makefile
apic.c
debugfs.c
debugfs.h
efi.c
enlighten.c
enlighten_hvm.c x86/xen: Add xen_no_vector_callback option to test PCI INTX delivery 2021-01-27 11:47:45 +01:00
enlighten_pv.c x86/xen: disable Firmware First mode for correctable memory errors 2020-11-01 12:01:05 +01:00
enlighten_pvh.c
grant-table.c
irq.c
mmu.c
mmu.h
mmu_hvm.c
mmu_pv.c
multicalls.c
multicalls.h
p2m.c xen: fix setting of max_pfn in shared_info 2021-09-22 12:26:20 +02:00
pci-swiotlb-xen.c
platform-pci-unplug.c
pmu.c
pmu.h
setup.c
smp.c
smp.h
smp_hvm.c
smp_pv.c x86: Fix early boot crash on gcc-10, third try 2020-05-20 08:20:34 +02:00
spinlock.c x86/xen: don't unbind uninitialized lock_kicker_irq 2020-12-02 08:49:48 +01:00
suspend.c
suspend_hvm.c
suspend_pv.c
time.c
trace.c
vdso.h
vga.c
xen-asm.S
xen-asm_32.S x86/asm/32: Add ENDs to some functions and relabel with SYM_CODE_* 2021-01-17 14:05:30 +01:00
xen-asm_64.S
xen-head.S
xen-ops.h