linux/arch/s390
Gerald Schaefer f934f6be76 s390/mm: Introduce region-third and segment table swap entries
Introduce region-third (PUD) and segment table (PMD) swap entries, and
make hugetlbfs RSTE <-> PTE conversion code aware of them, so that they
can be used for hugetlbfs PTE_MARKER entries. Future work could also
build on this to enable THP_SWAP and THP_MIGRATION for s390.

Similar to PTE swap entries, bits 0-51 can be used to store the swap
offset, but bits 57-61 cannot be used for swap type because that overlaps
with the INVALID and TABLE TYPE bits. PMD/PUD swap entries must be invalid,
and have a correct table type so that pud_folded() check still works.

Bits 53-57 can be used for swap type, but those include the PROTECT bit.
So unlike swap PTEs, the PROTECT bit cannot be used to mark the swap entry.
Use the "Common-Segment/Region" bit 59 instead for that.

Also remove the !MACHINE_HAS_NX check in __set_huge_pte_at(). Otherwise,
that would clear the _SEGMENT_ENTRY_NOEXEC bit also for swap entries, where
it is used for encoding the swap type. The architecture only requires this
bit to be 0 for PTEs, with !MACHINE_HAS_NX, not for segment or region-third
entries. And the check is also redundant, because after __pte_to_rste()
conversion, for non-swap PTEs it would only be set if it was already set in
the PTE, which should never be the case for !MACHINE_HAS_NX.

This is a prerequisite for hugetlbfs PTE_MARKER support on s390, which
is needed to fix a regression introduced with commit 8a13897fb0
("mm: userfaultfd: support UFFDIO_POISON for hugetlbfs"). That commit
depends on the availability of swap entries for hugetlbfs, which were
not available for s390 so far.

Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
2024-11-27 12:55:21 +01:00
..
appldata sysctl: treewide: constify the ctl_table argument of proc_handlers 2024-07-24 20:59:29 +02:00
boot s390/mm: Allow large pages for KASAN shadow mapping 2024-11-24 16:59:51 +01:00
configs s390 updates for 6.13 merge window 2024-11-18 17:45:41 -08:00
crypto s390/crypto: Add hardware acceleration for full AES-XTS mode 2024-10-29 11:17:19 +01:00
hypfs [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
include s390/mm: Introduce region-third and segment table swap entries 2024-11-27 12:55:21 +01:00
kernel s390/entry: Mark IRQ entries to fix stack depot warnings 2024-11-21 12:44:07 +01:00
kvm KVM: s390: Remove one byte cmpxchg() usage 2024-11-27 12:55:15 +01:00
lib s390/string: Convert to use flag output macros 2024-11-13 14:31:33 +01:00
mm s390/mm: Introduce region-third and segment table swap entries 2024-11-27 12:55:21 +01:00
net s390/bpf: Implement exceptions 2024-07-08 16:39:35 +02:00
pci s390 updates for 6.13 merge window 2024-11-18 17:45:41 -08:00
purgatory s390: Fix various typos 2024-10-25 16:03:23 +02:00
tools s390 updates for 6.12 merge window 2024-09-21 09:02:54 -07:00
Kbuild - An extensive rework of kexec and crash Kconfig from Eric DeVolder 2023-08-29 14:53:51 -07:00
Kconfig s390: Add ARCH_HAS_PREEMPT_LAZY support 2024-11-24 16:59:42 +01:00
Kconfig.debug
Makefile s390: use a larger stack for KMSAN 2024-07-03 19:30:24 -07:00
Makefile.postlink s390/build: Avoid relocation information in final vmlinux 2024-08-27 20:16:48 +02:00