linux-next/arch/s390/mm
Gerald Schaefer 03e6db16b8 s390/mm: Introduce region-third and segment table entry present bits
Introduce region-third and segment table entry present SW bits, and adjust
pmd/pud_present() accordingly.

Also add pmd/pud_present() checks to pmd/pud_leaf(), to return false for
future swap entries. Same logic applies to pmd_trans_huge(), make that
return pmd_leaf() instead of duplicating the same check.

huge_pte_offset() also needs to be adjusted, current code would return
NULL for !pud_present(). Use the same logic as in the generic version,
which allows for !pud_present() swap entries.

Similar to PTE, bit 63 can be used for the new SW present bit in region
and segment table entries. For segment-table entries (PMD) the architecture
says that "Bits 62-63 are available for programming", so they are safe to
use. The same is true for large leaf region-third-table entries (PUD).

However, for non-leaf region-third-table entries, bits 62-63 indicate the
TABLE LENGTH and both must be set to 1. But such entries would always be
considered as present, so it is safe to use bit 63 as PRESENT bit for PUD.
They also should not conflict with bit 62 potentially later used for
preserving SOFT_DIRTY in swap entries, because they are not swap entries.

Valid PMDs / PUDs should always have the present bit set, so add it to
the various pgprot defines, and also _SEGMENT_ENTRY which is OR'ed e.g.
in pmd_populate(). _REGION3_ENTRY wouldn't need any change, as the present
bit is already included in the TABLE LENGTH, but also explicitly add it
there, for completeness, and just in case the bit would ever be changed.

gmap code needs some adjustment, to also OR the _SEGMENT_ENTRY, like it
is already done gmap_shadow_pgt() when creating new PMDs, but not in
__gmap_link(). Otherwise, the gmap PMDs would not be considered present,
e.g. when using pmd_leaf() checks in gmap code. The various WARN_ON
checks in gmap code also need adjustment, to tolerate the new present
bit.

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
..
cmm.c s390/mm: Add cond_resched() to cmm_alloc/free_pages() 2024-09-05 15:17:23 +02:00
dump_pagetables.c s390 updates for 6.12 merge window 2024-09-21 09:02:54 -07:00
extable.c s390: add support for DCACHE_WORD_ACCESS 2023-10-16 13:04:09 +02:00
extmem.c s390/extmem: Convert to use flag output macros 2024-11-13 14:31:33 +01:00
fault.c s390/mm: Cleanup fault error handling 2024-10-29 11:49:19 +01:00
gmap.c s390/mm: Introduce region-third and segment table entry present bits 2024-11-27 12:55:21 +01:00
hugetlbpage.c s390/mm: Introduce region-third and segment table entry present bits 2024-11-27 12:55:21 +01:00
init.c memblock: updates for 6.12-rc1 2024-09-25 11:35:19 -07:00
maccess.c s390/uaccess: Make s390_kernel_write() usable for decompressor 2024-07-23 16:02:31 +02:00
Makefile s390/mm: provide simple ARCH_HAS_DEBUG_VIRTUAL support 2024-03-13 09:23:49 +01:00
mmap.c mm: make arch_get_unmapped_area() take vm_flags by default 2024-09-09 16:39:13 -07:00
page-states.c s390/cmma: rework no-dat handling 2023-11-05 22:34:58 +01:00
pageattr.c s390/pageattr: Convert to use flag output macros 2024-11-13 14:31:31 +01:00
pfault.c s390/pfault: use consistent comment style 2023-07-29 14:57:18 +02:00
pgalloc.c s390 updates for 6.11 merge window 2024-07-18 15:41:45 -07:00
pgtable.c s390: Fix various typos 2024-10-25 16:03:23 +02:00
physaddr.c s390/mm: provide simple ARCH_HAS_DEBUG_VIRTUAL support 2024-03-13 09:23:49 +01:00
vmem.c s390: Keep inittext section writable 2024-07-31 16:30:20 +02:00