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

Palmer Dabbelt palmer at dabbelt.com
Sun Jun 25 13:32:32 PDT 2023


On Tue, 16 May 2023 02:37:53 PDT (-0700), suagrfillet at gmail.com wrote:
> Steven Rostedt <rostedt at goodmis.org> 于2023年5月15日周一 18:37写道:
>>
>> On Thu, 11 May 2023 17:32:34 +0800
>> Song Shuai <suagrfillet at gmail.com> 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@yadro.com/T/#ma13012560331c66b051b580b3ab4a04ba44455ec
>> > Tested-by: Evgenii Shatokhin <e.shatokhin at yadro.com>
>> > Signed-off-by: Song Shuai <suagrfillet at gmail.com>
>> > Tested-by: Guo Ren <guoren at kernel.org>
>> > Signed-off-by: Guo Ren <guoren at kernel.org>
>> > Acked-by: Björn Töpel <bjorn at rivosinc.com>
>> > ---
>> >  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



More information about the linux-riscv mailing list