The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Alexander Gordeev <agordeev@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Mike Rapoport <rppt@kernel.org>,
	Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Subject: [PATCH 00/17] s390/mm: Large kernel mappings for vmalloc and execmem ROX cache
Date: Thu,  3 Dec 2026 11:33:28 +0100	[thread overview]
Message-ID: <20261203103345.1206548-1-hca@linux.ibm.com> (raw)

Enable the execmem ROX cache on s390. With EDAT1, module text, kprobes
and ftrace allocations are backed by 1MB read-only and executable
mappings instead of 4k mappings, which reduces TLB pressure.

The series consists of several parts:

Patches 1-4 are fixes and preparation, which are also useful on their
own: init_mm->asce_limit is initialized, the direct map page counters are
no longer modified for the kernel image, kernel page table changes are
serialized with the init_mm mmap lock instead of two unrelated mutexes,
and the vmem code uses the generic page table allocators.

Patches 5-7 add the page table dump WC attribute and implement
HAVE_ARCH_HUGE_VMAP and HAVE_ARCH_HUGE_VMALLOC, so that vmap(),
ioremap() and vmalloc() can use 1MB mappings.

Patches 8-13 rework pageattr.c: add helpers to replace live kernel page
table entries, use a common helper to change permissions on all page
table levels, avoid splitting mappings if the resulting entry would be
identical, mark intentional 4k mappings, and collapse split mappings back
into large pages after a successful set_memory_rox().

Patches 14-17 add PAGE_KERNEL_ROX, EXECMEM_KPROBES and EXECMEM_FTRACE
ranges (which makes the s390 specific alloc_insn_page() and the explicit
set_memory_rox() for ftrace trampolines obsolete), and finally enable
ARCH_HAS_EXECMEM_ROX.

Tested on s390 with EDAT1: all module text lives in two 1MB "PMD RO X"
mappings which stay intact across module load/unload and ftrace
selftests.

Series applies on top of linux-next 20261202.

Thanks,
Heiko

Heiko Carstens (17):
  s390/boot: Initialize asce_limit for init_mm properly
  s390/pageattr: Only account direct mapping in direct map page counters
  s390/mm: Serialize kernel page table changes with init_mm mmap lock
  s390/vmem: Use generic page table allocators for vmem page tables
  s390/mm: Show write-combining attribute in page table dump
  s390/mm: Implement HAVE_ARCH_HUGE_VMAP
  s390/mm: Implement HAVE_ARCH_HUGE_VMALLOC
  s390/pageattr: Add helpers to replace kernel page table entries
  s390/mm: Add _SEGMENT_ENTRY_TYPE
  s390/pageattr: Use common helper to change kernel page table permissions
  s390/pageattr: Avoid splitting mappings if permissions do not change
  s390/pageattr: Mark intentional 4k kernel mappings
  s390/pageattr: Collapse kernel mappings after changing page attributes
  s390/mm: Add PAGE_KERNEL_ROX
  s390/execmem: Add EXECMEM_KPROBES range
  s390/execmem: Add EXECMEM_FTRACE range
  s390/execmem: Enable EXECMEM_ARCH_ROX

 .../features/vm/huge-vmap/arch-support.txt    |   2 +-
 arch/s390/Kconfig                             |   3 +
 arch/s390/boot/vmem.c                         |   1 +
 arch/s390/include/asm/pgalloc.h               |   2 +
 arch/s390/include/asm/pgtable.h               |  29 ++
 arch/s390/include/asm/set_memory.h            |   4 -
 arch/s390/include/asm/vmalloc.h               |  16 +
 arch/s390/kernel/kprobes.c                    |  16 -
 arch/s390/kernel/module.c                     |  11 +-
 arch/s390/mm/dump_pagetables.c                |  17 +-
 arch/s390/mm/init.c                           |  45 +++
 arch/s390/mm/pageattr.c                       | 336 +++++++++++++-----
 arch/s390/mm/pgtable.c                        |  81 +++++
 arch/s390/mm/vmem.c                           |  80 +++--
 14 files changed, 484 insertions(+), 159 deletions(-)


base-commit: 799dd936553182df5770dde7f38d94c8337df75a
-- 
2.53.0


             reply	other threads:[~2026-12-03 10:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 10:33 Heiko Carstens [this message]
2026-12-03 10:33 ` [PATCH 01/17] s390/boot: Initialize asce_limit for init_mm properly Heiko Carstens
2026-12-03 10:33 ` [PATCH 02/17] s390/pageattr: Only account direct mapping in direct map page counters Heiko Carstens
2026-12-03 10:33 ` [PATCH 03/17] s390/mm: Serialize kernel page table changes with init_mm mmap lock Heiko Carstens
2026-12-03 10:33 ` [PATCH 04/17] s390/vmem: Use generic page table allocators for vmem page tables Heiko Carstens
2026-12-03 10:33 ` [PATCH 05/17] s390/mm: Show write-combining attribute in page table dump Heiko Carstens
2026-12-03 10:33 ` [PATCH 06/17] s390/mm: Implement HAVE_ARCH_HUGE_VMAP Heiko Carstens
2026-12-03 10:33 ` [PATCH 07/17] s390/mm: Implement HAVE_ARCH_HUGE_VMALLOC Heiko Carstens
2026-12-03 10:33 ` [PATCH 08/17] s390/pageattr: Add helpers to replace kernel page table entries Heiko Carstens
2026-12-03 10:33 ` [PATCH 09/17] s390/mm: Add _SEGMENT_ENTRY_TYPE Heiko Carstens
2026-12-03 10:33 ` [PATCH 10/17] s390/pageattr: Use common helper to change kernel page table permissions Heiko Carstens
2026-12-03 10:33 ` [PATCH 11/17] s390/pageattr: Avoid splitting mappings if permissions do not change Heiko Carstens
2026-12-03 10:33 ` [PATCH 12/17] s390/pageattr: Mark intentional 4k kernel mappings Heiko Carstens
2026-12-03 10:33 ` [PATCH 13/17] s390/pageattr: Collapse kernel mappings after changing page attributes Heiko Carstens
2026-12-03 10:33 ` [PATCH 14/17] s390/mm: Add PAGE_KERNEL_ROX Heiko Carstens
2026-12-03 10:33 ` [PATCH 15/17] s390/execmem: Add EXECMEM_KPROBES range Heiko Carstens
2026-12-03 10:33 ` [PATCH 16/17] s390/execmem: Add EXECMEM_FTRACE range Heiko Carstens
2026-12-03 10:33 ` [PATCH 17/17] s390/execmem: Enable EXECMEM_ARCH_ROX Heiko Carstens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203103345.1206548-1-hca@linux.ibm.com \
    --to=hca@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gerald.schaefer@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=rppt@kernel.org \
    --cc=svens@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox