Skip to contentSkip to conversation

powerpc ftrace broken due to "manual merge of the ftrace tree with the arm64 tree"

PATCH Qian Cai 2 participants 7 messages Nov 15, 2019 – Nov 18, 2019

Subsystems (3)
lore
Share & tools
lore

Qian Cai

author
#0 lore raw
# echo function >/sys/kernel/debug/tracing/current_tracer

It hangs forever with today's linux-next on powerpc. Reverted the conflict fix
[1] as below fixes the issue.

[1] https://lore.kernel.org/linux-next/[email protected]/

include/asm- renamed from include/asm-generic/vmlinux.lds.h +0 -0

generic/vmlinux.lds.h
index 7d0d03a03d4d..a92222f79b53 100644

include/asm-generic/vmlinux.lds.h +0 -0
@@ -136,29 +136,20 @@

 #endif

 #ifdef CONFIG_FTRACE_MCOUNT_RECORD
-/*
- * The ftrace call sites are logged to a section whose name depends on the
- * compiler option used. A given kernel image will only use one, AKA
- * FTRACE_CALLSITE_SECTION. We capture all of them here to avoid header
- * dependencies for FTRACE_CALLSITE_SECTION's definition.
- */
-/*
- * Need to also make ftrace_graph_stub point to ftrace_stub
- * so that the same stub location may have different protocols
- * and not mess up with C verifiers.
- */
-#define MCOUNT_REC() . = ALIGN(8); \
+#ifdef CC_USING_PATCHABLE_FUNCTION_ENTRY
+#define MCOUNT_REC() . = ALIGN(8) \
  __start_mcount_loc = .; \
- KEEP(*(__mcount_loc)) \
  KEEP(*(__patchable_function_entries)) \
  __stop_mcount_loc = .; \
  ftrace_graph_stub = ftrace_stub;
 #else
-# ifdef CONFIG_FUNCTION_TRACER
-#  define MCOUNT_REC() ftrace_graph_stub = ftrace_stub;
-# else
-#  define MCOUNT_REC()
-# endif
+#define MCOUNT_REC() . = ALIGN(8); \
+ __start_mcount_loc = .; \
+ KEEP(*(__mcount_loc)) \
+ __stop_mcount_loc = .;
+#endif
+#else
+#define MCOUNT_REC()
 #endif

 #ifdef CONFIG_TRACE_BRANCH_PROFILING

maintainer
#1 lore raw
Quoted 6 lines · On Fri, 15 Nov 2019 15:28:52 -0500 Qian Cai <[email protected]> wrote:
# echo function >/sys/kernel/debug/tracing/current_tracer

It hangs forever with today's linux-next on powerpc. Reverted the conflict fix
[1] as below fixes the issue.

[1] https://lore.kernel.org/linux-next/[email protected]/

What's your config file.

And can you test the two conflicting commits to see which one caused your error?

Test this commit please: b83b43ffc6e4b514ca034a0fbdee01322e2f7022

And see if the issue is with that one, and not with the one without it.

-- Steve

Quoted 45 lines
include/asm- renamed from include/asm-generic/vmlinux.lds.h +0 -0

generic/vmlinux.lds.h
index 7d0d03a03d4d..a92222f79b53 100644

include/asm-generic/vmlinux.lds.h +0 -0
@@ -136,29 +136,20 @@
  #endif


 #ifdef CONFIG_FTRACE_MCOUNT_RECORD

include/asm-generic/vmlinux.lds.h +2 -12
-/*
- * The ftrace call sites are logged to a section whose name depends on the
- * compiler option used. A given kernel image will only use one, AKA
- * FTRACE_CALLSITE_SECTION. We capture all of them here to avoid header
- * dependencies for FTRACE_CALLSITE_SECTION's definition.
- */
-/*
- * Need to also make ftrace_graph_stub point to ftrace_stub
- * so that the same stub location may have different protocols
- * and not mess up with C verifiers.
- */
-#define MCOUNT_REC()	. = ALIGN(8);				\
+#ifdef CC_USING_PATCHABLE_FUNCTION_ENTRY
+#define MCOUNT_REC()	. = ALIGN(8)				\

  __start_mcount_loc = .; \

include/asm-generic/vmlinux.lds.h +0 -1
-			KEEP(*(__mcount_loc))			\

  KEEP(*(__patchable_function_entries)) \
  __stop_mcount_loc = .; \
  ftrace_graph_stub = ftrace_stub; #else

