linux-stable/drivers/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
..
events xen/events: increment refcnt only if event channel is refcounted 2024-03-26 18:17:34 -04:00
xen-pciback xen-pciback: Consider INTx disabled when MSI/MSI-X is enabled 2023-10-16 15:20:31 +02:00
xenbus xen/xenbus: document will_handle argument for xenbus_watch_path() 2024-02-12 18:03:14 +01:00
xenfs xen: remove unnecessary (void*) conversions 2023-03-16 12:04:00 +01:00
Kconfig xen: privcmd: Add support for ioeventfd 2023-10-16 15:18:33 +02:00
Makefile
acpi.c
arm-device.c
balloon.c x86/xen: attempt to inflate the memory balloon on PVH 2024-04-13 13:10:10 +02:00
biomerge.c
cpu_hotplug.c
dbgp.c
efi.c
evtchn.c xen/evtchn: avoid WARN() when unbinding an event channel 2024-03-26 18:17:34 -04:00
features.c
gntalloc.c xen/gntalloc: Replace UAPI 1-element array 2024-02-13 09:06:48 +01:00
gntdev-common.h
gntdev-dmabuf.c xen/gntdev: Fix the abuse of underlying struct page in DMA-buf import 2024-01-10 07:32:40 +01:00
gntdev-dmabuf.h
gntdev.c mm: replace vma->vm_flags direct modifications with modifier calls 2023-02-09 16:51:39 -08:00
grant-dma-iommu.c xen/grant-dma-iommu: Implement a dummy probe_device() callback 2023-02-13 07:22:08 +01:00
grant-dma-ops.c xen/virtio: Fix NULL deref when a bridge of PCI root bus has no parent 2023-07-04 08:18:21 +02:00
grant-table.c locking/atomic, xen: Use sync_try_cmpxchg() instead of sync_cmpxchg() 2023-10-09 18:14:34 +02:00
manage.c
mcelog.c
mem-reservation.c
pci.c
pcpu.c xen: pcpu: make xen_pcpu_subsys const 2024-02-13 09:03:31 +01:00
platform-pci.c xen: simplify evtchn_do_upcall() call maze 2023-09-19 07:04:49 +02:00
privcmd-buf.c mm: replace vma->vm_flags direct modifications with modifier calls 2023-02-09 16:51:39 -08:00
privcmd.c xen/privcmd: Use memdup_array_user() in alloc_ioreq() 2024-02-13 08:58:21 +01:00
privcmd.h
pvcalls-back.c workqueue: Ordered workqueue creation cleanups 2023-06-27 16:46:06 -07:00
pvcalls-front.c xen/pvcalls: don't call bind_evtchn_to_irqhandler() under lock 2023-04-24 07:27:10 +02:00
pvcalls-front.h
swiotlb-xen.c swiotlb-xen: provide the "max_mapping_size" method 2023-11-17 10:45:46 +01:00
sys-hypervisor.c xen: sysfs: make kobj_type structure constant 2023-02-18 16:50:21 +01:00
time.c
unpopulated-alloc.c
xen-acpi-pad.c
xen-acpi-processor.c xen: Switch to use kmemdup() helper 2023-08-21 09:54:05 +02:00
xen-balloon.c xen: balloon: make balloon_subsys const 2024-02-13 09:03:34 +01:00
xen-front-pgdir-shbuf.c xen/shbuf: eliminate 17 kernel-doc warnings 2023-11-13 08:14:42 +01:00
xen-scsiback.c scsi: target: Have drivers report if they support direct submissions 2023-10-13 15:53:57 -04:00
xlate_mmu.c