aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/instrumentation.h
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@redhat.com>2021-11-08 14:35:59 -0800
committerJosh Poimboeuf <jpoimboe@redhat.com>2021-12-21 15:09:46 -0800
commitdcce50e6cc4d86a63dc0a9a6ee7d4f948ccd53a1 (patch)
tree924ef38b1c608d28308f4684364482009d39409a /include/linux/instrumentation.h
parentuapi: Fix undefined __always_inline on non-glibc systems (diff)
downloadlinux-dev-dcce50e6cc4d86a63dc0a9a6ee7d4f948ccd53a1.tar.xz
linux-dev-dcce50e6cc4d86a63dc0a9a6ee7d4f948ccd53a1.zip
compiler.h: Fix annotation macro misplacement with Clang
When building with Clang and CONFIG_TRACE_BRANCH_PROFILING, there are a lot of unreachable warnings, like: arch/x86/kernel/traps.o: warning: objtool: handle_xfd_event()+0x134: unreachable instruction Without an input to the inline asm, 'volatile' is ignored for some reason and Clang feels free to move the reachable() annotation away from its intended location. Fix that by re-adding the counter value to the inputs. Fixes: f1069a8756b9 ("compiler.h: Avoid using inline asm operand modifiers") Fixes: c199f64ff93c ("instrumentation.h: Avoid using inline asm operand modifiers") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Link: https://lore.kernel.org/r/0417e96909b97a406323409210de7bf13df0b170.1636410380.git.jpoimboe@redhat.com Cc: Peter Zijlstra <peterz@infradead.org> Cc: x86@kernel.org Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Miroslav Benes <mbenes@suse.cz>
Diffstat (limited to 'include/linux/instrumentation.h')
-rw-r--r--include/linux/instrumentation.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/instrumentation.h b/include/linux/instrumentation.h
index fa2cd8c63dcc..24359b4a9605 100644
--- a/include/linux/instrumentation.h
+++ b/include/linux/instrumentation.h
@@ -11,7 +11,7 @@
asm volatile(__stringify(c) ": nop\n\t" \
".pushsection .discard.instr_begin\n\t" \
".long " __stringify(c) "b - .\n\t" \
- ".popsection\n\t"); \
+ ".popsection\n\t" : : "i" (c)); \
})
#define instrumentation_begin() __instrumentation_begin(__COUNTER__)
@@ -50,7 +50,7 @@
asm volatile(__stringify(c) ": nop\n\t" \
".pushsection .discard.instr_end\n\t" \
".long " __stringify(c) "b - .\n\t" \
- ".popsection\n\t"); \
+ ".popsection\n\t" : : "i" (c)); \
})
#define instrumentation_end() __instrumentation_end(__COUNTER__)
#else