Skip to content

[PW_SID:1056463] mm/pgtable: Support for page table check on s390#1489

Open
linux-riscv-bot wants to merge 4 commits intoworkflow__riscv__fixesfrom
pw1056463
Open

[PW_SID:1056463] mm/pgtable: Support for page table check on s390#1489
linux-riscv-bot wants to merge 4 commits intoworkflow__riscv__fixesfrom
pw1056463

Conversation

@linux-riscv-bot
Copy link

PR for series 1056463 applied to workflow__riscv__fixes

Name: mm/pgtable: Support for page table check on s390
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1056463
Version: 1

tobias-huschle and others added 4 commits February 23, 2026 12:48
Unlike other architectures, s390 does not have means to
distinguish kernel vs user page table entries - neither
an entry itself, nor the address could be used for that.
It is only the mm_struct that indicates whether an entry
in question is mapped to a user space. So pass mm_struct
to pxx_user_accessible_page() callbacks.

[agordeev@linux.ibm.com: rephrased commit message, removed braces]

Reviewed-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Signed-off-by: Tobias Huschle <huschle@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Commit 3a5a8d3 ("mm: fix race between __split_huge_pmd_locked()
and GUP-fast") failed to follow the convention and used direct PMD
entry modification instead of set_pmd_bit().

Reviewed-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add page table check hooks into routines that modify user page
tables.

Unlike other architectures s390 does not have means to distinguish
between kernel and user page table entries. Rely on the fact the
page table check infrastructure itself operates on non-init_mm
memory spaces only.

Use the provided mm_struct to verify that the memory space is not
init_mm (aka not the kernel memory space) indeed. That check is
supposed to be succeeded already (on some code paths even twice).

If the passed memory space by contrast is init_mm that would be an
unexpected semantical change in generic code, so do VM_BUG_ON() in
such case.

Unset _SEGMENT_ENTRY_READ bit to indicate that pmdp_invalidate()
was applied against a huge PMD and is going to be updated by
set_pmd_at() shortly. The hook pmd_user_accessible_page() should
skip such entries until that, otherwise the page table accounting
falls apart and BUG_ON() gets hit as result.

The invalidated huge PMD entry should not be confused with a PROT_NONE
entry as reported by pmd_protnone(), though the entry characteristics
exactly match: _SEGMENT_ENTRY_LARGE is set while _SEGMENT_ENTRY_READ is
unset. Since pmd_protnone() implementation depends on NUMA_BALANCING
configuration option, it should not be used in pmd_user_accessible_page()
check, which is expected to be CONFIG_NUMA_BALANCING-agnostic.

Nevertheless, an invalidated huge PMD is technically still pmd_protnone()
entry and it should not break other code paths once _SEGMENT_ENTRY_READ
is unset. As of now, all pmd_protnone() checks are done under page table
locks or exercise GUP-fast and HMM code paths, which are expected to be
safe against concurrent page table updates.

Alternative approach would be using the last remaining unused PMD entry
bit 0x800 to indicate that pmdp_invalidate() was called on a PMD. That
would allow avoiding collisions with pmd_protnone() handling code paths,
but saving the bit is more preferable way to go.

Reviewed-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Signed-off-by: Tobias Huschle <huschle@linux.ibm.com>
Co-developed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Reviewed-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Author

Patch 1: "[1/4] mm/page_table_check: Pass mm_struct to pxx_user_accessible_page()"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 139.90 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/4] mm/page_table_check: Pass mm_struct to pxx_user_accessible_page()"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 2224.73 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/4] mm/page_table_check: Pass mm_struct to pxx_user_accessible_page()"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 2954.73 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/4] mm/page_table_check: Pass mm_struct to pxx_user_accessible_page()"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 28.75 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/4] mm/page_table_check: Pass mm_struct to pxx_user_accessible_page()"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 30.02 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/4] mm/page_table_check: Pass mm_struct to pxx_user_accessible_page()"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.59 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/4] mm/page_table_check: Pass mm_struct to pxx_user_accessible_page()"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 84.12 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/4] mm/page_table_check: Pass mm_struct to pxx_user_accessible_page()"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/4] mm/page_table_check: Pass mm_struct to pxx_user_accessible_page()"
kdoc
Desc: Detects for kdoc errors
Duration: 1.02 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/4] mm/page_table_check: Pass mm_struct to pxx_user_accessible_page()"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/4] mm/page_table_check: Pass mm_struct to pxx_user_accessible_page()"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/4] mm/page_table_check: Pass mm_struct to pxx_user_accessible_page()"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.29 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/4] s390/pgtable: Use set_pmd_bit() to invalidate PMD entry"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 140.99 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/4] s390/pgtable: Use set_pmd_bit() to invalidate PMD entry"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 996.16 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/4] s390/pgtable: Use set_pmd_bit() to invalidate PMD entry"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1342.82 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/4] s390/pgtable: Use set_pmd_bit() to invalidate PMD entry"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 28.58 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/4] s390/pgtable: Use set_pmd_bit() to invalidate PMD entry"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 30.31 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/4] s390/pgtable: Use set_pmd_bit() to invalidate PMD entry"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.88 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/4] s390/pgtable: Use set_pmd_bit() to invalidate PMD entry"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 84.07 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/4] s390/pgtable: Use set_pmd_bit() to invalidate PMD entry"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/4] s390/pgtable: Use set_pmd_bit() to invalidate PMD entry"
kdoc
Desc: Detects for kdoc errors
Duration: 0.92 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/4] s390/pgtable: Use set_pmd_bit() to invalidate PMD entry"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/4] s390/pgtable: Use set_pmd_bit() to invalidate PMD entry"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.21 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/4] s390/pgtable: Use set_pmd_bit() to invalidate PMD entry"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 3: "[3/4] s390/pgtable: Add s390 support for page table check"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 141.14 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 3: "[3/4] s390/pgtable: Add s390 support for page table check"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 994.54 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 3: "[3/4] s390/pgtable: Add s390 support for page table check"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1341.62 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 3: "[3/4] s390/pgtable: Add s390 support for page table check"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 28.67 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 3: "[3/4] s390/pgtable: Add s390 support for page table check"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 29.78 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 3: "[3/4] s390/pgtable: Add s390 support for page table check"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 2.27 seconds
Result: WARNING
Output:

