ftrace function_graph causes kernel panic on arm32

liang wang liang26812 at gmail.com
Fri Oct 9 02:48:08 EDT 2020


Hi all,
I just found that function_graph cannot work on arm32,enable
function_graph will cause kernel panic.I noticed LR is always at
psci_cpu_suspend
[  101.855680] c7 CPU: 7 PID: 0 Comm: swapper/7 Tainted: G           O
   4.14.193+ #28
[  101.863377] c7 Hardware name: Generic DT based system
[  101.868397] c7 task: cf841199 task.stack: ec0658c9
[  101.873165] c7 PC is at 0xedef3200
[  101.876548] c7 LR is at psci_cpu_suspend+0x70/0x94
[  101.881291] c7 pc : [<edef3200>]    lr : [<c084920c>]    psr: 600001d3
[  101.887782] c7 sp : ee96bf28  ip : 00000004  fp : 00000001
[  101.893234] c7 r10: edef3200  r9 : 00000001  r8 : edefb400
[  101.898686] c7 r7 : c01114fc  r6 : ee96bf28  r5 : 00000000  r4 : 00000001
[  101.905436] c7 r3 : 4100c0f0  r2 : 4100d050  r1 : 00000009  r0 : 00000000

I searched online and found the commit
de818bd4522c40ea02a81b387d2fa86f989c9623 ("arm64: kernel:
pause/unpause function graph tracer in cpu_suspend()").
I refer to this patch and made the following changes on arm32,it fixes the crash
diff --git a/arch/arm/kernel/suspend.c b/arch/arm/kernel/suspend.c
index d080992..31130b1 100644
--- a/arch/arm/kernel/suspend.c
+++ b/arch/arm/kernel/suspend.c
@@ -12,6 +12,7 @@
 #include <asm/smp_plat.h>
 #include <asm/suspend.h>
 #include <asm/tlbflush.h>
+#include <linux/ftrace.h>

 extern int __cpu_suspend(unsigned long, int (*)(unsigned long), u32
 extern void cpu_resume_mmu(void);
@@ -23,6 +24,8 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsign
        u32 __mpidr = cpu_logical_map(smp_processor_id());
        int ret;

+       pause_graph_tracing();
+
        if (!idmap_pgd)
                return -EINVAL;

@@ -40,6 +43,8 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsign
                check_other_bugs();
        }

+       unpause_graph_tracing();
+
        return ret;
 }
 #else

I want to know why this change has not been pushed to arm32,is it
appropriate to use pause/unpause_graph_tracing in cpu_suspend?
Thanks.



More information about the linux-arm mailing list