The ftrace-direct-too sample traces the handle_mm_fault function whose signature changed since the introduction of the sample. Since: commit bce617edecad ("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
Showing the changes to samples (1 of 1 file). Show all
Unified · Split
| @@ -5,14 +5,14 @@ · 4 unmodified lines | |||
| 5 | #include <linux/ftrace.h> | 5 | #include <linux/ftrace.h> |
| 6 | #include <asm/asm-offsets.h> | 6 | #include <asm/asm-offsets.h> |
| 7 | 7 | ||
| 8 | extern void my_direct_func(struct vm_area_struct *vma, | 8 | extern void my_direct_func(struct vm_area_struct *vma, unsigned long address, |
| 9 | unsigned long address, unsigned int flags); | 9 | unsigned int flags, struct pt_regs *regs); |
| 10 | 10 | ||
| 11 | void my_direct_func(struct vm_area_struct *vma, | 11 | void my_direct_func(struct vm_area_struct *vma, unsigned long address, |
| 12 | unsigned long address, unsigned int flags) | 12 | unsigned int flags, struct pt_regs *regs) |
| 13 | { | 13 | { |
| 14 | trace_printk("handle mm fault vma=%p address=%lx flags=%x\n", | 14 | trace_printk("handle mm fault vma=%p address=%lx flags=%x regs=%p\n", |
| 15 | vma, address, flags); | 15 | vma, address, flags, regs); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | extern void my_tramp(void *); | 18 | extern void my_tramp(void *); |
| @@ -34,7 +34,9 @@ asm ( · 15 unmodified lines | |||
| 34 | " pushq %rdi\n" | 34 | " pushq %rdi\n" |
| 35 | " pushq %rsi\n" | 35 | " pushq %rsi\n" |
| 36 | " pushq %rdx\n" | 36 | " pushq %rdx\n" |
| 37 | " pushq %rcx\n" | ||
| 37 | " call my_direct_func\n" | 38 | " call my_direct_func\n" |
| 39 | " popq %rcx\n" | ||
| 38 | " popq %rdx\n" | 40 | " popq %rdx\n" |
| 39 | " popq %rsi\n" | 41 | " popq %rsi\n" |
| 40 | " popq %rdi\n" | 42 | " popq %rdi\n" |