lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b1fde3cf-f4ed-68cc-fd4d-8b8b089870f1@loongson.cn>
Date: Thu, 6 Mar 2025 14:25:37 +0800
From: bibo mao <maobibo@...ngson.cn>
To: Huacai Chen <chenhuacai@...nel.org>
Cc: WANG Xuerui <kernel@...0n.name>, loongarch@...ts.linux.dev,
 linux-kernel@...r.kernel.org, Andrew Morton <akpm@...ux-foundation.org>,
 stable@...r.kernel.org
Subject: Re: [PATCH v2] LoongArch: mm: Set max_pfn with the PFN of the last
 page



On 2025/3/6 下午12:06, Huacai Chen wrote:
> Hi, Bibo,
> 
> On Thu, Mar 6, 2025 at 11:53 AM Bibo Mao <maobibo@...ngson.cn> wrote:
>>
>> The current max_pfn equals to zero. In this case, it caused users cannot
>> get some page information through /proc such as kpagecount. The following
>> message is displayed by stress-ng test suite with the 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@...r.kernel.org
>> Fixes: ff6c3d81f2e8 ("NUMA: optimize detection of memory with no node id assigned by firmware")
>>
>> Signed-off-by: Bibo Mao <maobibo@...ngson.cn>
>> ---
>>   arch/loongarch/kernel/setup.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
>> index edcfdfcad7d2..a9c1184ab893 100644
>> --- a/arch/loongarch/kernel/setup.c
>> +++ b/arch/loongarch/kernel/setup.c
>> @@ -390,6 +390,7 @@ static void __init arch_mem_init(char **cmdline_p)
>>          if (usermem)
>>                  pr_info("User-defined physical RAM map overwrite\n");
>>
>> +       max_low_pfn = max_pfn = PHYS_PFN(memblock_end_of_DRAM());
> max_low_pfn is already calculated for all three cases, so here just
> need "max_pfn = max_low_pfn".
In theory it should be.

However there are potential problems, it should be recalculated in 
function early_parse_mem() also if commandline "mem=" is added.

The other thing is that calculation init_numa_memory() is unnecessary 
since it is already calculated in memblock_init(). Memory block 
information comes from UEFI table or FDT table, and ACPI srat 
information only adds node information.

Regards
Bibo Mao
> 
> Huacai
> 
>>          check_kernel_sections_mem();
>>
>>          /*
>>
>> base-commit: 848e076317446f9c663771ddec142d7c2eb4cb43
>> --
>> 2.39.3
>>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