Message ID | 73ec95f40cafbbb69bdfb43a7f53876fd845b0ce.1620990479.git.christophe.leroy@csgroup.eu (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | arm64: Define only {pud/pmd}_{set/clear}_huge when usefull | expand |
On Fri, 14 May 2021 11:08:53 +0000 (UTC) Christophe Leroy <christophe.leroy@csgroup.eu> wrote: > When PUD and/or PMD are folded, those functions are useless > and we now have a stub in linux/pgtable.h OK, help me out here please. What patch does this fix?
On Fri, May 14, 2021 at 02:42:00PM -0700, Andrew Morton wrote: > On Fri, 14 May 2021 11:08:53 +0000 (UTC) Christophe Leroy <christophe.leroy@csgroup.eu> wrote: > > > When PUD and/or PMD are folded, those functions are useless > > and we now have a stub in linux/pgtable.h > > OK, help me out here please. What patch does this fix? > Naresh's original report is here it seems: https://lore.kernel.org/r/CA+G9fYv79t0+2W4Rt3wDkBShc4eY3M3utC5BHqUgGDwMYExYMw@mail.gmail.com/ I can reproduce the failure that he reported with ARCH=arm64 allmodconfig and this patch resolves it for me. Cheers, Nathan
Le 14/05/2021 à 23:42, Andrew Morton a écrit : > On Fri, 14 May 2021 11:08:53 +0000 (UTC) Christophe Leroy <christophe.leroy@csgroup.eu> wrote: > >> When PUD and/or PMD are folded, those functions are useless >> and we now have a stub in linux/pgtable.h > > OK, help me out here please. What patch does this fix? > Both this one and the x86 one from the day before fix 1cff41494b15cd82c1ec418bb5c ("mm/pgtable: add stubs for {pmd/pub}_{set/clear}_huge") I think both the x86 fix and the arm64 fix should be squashed into that patch at the end. I checked, the only other architecture involving pud_set_huge() and friends is powerpc, and powerpc doesn't have this problem as it only defined those for book3s/64 platforms which have 4 level page tables by definition. Thanks Christophe
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 6dd9369e3ea0..98af085afe90 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -1337,6 +1337,7 @@ void *__init fixmap_remap_fdt(phys_addr_t dt_phys, int *size, pgprot_t prot) return dt_virt; } +#if CONFIG_PGTABLE_LEVELS > 3 int pud_set_huge(pud_t *pudp, phys_addr_t phys, pgprot_t prot) { pud_t new_pud = pfn_pud(__phys_to_pfn(phys), mk_pud_sect_prot(prot)); @@ -1351,6 +1352,16 @@ int pud_set_huge(pud_t *pudp, phys_addr_t phys, pgprot_t prot) return 1; } +int pud_clear_huge(pud_t *pudp) +{ + if (!pud_sect(READ_ONCE(*pudp))) + return 0; + pud_clear(pudp); + return 1; +} +#endif + +#if CONFIG_PGTABLE_LEVELS > 2 int pmd_set_huge(pmd_t *pmdp, phys_addr_t phys, pgprot_t prot) { pmd_t new_pmd = pfn_pmd(__phys_to_pfn(phys), mk_pmd_sect_prot(prot)); @@ -1365,14 +1376,6 @@ int pmd_set_huge(pmd_t *pmdp, phys_addr_t phys, pgprot_t prot) return 1; } -int pud_clear_huge(pud_t *pudp) -{ - if (!pud_sect(READ_ONCE(*pudp))) - return 0; - pud_clear(pudp); - return 1; -} - int pmd_clear_huge(pmd_t *pmdp) { if (!pmd_sect(READ_ONCE(*pmdp))) @@ -1380,6 +1383,7 @@ int pmd_clear_huge(pmd_t *pmdp) pmd_clear(pmdp); return 1; } +#endif int pmd_free_pte_page(pmd_t *pmdp, unsigned long addr) {
When PUD and/or PMD are folded, those functions are useless and we now have a stub in linux/pgtable.h Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> --- arch/arm64/mm/mmu.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)