[PATCH 1/1] selftests: mm: hugepage-vmemmap fails on 64K page size systems.

Muchun Song muchun.song at linux.dev
Thu Jan 11 13:07:58 AEDT 2024



> On Jan 10, 2024, at 23:53, Andrew Morton <akpm at linux-foundation.org> wrote:
> 
> (cc Muchun)
> On Wed, 10 Jan 2024 14:03:35 +0530 Donet Tom <donettom at linux.vnet.ibm.com> wrote:
> 
>> The kernel sefltest mm/hugepage-vmemmap fails on architectures
>> which has different page size other than 4K. In hugepage-vmemmap
>> page size used is 4k so the pfn calculation will go wrong on systems
>> which has different page size .The length of MAP_HUGETLB memory must
>> be hugepage aligned but in hugepage-vmemmap map length is 2M so this
>> will not get aligned if the system has differnet hugepage size.
>> 
>> Added  psize() to get the page size and default_huge_page_size() to
>> get the default hugepage size at run time, hugepage-vmemmap test pass
>> on powerpc with 64K page size and x86 with 4K page size.
>> 
>> Result on powerpc without patch (page size 64K)
>> *# ./hugepage-vmemmap
>> Returned address is 0x7effff000000 whose pfn is 0
>> Head page flags (100000000) is invalid
>> check_page_flags: Invalid argument
>> *#
>> 
>> Result on powerpc with patch (page size 64K)
>> *# ./hugepage-vmemmap
>> Returned address is 0x7effff000000 whose pfn is 600
>> *#
>> 
>> Result on x86 with patch (page size 4K)
>> *# ./hugepage-vmemmap
>> Returned address is 0x7fc7c2c00000 whose pfn is 1dac00
>> *#
>> 
>> Signed-off-by: Donet Tom <donettom at linux.vnet.ibm.com>
>> Reported-by : Geetika Moolchandani (geetika at linux.ibm.com)
>> Tested-by : Geetika Moolchandani (geetika at linux.ibm.com)

Acked-by: Muchun Song <muchun.song at linux.dev>

> 
> I'll add 
> 
> Fixes: b147c89cd429 ("selftests: vm: add a hugetlb test case")
> Cc: <stable at vger.kernel.org>

Yes. It should be a real bug fix.

Thanks.



More information about the Linuxppc-dev mailing list