[PATCH 6/7] mm: Make mk_pte() definition unconditional

2025-02-17 Thread Matthew Wilcox (Oracle)
All architectures now use the common mk_pte() definition, so we can remove the condition. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/mm.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 3ef11ff3922f..62dccde9c561 100644 --- a/inclu

[PATCH 3/7] sparc32: Remove custom definition of mk_pte()

2025-02-17 Thread Matthew Wilcox (Oracle)
Instead of defining pfn_pte() in terms of mk_pte(), make pfn_pte() the base implementation. That lets us use the generic definition of mk_pte(). Signed-off-by: Matthew Wilcox (Oracle) --- arch/sparc/include/asm/pgtable_32.h | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-)

[PATCH 2/7] mm: Introduce a common definition of mk_pte()

2025-02-17 Thread Matthew Wilcox (Oracle)
Most architectures simply call pfn_pte(). Centralise that as the normal definition and remove the definition of mk_pte() from the architectures which have either that exact definition or something similar. Signed-off-by: Matthew Wilcox (Oracle) --- arch/alpha/include/asm/pgtable.h | 7 -

[PATCH 5/7] um: Remove custom definition of mk_pte()

2025-02-17 Thread Matthew Wilcox (Oracle)
Move the pfn_pte() definitions from the 2level and 4level files to the generic pgtable.h and delete the custom definition of mk_pte() so that we use the central definition. Signed-off-by: Matthew Wilcox (Oracle) --- arch/um/include/asm/pgtable-2level.h | 1 - arch/um/include/asm/pgtable-4level.

[PATCH 1/7] mm: Set the pte dirty if the folio is already dirty

2025-02-17 Thread Matthew Wilcox (Oracle)
If the first access to a folio is a read that is then followed by a write, we can save a page fault. s390 implemented this in their mk_pte() in commit abf09bed3cce ("s390/mm: implement software dirty bits"), but other architectures can also benefit from this. Signed-off-by: Matthew Wilcox (Oracle

[PATCH 0/7] Add folio_mk_pte() and simplify mk_pte()

2025-02-17 Thread Matthew Wilcox (Oracle)
The intent is to add folio_mk_pte() to remove the conversion from folio to page necessary to call mk_pte(). Eventually we might end up removing mk_pte(), but that's not what's being proposed today. I didn't want to add folio_mk_pte() to each architecture, and I didn't want to lose any optimisatio

[PATCH 7/7] mm: Add folio_mk_pte()

2025-02-17 Thread Matthew Wilcox (Oracle)
Removes a cast from folio to page in four callers of mk_pte(). Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/mm.h | 15 +++ mm/memory.c| 6 +++--- mm/userfaultfd.c | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/include/linux/mm.h b/incl

[PATCH 4/7] x86: Remove custom definition of mk_pte()

2025-02-17 Thread Matthew Wilcox (Oracle)
Move the shadow stack check to pfn_pte() which lets us use the common definition of mk_pte(). Signed-off-by: Matthew Wilcox (Oracle) --- arch/x86/include/asm/pgtable.h | 19 +++ 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x

[PATCH v6 0/6] ptrace: introduce PTRACE_SET_SYSCALL_INFO API

2025-02-17 Thread Dmitry V. Levin
PTRACE_SET_SYSCALL_INFO is a generic ptrace API that complements PTRACE_GET_SYSCALL_INFO by letting the ptracer modify details of system calls the tracee is blocked in. This API allows ptracers to obtain and modify system call details in a straightforward and architecture-agnostic way, providing a

[PATCH v6 2/6] syscall.h: add syscall_set_arguments()

2025-02-17 Thread Dmitry V. Levin
This function is going to be needed on all HAVE_ARCH_TRACEHOOK architectures to implement PTRACE_SET_SYSCALL_INFO API. This partially reverts commit 7962c2eddbfe ("arch: remove unused function syscall_set_arguments()") by reusing some of old syscall_set_arguments() implementations. Signed-off-by:

[PATCH v6 3/6] syscall.h: introduce syscall_set_nr()

2025-02-17 Thread Dmitry V. Levin
Similar to syscall_set_arguments() that complements syscall_get_arguments(), introduce syscall_set_nr() that complements syscall_get_nr(). syscall_set_nr() is going to be needed along with syscall_set_arguments() on all HAVE_ARCH_TRACEHOOK architectures to implement PTRACE_SET_SYSCALL_INFO API. S