OrangePi_CM5/arch/powerpc/mm/book3s64
Nicholas Piggin e09f47e77b powerpc/64s/radix: Fix huge vmap false positive
commit 467ba14e1660b52a2f9338b484704c461bd23019 upstream.

pmd_huge() is defined to false when HUGETLB_PAGE is not configured, but
the vmap code still installs huge PMDs. This leads to false bad PMD
errors when vunmapping because it is not seen as a huge PTE, and the bad
PMD check catches it. The end result may not be much more serious than
some bad pmd warning messages, because the pmd_none_or_clear_bad() does
what we wanted and clears the huge PTE anyway.

Fix this by checking pmd_is_leaf(), which checks for a PTE regardless of
config options. The whole huge/large/leaf stuff is a tangled mess but
that's kernel-wide and not something we can improve much in arch/powerpc
code.

pmd_page(), pud_page(), etc., called by vmalloc_to_page() on huge vmaps
can similarly trigger a false VM_BUG_ON when CONFIG_HUGETLB_PAGE=n, so
those checks are adjusted. The checks were added by commit d6eacedd1f
("powerpc/book3s: Use config independent helpers for page table walk"),
while implementing a similar fix for other page table walking functions.

Fixes: d909f9109c ("powerpc/64s/radix: Enable HAVE_ARCH_HUGE_VMAP")
Cc: stable@vger.kernel.org # v5.3+
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211216103342.609192-1-npiggin@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-27 10:54:26 +01:00
..
Makefile powerpc/pseries: Move mm/book3s64/vphn.c under platforms/pseries/ 2019-07-04 22:23:38 +10:00
hash_4k.c
…
hash_64k.c
…
hash_hugepage.c
…
hash_hugetlbpage.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
hash_native.c powerpc/64s/pseries: Fix hash tlbiel_all_isa300 for guest kernels 2020-11-27 00:10:39 +11:00
hash_pgtable.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
hash_tlb.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
hash_utils.c powerpc/mm: Add cond_resched() while removing hpte mappings 2021-05-19 10:12:56 +02:00
internal.h powerpc/mm/64s: Fix slb_setup_new_exec() sparse warning 2020-09-18 19:59:43 +10:00
iommu_api.c mmap locking API: use coccinelle to convert mmap_sem rwsem call sites 2020-06-09 09:39:14 -07:00
mmu_context.c powerpc/64s: Trim offlined CPUs from mm_cpumasks 2020-11-27 00:10:39 +11:00
pgtable.c powerpc/book3s64/keys/kuap: Reset AMR/IAMR values on kexec 2020-07-20 22:57:59 +10:00
pkeys.c powerpc/pkeys: Fix boot failures with Nemo board (A-EON AmigaOne X1000) 2020-08-10 23:07:21 +10:00
radix_hugetlbpage.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
radix_pgtable.c powerpc/64s/radix: Fix huge vmap false positive 2022-01-27 10:54:26 +01:00
radix_tlb.c powerpc/mm/book3s64: Fix possible build error 2021-07-20 16:05:43 +02:00
slb.c powerpc/mm/book3s: Split radix and hash MAX_PHYSMEM limit 2020-09-15 22:13:22 +10:00
subpage_prot.c mmap locking API: convert mmap_sem comments 2020-06-09 09:39:14 -07:00