[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220429094355.122389-17-chenzhongjin@huawei.com>
Date: Fri, 29 Apr 2022 17:43:34 +0800
From: Chen Zhongjin <chenzhongjin@...wei.com>
To: <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-arch@...r.kernel.org>
CC: <jthierry@...hat.com>, <catalin.marinas@....com>,
<will@...nel.org>, <masahiroy@...nel.org>, <jpoimboe@...hat.com>,
<peterz@...radead.org>, <ycote@...hat.com>,
<herbert@...dor.apana.org.au>, <mark.rutland@....com>,
<davem@...emloft.net>, <ardb@...nel.org>, <maz@...nel.org>,
<tglx@...utronix.de>, <luc.vanoostenryck@...il.com>,
<chenzhongjin@...wei.com>
Subject: [RFC PATCH v4 16/37] arm64: Add annotate_reachable() for objtools
x86 removed annotate_reachable and replaced it with ASM_REACHABLE
which is not suitable for arm64 micro because there are some cases
GCC will merge duplicate inline asm.
Re-add annotation_reachable() for arm64.
Signed-off-by: Chen Zhongjin <chenzhongjin@...wei.com>
---
include/linux/compiler.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 219aa5ddbc73..6a14e4bae37d 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -117,6 +117,14 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
*/
#define __stringify_label(n) #n
+#define __annotate_reachable(c) ({ \
+ asm volatile(__stringify_label(c) ":\n\t" \
+ ".pushsection .discard.reachable\n\t" \
+ ".long " __stringify_label(c) "b - .\n\t" \
+ ".popsection\n\t"); \
+})
+#define annotate_reachable() __annotate_reachable(__COUNTER__)
+
#define __annotate_unreachable(c) ({ \
asm volatile(__stringify_label(c) ":\n\t" \
".pushsection .discard.unreachable\n\t" \
@@ -129,6 +137,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
#define __annotate_jump_table __section(".rodata..c_jump_table")
#else
+#define annotate_reachable()
#define annotate_unreachable()
#define __annotate_jump_table
#endif
--
2.17.1
Powered by blists - more mailing lists