]> www.infradead.org Git - users/jedix/linux-maple.git/commit
s390/mm: Add PTE_MARKER support for hugetlbfs mappings
authorGerald Schaefer <gerald.schaefer@linux.ibm.com>
Thu, 21 Nov 2024 17:45:23 +0000 (18:45 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Wed, 27 Nov 2024 11:57:01 +0000 (12:57 +0100)
commit487ef5d4d912f6a32556d8a61cede17870925295
treeba87553d680175faa57960092bb6e1d07b8590ac
parentf934f6be76c1d033692f7fbfcbb06ec44a25bf3f
s390/mm: Add PTE_MARKER support for hugetlbfs mappings

Commit 8a13897fb0daa ("mm: userfaultfd: support UFFDIO_POISON for
hugetlbfs") added support for PTE_MARKER_POISONED for hugetlbfs, but
PTE_MARKER also needs support for swap entries. For s390, swap entries
were only supported on PTE level, not on the PMD/PUD levels that are used
for large hugetlbfs mappings.

Therefore, when writing a PTE_MARKER_POISONED entry, the resulting entry
on PMD/PUD level would be an invalid / empty entry. Further access would
then generate a pagefault loop, instead of the expected SIGBUS. It is a
loop inside the kernel, but interruptible and uffd fault handling also
calls schedule() in between, so at least it won't completely block the
system.

Previous commits prepared support for swap entries on PMD/PUD levels.
PTE_MARKER support for hugetlbfs can now be enabled by simply adding an
extra is_pte_marker() check to huge_pte_none_mostly(). Fault handling
code also needs to be adjusted to expect the VM_FAULT_HWPOISON_LARGE
fault flag, which was not possible on s390 before.

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>
arch/s390/include/asm/hugetlb.h
arch/s390/mm/fault.c