summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorBibo Mao <maobibo@loongson.cn>2025-03-08 13:51:32 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-03-13 13:07:40 +0100
commite1fce6292ce9734462d1281a63f9d2c357185afb (patch)
treeddc6932144326110056f92a72010de1064eb87bd /arch
parent242b34f48a377afe4b285b472bd0f17744fca8e8 (diff)
downloadlinux-e1fce6292ce9734462d1281a63f9d2c357185afb.tar.gz
linux-e1fce6292ce9734462d1281a63f9d2c357185afb.tar.bz2
linux-e1fce6292ce9734462d1281a63f9d2c357185afb.zip
LoongArch: Set max_pfn with the PFN of the last page
commit c8477bb0a8e7f6b2e47952b403c5cb67a6929e55 upstream. The current max_pfn equals to zero. In this case, it causes user cannot get some page information through /proc filesystem such as kpagecount. The following message is displayed by stress-ng test suite with command "stress-ng --verbose --physpage 1 -t 1". # stress-ng --verbose --physpage 1 -t 1 stress-ng: error: [1691] physpage: cannot read page count for address 0x134ac000 in /proc/kpagecount, errno=22 (Invalid argument) stress-ng: error: [1691] physpage: cannot read page count for address 0x7ffff207c3a8 in /proc/kpagecount, errno=22 (Invalid argument) stress-ng: error: [1691] physpage: cannot read page count for address 0x134b0000 in /proc/kpagecount, errno=22 (Invalid argument) ... After applying this patch, the kernel can pass the test. # stress-ng --verbose --physpage 1 -t 1 stress-ng: debug: [1701] physpage: [1701] started (instance 0 on CPU 3) stress-ng: debug: [1701] physpage: [1701] exited (instance 0 on CPU 3) stress-ng: debug: [1700] physpage: [1701] terminated (success) Cc: stable@vger.kernel.org # 6.8+ Fixes: ff6c3d81f2e8 ("NUMA: optimize detection of memory with no node id assigned by firmware") Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/loongarch/kernel/setup.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
index 56934fe58170..1fa6a604734e 100644
--- a/arch/loongarch/kernel/setup.c
+++ b/arch/loongarch/kernel/setup.c
@@ -387,6 +387,9 @@ static void __init check_kernel_sections_mem(void)
*/
static void __init arch_mem_init(char **cmdline_p)
{
+ /* Recalculate max_low_pfn for "mem=xxx" */
+ max_pfn = max_low_pfn = PHYS_PFN(memblock_end_of_DRAM());
+
if (usermem)
pr_info("User-defined physical RAM map overwrite\n");