include/asm-generic/vmlinux.lds.h +7 -5
-# ifdef CONFIG_FUNCTION_TRACER
-#  define MCOUNT_REC()	ftrace_graph_stub = ftrace_stub;
-# else
-#  define MCOUNT_REC()
-# endif
+#define MCOUNT_REC()	. = ALIGN(8);				\
+			__start_mcount_loc = .;			\
+			KEEP(*(__mcount_loc))			\
+			__stop_mcount_loc = .;
+#endif
+#else
+#define MCOUNT_REC()

 #endif

 #ifdef CONFIG_TRACE_BRANCH_PROFILING

author
#2 lore raw
Quoted 11 lines · Steven Rostedt
Quoted 6 lines · On Fri, 15 Nov 2019 15:28:52 -0500 Qian Cai <[email protected]> wrote:
# echo function >/sys/kernel/debug/tracing/current_tracer

It hangs forever with today's linux-next on powerpc. Reverted the conflict fix
[1] as below fixes the issue.

[1] https://lore.kernel.org/linux-next/[email protected]/

What's your config file.

https://raw.githubusercontent.com/cailca/linux-mm/master/powerpc.config

Quoted 5 lines

And can you test the two conflicting commits to see which one caused your error?

Test this commit please: b83b43ffc6e4b514ca034a0fbdee01322e2f7022

# git reset --hard b83b43ffc6e4b514ca034a0fbdee01322e2f7022

Yes, that one is bad.

Quoted 53 lines

And see if the issue is with that one, and not with the one without it.

-- Steve

Quoted 45 lines
include/asm- renamed from include/asm-generic/vmlinux.lds.h +0 -0

generic/vmlinux.lds.h
index 7d0d03a03d4d..a92222f79b53 100644

include/asm-generic/vmlinux.lds.h +0 -0
@@ -136,29 +136,20 @@
  #endif


 #ifdef CONFIG_FTRACE_MCOUNT_RECORD

include/asm-generic/vmlinux.lds.h +2 -12
-/*
- * The ftrace call sites are logged to a section whose name depends on the
- * compiler option used. A given kernel image will only use one, AKA
- * FTRACE_CALLSITE_SECTION. We capture all of them here to avoid header
- * dependencies for FTRACE_CALLSITE_SECTION's definition.
- */
-/*
- * Need to also make ftrace_graph_stub point to ftrace_stub
- * so that the same stub location may have different protocols
- * and not mess up with C verifiers.
- */
-#define MCOUNT_REC()	. = ALIGN(8);				\
+#ifdef CC_USING_PATCHABLE_FUNCTION_ENTRY
+#define MCOUNT_REC()	. = ALIGN(8)				\

  __start_mcount_loc = .; \

include/asm-generic/vmlinux.lds.h +0 -1
-			KEEP(*(__mcount_loc))			\

  KEEP(*(__patchable_function_entries)) \
  __stop_mcount_loc = .; \
  ftrace_graph_stub = ftrace_stub; #else

include/asm-generic/vmlinux.lds.h +7 -5
-# ifdef CONFIG_FUNCTION_TRACER
-#  define MCOUNT_REC()	ftrace_graph_stub = ftrace_stub;
-# else
-#  define MCOUNT_REC()
-# endif
+#define MCOUNT_REC()	. = ALIGN(8);				\
+			__start_mcount_loc = .;			\
+			KEEP(*(__mcount_loc))			\
+			__stop_mcount_loc = .;
+#endif
+#else
+#define MCOUNT_REC()

 #endif

 #ifdef CONFIG_TRACE_BRANCH_PROFILING

maintainer
#3 lore raw
Quoted 5 lines · On Fri, 15 Nov 2019 16:06:34 -0500 Qian Cai <[email protected]> wrote:
Quoted 1 line

Test this commit please: b83b43ffc6e4b514ca034a0fbdee01322e2f7022

# git reset --hard b83b43ffc6e4b514ca034a0fbdee01322e2f7022

Yes, that one is bad.

Can you see if this patch fixes the issue for you?

Thanks!

-- Steve

include/asm-generic/vmlinux.lds.h +10 -3
index 0f358be551cd..fd8f4dc661dc 100644
@@ -109,6 +109,13 @@
 #define MEM_DISCARD(sec) *(.mem##sec)
 #endif
 