WARNING: Do not crash the kernel unless it is absolutely unavoidable--use WARN_ON_ONCE() plus recovery code (if feasible) instead of BUG() or variants
#179: FILE: arch/s390/include/asm/pgtable.h:1812:
+	VM_BUG_ON(mm == &init_mm);

WARNING: Do not crash the kernel unless it is absolutely unavoidable--use WARN_ON_ONCE() plus recovery code (if feasible) instead of BUG() or variants
#186: FILE: arch/s390/include/asm/pgtable.h:1819:
+	VM_BUG_ON(mm == &init_mm);

WARNING: Do not crash the kernel unless it is absolutely unavoidable--use WARN_ON_ONCE() plus recovery code (if feasible) instead of BUG() or variants
#193: FILE: arch/s390/include/asm/pgtable.h:1826:
+	VM_BUG_ON(mm == &init_mm);

total: 0 errors, 3 warnings, 0 checks, 127 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit a71007fdae47 ("s390/pgtable: Add s390 support for page table check") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 3 warnings, 0 checks, 127 lines checked
WARNING: Do not crash the kernel unless it is absolutely unavoidable--use WARN_ON_ONCE() plus recovery code (if feasible) instead of BUG() or variants


@linux-riscv-bot
Copy link
Author

Patch 3: "[3/4] s390/pgtable: Add s390 support for page table check"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 83.98 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 3: "[3/4] s390/pgtable: Add s390 support for page table check"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 3: "[3/4] s390/pgtable: Add s390 support for page table check"
kdoc
Desc: Detects for kdoc errors
Duration: 1.01 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 3: "[3/4] s390/pgtable: Add s390 support for page table check"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 3: "[3/4] s390/pgtable: Add s390 support for page table check"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.21 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 3: "[3/4] s390/pgtable: Add s390 support for page table check"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/4] s390: Enable page table check for debug_defconfig"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 141.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/4] s390: Enable page table check for debug_defconfig"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 996.73 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/4] s390: Enable page table check for debug_defconfig"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1347.28 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/4] s390: Enable page table check for debug_defconfig"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 28.70 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/4] s390: Enable page table check for debug_defconfig"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 29.94 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/4] s390: Enable page table check for debug_defconfig"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.77 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/4] s390: Enable page table check for debug_defconfig"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 84.06 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/4] s390: Enable page table check for debug_defconfig"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/4] s390: Enable page table check for debug_defconfig"
kdoc
Desc: Detects for kdoc errors
Duration: 1.00 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/4] s390: Enable page table check for debug_defconfig"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/4] s390: Enable page table check for debug_defconfig"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/4] s390: Enable page table check for debug_defconfig"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants