Skip to content

Commit 890e3dc

Browse files
committed
ftrace/samples: add s390 support for ftrace direct multi sample
Add s390 architecture support for the ftrace direct multi sample. See commit 5fae941 ("ftrace/samples: Add multi direct interface test module") for further details. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Heiko Carstens <[email protected]>
1 parent 503e451 commit 890e3dc

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

arch/s390/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ config S390
194194
select HAVE_RELIABLE_STACKTRACE
195195
select HAVE_RSEQ
196196
select HAVE_SAMPLE_FTRACE_DIRECT
197+
select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
197198
select HAVE_SOFTIRQ_ON_OWN_STACK
198199
select HAVE_SYSCALL_TRACEPOINTS
199200
select HAVE_VIRT_CPU_ACCOUNTING

samples/ftrace/ftrace-direct-multi.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <linux/mm.h> /* for handle_mm_fault() */
55
#include <linux/ftrace.h>
66
#include <linux/sched/stat.h>
7+
#include <asm/asm-offsets.h>
78

89
extern void my_direct_func(unsigned long ip);
910

@@ -14,6 +15,8 @@ void my_direct_func(unsigned long ip)
1415

1516
extern void my_tramp(void *);
1617

18+
#ifdef CONFIG_X86_64
19+
1720
asm (
1821
" .pushsection .text, \"ax\", @progbits\n"
1922
" .type my_tramp, @function\n"
@@ -31,6 +34,33 @@ asm (
3134
" .popsection\n"
3235
);
3336

37+
#endif /* CONFIG_X86_64 */
38+
39+
#ifdef CONFIG_S390
40+
41+
asm (
42+
" .pushsection .text, \"ax\", @progbits\n"
43+
" .type my_tramp, @function\n"
44+
" .globl my_tramp\n"
45+
" my_tramp:"
46+
" lgr %r1,%r15\n"
47+
" stmg %r0,%r5,"__stringify(__SF_GPRS)"(%r15)\n"
48+
" stg %r14,"__stringify(__SF_GPRS+8*8)"(%r15)\n"
49+
" aghi %r15,"__stringify(-STACK_FRAME_OVERHEAD)"\n"
50+
" stg %r1,"__stringify(__SF_BACKCHAIN)"(%r15)\n"
51+
" lgr %r2,%r0\n"
52+
" brasl %r14,my_direct_func\n"
53+
" aghi %r15,"__stringify(STACK_FRAME_OVERHEAD)"\n"
54+
" lmg %r0,%r5,"__stringify(__SF_GPRS)"(%r15)\n"
55+
" lg %r14,"__stringify(__SF_GPRS+8*8)"(%r15)\n"
56+
" lgr %r1,%r0\n"
57+
" br %r1\n"
58+
" .size my_tramp, .-my_tramp\n"
59+
" .popsection\n"
60+
);
61+
62+
#endif /* CONFIG_S390 */
63+
3464
static struct ftrace_ops direct;
3565

3666
static int __init ftrace_direct_multi_init(void)

0 commit comments

Comments
 (0)