mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2025-04-19 20:58:31 +09:00

CONFIG_TRACE_BRANCH_PROFILING inserts a call to ftrace_likely_update() for each use of likely() or unlikely(). That breaks noinstr rules if the affected function is annotated as noinstr. Disable branch profiling for files with noinstr functions. In addition to some individual files, this also includes the entire arch/x86 subtree, as well as the kernel/entry, drivers/cpuidle, and drivers/idle directories, all of which are noinstr-heavy. Due to the nature of how sched binaries are built by combining multiple .c files into one, branch profiling is disabled more broadly across the sched code than would otherwise be needed. This fixes many warnings like the following: vmlinux.o: warning: objtool: do_syscall_64+0x40: call to ftrace_likely_update() leaves .noinstr.text section vmlinux.o: warning: objtool: __rdgsbase_inactive+0x33: call to ftrace_likely_update() leaves .noinstr.text section vmlinux.o: warning: objtool: handle_bug.isra.0+0x198: call to ftrace_likely_update() leaves .noinstr.text section ... Reported-by: Ingo Molnar <mingo@kernel.org> Suggested-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Acked-by: Thomas Gleixner <tglx@linutronix.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/fb94fc9303d48a5ed370498f54500cc4c338eb6d.1742586676.git.jpoimboe@kernel.org
40 lines
1.5 KiB
Makefile
40 lines
1.5 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
# The compilers are complaining about unused variables inside an if(0) scope
|
|
# block. This is daft, shut them up.
|
|
ccflags-y += $(call cc-disable-warning, unused-but-set-variable)
|
|
|
|
# These files are disabled because they produce non-interesting flaky coverage
|
|
# that is not a function of syscall inputs. E.g. involuntary context switches.
|
|
KCOV_INSTRUMENT := n
|
|
|
|
# Disable KCSAN to avoid excessive noise and performance degradation. To avoid
|
|
# false positives ensure barriers implied by sched functions are instrumented.
|
|
KCSAN_SANITIZE := n
|
|
KCSAN_INSTRUMENT_BARRIERS := y
|
|
|
|
ifneq ($(CONFIG_SCHED_OMIT_FRAME_POINTER),y)
|
|
# According to Alan Modra <alan@linuxcare.com.au>, the -fno-omit-frame-pointer is
|
|
# needed for x86 only. Why this used to be enabled for all architectures is beyond
|
|
# me. I suspect most platforms don't need this, but until we know that for sure
|
|
# I turn this off for IA-64 only. Andreas Schwab says it's also needed on m68k
|
|
# to get a correct value for the wait-channel (WCHAN in ps). --davidm
|
|
CFLAGS_core.o := $(PROFILING) -fno-omit-frame-pointer
|
|
endif
|
|
|
|
# Branch profiling isn't noinstr-safe
|
|
ifdef CONFIG_TRACE_BRANCH_PROFILING
|
|
CFLAGS_build_policy.o += -DDISABLE_BRANCH_PROFILING
|
|
CFLAGS_build_utility.o += -DDISABLE_BRANCH_PROFILING
|
|
endif
|
|
#
|
|
# Build efficiency:
|
|
#
|
|
# These compilation units have roughly the same size and complexity - so their
|
|
# build parallelizes well and finishes roughly at once:
|
|
#
|
|
obj-y += core.o
|
|
obj-y += fair.o
|
|
obj-y += build_policy.o
|
|
obj-y += build_utility.o
|