summaryrefslogtreecommitdiff
path: root/arch/s390/boot/kaslr.c
diff options
context:
space:
mode:
authorVasily Gorbik <gor@linux.ibm.com>2023-02-10 17:47:06 +0300
committerHeiko Carstens <hca@linux.ibm.com>2023-02-14 13:45:40 +0300
commitaf0735269b72333d06e9677cb843bf5ce689a38c (patch)
tree02604174585bae1e3ef0225289090f0c02a57597 /arch/s390/boot/kaslr.c
parent55d169c87db1d0faa95313809f18f8b49cafdd75 (diff)
downloadlinux-af0735269b72333d06e9677cb843bf5ce689a38c.tar.xz
s390/mem_detect: do not truncate online memory ranges info
Commit bf64f0517e5d ("s390/mem_detect: handle online memory limit just once") introduced truncation of mem_detect online ranges based on identity mapping size. For kdump case however the full set of online memory ranges has to be feed into memblock_physmem_add so that crashed system memory could be extracted. Instead of truncating introduce a "usable limit" which is respected by mem_detect api. Also add extra online memory ranges iterator which still provides full set of online memory ranges disregarding the "usable limit". Fixes: bf64f0517e5d ("s390/mem_detect: handle online memory limit just once") Reported-by: Alexander Egorenkov <egorenar@linux.ibm.com> Tested-by: Alexander Egorenkov <egorenar@linux.ibm.com> Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch/s390/boot/kaslr.c')
-rw-r--r--arch/s390/boot/kaslr.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/s390/boot/kaslr.c b/arch/s390/boot/kaslr.c
index 70ff68dd1fee..3e3d846400b4 100644
--- a/arch/s390/boot/kaslr.c
+++ b/arch/s390/boot/kaslr.c
@@ -132,7 +132,7 @@ static unsigned long count_valid_kernel_positions(unsigned long kernel_size,
unsigned long start, end, pos = 0;
int i;
- for_each_mem_detect_block(i, &start, &end) {
+ for_each_mem_detect_usable_block(i, &start, &end) {
if (_min >= end)
continue;
if (start >= _max)
@@ -153,7 +153,7 @@ static unsigned long position_to_address(unsigned long pos, unsigned long kernel
unsigned long start, end;
int i;
- for_each_mem_detect_block(i, &start, &end) {
+ for_each_mem_detect_usable_block(i, &start, &end) {
if (_min >= end)
continue;
if (start >= _max)
@@ -172,7 +172,7 @@ static unsigned long position_to_address(unsigned long pos, unsigned long kernel
unsigned long get_random_base(unsigned long safe_addr)
{
- unsigned long online_mem_total = get_mem_detect_online_total();
+ unsigned long usable_total = get_mem_detect_usable_total();
unsigned long memory_limit = get_mem_detect_end();
unsigned long base_pos, max_pos, kernel_size;
int i;
@@ -182,8 +182,8 @@ unsigned long get_random_base(unsigned long safe_addr)
* which vmem and kasan code will use for shadow memory and
* pgtable mapping allocations.
*/
- memory_limit -= kasan_estimate_memory_needs(online_mem_total);
- memory_limit -= vmem_estimate_memory_needs(online_mem_total);
+ memory_limit -= kasan_estimate_memory_needs(usable_total);
+ memory_limit -= vmem_estimate_memory_needs(usable_total);
safe_addr = ALIGN(safe_addr, THREAD_SIZE);
kernel_size = vmlinux.image_size + vmlinux.bss_size;