Skip to content

Commit 67bfce0

Browse files
committed
Merge tag 'trace-v5.17-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull ftrace fix from Steven Rostedt: "Fix s390 breakage from sorting mcount tables. The latest merge of the tracing tree sorts the mcount table at build time. But s390 appears to do things differently (like always) and replaces the sorted table back to the original unsorted one. As the ftrace algorithm depends on it being sorted, bad things happen when it is not, and s390 experienced those bad things. Add a new config to tell the boot if the mcount table is sorted or not, and allow s390 to opt out of it" * tag 'trace-v5.17-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: ftrace: Fix assuming build time sort works for s390
2 parents 473aec0 + 6b9b641 commit 67bfce0

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

kernel/trace/Kconfig

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ config HAVE_C_RECORDMCOUNT
7070
help
7171
C version of recordmcount available?
7272

73+
config BUILDTIME_MCOUNT_SORT
74+
bool
75+
default y
76+
depends on BUILDTIME_TABLE_SORT && !S390
77+
help
78+
Sort the mcount_loc section at build time.
79+
7380
config TRACER_MAX_TRACE
7481
bool
7582

@@ -918,7 +925,7 @@ config EVENT_TRACE_TEST_SYSCALLS
918925
config FTRACE_SORT_STARTUP_TEST
919926
bool "Verify compile time sorting of ftrace functions"
920927
depends on DYNAMIC_FTRACE
921-
depends on BUILDTIME_TABLE_SORT
928+
depends on BUILDTIME_MCOUNT_SORT
922929
help
923930
Sorting of the mcount_loc sections that is used to find the
924931
where the ftrace knows where to patch functions for tracing

kernel/trace/ftrace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6435,10 +6435,10 @@ static int ftrace_process_locs(struct module *mod,
64356435

64366436
/*
64376437
* Sorting mcount in vmlinux at build time depend on
6438-
* CONFIG_BUILDTIME_TABLE_SORT, while mcount loc in
6438+
* CONFIG_BUILDTIME_MCOUNT_SORT, while mcount loc in
64396439
* modules can not be sorted at build time.
64406440
*/
6441-
if (!IS_ENABLED(CONFIG_BUILDTIME_TABLE_SORT) || mod) {
6441+
if (!IS_ENABLED(CONFIG_BUILDTIME_MCOUNT_SORT) || mod) {
64426442
sort(start, count, sizeof(*start),
64436443
ftrace_cmp_ips, NULL);
64446444
} else {

0 commit comments

Comments
 (0)