linux/arch/powerpc/mm
Christophe Leroy f222ab83df powerpc: Add set_memory_{p/np}() and remove set_memory_attr()
set_memory_attr() was implemented by commit 4d1755b6a7 ("powerpc/mm:
implement set_memory_attr()") because the set_memory_xx() couldn't
be used at that time to modify memory "on the fly" as explained it
the commit.

But set_memory_attr() uses set_pte_at() which leads to warnings when
CONFIG_DEBUG_VM is selected, because set_pte_at() is unexpected for
updating existing page table entries.

The check could be bypassed by using __set_pte_at() instead,
as it was the case before commit c988cfd38e ("powerpc/32:
use set_memory_attr()") but since commit 9f7853d760 ("powerpc/mm:
Fix set_memory_*() against concurrent accesses") it is now possible
to use set_memory_xx() functions to update page table entries
"on the fly" because the update is now atomic.

For DEBUG_PAGEALLOC we need to clear and set back _PAGE_PRESENT.
Add set_memory_np() and set_memory_p() for that.

Replace all uses of set_memory_attr() by the relevant set_memory_xx()
and remove set_memory_attr().

Fixes: c988cfd38e ("powerpc/32: use set_memory_attr()")
Cc: stable@vger.kernel.org
Reported-by: Maxime Bizon <mbizon@freebox.fr>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Tested-by: Maxime Bizon <mbizon@freebox.fr>
Reviewed-by: Russell Currey <ruscur@russell.cc>
Depends-on: 9f7853d760 ("powerpc/mm: Fix set_memory_*() against concurrent accesses")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/cda2b44b55c96f9ac69fa92e68c01084ec9495c5.1640344012.git.christophe.leroy@csgroup.eu
2022-02-12 22:47:42 +11:00
..
book3s32 powerpc/32s: Fix kasan_init_region() for KASAN 2022-01-16 20:51:05 +11:00
book3s64 powerpc/mm/book3s64/hash: Switch pre 2.06 tlbiel to .long 2021-12-23 22:35:13 +11:00
kasan powerpc/kasan: Fix early region not updated correctly 2022-02-03 22:37:44 +11:00
nohash powerpc updates for 5.17 2022-01-14 15:17:26 +01:00
ptdump powerpc/ptdump: Fix sparse warning in hashpagetable.c 2022-02-02 20:32:11 +11:00
cacheflush.c powerpc/mem: Use kmap_local_page() in flushing functions 2021-04-14 23:04:19 +10:00
copro_fault.c powerpc/64s: Move hash MMU support code under CONFIG_PPC_64S_HASH_MMU 2021-12-09 22:41:13 +11:00
dma-noncoherent.c dma-mapping: merge <linux/dma-noncoherent.h> into <linux/dma-map-ops.h> 2020-10-06 07:07:06 +02:00
drmem.c pseries/drmem: update LMBs after LPM 2021-08-10 23:14:55 +10:00
fault.c Merge branch 'akpm' (patches from Andrew) 2022-01-15 20:37:06 +02:00
hugetlbpage.c powerpc/64s: Always define arch unmapped area calls 2021-12-09 22:40:24 +11:00
init_32.c powerpc: Enable KFENCE for PPC32 2021-03-24 14:09:30 +11:00
init_64.c powerpc/64s: Make hash MMU support configurable 2021-12-09 22:40:24 +11:00
init-common.c powerpc/kuep: Remove 'nosmep' boot time parameter except for book3s/64 2021-12-09 22:41:18 +11:00
ioremap_32.c powerpc/mm: Leave a gap between early allocated IO areas 2021-06-25 00:07:10 +10:00
ioremap_64.c powerpc/mm: Leave a gap between early allocated IO areas 2021-06-25 00:07:10 +10:00
ioremap.c powerpc: make memremap_compat_align 64s-only 2021-12-02 22:57:24 +11:00
maccess.c powerpc/inst: Optimise copy_inst_from_kernel_nofault() 2021-12-09 22:41:21 +11:00
Makefile powerpc/ptdump: Convert powerpc to GENERIC_PTDUMP 2021-08-25 13:35:48 +10:00
mem.c powerpc/code-patching: Remove init_mem_is_free 2021-12-23 22:35:24 +11:00
mmap.c powerpc/64s: Always define arch unmapped area calls 2021-12-09 22:40:24 +11:00
mmu_context.c powerpc/mm: Switch obsolete dssall to .long 2021-12-23 22:35:13 +11:00
mmu_decl.h powerpc/fsl_booke: Update of TLBCAMs after init 2021-10-22 15:22:03 +11:00
numa.c powerpc/mm: Add __init attribute to eligible functions 2021-12-23 22:33:11 +11:00
pageattr.c powerpc: Add set_memory_{p/np}() and remove set_memory_attr() 2022-02-12 22:47:42 +11:00
pgtable_32.c powerpc: Add set_memory_{p/np}() and remove set_memory_attr() 2022-02-12 22:47:42 +11:00
pgtable_64.c powerpc/64s/radix: Fix huge vmap false positive 2021-12-20 12:13:32 +11:00
pgtable-frag.c powerpc/mm/radix: Fix PTE/PMD fragment count for early page table mappings 2020-07-20 22:57:56 +10:00
pgtable.c powerpc/fixmap: Fix VM debug warning on unmap 2022-01-24 17:29:05 +11:00
slice.c powerpc/64s: Always define arch unmapped area calls 2021-12-09 22:40:24 +11:00