Re: [PATCH v3 3/4] openrisc: Add unit tests for KProbes on branch instructions

From: Sahil

Date: Wed Nov 18 2026 - 06:27:01 EST


On 11/15/26 7:22 AM, Stafford Horne wrote:
On Fri, Nov 13, 2026 at 10:45:03PM +0530, Sahil wrote:
On 11/8/26 1:33 PM, Stafford Horne wrote:
On Tue, Oct 27, 2026 at 01:42:39AM +0530, Sahil Siddiq wrote:
Tests already exist lib/tests to verify the generic functionality of
KProbes. Add unit tests to verify that KProbes work on instructions
that require simulation in the OpenRISC ISA, and that the corresponding
delay slots are handled correctly.

Signed-off-by: Sahil Siddiq <sahilcdq0@xxxxxxxxx>
[...]
+
+SYM_FUNC_START(test_kprobes_j)
+test_kprobes_j_addr1:
+ l.addi r11,r0,0
+ l.j 2f
+ l.nop

Just a tiny comment here about indenting the delay slots.

Got it, I'll indent this.

You could also use the delayslots here, for example:

l.j 2f
l.addi r11,r0,0

I initially thought of that too. But then I thought by keeping l.addi
before l.j, I would also be able to test this for the case when
there are no delay slots. I can reshuffle the instructions if that
test isn't required. Please let me know what your thoughts are.

I don't think it matters either way since these are tests. But, it would be good
to note that in a comment at the top of the files where you want to maintain
that convention.

However, thinking a bit further that may be hard to enforce down the line just
for a handful of files. We should assume the kernel code uses delayslots.

I agree. Since "head.S" and "entry.S" already use delay slots, I don't think the
kernel will work with a CPU config that has delay slots disabled. Also, there
should now be no need to have a static key for "delay_slot".


-Stafford


Thanks,
Sahil