linux-stable/arch/powerpc
Michael Ellerman 710dee5701 powerpc/64s/radix: Fix soft dirty tracking
commit 66b2ca0862 upstream.

It was reported that soft dirty tracking doesn't work when using the
Radix MMU.

The tracking is supposed to work by clearing the soft dirty bit for a
mapping and then write protecting the PTE. If/when the page is written
to, a page fault occurs and the soft dirty bit is added back via
pte_mkdirty(). For example in wp_page_reuse():

	entry = maybe_mkwrite(pte_mkdirty(entry), vma);
	if (ptep_set_access_flags(vma, vmf->address, vmf->pte, entry, 1))
		update_mmu_cache(vma, vmf->address, vmf->pte);

Unfortunately on radix _PAGE_SOFTDIRTY is being dropped by
radix__ptep_set_access_flags(), called from ptep_set_access_flags(),
meaning the soft dirty bit is not set even though the page has been
written to.

Fix it by adding _PAGE_SOFTDIRTY to the set of bits that are able to be
changed in radix__ptep_set_access_flags().

Fixes: b0b5e9b130 ("powerpc/mm/radix: Add radix pte #defines")
Cc: stable@vger.kernel.org # v4.7+
Reported-by: Dan Horák <dan@danny.cz>
Link: https://lore.kernel.org/r/20230511095558.56663a50f86bdc4cd97700b7@danny.cz
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230511114224.977423-1-mpe@ellerman.id.au
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-30 12:57:55 +01:00
..
boot powerpc: dts: t1040rdb: fix compatible string for Rev A boards 2023-03-17 08:45:10 +01:00
configs powerpc/config: Renable MTD_PHYSMAP_OF 2021-09-18 13:40:14 +02:00
crypto crypto: powerpc/crc-vpmsum_test - Fix sparse endianness warning 2020-09-04 17:57:15 +10:00
include powerpc/pseries: Add support for FORM2 associativity 2023-04-20 12:10:28 +02:00
kernel powerpc/rtas: use memmove for potentially overlapping buffer copy 2023-05-17 11:48:00 +02:00
kexec powerpc: Set crashkernel offset to mid of RMA region 2022-04-13 21:00:56 +02:00
kvm KVM: PPC: Tick accounting should defer vtime accounting 'til after IRQ handling 2022-09-23 14:16:55 +02:00
lib powerpc/lib/sstep: Fix build errors with newer binutils 2022-04-08 14:40:36 +02:00
math-emu powerpc/math_emu/efp: Include module.h 2022-10-26 13:25:40 +02:00
mm powerpc/64s/radix: Fix soft dirty tracking 2023-05-30 12:57:55 +01:00
net powerpc64/bpf: Limit 'ldbrx' to processors compliant with ISA v2.06 2022-02-01 17:25:45 +01:00
oprofile powerpc/oprofile: fix spelling mistake "contex" -> "context" 2020-08-25 01:31:33 +10:00
perf powerpc/perf/hv-24x7: add missing RTAS retry status handling 2023-03-11 16:39:44 +01:00
platforms powerpc/wii: fix resource printk format warnings 2023-05-17 11:47:59 +02:00
purgatory powerpc/kexec_file: Enable early kernel OPAL calls 2020-07-29 23:47:55 +10:00
sysdev powerpc/sysdev/tsi108: fix resource printk format warnings 2023-05-17 11:47:59 +02:00
tools powerpc/tools: Remove 90 line limit in checkpatch script 2020-09-08 22:57:11 +10:00
xmon powerpc/xmon: Fix -Wswitch-unreachable warning in bpt_cmds 2023-01-14 10:16:06 +01:00
Kbuild
Kconfig powerpc/kasan: Force thread size increase with KASAN 2022-06-14 18:32:39 +02:00
Kconfig.debug powerpc: iommu: fix build when neither PCI or IBMVIO is set 2021-05-14 09:50:34 +02:00
Makefile powerpc: Remove linker flag from KBUILD_AFLAGS 2023-03-11 16:39:46 +01:00
Makefile.postlink powerpc: unrel_branch_check.sh: use nm to find symbol value 2020-09-02 11:00:22 +10:00