Kconfig dependency issue on function-graph tracer and frame pointer on arm
Subsystems (2)
Masami Hiramatsu
maintainerHello,
Recently, Naresh reported that the function-graph tracer on the latest kernel crashes on arm. I could reproduce it and bisected. I finally found the commit f9b58e8c7d03 ("ARM: 8800/1: use choice for kernel unwinders") was the first bad commit.
Actually, this commit is just changing Kconfig for making kernel unwinder choosable. However, as a side effect, this makes CONFIG_FRAME_POINTER=n by default even if CONFIG_FUNCTION_GRAPH_TRACER=y.
(Note that function-graph tracer implementation on arm depends on
FRAME_POINTER.)
This seems odd, because the commit introduced below code
+choice
+ prompt "Choose kernel unwinder" + default UNWINDER_ARM if AEABI && !FUNCTION_GRAPH_TRACER + default UNWINDER_FRAME_POINTER if !AEABI || FUNCTION_GRAPH_TRACER + help
So, it seems UNWINDER_FRAME_POINTER is used if FUNCTION_GRAPH_TRACER=y. However, it seems not working. (I guess this is a wrong syntax for Kconfig)
Moreover, since this just setting default value, there seems no direct dependency to FRAME_POINTER from FUNCTION_GRAPH_TRACER. I guess user can change it...
I made a fix below (which I tested). This is ugly (arch specific dependency in generic part) but works.
It enables both of FRAME_POINTER and UNWINDER_ARM.
However I still have some questions.
- Is above choice+default a correct syntax for Kconfig? (Masahiro?)
- Can UNWINDER_ARM work with FRAME_POINTER? (Arnd?)
kernel/trace/Kconfig +1 -0
@@ -160,6 +160,7 @@ config FUNCTION_GRAPH_TRACER depends on HAVE_FUNCTION_GRAPH_TRACER depends on FUNCTION_TRACER depends on !X86_32 || !CC_OPTIMIZE_FOR_SIZE + select ARCH_WANT_FRAME_POINTERS if ARM default y help Enable the kernel to trace a function at both its return
Thank you,
Signature · 1 line
Masami Hiramatsu <[email protected]>
Russell King - ARM Linux admin
maintainerQuoted 6 lines · Masami Hiramatsu
Hello,
Recently, Naresh reported that the function-graph tracer on the latest kernel crashes on arm. I could reproduce it and bisected. I finally found the commit
f9b58e8c7d03("ARM: 8800/1: use choice for kernel unwinders") was the first bad commit.
I don't think that littering the rest of the kernel Kconfig with ARM specific stuff is really a viable solution to this.
If we examine the current situation, we have:
- THUMB2_KERNEL selecting ARM_UNWIND when enabled.
- UNWINDER_FRAME_POINTER disabled if THUMB2_KERNEL is enabled, provided we're not using Clang. This leaves UNWINDER_ARM as the only choice, which also selects ARM_UNWIND.
- The default choice is dependent on the settings of AEABI and FUNCTION_GRAPH_TRACER.
- HAVE_FUNCTION_GRAPH_TRACER is disabled if THUMB2_KERNEL is enabled.
which seems to be _way_ too messy.
Looking back before this commit, the function graph tracer never had a strong dependence on frame pointers being enabled in the kernel, but it seems the code relies upon them (see ftrace_return_to_handler() in kernel/trace/ and return_to_handler in arch/arm/kernel/entry-frace.S). There is also the __ftrace_graph_caller macro which seems to rely on it.
Since Clang does not support frame pointers, we shouldn't even offer the function graph tracer for Clang compilers, so let's do that with the first hunk of the patch below.
The subsequent hunks remove the defaulting of the choice according to the function graph tracer - this is not a "hint" where the user can still choose either option irrespective of the state of the function graph tracer. They should only be able to select the frame pointer option in that case.
Another way forward would be for someone to put the work in to making the function graph tracer work without frame pointers.
So, how about this:
arch/arm/Kconfig +1 -1
@@ -73,7 +73,7 @@ config ARM select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && MMU select HAVE_EXIT_THREAD select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL - select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL + select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG select HAVE_FUNCTION_TRACER if !XIP_KERNEL select HAVE_GCC_PLUGINS select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
arch/arm/Kconfig.debug +3 -3
@@ -47,8 +47,8 @@ config DEBUG_WX choice prompt "Choose kernel unwinder" - default UNWINDER_ARM if AEABI && !FUNCTION_GRAPH_TRACER - default UNWINDER_FRAME_POINTER if !AEABI || FUNCTION_GRAPH_TRACER + default UNWINDER_ARM if AEABI + default UNWINDER_FRAME_POINTER if !AEABI help This determines which method will be used for unwinding kernel stack traces for panics, oopses, bugs, warnings, perf, /proc/<pid>/stack,
@@ -65,7 +65,7 @@ config UNWINDER_FRAME_POINTER config UNWINDER_ARM bool "ARM EABI stack unwinder" - depends on AEABI + depends on AEABI && !FUNCTION_GRAPH_TRACER select ARM_UNWIND help This option enables stack unwinding support in the kernel
Signature · 8 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Masami Hiramatsu
maintainerQuoted 21 lines · On Sun, 14 Apr 2019 14:34:58 +0100 Russell King - ARM Linux admin…
Quoted 6 lines · Masami Hiramatsu
Hello,
Recently, Naresh reported that the function-graph tracer on the latest kernel crashes on arm. I could reproduce it and bisected. I finally found the commit
f9b58e8c7d03("ARM: 8800/1: use choice for kernel unwinders") was the first bad commit.I don't think that littering the rest of the kernel
Kconfigwith ARM specific stuff is really a viable solution to this.If we examine the current situation, we have:
-
THUMB2_KERNELselectingARM_UNWINDwhen enabled.
-UNWINDER_FRAME_POINTERdisabled ifTHUMB2_KERNELis enabled, provided we're not using Clang. This leavesUNWINDER_ARMas the only choice, which also selectsARM_UNWIND.
- The default choice is dependent on the settings of AEABI andFUNCTION_GRAPH_TRACER.
-HAVE_FUNCTION_GRAPH_TRACERis disabled ifTHUMB2_KERNELis enabled.
Quoted 7 lines
which seems to be _way_ too messy.
Looking back before this commit, the function graph tracer never had a strong dependence on frame pointers being enabled in the kernel, but it seems the code relies upon them (see
ftrace_return_to_handler()inkernel/trace/andreturn_to_handlerinarch/arm/kernel/entry-frace.S). There is also the__ftrace_graph_callermacro which seems to rely on it.
Yes, so I think similar bug is hiding in other LTS kernels. It should have a dependency to FRAME_POINTER on arm.
Quoted 9 lines
Since Clang does not support frame pointers, we shouldn't even offer the function graph tracer for Clang compilers, so let's do that with the first hunk of the patch below.
The subsequent hunks remove the defaulting of the choice according to the function graph tracer - this is not a "hint" where the user can still choose either option irrespective of the state of the function graph tracer. They should only be able to select the frame pointer option in that case.
Agreed. Using default for making dependency is wrong.
Quoted 3 lines
Another way forward would be for someone to put the work in to making the function graph tracer work without frame pointers.
Yes, we eventually need that. But for fixing current released kernel (this bug is in v5.0 series), I think Kconfig fix is needed.
Quoted 21 lines
So, how about this:
arch/arm/Kconfig +1
-1@@ -73,7 +73,7 @@ config ARM select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && MMU select HAVE_EXIT_THREAD select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL - select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL + select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG select HAVE_FUNCTION_TRACER if !XIP_KERNEL select HAVE_GCC_PLUGINS select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)arch/arm/Kconfig.debug +0
-0
arch/arm/Kconfig.debug config DEBUG_WX · line 51
Quoted 7 lines
arch/arm/Kconfig.debug +2
-2@@ -47,8 +47,8 @@ config DEBUG_WX choice prompt "Choose kernel unwinder" - default UNWINDER_ARM if AEABI && !FUNCTION_GRAPH_TRACER - default UNWINDER_FRAME_POINTER if !AEABI || FUNCTION_GRAPH_TRACER + default UNWINDER_ARM if AEABI + default UNWINDER_FRAME_POINTER if !AEABI
If UNWINDER_ARM depends on ARM EABI, would we really need this "if !AEABI"? (I doubt we need these default...)
arch/arm/Kconfig.debug config UNWINDER_FRAME_POINTER · line 68
Quoted 9 lines
arch/arm/Kconfig.debug +1
-1help This determines which method will be used for unwinding kernel stack traces for panics, oopses, bugs, warnings, perf, /proc/<pid>/stack,@@ -65,7 +65,7 @@ config UNWINDER_FRAME_POINTER config UNWINDER_ARM bool "ARM EABI stack unwinder" - depends on AEABI + depends on AEABI && !FUNCTION_GRAPH_TRACER
Hmm, AFAIK, FUNCTION_GRAPH_TRACER only depends on FRAME_POINTER, but not UNWINDER_FRAME_POINTER. So can user still choose UNWINDER_ARM even if FUNCTION_GRAPH_TRACER=y ? (Of course that may not be a meaningful option)
Thank you,
Quoted 8 lines
arch/arm/Kconfig.debug +0
-0select ARM_UNWIND help This option enables stack unwinding support in the kernelSignature · 4 lines
-- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up
Signature · 1 line
Masami Hiramatsu <[email protected]>
Russell King - ARM Linux admin
maintainerQuoted 91 lines · Masami Hiramatsu
Quoted 21 lines · On Sun, 14 Apr 2019 14:34:58 +0100 Russell King - ARM Linux admin…
Quoted 6 lines · Masami Hiramatsu
Hello,
Recently, Naresh reported that the function-graph tracer on the latest kernel crashes on arm. I could reproduce it and bisected. I finally found the commit
f9b58e8c7d03("ARM: 8800/1: use choice for kernel unwinders") was the first bad commit.I don't think that littering the rest of the kernel
Kconfigwith ARM specific stuff is really a viable solution to this.If we examine the current situation, we have:
-
THUMB2_KERNELselectingARM_UNWINDwhen enabled.
-UNWINDER_FRAME_POINTERdisabled ifTHUMB2_KERNELis enabled, provided we're not using Clang. This leavesUNWINDER_ARMas the only choice, which also selectsARM_UNWIND.
- The default choice is dependent on the settings of AEABI andFUNCTION_GRAPH_TRACER.
-HAVE_FUNCTION_GRAPH_TRACERis disabled ifTHUMB2_KERNELis enabled.Quoted 7 lines
which seems to be _way_ too messy.
Looking back before this commit, the function graph tracer never had a strong dependence on frame pointers being enabled in the kernel, but it seems the code relies upon them (see
ftrace_return_to_handler()inkernel/trace/andreturn_to_handlerinarch/arm/kernel/entry-frace.S). There is also the__ftrace_graph_callermacro which seems to rely on it.Yes, so I think similar bug is hiding in other LTS kernels. It should have a dependency to
FRAME_POINTERon arm.Quoted 9 lines
Since Clang does not support frame pointers, we shouldn't even offer the function graph tracer for Clang compilers, so let's do that with the first hunk of the patch below.
The subsequent hunks remove the defaulting of the choice according to the function graph tracer - this is not a "hint" where the user can still choose either option irrespective of the state of the function graph tracer. They should only be able to select the frame pointer option in that case.
Agreed. Using default for making dependency is wrong.
Quoted 3 lines
Another way forward would be for someone to put the work in to making the function graph tracer work without frame pointers.
Yes, we eventually need that. But for fixing current released kernel (this bug is in v5.0 series), I think
Kconfigfix is needed.Quoted 21 lines
So, how about this:
arch/arm/Kconfig +1
-1@@ -73,7 +73,7 @@ config ARM select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && MMU select HAVE_EXIT_THREAD select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL - select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL + select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG select HAVE_FUNCTION_TRACER if !XIP_KERNEL select HAVE_GCC_PLUGINS select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)arch/arm/Kconfig.debug +0
-0arch/arm/Kconfig.debug config DEBUG_WX · line 51
Quoted 7 lines
arch/arm/Kconfig.debug +2
-2@@ -47,8 +47,8 @@ config DEBUG_WX choice prompt "Choose kernel unwinder" - default UNWINDER_ARM if AEABI && !FUNCTION_GRAPH_TRACER - default UNWINDER_FRAME_POINTER if !AEABI || FUNCTION_GRAPH_TRACER + default UNWINDER_ARM if AEABI + default UNWINDER_FRAME_POINTER if !AEABIIf
UNWINDER_ARMdepends on ARM EABI, would we really need this "if !AEABI"? (I doubt we need these default...)Quoted 5 lines
arch/arm/Kconfig.debug +0
-0help This determines which method will be used for unwinding kernel stack traces for panics, oopses, bugs, warnings, perf, /proc/<pid>/stack,@@ -65,7 +65,7 @@ config UNWINDER_FRAME_POINTER
Quoted 8 lines
arch/arm/Kconfig.debug config UNWINDER_FRAME_POINTER · line 68
Quoted 4 lines
arch/arm/Kconfig.debug +1
-1config UNWINDER_ARM bool "ARM EABI stack unwinder" - depends on AEABI + depends on AEABI && !FUNCTION_GRAPH_TRACERHmm, AFAIK,
FUNCTION_GRAPH_TRACERonly depends onFRAME_POINTER, but notUNWINDER_FRAME_POINTER. So can user still chooseUNWINDER_ARMeven if FUNCTION_GRAPH_TRACER=y ? (Of course that may not be a meaningful option)
The UNWINDER_* options do not control anything except whether FRAME_POINTER is enabled or not. FRAME_POINTER controls not only whether we build with frame pointers, but also how we unwind. If both ARM_UNWIND and FRAME_POINTER are set, the kernel will fail to link due to a multiple definition of unwind_frame().
The UNWINDER_* symbols were added in the commit you referenced merely to select which of ARM_UNWIND or FRAME_POINTER are enabled.
Signature · 3 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up
Quoted 101 lines · On Sun, 14 Apr 2019 16:37:04 +0100 Russell King - ARM Linux admin…
Quoted 91 lines · Masami Hiramatsu
Quoted 21 lines · On Sun, 14 Apr 2019 14:34:58 +0100 Russell King - ARM Linux admin…
Quoted 6 lines · Masami Hiramatsu
Hello,
Recently, Naresh reported that the function-graph tracer on the latest kernel crashes on arm. I could reproduce it and bisected. I finally found the commit
f9b58e8c7d03("ARM: 8800/1: use choice for kernel unwinders") was the first bad commit.I don't think that littering the rest of the kernel
Kconfigwith ARM specific stuff is really a viable solution to this.If we examine the current situation, we have:
-
THUMB2_KERNELselectingARM_UNWINDwhen enabled.
-UNWINDER_FRAME_POINTERdisabled ifTHUMB2_KERNELis enabled, provided we're not using Clang. This leavesUNWINDER_ARMas the only choice, which also selectsARM_UNWIND.
- The default choice is dependent on the settings of AEABI andFUNCTION_GRAPH_TRACER.
-HAVE_FUNCTION_GRAPH_TRACERis disabled ifTHUMB2_KERNELis enabled.Quoted 7 lines
which seems to be _way_ too messy.
Looking back before this commit, the function graph tracer never had a strong dependence on frame pointers being enabled in the kernel, but it seems the code relies upon them (see
ftrace_return_to_handler()inkernel/trace/andreturn_to_handlerinarch/arm/kernel/entry-frace.S). There is also the__ftrace_graph_callermacro which seems to rely on it.Yes, so I think similar bug is hiding in other LTS kernels. It should have a dependency to
FRAME_POINTERon arm.Quoted 9 lines
Since Clang does not support frame pointers, we shouldn't even offer the function graph tracer for Clang compilers, so let's do that with the first hunk of the patch below.
The subsequent hunks remove the defaulting of the choice according to the function graph tracer - this is not a "hint" where the user can still choose either option irrespective of the state of the function graph tracer. They should only be able to select the frame pointer option in that case.
Agreed. Using default for making dependency is wrong.
Quoted 3 lines
Another way forward would be for someone to put the work in to making the function graph tracer work without frame pointers.
Yes, we eventually need that. But for fixing current released kernel (this bug is in v5.0 series), I think
Kconfigfix is needed.Quoted 21 lines
So, how about this:
arch/arm/Kconfig +1
-1@@ -73,7 +73,7 @@ config ARM select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && MMU select HAVE_EXIT_THREAD select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL - select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL + select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG select HAVE_FUNCTION_TRACER if !XIP_KERNEL select HAVE_GCC_PLUGINS select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)arch/arm/Kconfig.debug +0
-0arch/arm/Kconfig.debug config DEBUG_WX · line 51
Quoted 7 lines
arch/arm/Kconfig.debug +2
-2@@ -47,8 +47,8 @@ config DEBUG_WX choice prompt "Choose kernel unwinder" - default UNWINDER_ARM if AEABI && !FUNCTION_GRAPH_TRACER - default UNWINDER_FRAME_POINTER if !AEABI || FUNCTION_GRAPH_TRACER + default UNWINDER_ARM if AEABI + default UNWINDER_FRAME_POINTER if !AEABIIf
UNWINDER_ARMdepends on ARM EABI, would we really need this "if !AEABI"? (I doubt we need these default...)Quoted 5 lines
arch/arm/Kconfig.debug +0
-0help This determines which method will be used for unwinding kernel stack traces for panics, oopses, bugs, warnings, perf, /proc/<pid>/stack,@@ -65,7 +65,7 @@ config UNWINDER_FRAME_POINTERQuoted 8 lines
arch/arm/Kconfig.debug config UNWINDER_FRAME_POINTER · line 68
Quoted 4 lines
arch/arm/Kconfig.debug +1
-1config UNWINDER_ARM bool "ARM EABI stack unwinder" - depends on AEABI + depends on AEABI && !FUNCTION_GRAPH_TRACERHmm, AFAIK,
FUNCTION_GRAPH_TRACERonly depends onFRAME_POINTER, but notUNWINDER_FRAME_POINTER. So can user still chooseUNWINDER_ARMeven if FUNCTION_GRAPH_TRACER=y ? (Of course that may not be a meaningful option)
Quoted 5 lines
The UNWINDER_* options do not control anything except whether
FRAME_POINTERis enabled or not.FRAME_POINTERcontrols not only whether we build with frame pointers, but also how we unwind. If bothARM_UNWINDandFRAME_POINTERare set, the kernel will fail to link due to a multiple definition ofunwind_frame().
Thank you for the explanation :) got it.
Quoted 4 lines
The UNWINDER_* symbols were added in the commit you referenced merely to select which of
ARM_UNWINDorFRAME_POINTERare enabled.
OK, this looks good to me.
Thank you!
Signature · 6 lines
Masami Hiramatsu <[email protected]> _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 8 lines · Russell King - ARM Linux admin
The subsequent hunks remove the defaulting of the choice according to the function graph tracer - this is not a "hint" where the user can still choose either option irrespective of the state of the function graph tracer. They should only be able to select the frame pointer option in that case.
Another way forward would be for someone to put the work in to making the function graph tracer work without frame pointers.
I think Stefan was already looking into making CONFIG_FUNCTION_TRACER work with clang. I don't know what the status of that work is, but I think gettingFUNCTION_GRAPH_TRACER working at the same time would be best.
I never noticed the Kconfig issue here, because I was using a patch to turn off FUNCTION_TRACER on ARM with clang to make it build, and that turns off FUNCTION_GRAPH_TRACER in the process.
Quoted 31 lines
So, how about this:
arch/arm/Kconfig +1
-1@@ -73,7 +73,7 @@ config ARM select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && MMU select HAVE_EXIT_THREAD select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL - select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL + select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG select HAVE_FUNCTION_TRACER if !XIP_KERNEL select HAVE_GCC_PLUGINS select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)arch/arm/Kconfig.debug +2
-2@@ -47,8 +47,8 @@ config DEBUG_WX choice prompt "Choose kernel unwinder" - default UNWINDER_ARM if AEABI && !FUNCTION_GRAPH_TRACER - default UNWINDER_FRAME_POINTER if !AEABI || FUNCTION_GRAPH_TRACER + default UNWINDER_ARM if AEABI + default UNWINDER_FRAME_POINTER if !AEABI help This determines which method will be used for unwinding kernel stack traces for panics, oopses, bugs, warnings, perf, /proc/<pid>/stack,
arch/arm/Kconfig.debug config UNWINDER_FRAME_POINTER · line 71
Quoted 8 lines
arch/arm/Kconfig.debug +1
-1@@ -65,7 +65,7 @@ config UNWINDER_FRAME_POINTER config UNWINDER_ARM bool "ARM EABI stack unwinder" - depends on AEABI + depends on AEABI && !FUNCTION_GRAPH_TRACER select ARM_UNWIND help This option enables stack unwinding support in the kernel
This looks good to me in the meantime, at least if there is any way to get the non-graph FUNCTION_TRACER to build with clang.
Arnd
Quoted 9 lines · Arnd Bergmann
Quoted 6 lines · Russell King - ARM Linux admin
The subsequent hunks remove the defaulting of the choice according to the function graph tracer - this is not a "hint" where the user can still choose either option irrespective of the state of the function graph tracer. They should only be able to select the frame pointer option in that case.
Quoted 7 lines
Quoted 2 lines
Another way forward would be for someone to put the work in to making the function graph tracer work without frame pointers.
I think Stefan was already looking into making
CONFIG_FUNCTION_TRACERwork with clang. I don't know what the status of that work is, but I think gettingFUNCTION_GRAPH_TRACERworking at the same time would be best.
Function Tracer is currently blocked by buggy mcount implemention on Clang side. I do have a hacked up version which works with the buggy Clang implementation, but not something we want to merge IMHO. see also:
https://bugs.llvm.org/show_bug.cgi?id=33845
Quoted 7 lines
I never noticed the
Kconfigissue here, because I was using a patch to turn offFUNCTION_TRACERon ARM with clang to make it build, and that turns offFUNCTION_GRAPH_TRACERin the process.Quoted 2 lines
So, how about this:
Quoted 11 lines
arch/arm/Kconfig config ARM · line 77
Quoted 11 lines
arch/arm/Kconfig +1
-1@@ -73,7 +73,7 @@ config ARM select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && MMU select HAVE_EXIT_THREAD select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL - select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL + select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG select HAVE_FUNCTION_TRACER if !XIP_KERNEL
I think due to the fact above, we should add && !CC_IS_CLANG here too.
Quoted 19 lines
Quoted 19 lines
arch/arm/Kconfig +0
-0select HAVE_GCC_PLUGINS select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)arch/arm/Kconfig.debug +2
-2@@ -47,8 +47,8 @@ config DEBUG_WX choice prompt "Choose kernel unwinder" - default UNWINDER_ARM if AEABI && !FUNCTION_GRAPH_TRACER - default UNWINDER_FRAME_POINTER if !AEABI || FUNCTION_GRAPH_TRACER + default UNWINDER_ARM if AEABI + default UNWINDER_FRAME_POINTER if !AEABI help This determines which method will be used for unwinding kernel stack traces for panics, oopses, bugs, warnings, perf, /proc/<pid>/stack,@@ -65,7 +65,7 @@ config UNWINDER_FRAME_POINTER
Quoted 10 lines
arch/arm/Kconfig.debug config UNWINDER_FRAME_POINTER · line 71
Quoted 7 lines
arch/arm/Kconfig.debug +1
-1config UNWINDER_ARM bool "ARM EABI stack unwinder" - depends on AEABI + depends on AEABI && !FUNCTION_GRAPH_TRACER select ARM_UNWIND help This option enables stack unwinding support in the kernelThis looks good to me in the meantime, at least if there is any way to get the non-graph
FUNCTION_TRACERto build with clang.
Looks sensible to me too.
Note that a similar issue came up a while ago on the mailing list:
https://marc.info/?l=linux-arm-kernel&m=154739414703313&w=2
[added Jeremy]
Unfortunately this never really materialized in a mergeable patch.
--
Stefan