mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] riscv: kprobes: simulate nop and c.nop instructions
@ 2026-08-19 10:26 Xiaofeng Yuan
  2026-08-19 10:26 ` [PATCH 1/2] " Xiaofeng Yuan
  2026-08-19 10:26 ` [PATCH 2/2] riscv: kprobes: add nop and c.nop to the KUnit test Xiaofeng Yuan
  0 siblings, 2 replies; 3+ messages in thread
From: Xiaofeng Yuan @ 2026-08-19 10:26 UTC (permalink / raw)
  To: linux-kernel

nop and c.nop have no architectural effect, so handling them through
an out-of-line instruction slot and single-stepping is pure overhead.
This series simulates them directly in the breakpoint handler by
advancing the program counter, following the approach already used on
arm64, and extends the RISC-V kprobes KUnit test to cover both paths.

Patch 1 adds the simulation. Patch 2 extends the KUnit test with
test_kprobes_nop and test_kprobes_c_nop.

Verified by cross-compiling for RISC-V and running the kprobes KUnit
test in QEMU (ok 1 kprobes_riscv).

Xiaofeng Yuan (2):
  riscv: kprobes: simulate nop and c.nop instructions
  riscv: kprobes: add nop and c.nop to the KUnit test

 arch/riscv/include/asm/insn.h                 | 11 ++++++++
 arch/riscv/kernel/probes/decode-insn.c        |  6 +++++
 arch/riscv/kernel/probes/simulate-insn.c      | 14 ++++++++++
 arch/riscv/kernel/probes/simulate-insn.h      |  2 ++
 .../kernel/tests/kprobes/test-kprobes-asm.S   | 27 +++++++++++++++++++
 5 files changed, 60 insertions(+)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-19 10:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-19 10:26 [PATCH 0/2] riscv: kprobes: simulate nop and c.nop instructions Xiaofeng Yuan
2026-08-19 10:26 ` [PATCH 1/2] " Xiaofeng Yuan
2026-08-19 10:26 ` [PATCH 2/2] riscv: kprobes: add nop and c.nop to the KUnit test Xiaofeng Yuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®