Skip to content

[PW_SID:1155929] riscv: kprobes: simulate nop and c.nop instructions - #2576

Open
linux-riscv-bot wants to merge 3 commits into
workflow__riscv__fixesfrom
pw1155929
Open

[PW_SID:1155929] riscv: kprobes: simulate nop and c.nop instructions#2576
linux-riscv-bot wants to merge 3 commits into
workflow__riscv__fixesfrom
pw1155929

Conversation

@linux-riscv-bot

Copy link
Copy Markdown

PR for series 1155929 applied to workflow__riscv__fixes

Name: riscv: kprobes: simulate nop and c.nop instructions
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1155929
Version: 3

Linux RISC-V bot and others added 3 commits September 2, 2026 05:24
A kprobe or uprobe placed on a nop currently replays the instruction
out-of-line: the breakpoint trap runs the probe handler and redirects
execution to a copy of the instruction sitting in an XOL slot, and a
second breakpoint appended after the copy traps again to finish the
hit.  That costs an extra exception round-trip per hit; for uprobes
the slot runs in user mode, so the re-trap is a full
kernel<->userspace round-trip.

nop and c.nop have no architectural effect, so the replay can be
replaced by simply advancing the program counter when handling the
initial breakpoint, completing every hit within a single trap.
arm64 does the same in its probe-decode path, which is also shared
between kprobes and uprobes; see commit ac4ad5c ("arm64: insn:
Simulate nop instruction for better uprobe performance").

riscv_probe_decode_insn() is shared by kprobes and uprobes, so the
simulation applies to both.  It primarily matters for uprobes on
USDT probe sites: under the SystemTap SDT ABI (sys/sdt.h, parsed by
libbpf), the recorded probe location is by construction a plain nop
or c.nop, the same case that motivated the arm64 series.

Measured on QEMU (RISC-V virt, emulated): for a uprobe on a USDT
style nop site the per-hit cost drops by roughly 80 percent; for a
kprobe on a nop by roughly 40 percent.  On real arm64 hardware the
referenced commit measured ~2x.

Compile tested on RISC-V, and verified with the RISC-V kprobes
KUnit test which now covers nop and c.nop.

Signed-off-by: Xiaofeng Yuan <yuanxiaofeng@eswincomputing.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Extend the RISC-V kprobes KUnit test with test_kprobes_nop and
test_kprobes_c_nop, covering both the 32-bit nop and the
compressed c.nop simulation paths.

Signed-off-by: Xiaofeng Yuan <yuanxiaofeng@eswincomputing.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v3,1/2] riscv: kprobes: simulate nop and c.nop instructions"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 141.73 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v3,1/2] riscv: kprobes: simulate nop and c.nop instructions"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1575.72 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v3,1/2] riscv: kprobes: simulate nop and c.nop instructions"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1820.37 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v3,1/2] riscv: kprobes: simulate nop and c.nop instructions"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 26.44 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v3,1/2] riscv: kprobes: simulate nop and c.nop instructions"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 27.64 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v3,1/2] riscv: kprobes: simulate nop and c.nop instructions"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.41 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v3,1/2] riscv: kprobes: simulate nop and c.nop instructions"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 92.19 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v3,1/2] riscv: kprobes: simulate nop and c.nop instructions"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.65 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v3,1/2] riscv: kprobes: simulate nop and c.nop instructions"
kdoc
Desc: Detects for kdoc errors
Duration: 0.83 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v3,1/2] riscv: kprobes: simulate nop and c.nop instructions"
module-param
Desc: Detect module_param changes
Duration: 0.28 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v3,1/2] riscv: kprobes: simulate nop and c.nop instructions"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v3,1/2] riscv: kprobes: simulate nop and c.nop instructions"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.32 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v3,2/2] riscv: kprobes: add nop and c.nop to the KUnit test"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 142.01 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v3,2/2] riscv: kprobes: add nop and c.nop to the KUnit test"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1184.34 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v3,2/2] riscv: kprobes: add nop and c.nop to the KUnit test"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1507.60 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v3,2/2] riscv: kprobes: add nop and c.nop to the KUnit test"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 26.47 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v3,2/2] riscv: kprobes: add nop and c.nop to the KUnit test"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 27.66 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v3,2/2] riscv: kprobes: add nop and c.nop to the KUnit test"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.77 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v3,2/2] riscv: kprobes: add nop and c.nop to the KUnit test"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 91.05 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v3,2/2] riscv: kprobes: add nop and c.nop to the KUnit test"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v3,2/2] riscv: kprobes: add nop and c.nop to the KUnit test"
kdoc
Desc: Detects for kdoc errors
Duration: 0.81 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v3,2/2] riscv: kprobes: add nop and c.nop to the KUnit test"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v3,2/2] riscv: kprobes: add nop and c.nop to the KUnit test"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 2: "[v3,2/2] riscv: kprobes: add nop and c.nop to the KUnit test"
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