+/* PowerPC defines ftrace_graph_stub in the code */
+#ifndef CONFIG_PPC
+# define DEFINE_FTRACE_GRAPH_STUB	ftrace_graph_stub = ftrace_stub;
+#else
+# define DEFINE_FTRACE_GRAPH_STUB
+#endif
+
 #ifdef CONFIG_FTRACE_MCOUNT_RECORD
 #ifdef CC_USING_PATCHABLE_FUNCTION_ENTRY
 /*
@@ -120,17 +127,17 @@
 			__start_mcount_loc = .;			\
 			KEEP(*(__patchable_function_entries))	\
 			__stop_mcount_loc = .;			\
-			ftrace_graph_stub = ftrace_stub;
+			DEFINE_FTRACE_GRAPH_STUB
 #else
 #define MCOUNT_REC()	. = ALIGN(8);				\
 			__start_mcount_loc = .;			\
 			KEEP(*(__mcount_loc))			\
 			__stop_mcount_loc = .;			\
-			ftrace_graph_stub = ftrace_stub;
+			DEFINE_FTRACE_GRAPH_STUB
 #endif
 #else
 # ifdef CONFIG_FUNCTION_TRACER
-#  define MCOUNT_REC()	ftrace_graph_stub = ftrace_stub;
+#  define MCOUNT_REC()	DEFINE_FTRACE_GRAPH_STUB
 # else
 #  define MCOUNT_REC()
 # endif
maintainer
#4 lore raw
Quoted 7 lines · On Mon, 18 Nov 2019 09:51:04 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 5 lines
Quoted 1 line

Test this commit please: b83b43ffc6e4b514ca034a0fbdee01322e2f7022

# git reset --hard b83b43ffc6e4b514ca034a0fbdee01322e2f7022

Yes, that one is bad.

Can you see if this patch fixes the issue for you?

Don't bother. This isn't the right fix, I know see the real issue.

New fix coming shortly.

-- Steve

maintainer
#5 lore raw
Quoted 7 lines · On Mon, 18 Nov 2019 09:58:42 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 4 lines · On Mon, 18 Nov 2019 09:51:04 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 4 lines
Quoted 1 line

Test this commit please: b83b43ffc6e4b514ca034a0fbdee01322e2f7022

# git reset --hard b83b43ffc6e4b514ca034a0fbdee01322e2f7022
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Yes, that one is bad.

Can you see if this patch fixes the issue for you?

Don't bother. This isn't the right fix, I know see the real issue.

New fix coming shortly.

Can you try this?

It appears that I picked a name "ftrace_graph_stub", that was already in use by powerpc. This just renames the function stub I used.

-- Steve

include/asm-generic/vmlinux.lds.h +4 -4
index 0f358be551cd..996db32c491b 100644
@@ -112,7 +112,7 @@
 #ifdef CONFIG_FTRACE_MCOUNT_RECORD
 #ifdef CC_USING_PATCHABLE_FUNCTION_ENTRY
 /*
- * Need to also make ftrace_graph_stub point to ftrace_stub
+ * Need to also make ftrace_stub_graph point to ftrace_stub
  * so that the same stub location may have different protocols
  * and not mess up with C verifiers.
  */
@@ -120,17 +120,17 @@
 			__start_mcount_loc = .;			\
 			KEEP(*(__patchable_function_entries))	\
 			__stop_mcount_loc = .;			\
-			ftrace_graph_stub = ftrace_stub;
+			ftrace_stub_graph = ftrace_stub;
 #else
 #define MCOUNT_REC()	. = ALIGN(8);				\
 			__start_mcount_loc = .;			\
 			KEEP(*(__mcount_loc))			\
 			__stop_mcount_loc = .;			\
-			ftrace_graph_stub = ftrace_stub;
+			ftrace_stub_graph = ftrace_stub;
 #endif
 #else
 # ifdef CONFIG_FUNCTION_TRACER
-#  define MCOUNT_REC()	ftrace_graph_stub = ftrace_stub;
+#  define MCOUNT_REC()	ftrace_stub_graph = ftrace_stub;
 # else
 #  define MCOUNT_REC()
 # endif
kernel/trace/fgraph.c +3 -3
index fa3ce10d0405..67e0c462b059 100644
@@ -336,10 +336,10 @@ int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace)
  * Simply points to ftrace_stub, but with the proper protocol.
  * Defined by the linker script in linux/vmlinux.lds.h
  */
-extern void ftrace_graph_stub(struct ftrace_graph_ret *);
+extern void ftrace_stub_graph(struct ftrace_graph_ret *);
 
 /* The callbacks that hook a function */
