Skip to content

Commit 8564c31

Browse files
FlorentRevestrostedt
authored andcommitted
samples: ftrace: Save required argument registers in sample trampolines
The ftrace-direct-too sample traces the handle_mm_fault function whose signature changed since the introduction of the sample. Since: commit bce617e ("mm: do page fault accounting in handle_mm_fault") handle_mm_fault now has 4 arguments. Therefore, the sample trampoline should save 4 argument registers. s390 saves all argument registers already so it does not need a change but x86_64 needs an extra push and pop. This also evolves the signature of the tracing function to make it mirror the signature of the traced function. Link: https://lkml.kernel.org/r/20230427140700.625241-2-revest@chromium.org Cc: stable@vger.kernel.org Fixes: bce617e ("mm: do page fault accounting in handle_mm_fault") Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org> Reviewed-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Florent Revest <revest@chromium.org> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent 06c2afb commit 8564c31

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

samples/ftrace/ftrace-direct-too.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
#include <linux/ftrace.h>
66
#include <asm/asm-offsets.h>
77

8-
extern void my_direct_func(struct vm_area_struct *vma,
9-
unsigned long address, unsigned int flags);
8+
extern void my_direct_func(struct vm_area_struct *vma, unsigned long address,
9+
unsigned int flags, struct pt_regs *regs);
1010

11-
void my_direct_func(struct vm_area_struct *vma,
12-
unsigned long address, unsigned int flags)
11+
void my_direct_func(struct vm_area_struct *vma, unsigned long address,
12+
unsigned int flags, struct pt_regs *regs)
1313
{
14-
trace_printk("handle mm fault vma=%p address=%lx flags=%x\n",
15-
vma, address, flags);
14+
trace_printk("handle mm fault vma=%p address=%lx flags=%x regs=%p\n",
15+
vma, address, flags, regs);
1616
}
1717

1818
extern void my_tramp(void *);
@@ -34,7 +34,9 @@ asm (
3434
" pushq %rdi\n"
3535
" pushq %rsi\n"
3636
" pushq %rdx\n"
37+
" pushq %rcx\n"
3738
" call my_direct_func\n"
39+
" popq %rcx\n"
3840
" popq %rdx\n"
3941
" popq %rsi\n"
4042
" popq %rdi\n"

0 commit comments

Comments
 (0)