Re: [PATCH v2 0/4] openrisc: Add support for KProbes
From: Sahil
Date: Wed Sep 30 2026 - 18:08:33 EST
On 10/1/26 2:01 AM, Sahil Siddiq wrote:
Hi,
Apologies for the delay. This is v2 of the patch series to add KProbe
support for OpenRISC.
The series also adds support for Kretprobes (which depends on the rethook
framework [1]). Kretprobes are fired on function return.
[...]
I have also made changes based on the review comments I received for
v1 [5] including several of Sachiko's comments [6]. I chose not to make
changes in a few places. I'll send emails as a reply to this thread
explaining my reasoning inline.
[...]
Sahil Siddiq (4):
openrisc: Add utilities and clean up simulation of instructions
openrisc: Add KProbes
openrisc: Add unit tests for KProbes on branch instructions
openrisc: Add Kretprobes
[...]>
Sorry, I forgot to post a summary of the differences between v2 and v1:
Commit #1:
- arch/openrisc/include/asm/cpuinfo.h: Introduce "delay_slot" static key
- arch/openrisc/include/asm/insn-def.h:
- Use macros instead of union
- Use better names for macros
- Use genmask() for masks
- arch/openrisc/kernel/insn.c:
- Use macros instead of magic values
- (simulate_pc): Update PC
- (simulate_branch): Handle rb=r9 in l.jalr simulation
- arch/openrisc/kernel/setup.c: Use "delay slot" static key
- arch/openrisc/kernel/traps.c: Use macros instead of magic values
Commit #2:
- arch/openrisc/include/asm/kprobes.h:
- (struct prev_kprobe): Add restore_pc
- (struct kprobe_ctlblk): Move restore_pc from global "struct arch_specific_insn"
- arch/openrisc/kernel/kprobes.c:
- Use macros instead of magic values
- Use "get_kernel_nofault" instead of directly dereferencing address
- (insns_need_simulation): Use "daley slot" static key
- (arch_prepare_kprobe): Prevent KProbe insertion if instruction in delay slot also requires simulation
- (save_previous_kprobe): Use "restore_pc"
- (restore_previous_kprobe): Likewise
- (post_kprobe_handler): Don't re-enable preemption if KProbe is nested
- (setup_singlestep): Use "restore_pc"
- (reenter_kprobe): Return false in case of unrecoverable KProbe
- (kprobe_singlestep_handler): Enable interrupt in pt_regs->sr
- (kprobe_fault_handler): Likewise
Commit #3/#4: Introduced in v2 of the series
Thanks,
Sahil