-trace_func_graph_ret_t ftrace_graph_return = ftrace_graph_stub;
+trace_func_graph_ret_t ftrace_graph_return = ftrace_stub_graph;
 trace_func_graph_ent_t ftrace_graph_entry = ftrace_graph_entry_stub;
 static trace_func_graph_ent_t __ftrace_graph_entry = ftrace_graph_entry_stub;
 
@@ -619,7 +619,7 @@ void unregister_ftrace_graph(struct fgraph_ops *gops)
 		goto out;
 
 	ftrace_graph_active--;
-	ftrace_graph_return = ftrace_graph_stub;
+	ftrace_graph_return = ftrace_stub_graph;
 	ftrace_graph_entry = ftrace_graph_entry_stub;
 	__ftrace_graph_entry = ftrace_graph_entry_stub;
 	ftrace_shutdown(&graph_ops, FTRACE_STOP_FUNC_RET);
author
#6 lore raw
Quoted 12 lines · Steven Rostedt
Quoted 9 lines · On Mon, 18 Nov 2019 09:58:42 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 6 lines · On Mon, 18 Nov 2019 09:51:04 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 5 lines
Quoted 1 line

Test this commit please: b83b43ffc6e4b514ca034a0fbdee01322e2f7022

# git reset --hard b83b43ffc6e4b514ca034a0fbdee01322e2f7022

Yes, that one is bad.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Can you see if this patch fixes the issue for you?

Don't bother. This isn't the right fix, I know see the real issue.

New fix coming shortly.

Can you try this?

Yes, it works fine.

Quoted 66 lines

It appears that I picked a name "ftrace_graph_stub", that was already in use by powerpc. This just renames the function stub I used.

-- Steve

include/asm-generic/vmlinux.lds.h +4 -4
index 0f358be551cd..996db32c491b 100644
@@ -112,7 +112,7 @@
 #ifdef CONFIG_FTRACE_MCOUNT_RECORD
 #ifdef CC_USING_PATCHABLE_FUNCTION_ENTRY
 /*
- * Need to also make ftrace_graph_stub point to ftrace_stub
+ * Need to also make ftrace_stub_graph point to ftrace_stub
  * so that the same stub location may have different protocols
  * and not mess up with C verifiers.
  */
@@ -120,17 +120,17 @@
 			__start_mcount_loc = .;			\
 			KEEP(*(__patchable_function_entries))	\
 			__stop_mcount_loc = .;			\
-			ftrace_graph_stub = ftrace_stub;
+			ftrace_stub_graph = ftrace_stub;
 #else
 #define MCOUNT_REC()	. = ALIGN(8);				\
 			__start_mcount_loc = .;			\
 			KEEP(*(__mcount_loc))			\
 			__stop_mcount_loc = .;			\
-			ftrace_graph_stub = ftrace_stub;
+			ftrace_stub_graph = ftrace_stub;
 #endif
 #else
 # ifdef CONFIG_FUNCTION_TRACER
-#  define MCOUNT_REC()	ftrace_graph_stub = ftrace_stub;
+#  define MCOUNT_REC()	ftrace_stub_graph = ftrace_stub;
 # else
 #  define MCOUNT_REC()
 # endif
kernel/trace/fgraph.c +3 -3
index fa3ce10d0405..67e0c462b059 100644
@@ -336,10 +336,10 @@ int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace)
  * Simply points to ftrace_stub, but with the proper protocol.
  * Defined by the linker script in linux/vmlinux.lds.h
  */
-extern void ftrace_graph_stub(struct ftrace_graph_ret *);
+extern void ftrace_stub_graph(struct ftrace_graph_ret *);
 
 /* The callbacks that hook a function */
-trace_func_graph_ret_t ftrace_graph_return = ftrace_graph_stub;
+trace_func_graph_ret_t ftrace_graph_return = ftrace_stub_graph;
 trace_func_graph_ent_t ftrace_graph_entry = ftrace_graph_entry_stub;
 static trace_func_graph_ent_t __ftrace_graph_entry = ftrace_graph_entry_stub;
 
@@ -619,7 +619,7 @@ void unregister_ftrace_graph(struct fgraph_ops *gops)
 		goto out;
 
 	ftrace_graph_active--;
-	ftrace_graph_return = ftrace_graph_stub;
+	ftrace_graph_return = ftrace_stub_graph;
 	ftrace_graph_entry = ftrace_graph_entry_stub;
 	__ftrace_graph_entry = ftrace_graph_entry_stub;
 	ftrace_shutdown(&graph_ops, FTRACE_STOP_FUNC_RET);