]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc: Add set_memory_{p/np}() and remove set_memory_attr()
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Fri, 24 Dec 2021 11:07:40 +0000 (11:07 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 12 Feb 2022 11:47:42 +0000 (22:47 +1100)
commit551fc2a5771a72fef9ae51bc007157870a7028be
tree27c369721e908d9614b72de07a7950ab1c5ecbae
parent0959fe477a2a2c453fcdf871f7c7e27c3d99e16a
powerpc: Add set_memory_{p/np}() and remove set_memory_attr()

set_memory_attr() was implemented by commit 08a17d7a00dc ("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 9462c4feb350 ("powerpc/32:
use set_memory_attr()") but since commit 592676f9ce99 ("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: 9462c4feb350 ("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: 592676f9ce99 ("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
arch/powerpc/include/asm/set_memory.h
arch/powerpc/mm/pageattr.c
arch/powerpc/mm/pgtable_32.c