linux-stable/arch
Roger Pau Monne 4cd44fd345 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:07:39 +02:00
..
alpha rtc: Add support for configuring the UIP timeout for RTC reads 2024-01-31 16:18:56 -08:00
arc work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:24:47 +01:00
arm ARM: dts: rockchip: fix rk322x hdmi ports node 2024-04-13 13:07:30 +02:00
arm64 arm64: dts: rockchip: fix rk3399 hdmi ports node 2024-04-13 13:07:30 +02:00
csky work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:24:47 +01:00
hexagon hexagon: vmlinux.lds.S: handle attributes section 2024-04-03 15:28:55 +02:00
ia64 cpu-hotplug: Provide prototypes for arch CPU registration 2023-10-11 14:27:37 +02:00
loongarch LoongArch/crypto: Clean up useless assignment operations 2024-04-03 15:28:36 +02:00
m68k mm: Introduce flush_cache_vmap_early() 2024-02-16 19:10:52 +01:00
microblaze Microblaze patches for 6.6-rc1 2023-09-05 10:15:22 -07:00
mips MIPS: Clear Cause.BD in instruction_pointer_set 2024-03-26 18:19:10 -04:00
nios2 mm: Introduce flush_cache_vmap_early() 2024-02-16 19:10:52 +01:00
openrisc OpenRISC updates for 6.6 2023-09-05 10:09:31 -07:00
parisc prctl: generalize PR_SET_MDWE support check to be per-arch 2024-04-03 15:28:54 +02:00
powerpc mm/treewide: replace pud_large() with pud_leaf() 2024-04-10 16:35:46 +02:00
riscv riscv: process: Fix kernel gp leakage 2024-04-10 16:36:04 +02:00
s390 s390/entry: align system call table on 8 bytes 2024-04-10 16:36:04 +02:00
sh mm: Introduce flush_cache_vmap_early() 2024-02-16 19:10:52 +01:00
sparc mm/treewide: replace pud_large() with pud_leaf() 2024-04-10 16:35:46 +02:00
um um: Fix adding '-no-pie' for clang 2024-02-23 09:25:03 +01:00
x86 x86/xen: attempt to inflate the memory balloon on PVH 2024-04-13 13:07:39 +02:00
xtensa work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:24:47 +01:00
.gitignore
Kconfig scs: add CONFIG_MMU dependency for vfree_atomic() 2024-02-23 09:24:54 +01:00