Skip to content

[PW_SID:1147295] [v4] perf tests: mmap-basic: fix user rdpmc detection logic - #2484

Closed
linux-riscv-bot wants to merge 4 commits into
workflow__riscv__fixesfrom
pw1147295
Closed

[PW_SID:1147295] [v4] perf tests: mmap-basic: fix user rdpmc detection logic#2484
linux-riscv-bot wants to merge 4 commits into
workflow__riscv__fixesfrom
pw1147295

Conversation

@linux-riscv-bot

Copy link
Copy Markdown

PR for series 1147295 applied to workflow__riscv__fixes

Name: [v4] perf tests: mmap-basic: fix user rdpmc detection logic
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1147295
Version: 4

ThreeBottleCap and others added 4 commits August 14, 2026 14:12
…_RWX

When CONFIG_STRICT_MODULE_RWX is not set, execmem cannot create
temporary writable mappings for read-only executable pages. In this
case, the execmem ranges must already have writable permissions.

Currently EXECMEM_KPROBES unconditionally uses PAGE_KERNEL_READ_EXEC,
which causes kprobe instruction slot writes to trigger page faults
on systems where CONFIG_STRICT_MODULE_RWX is not enabled.

Fix this by using PAGE_KERNEL_EXEC when CONFIG_STRICT_MODULE_RWX
is not available.

Signed-off-by: Xiaofeng Yuan <xiaofengmian@163.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Nam Cao <namcao@linutronix.de>
Link: https://patch.msgid.link/20260814082742.148403-2-xiaofengmian@163.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
patch_map() always creates a temporary writable mapping via fixmap for
kernel text addresses, even when CONFIG_STRICT_KERNEL_RWX is disabled
and the kernel text is already mapped with _PAGE_WRITE.

This is unnecessary overhead at best, and on minimal configurations
it can cause page faults.

Skip the fixmap path for kernel text when CONFIG_STRICT_KERNEL_RWX
is not enabled, since the text pages are already writable in that case.
The module text path is already gated on CONFIG_STRICT_MODULE_RWX and
is kept unchanged.

Reported-by: Klara Modin <klara@kasm.eu>
Closes: https://lore.kernel.org/all/ant_8TaBbov_GS4i@soda.int.kasm.eu/
Reported-by: Lad Prabhakar <prabhakar.csengg@gmail.com>
Closes: https://lore.kernel.org/all/CA+V-a8tQK8rih9SGGTyqrEBGpNkx4H0eX2YccCRrgkVAPr+EBg@mail.gmail.com/
Tested-by: Klara Modin <klarasmodin@gmail.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://patch.msgid.link/20260814082742.148403-3-xiaofengmian@163.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
RISC-V and Arm control userspace counter access through
/proc/sys/kernel/perf_user_access. Add that as a fallback to
set_user_read() so the test can test both the enabled and disabled
states on those platforms. RISC-V also uses a '2' value rather than just
0 or 1 so add support for restoring arbitrary values.

On Arm, cap_user_rdpmc will always be set when requested, even if the
global setting is disabled. This is so that the feature can be enabled
or revoked while events are live. Skip checking it on Arm for the
"expected disabled" case, otherwise the test will fail.

Add comments, more meaningful variable names and improve the error
messages so that it's clearer what this part of the test is doing.

Signed-off-by: Qiao Zhao <qzhao@redhat.com>
[Test pc->index, fix bugs in set_user_read(), and simplify commit msg]
Assisted-by: Codex:GPT-5.6
Signed-off-by: James Clark <james.clark@linaro.org>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v4] perf tests: mmap-basic: fix user rdpmc detection logic"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 144.12 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v4] perf tests: mmap-basic: fix user rdpmc detection logic"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1126.93 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v4] perf tests: mmap-basic: fix user rdpmc detection logic"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1478.59 seconds
Result: PENDING

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v4] perf tests: mmap-basic: fix user rdpmc detection logic"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 61.61 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v4] perf tests: mmap-basic: fix user rdpmc detection logic"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 28.63 seconds
Result: PENDING

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v4] perf tests: mmap-basic: fix user rdpmc detection logic"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 64.25 seconds
Result: PENDING

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v4] perf tests: mmap-basic: fix user rdpmc detection logic"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 121.29 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v4] perf tests: mmap-basic: fix user rdpmc detection logic"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 33.70 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v4] perf tests: mmap-basic: fix user rdpmc detection logic"
kdoc
Desc: Detects for kdoc errors
Duration: 32.33 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v4] perf tests: mmap-basic: fix user rdpmc detection logic"
module-param
Desc: Detect module_param changes
Duration: 19.03 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v4] perf tests: mmap-basic: fix user rdpmc detection logic"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 16.59 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v4] perf tests: mmap-basic: fix user rdpmc detection logic"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 35.92 seconds
Result: PASS

@linux-riscv-bot
linux-riscv-bot force-pushed the workflow__riscv__fixes branch 2 times, most recently from bb1a926 to 6f6f7c0 Compare August 21, 2026 03:35
@linux-riscv-bot
linux-riscv-bot deleted the pw1147295 branch August 25, 2026 00:50
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.

3 participants