linux-stable/arch/x86/xen
Roger Pau Monne 659019909b x86/xen: attempt to inflate the memory balloon on PVH
[ Upstream commit 38620fc4e8 ]

When running as PVH or HVM Linux will use holes in the memory map as scratch
space to map grants, foreign domain pages and possibly miscellaneous other
stuff.  However the usage of such memory map holes for Xen purposes can be
problematic.  The request of holesby Xen happen quite early in the kernel boot
process (grant table setup already uses scratch map space), and it's possible
that by then not all devices have reclaimed their MMIO space.  It's not
unlikely for chunks of Xen scratch map space to end up using PCI bridge MMIO
window memory, which (as expected) causes quite a lot of issues in the system.

At least for PVH dom0 we have the possibility of using regions marked as
UNUSABLE in the e820 memory map.  Either if the region is UNUSABLE in the
native memory map, or it has been converted into UNUSABLE in order to hide RAM
regions from dom0, the second stage translation page-tables can populate those
areas without issues.

PV already has this kind of logic, where the balloon driver is inflated at
boot.  Re-use the current logic in order to also inflate it when running as
PVH.  onvert UNUSABLE regions up to the ratio specified in EXTRA_MEM_RATIO to
RAM, while reserving them using xen_add_extra_mem() (which is also moved so
it's no longer tied to CONFIG_PV).

[jgross: fixed build for CONFIG_PVH without CONFIG_XEN_PVH]

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/20240220174341.56131-1-roger.pau@citrix.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-13 13:10:10 +02:00
..
Kconfig x86/xen: add CPU dependencies for 32-bit build 2023-12-21 08:30:25 +01:00
Makefile x86/PVH: obtain VGA console info in Dom0 2023-03-14 15:20:51 +01:00
apic.c x86/apic: Use u32 for [gs]et_apic_id() 2023-10-10 14:38:19 +02:00
debugfs.c
debugfs.h
efi.c xen/efi: refactor deprecated strncpy 2023-09-19 07:04:49 +02:00
enlighten.c x86/xen: attempt to inflate the memory balloon on PVH 2024-04-13 13:10:10 +02:00
enlighten_hvm.c xen: simplify evtchn_do_upcall() call maze 2023-09-19 07:04:49 +02:00
enlighten_pv.c x86/entry: Convert INT 0x80 emulation to IDTENTRY 2023-12-07 09:51:29 -08:00
enlighten_pvh.c x86/xen: attempt to inflate the memory balloon on PVH 2024-04-13 13:10:10 +02:00
grant-table.c x86/xen: open code alloc_vm_area in arch_gnttab_valloc 2020-10-18 09:27:10 -07:00
irq.c x86/paravirt: Move some functions and defines to alternative.c 2023-12-10 20:30:31 +01:00
mmu.c
mmu.h
mmu_hvm.c proc/vmcore: convert oldmem_pfn_is_ram callback to more generic vmcore callbacks 2021-11-09 10:02:48 -08:00
mmu_pv.c mm/treewide: replace pud_large() with pud_leaf() 2024-04-10 16:38:00 +02:00
multicalls.c
multicalls.h x86/xen: move paravirt lazy code 2023-09-19 07:04:49 +02:00
p2m.c x86/xen: Remove the unused function p2m_index() 2023-01-09 07:54:28 +01:00
platform-pci-unplug.c x86: xen: platform-pci-unplug: use pr_err() and pr_warn() instead of raw printk() 2021-08-30 12:09:54 +02:00
pmu.c x86/xen: silence smatch warning in pmu_msr_chk_emulated() 2022-11-03 10:23:26 +01:00
pmu.h xen: fix is_xen_pmu() 2022-03-25 14:22:53 -05:00
setup.c x86/xen: attempt to inflate the memory balloon on PVH 2024-04-13 13:10:10 +02:00
smp.c x86/xen: Add some null pointer checking to smp.c 2024-02-12 20:14:52 +01:00
smp.h x86: xen: add missing prototypes 2023-06-26 07:47:11 +02:00
smp_hvm.c x86/smpboot: Switch to hotplug core state synchronization 2023-05-15 13:44:56 +02:00
smp_pv.c x86/xen/pv: Pretend that it found SMP configuration 2023-08-09 11:58:21 -07:00
spinlock.c x86/xen: Fix memory leak in xen_init_lock_cpu() 2022-12-05 12:59:50 +01:00
suspend.c
suspend_hvm.c x86/xen: Add support for HVMOP_set_evtchn_upcall_vector 2022-08-12 11:28:21 +02:00
suspend_pv.c locking/seqlock, headers: Untangle the spaghetti monster 2020-08-06 16:13:13 +02:00
time.c x86/tsc: Provide sched_clock_noinstr() 2023-06-05 21:11:08 +02:00
trace.c
vga.c x86/PVH: obtain VGA console info in Dom0 2023-03-14 15:20:51 +01:00
xen-asm.S x86/entry: Convert INT 0x80 emulation to IDTENTRY 2023-12-07 09:51:29 -08:00
xen-head.S x86/Xen: tidy xen-head.S 2023-07-04 06:57:38 +02:00
xen-ops.h x86/xen: attempt to inflate the memory balloon on PVH 2024-04-13 13:10:10 +02:00