linux/arch/sh/include/asm
Baolin Wang ae07562909 mm: change huge_ptep_clear_flush() to return the original pte
Patch series "Fix CONT-PTE/PMD size hugetlb issue when unmapping or migrating", v4.

presently, migrating a hugetlb page or unmapping a poisoned hugetlb page,
we'll use ptep_clear_flush() and set_pte_at() to nuke the page table entry
and remap it, and this is incorrect for CONT-PTE or CONT-PMD size hugetlb
page, which will cause potential data consistent issue.  This patch set
will change to use hugetlb related APIs to fix this issue.

Note: Mike pointed out the huge_ptep_get() will only return the one
specific value, and it would not take into account the dirty or young bits
of CONT-PTE/PMDs like the huge_ptep_get_and_clear() [1].  This
inconsistent issue is not introduced by this patch set, and this issue
will be addressed in another thread [2].  Meanwhile the uffd for hugetlb
case [3] pointed out by Gerald also needs another patch to address.

[1] https://lore.kernel.org/linux-mm/85bd80b4-b4fd-0d3f-a2e5-149559f2f387@oracle.com/
[2] https://lore.kernel.org/all/cover.1651998586.git.baolin.wang@linux.alibaba.com/
[3] https://lore.kernel.org/linux-mm/20220503120343.6264e126@thinkpad/


This patch (of 3):

It is incorrect to use ptep_clear_flush() to nuke a hugetlb page table
when unmapping or migrating a hugetlb page, and will change to use
huge_ptep_clear_flush() instead in the following patches.

So this is a preparation patch, which changes the huge_ptep_clear_flush()
to return the original pte to help to nuke a hugetlb page table.

[baolin.wang@linux.alibaba.com: fix build in several more architectures]
  Link: https://lkml.kernel.org/r/0009a4cd-2826-e8be-e671-f050d4f18d5d@linux.alibaba.com
[sfr@canb.auug.org.au: fixup]
  Link: https://lkml.kernel.org/r/20220511181531.7f27a5c1@canb.auug.org.au
Link: https://lkml.kernel.org/r/cover.1652270205.git.baolin.wang@linux.alibaba.com
Link: https://lkml.kernel.org/r/20f77ddab90baa249bd24504c413189b82acde69.1652270205.git.baolin.wang@linux.alibaba.com
Link: https://lkml.kernel.org/r/cover.1652147571.git.baolin.wang@linux.alibaba.com
Link: https://lkml.kernel.org/r/dcf065868cce35bceaf138613ad27f17bb7c0c19.1652147571.git.baolin.wang@linux.alibaba.com
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Mike Kravetz <mike.kravetz@oracle.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Yoshinori Sato <ysato@users.osdn.me>
Cc: Rich Felker <dalias@libc.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2022-05-13 16:48:55 -07:00
..
Kbuild
adc.h
addrspace.h
alignment.h
asm-offsets.h
atomic-grb.h
atomic-irq.h
atomic-llsc.h
atomic.h
barrier.h
bitops-cas.h
bitops-grb.h
bitops-llsc.h
bitops-op32.h
bitops.h include: move find.h from asm_generic to linux 2022-01-15 08:47:31 -08:00
bl_bit.h
bl_bit_32.h
bug.h
bugs.h
cache.h
cache_insns.h
cache_insns_32.h
cacheflush.h Add linux/cacheflush.h 2021-11-17 10:36:15 -05:00
checksum.h
checksum_32.h
clock.h
cmpxchg-cas.h
cmpxchg-grb.h
cmpxchg-irq.h
cmpxchg-llsc.h
cmpxchg-xchg.h
cmpxchg.h
device.h
dma-register.h
dma.h
dmabrg.h
dwarf.h
elf.h
entry-macros.S
extable.h
fb.h
fixmap.h
flat.h
fpu.h
freq.h
ftrace.h
futex-cas.h
futex-irq.h
futex-llsc.h
futex.h
gpio.h
hardirq.h
hd64461.h
heartbeat.h
hugetlb.h mm: change huge_ptep_clear_flush() to return the original pte 2022-05-13 16:48:55 -07:00
hw_breakpoint.h
hw_irq.h
i2c-sh7760.h
io.h
io_generic.h
io_noioport.h
io_trapped.h
irq.h sh: Cleanup about SPARSE_IRQ 2021-10-27 16:50:52 -04:00
irqflags.h
kdebug.h
kexec.h
kgdb.h
kprobes.h
linkage.h
machvec.h
mmiowb.h
mmu.h
mmu_context.h
mmu_context_32.h
mmzone.h
module.h
page.h
pci.h
perf_event.h
pgalloc.h
pgtable-2level.h
pgtable-3level.h sh: pgtable-3level: Fix cast to pointer from integer of different size 2021-10-27 16:56:34 -04:00
pgtable.h
pgtable_32.h arch: Add pmd_pfn() where it is missing 2022-03-21 12:59:02 -04:00
platform_early.h
posix_types.h
processor.h sh: remove CONFIG_SET_FS support 2022-02-25 09:36:06 +01:00
processor_32.h sched: Add wrapper for get_wchan() to keep task blocked 2021-10-15 11:25:14 +02:00
ptrace.h
ptrace_32.h
push-switch.h
reboot.h
romimage-macros.h
rtc.h
seccomp.h
sections.h
setup.h
sfp-machine.h sh: define __BIG_ENDIAN for math-emu 2021-10-27 16:51:24 -04:00
sh7760fb.h
sh_bios.h
shmparam.h
siu.h
smc37c93x.h
smp-ops.h
smp.h
sparsemem.h
spi.h
spinlock-cas.h
spinlock-llsc.h
spinlock.h
spinlock_types.h locking: Allow to include asm/spinlock_types.h from linux/spinlock_types_raw.h 2021-12-07 15:14:12 +01:00
sram.h
stackprotector.h
stacktrace.h
string.h
string_32.h
suspend.h
switch_to.h
switch_to_32.h
syscall.h
syscall_32.h
syscalls.h
syscalls_32.h
thread_info.h flexible-array transformations for 5.18-rc1 2022-03-24 11:39:32 -07:00
timex.h
tlb.h
tlbflush.h
topology.h
traps.h
traps_32.h
types.h
uaccess.h sh: remove CONFIG_SET_FS support 2022-02-25 09:36:06 +01:00
uaccess_32.h
uncached.h
unistd.h
unwinder.h
user.h asm/user.h: killed unused macros 2022-01-30 21:17:00 -05:00
vermagic.h
vga.h
vmalloc.h
vmlinux.lds.h
watchdog.h
word-at-a-time.h