[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241225223300.68299ea8a2836c6947fe9d1c@kernel.org>
Date: Wed, 25 Dec 2024 22:33:00 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Alexei Starovoitov <alexei.starovoitov@...il.com>, Florent Revest
<revest@...omium.org>, linux-trace-kernel@...r.kernel.org, LKML
<linux-kernel@...r.kernel.org>, Martin KaFai Lau <martin.lau@...ux.dev>,
bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>, Jiri Olsa
<jolsa@...nel.org>, Alan Maguire <alan.maguire@...cle.com>, Mark Rutland
<mark.rutland@....com>, linux-arch@...r.kernel.org, Heiko Carstens
<hca@...ux.ibm.com>, Will Deacon <will@...nel.org>, Catalin Marinas
<catalin.marinas@....com>, Huacai Chen <chenhuacai@...nel.org>, WANG Xuerui
<kernel@...0n.name>, Paul Walmsley <paul.walmsley@...ive.com>, Palmer
Dabbelt <palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>, Vasily
Gorbik <gor@...ux.ibm.com>, Alexander Gordeev <agordeev@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>, Sven Schnelle
<svens@...ux.ibm.com>, Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar
<mingo@...hat.com>, Borislav Petkov <bp@...en8.de>, Dave Hansen
<dave.hansen@...ux.intel.com>, x86@...nel.org, "H. Peter Anvin"
<hpa@...or.com>, Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Subject: Re: [PATCH v21 03/20] fgraph: Replace fgraph_ret_regs with
ftrace_regs
Hi,
On Mon, 23 Dec 2024 16:39:56 -0500
Steven Rostedt <rostedt@...dmis.org> wrote:
> On Tue, 10 Dec 2024 11:09:26 +0900
> "Masami Hiramatsu (Google)" <mhiramat@...nel.org> wrote:
>
> > From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
> >
> > Use ftrace_regs instead of fgraph_ret_regs for tracing return value
> > on function_graph tracer because of simplifying the callback interface.
> >
> > The CONFIG_HAVE_FUNCTION_GRAPH_RETVAL is also replaced by
> > CONFIG_HAVE_FUNCTION_GRAPH_FREGS.
> >
> > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>
> > Acked-by: Heiko Carstens <hca@...ux.ibm.com>
>
> My x86-32 test failed on this patch with:
>
> [ 8.387985] Testing tracer preemptoff: PASSED
> [ 9.603053] Testing tracer preemptirqsoff: PASSED
> [ 10.820200] Testing tracer wakeup: PASSED
> [ 12.030489] Testing tracer wakeup_rt: PASSED
> [ 13.237925] Testing tracer wakeup_dl: PASSED
> [ 14.440146] Testing tracer function_graph:
> [ 14.611021] ------------[ cut here ]------------
> [ 14.614997] WARNING: CPU: 0 PID: 1 at kernel/sched/deadline.c:1519 update_curr_dl_se+0x205/0x270
> [ 14.614997] Modules linked in:
> [ 14.614997] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 <89>E<EC><E8>^Q~A<FF>d<8B>5<80><96>wɅ<C0><B8>`<FC>9<C9>^OE<F8><8B><86><94>^D 6.13.0-rc4-test-00003-g50b6e5b87e20-dirty #811
> [ 14.614997] PSh<E5>^L5<C9><E8><99><FC>^Y<FF><83><C4>^L<EB><C3>.<8D><B4>&
> [ 14.614997] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
> [ 14.614997] EIP: update_curr_dl_se+0x205/0x270
> [ 14.614997] Code: 51 10 89 43 34 0f b7 43 48 89 53 38 66 25 40 01 66 83 f8 40 75 04 80 4b 48 81 89 d8 e8 14 5b ff ff 83 f8 01 0f 84 d4 fe ff ff <0f> 0b e9 cd fe ff ff 8d 74 26 00 ba 20 00 00 00 89 d8 e8 c4 ab ff
> [ 14.614997] EAX: c81eed9c EBX: f6f896e0 ECX: c81eed9c EDX: 00000001
> [ 14.614997] ESI: f6f89100 EDI: fffffffe EBP: c11cdaac ESP: c11cda94
> [ 14.614997] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 EFLAGS: 00010082
> [ 14.614997] CR0: 80050033 CR2: ff9ff000 CR3: 0978c000 CR4: 000006f0
> [ 14.614997] Call Trace:
> [ 14.614997] irq event stamp: 11132292
> [ 14.614997] hardirqs last enabled at (11132291): [<c82fac0c>] trace_graph_entry+0x23c/0x3d0
> [ 14.614997] hardirqs last disabled at (11132292): [<c8e9f0bc>] sysvec_apic_timer_interrupt+0xc/0x40
> [ 14.614997] softirqs last enabled at (11059360): [<c81678ac>] return_to_handler+0x0/0x34
> [ 14.614997] softirqs last disabled at (11059355): [<c81678ac>] return_to_handler+0x0/0x34
> [ 14.614997] ---[ end trace 0000000000000000 ]---
> [ 7.652636] ------------[ cut here ]------------
> [ 7.652636] DEBUG_LOCKS_WARN_ON(1)
> [ 7.652636] WARNING: CPU: 0 PID: 1 at kernel/locking/lockdep.c:232 __lock_acquire+0xf42/0x25c0
> [ 7.652636] Modules linked in:
> [ 7.652636] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 <89>E<EC><E8>^Q~A<FF>d<8B>5<80><96>wɅ<C0><B8>`<FC>9<C9>^OE<F8><8B><86><94>^D 6.13.0-rc4-test-00003-g50b6e5b87e20-dirty #811
> [ 7.652636] PSh<E5>^L5<C9><E8><99><FC>^Y<FF><83><C4>^L<EB><C3>.<8D><B4>&
> [ 7.652636] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
> [ 7.652636] EIP: __lock_acquire+0xf42/0x25c0
> [ 7.652636] Code: e8 63 ba 57 00 85 c0 0f 84 19 f9 ff ff 8b 0d a8 59 62 c9 85 c9 0f 85 0b f9 ff ff 68 c4 8c 34 c9 68 0b 23 32 c9 e8 be ce f7 ff <0f> 0b 58 31 c0 5a e9 61 f2 ff ff 8d 76 00 b9 05 00 00 00 64 a1 80
> [ 7.652636] EAX: c820bf72 EBX: 00000000 ECX: c820bf72 EDX: 00000001
> [ 7.652636] ESI: 00000000 EDI: c11a2e38 EBP: c1143e7c ESP: c1143de4
> [ 7.652636] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 EFLAGS: 00010086
> [ 7.652636] CR0: 80050033 CR2: ff9ff000 CR3: 0978c000 CR4: 000006f0
> [ 7.652636] Call Trace:
> [ 7.652636] WARNING: stack recursion on stack type 3
> [ 7.652636] irq event stamp: 11215629
> [ 7.652636] hardirqs last enabled at (11215628): [<c81917c9>] handle_softirqs+0x99/0x3b0
> [ 7.652636] hardirqs last disabled at (11215629): [<c8eaf5cd>] _raw_spin_lock_irq+0x4d/0x50
> [ 7.652636] softirqs last enabled at (11059360): [<c81678ac>] return_to_handler+0x0/0x34
> [ 7.652636] softirqs last disabled at (11215627): [<c81678ac>] return_to_handler+0x0/0x34
> [ 7.652636] ---[ end trace 0000000000000000 ]---
> [ 7.652636] ------------[ cut here ]------------
> [ 7.652636] kernel BUG at arch/x86/mm/extable.c:373!
> [ 7.652636] ------------[ cut here ]------------
> [ 7.652636] kernel BUG at arch/x86/mm/extable.c:373!
> [ 7.652636] ------------[ cut here ]------------
> [ 7.652636] kernel BUG at arch/x86/mm/extable.c:373!
> [ 7.652636] ------------[ cut here ]------------
> [ 7.652636] kernel BUG at arch/x86/mm/extable.c:373!
> [ 7.652636] ------------[ cut here ]------------
> [ 7.652636] kernel BUG at arch/x86/mm/extable.c:373!
> [ 7.652636] ------------[ cut here ]------------
> [ 7.652636] kernel BUG at arch/x86/mm/extable.c:373!
> [ 7.652636] ------------[ cut here ]------------
> [...]
>
> Config attached.
Thanks for reporting!
diff --git a/arch/x86/kernel/ftrace_32.S b/arch/x86/kernel/ftrace_32.S
index 58d9ed50fe61..8e1a27d2c1eb 100644
--- a/arch/x86/kernel/ftrace_32.S
+++ b/arch/x86/kernel/ftrace_32.S
@@ -187,14 +187,15 @@ SYM_CODE_END(ftrace_graph_caller)
.globl return_to_handler
return_to_handler:
- pushl $0
- pushl %edx
- pushl %eax
+ subl $(PTREGS_SIZE), %esp
+ movl $0, PT_EBP(%esp)
+ movl %edx, PT_EDX(%esp)
+ movl %eax, PT_EAX(%esp)
movl %esp, %eax
call ftrace_return_to_handler
movl %eax, %ecx
- popl %eax
- popl %edx
- addl $4, %esp # skip ebp
+ movl %eax, PT_EAX(%esp)
+ movl %edx, PT_EDX(%esp)
Aah, my bad! These should recover registers from stack...
movl PT_EAX(%esp), %eax
movl PT_EDX(%esp), %edx
+ addl $(PTREGS_SIZE), %esp
JMP_NOSPEC ecx
#endif
Can you try below change?
Thank you!
diff --git a/arch/x86/kernel/ftrace_32.S b/arch/x86/kernel/ftrace_32.S
index 8e1a27d2c1eb..f4e0c3361234 100644
--- a/arch/x86/kernel/ftrace_32.S
+++ b/arch/x86/kernel/ftrace_32.S
@@ -194,8 +194,8 @@ return_to_handler:
movl %esp, %eax
call ftrace_return_to_handler
movl %eax, %ecx
- movl %eax, PT_EAX(%esp)
- movl %edx, PT_EDX(%esp)
+ movl PT_EAX(%esp), %eax
+ movl PT_EDX(%esp), %edx
addl $(PTREGS_SIZE), %esp
JMP_NOSPEC ecx
#endif
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists