Skip to content

Commit fecab26

Browse files
stffrdhrnjfvogel
authored andcommitted
rseq/selftests: Fix riscv rseq_offset_deref_addv inline asm
commit 713e788 upstream. When working on OpenRISC support for restartable sequences I noticed and fixed these two issues with the riscv support bits. 1 The 'inc' argument to RSEQ_ASM_OP_R_DEREF_ADDV was being implicitly passed to the macro. Fix this by adding 'inc' to the list of macro arguments. 2 The inline asm input constraints for 'inc' and 'off' use "er", The riscv gcc port does not have an "e" constraint, this looks to be copied from the x86 port. Fix this by just using an "r" constraint. I have compile tested this only for riscv. However, the same fixes I use in the OpenRISC rseq selftests and everything passes with no issues. Fixes: 171586a ("selftests/rseq: riscv: Template memory ordering and percpu access mode") Signed-off-by: Stafford Horne <shorne@gmail.com> Tested-by: Charlie Jenkins <charlie@rivosinc.com> Reviewed-by: Charlie Jenkins <charlie@rivosinc.com> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Acked-by: Shuah Khan <skhan@linuxfoundation.org> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20250114170721.3613280-1-shorne@gmail.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit ec9acbab2ea787ef45e46679c62b656912c605b5) Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
1 parent 5a0eda2 commit fecab26

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tools/testing/selftests/rseq/rseq-riscv-bits.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,16 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_offset_deref_addv)(intptr_t *ptr, off_t off, i
243243
#ifdef RSEQ_COMPARE_TWICE
244244
RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, "%l[error1]")
245245
#endif
246-
RSEQ_ASM_OP_R_DEREF_ADDV(ptr, off, 3)
246+
RSEQ_ASM_OP_R_DEREF_ADDV(ptr, off, inc, 3)
247247
RSEQ_INJECT_ASM(4)
248248
RSEQ_ASM_DEFINE_ABORT(4, abort)
249249
: /* gcc asm goto does not allow outputs */
250250
: [cpu_id] "r" (cpu),
251251
[current_cpu_id] "m" (rseq_get_abi()->RSEQ_TEMPLATE_CPU_ID_FIELD),
252252
[rseq_cs] "m" (rseq_get_abi()->rseq_cs.arch.ptr),
253253
[ptr] "r" (ptr),
254-
[off] "er" (off),
255-
[inc] "er" (inc)
254+
[off] "r" (off),
255+
[inc] "r" (inc)
256256
RSEQ_INJECT_INPUT
257257
: "memory", RSEQ_ASM_TMP_REG_1
258258
RSEQ_INJECT_CLOBBER

tools/testing/selftests/rseq/rseq-riscv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ do { \
158158
"bnez " RSEQ_ASM_TMP_REG_1 ", 222b\n" \
159159
"333:\n"
160160

161-
#define RSEQ_ASM_OP_R_DEREF_ADDV(ptr, off, post_commit_label) \
161+
#define RSEQ_ASM_OP_R_DEREF_ADDV(ptr, off, inc, post_commit_label) \
162162
"mv " RSEQ_ASM_TMP_REG_1 ", %[" __rseq_str(ptr) "]\n" \
163163
RSEQ_ASM_OP_R_ADD(off) \
164164
REG_L RSEQ_ASM_TMP_REG_1 ", 0(" RSEQ_ASM_TMP_REG_1 ")\n" \

0 commit comments

Comments
 (0)