summaryrefslogtreecommitdiff
path: root/arch/s390/boot/mem_detect.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/mem_detect.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/mem_detect.c')
-rw-r--r--arch/s390/boot/mem_detect.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/s390/boot/mem_detect.c b/arch/s390/boot/mem_detect.c
index 3058d397a9da..35f4ba11f7fd 100644
--- a/arch/s390/boot/mem_detect.c
+++ b/arch/s390/boot/mem_detect.c
@@ -172,20 +172,20 @@ unsigned long detect_memory(unsigned long *safe_addr)
return max_physmem_end;
}
-void mem_detect_truncate(unsigned long limit)
+void mem_detect_set_usable_limit(unsigned long limit)
{
struct mem_detect_block *block;
int i;
+ /* make sure mem_detect.usable ends up within online memory block */
for (i = 0; i < mem_detect.count; i++) {
block = __get_mem_detect_block_ptr(i);
- if (block->start >= limit) {
- mem_detect.count = i;
+ if (block->start >= limit)
break;
- } else if (block->end > limit) {
- block->end = (u64)limit;
- mem_detect.count = i + 1;
+ if (block->end >= limit) {
+ mem_detect.usable = limit;
break;
}
+ mem_detect.usable = block->end;
}
}