From: "David Hildenbrand (Red Hat)" <david@kernel.org>
To: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Sourabh Jain <sourabhjain@linux.ibm.com>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Cc: Donet Tom <donettom@linux.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: powerpc/e500: WARNING: at mm/hugetlb.c:4755 hugetlb_add_hstate
Date: Mon, 10 Nov 2025 11:10:10 +0100 [thread overview]
Message-ID: <944be49c-aea4-4160-a010-1d4ce7bcf542@kernel.org> (raw)
In-Reply-To: <87ecq952pe.ritesh.list@gmail.com>
[fighting with mail transitioning, for some reason I did not receive
the mails from Christophe, so replying here]
>>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
>>> index e24f4d88885ae..55c3626c86273 100644
>>> --- a/arch/powerpc/Kconfig
>>> +++ b/arch/powerpc/Kconfig
>>> @@ -137,6 +137,7 @@ config PPC
>>> select ARCH_HAS_DMA_OPS if PPC64
>>> select ARCH_HAS_FORTIFY_SOURCE
>>> select ARCH_HAS_GCOV_PROFILE_ALL
>>> + select ARCH_HAS_GIGANTIC_PAGE if PPC64
>
>
> The patch looks good from PPC64 perspective, it also fixes the problem
> reported on corenet64_smp_defconfig...
>
>>
>> Problem is not only on PPC64, it is on PPC32 as well, for instance
>> corenet32_smp_defconfig has the problem as well.
>>
>
> However on looking deeper into it - I agree with Christophe that this
> problem might still exist on PPC32.
Ah, I missed that. I thought it would be a ppc64 thing. :(
>
> I did try the patch on corenet32_smp_defconfig and I can see the WARN_ON
> still triggering. You can check the logs here..
>
> https://github.com/riteshharjani/linux-ci/actions/runs/19169468405/job/54799498288
>
>
>>
>> So I think what you want instead is:
>>
>> diff --git a/arch/powerpc/platforms/Kconfig.cputype
>> b/arch/powerpc/platforms/Kconfig.cputype
>> index 7b527d18aa5ee..1f5a1e587740c 100644
>> --- a/arch/powerpc/platforms/Kconfig.cputype
>> +++ b/arch/powerpc/platforms/Kconfig.cputype
>> @@ -276,6 +276,7 @@ config PPC_E500
>> select FSL_EMB_PERFMON
>> bool
>> select ARCH_SUPPORTS_HUGETLBFS if PHYS_64BIT || PPC64
>> + select ARCH_HAS_GIGANTIC_PAGE if ARCH_SUPPORTS_HUGETLBFS
>> select PPC_SMP_MUXED_IPI
>> select PPC_DOORBELL
>> select PPC_KUEP
>>
>>
>>
>
> @Christophe,
>
> I don't think even the above diff will fix the warning on PPC32.
> The patch defines MAX_FOLIO_ORDER as P4D_ORDER...
>
> +#define MAX_FOLIO_ORDER P4D_ORDER
> +#define P4D_ORDER (P4D_SHIFT - PAGE_SHIFT)
>
> and for ppc32 in..
> include/asm-generic/pgtable-nop4d.h
> #define P4D_SHIFT PGDIR_SHIFT
>
> Then in..
> arch/powerpc/include/asm/nohash/32/pgtable.h
> #define PGDIR_SHIFT (PAGE_SHIFT + PTE_INDEX_SIZE)
> #define PTE_INDEX_SIZE PTE_SHIFT
>
> in...
> arch/powerpc/include/asm/page_32.h
> #define PTE_SHIFT (PAGE_SHIFT - PTE_T_LOG2) /* full page */
>
> #define PTE_T_LOG2 (__builtin_ffs(sizeof(pte_t)) - 1)
>
>
> So if you see from above P4D_ORDER is coming down to PTE_INDEX_SIZE
>
> IIUC, that will cause MAX_FOLIO_ORDER to be 9 in case of e500mc machine type right?
>
> Can you please confirm if the above analysis looks correct to you?
Cristophe wrote
"
Ah you are right, that's not enough. I was thinking that PGDIR_ORDER was
the highest possible value ever but in fact not. PGDIR_SIZE is 4Mbytes
so any page larger than that still triggers the warning. Here are the
warnings I get on QEMU with corenet32_smp_defconfig
"
And then we get
HugeTLB: registered 1.00 GiB page size, pre-allocated 0 pages
HugeTLB: 0 KiB vmemmap can be freed for a 1.00 GiB page
HugeTLB: registered 64.0 MiB page size, pre-allocated 1 pages
HugeTLB: 0 KiB vmemmap can be freed for a 64.0 MiB page
HugeTLB: registered 256 MiB page size, pre-allocated 1 pages
HugeTLB: 0 KiB vmemmap can be freed for a 256 MiB page
HugeTLB: registered 4.00 MiB page size, pre-allocated 0 pages
HugeTLB: 0 KiB vmemmap can be freed for a 4.00 MiB page
HugeTLB: registered 16.0 MiB page size, pre-allocated 0 pages
HugeTLB: 0 KiB vmemmap can be freed for a 16.0 MiB page
How could any of these larger sizes possibly ever get mapped into a page
table on 32bit? I'm probably missing something important :)
--
Cheers
David
next prev parent reply other threads:[~2025-11-10 10:10 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-29 5:49 powerpc/e500: WARNING: at mm/hugetlb.c:4755 hugetlb_add_hstate Sourabh Jain
2025-10-29 8:25 ` David Hildenbrand
2025-11-05 11:32 ` Christophe Leroy
2025-11-06 15:02 ` David Hildenbrand (Red Hat)
2025-11-06 16:19 ` Christophe Leroy
2025-11-07 14:37 ` Ritesh Harjani
2025-11-07 16:11 ` Christophe Leroy
2025-11-10 10:10 ` David Hildenbrand (Red Hat) [this message]
2025-11-10 10:33 ` Christophe Leroy
2025-11-10 11:04 ` David Hildenbrand (Red Hat)
2025-11-10 11:27 ` David Hildenbrand (Red Hat)
2025-11-10 18:31 ` Christophe Leroy
2025-11-11 8:29 ` David Hildenbrand (Red Hat)
2025-11-11 11:21 ` David Hildenbrand (Red Hat)
2025-11-11 11:42 ` Christophe Leroy
2025-11-11 12:20 ` David Hildenbrand (Red Hat)
2025-11-12 10:41 ` Ritesh Harjani
2025-11-07 8:00 ` Sourabh Jain
2025-11-07 9:02 ` David Hildenbrand (Red Hat)
2025-11-07 12:35 ` Sourabh Jain
2025-11-07 14:18 ` David Hildenbrand (Red Hat)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=944be49c-aea4-4160-a010-1d4ce7bcf542@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=christophe.leroy@csgroup.eu \
--cc=donettom@linux.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=sourabhjain@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).