linux/arch/s390
Sumanth Korikkar 1a65b73ae9 s390/mm: allocate vmemmap pages from self-contained memory range
Allocate memory map (struct pages array) from the hotplugged memory
range, rather than using system memory. The change addresses the issue
where standby memory, when configured to be much larger than online
memory, could potentially lead to ipl failure due to memory map
allocation from online memory. For example, 16MB of memory map
allocation is needed for a memory block size of 1GB and when standby
memory is configured much larger than online memory, this could lead to
ipl failure.

To address this issue, the solution involves introducing "memmap on
memory" using the vmem_altmap structure on s390.  Architectures that
want to implement it should pass the altmap to the vmemmap_populate()
function and its associated callchain. This enhancement is discussed in
commit 4b94ffdc41 ("x86, mm: introduce vmem_altmap to augment
vmemmap_populate()")

Provide "memmap on memory" support for s390 by passing the altmap in
vmemmap_populate() and its callchain. The allocation path is described
as follows:
* When altmap is NULL in vmemmap_populate(), memory map allocation
  occurs using the existing vmemmap_alloc_block_buf().
* When altmap is not NULL in vmemmap_populate(), memory map allocation
  still uses vmemmap_alloc_block_buf(), but this function internally
  calls altmap_alloc_block_buf().

For deallocation, the process is outlined as follows:
* When altmap is NULL in vmemmap_free(), memory map deallocation happens
  through free_pages().
* When altmap is not NULL in vmemmap_free(), memory map deallocation
  occurs via vmem_altmap_free().

While memory map allocation is primarily handled through the
self-contained memory map range, there might still be a small amount of
system memory allocation required for vmemmap pagetables. To mitigate
this impact, this feature will be limited to machines with EDAT1
support.

Link: https://lkml.kernel.org/r/20240108132747.3238763-3-sumanthk@linux.ibm.com
Reviewed-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-02-21 16:00:02 -08:00
..
appldata S390: Remove now superfluous sentinel elem from ctl_table arrays 2023-10-10 15:22:02 -07:00
boot s390/boot: always align vmalloc area on segment boundary 2023-11-22 14:07:28 +01:00
configs vfs-6.8.netfs 2024-01-19 09:10:23 -08:00
crypto s390 updates for 6.8 merge window 2024-01-10 18:18:20 -08:00
hypfs hypfs: convert to new timestamp accessors 2023-10-18 13:26:15 +02:00
include work around gcc bugs with 'asm goto' with outputs 2024-02-09 15:57:48 -08:00
kernel s390 updates for 6.8 merge window part 2 2024-01-18 14:11:25 -08:00
kvm pqap instruction missing cc fix 2024-01-26 12:57:12 -05:00
lib s390/nmi: implement and use local_mcck_save() / local_mcck_restore() 2023-12-11 14:33:05 +01:00
mm s390/mm: allocate vmemmap pages from self-contained memory range 2024-02-21 16:00:02 -08:00
net s390/bpf: Fix gotol with large offsets 2024-01-04 11:35:40 -08:00
pci s390/pci: fix max size calculation in zpci_memcpy_toio() 2024-01-11 18:22:58 +01:00
purgatory s390 updates for 6.5 merge window part 2 2023-07-06 13:18:30 -07:00
tools s390/als: add vector facility to z13 architecture level set 2023-12-11 14:33:07 +01:00
Kbuild - An extensive rework of kexec and crash Kconfig from Eric DeVolder 2023-08-29 14:53:51 -07:00
Kconfig s390/kexec: do not automatically select KEXEC option 2024-01-11 18:22:58 +01:00
Kconfig.debug s390/Kconfig.debug: fix indentation 2022-06-01 12:03:15 +02:00
Makefile kbuild: unify vdso_install rules 2023-10-28 21:09:02 +09:00