Re: [PATCH V10 4/4] samples: ftrace: Add riscv support for SAMPLE_FTRACE_DIRECT[_MULTI]

From: Palmer Dabbelt
Date: Sun Jun 25 2023 - 16:32:42 EST


On Tue, 16 May 2023 02:37:53 PDT (-0700), suagrfillet@xxxxxxxxx wrote:
Steven Rostedt <rostedt@xxxxxxxxxxx> 于2023年5月15日周一 18:37写道:

On Thu, 11 May 2023 17:32:34 +0800
Song Shuai <suagrfillet@xxxxxxxxx> wrote:

> select HAVE_SAMPLE_FTRACE_DIRECT and HAVE_SAMPLE_FTRACE_DIRECT_MULTI
> for ARCH_RV64I in arch/riscv/Kconfig. And add riscv asm code for
> the ftrace-direct*.c files in samples/ftrace/.
>
> Link: https://lore.kernel.org/linux-riscv/c68bac83-5c88-80b1-bac9-e1fd4ea8f07e@xxxxxxxxx/T/#ma13012560331c66b051b580b3ab4a04ba44455ec
> Tested-by: Evgenii Shatokhin <e.shatokhin@xxxxxxxxx>
> Signed-off-by: Song Shuai <suagrfillet@xxxxxxxxx>
> Tested-by: Guo Ren <guoren@xxxxxxxxxx>
> Signed-off-by: Guo Ren <guoren@xxxxxxxxxx>
> Acked-by: Björn Töpel <bjorn@xxxxxxxxxxxx>
> ---
> arch/riscv/Kconfig | 2 ++
> samples/ftrace/ftrace-direct-modify.c | 34 ++++++++++++++++++
> samples/ftrace/ftrace-direct-multi-modify.c | 40 +++++++++++++++++++++
> samples/ftrace/ftrace-direct-multi.c | 24 +++++++++++++
> samples/ftrace/ftrace-direct-too.c | 27 ++++++++++++++
> samples/ftrace/ftrace-direct.c | 23 ++++++++++++
> 6 files changed, 150 insertions(+)

I acked v8 (which you will need my ack to get these in). Unless this patch
changed since v8, you should include my ack in further versions.

There were no changes in this patch, except for a few tab pretties since v8.
your Acked-by will still be included.
Or you may be waiting longer for its acceptance.

If the patch did change, please acknowledge that in the next version (or
this one if it did change), asking me to ack it again.

The samples fail to build on rv32, they're rv64-specific. I think something like this should do it

diff --git a/samples/ftrace/ftrace-direct-too.c b/samples/ftrace/ftrace-direct-too.c
index 5c319db48af2..3707c447a42d 100644
--- a/samples/ftrace/ftrace-direct-too.c
+++ b/samples/ftrace/ftrace-direct-too.c
@@ -24,19 +24,19 @@ asm (
" .type my_tramp, @function\n"
" .globl my_tramp\n"
" my_tramp:\n"
-" addi sp,sp,-40\n"
-" sd a0,0(sp)\n"
-" sd a1,8(sp)\n"
-" sd a2,16(sp)\n"
-" sd t0,24(sp)\n"
-" sd ra,32(sp)\n"
+" addi sp,sp,-8*SZREG\n"
+" REG_S a0,0*SZREG(sp)\n"
+" REG_S a1,1*SZREG(sp)\n"
+" REG_S a2,2*SZREG(sp)\n"
+" REG_S t0,3*SZREG(sp)\n"
+" REG_S ra,4*SZREG(sp)\n"
" call my_direct_func\n"
-" ld a0,0(sp)\n"
-" ld a1,8(sp)\n"
-" ld a2,16(sp)\n"
-" ld t0,24(sp)\n"
-" ld ra,32(sp)\n"
-" addi sp,sp,40\n"
+" REG_L a0,0*SZREG(sp)\n"
+" REG_L a1,1*SZREG(sp)\n"
+" REG_L a2,2*SZREG(sp)\n"
+" REG_L t0,3*SZREG(sp)\n"
+" REG_L ra,4*SZREG(sp)\n"
+" addi sp,sp,8*SZREG\n"
" jr t0\n"
" .size my_tramp, .-my_tramp\n"
" .popsection\n"

probably for all of them. Do you mind sending a v11 with that fixed?

-- Steve



--
Thanks,
Song