Live-Patching Archive mirror
 help / color / mirror / Atom feed
From: Youling Tang <tangyouling@loongson.cn>
To: Josh Poimboeuf <jpoimboe@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Huacai Chen <chenhuacai@kernel.org>,
	madvenka@linux.microsoft.com
Cc: chenzhongjin@huawei.com, WANG Xuerui <kernel@xen0n.name>,
	Xi Ruoyao <xry111@xry111.site>,
	live-patching@vger.kernel.org, linux-kernel@vger.kernel.org,
	loongarch@lists.linux.dev, tangyouling00@gmail.com,
	youling.tang@outlook.com
Subject: [RFC PATCH v1 11/23] objtool: Add annotate_reachable() for objtools
Date: Tue, 20 Jun 2023 15:50:07 +0800	[thread overview]
Message-ID: <1687247415-32057-2-git-send-email-tangyouling@loongson.cn> (raw)
In-Reply-To: <1687247415-32057-1-git-send-email-tangyouling@loongson.cn>

x86 removed annotate_reachable and replaced it with ASM_REACHABLE
which is not suitable for LoongArch micro.

Re-add annotation_reachable() for LoongArch.

Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
---
 include/linux/compiler.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 947a60b801db..6b33de8bf7c3 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 /* !CONFIG_OBJTOOL */
+#define annotate_reachable()
 #define annotate_unreachable()
 #define __annotate_jump_table
 #endif /* CONFIG_OBJTOOL */
-- 
2.39.2


  reply	other threads:[~2023-06-20  7:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20  7:50 [RFC PATCH v1 10/23] objtool: LoongArch: Implement decoder Youling Tang
2023-06-20  7:50 ` Youling Tang [this message]
2023-06-20  7:50 ` [RFC PATCH v1 12/23] LoongArch: bug: Add reachable annotation to warning macros Youling Tang
2023-06-20  7:50 ` [RFC PATCH v1 13/23] objtool: Add next member in struct reloc Youling Tang
2023-06-20  8:57   ` Peter Zijlstra
2023-06-20  7:50 ` [RFC PATCH v1 14/23] objtool: Add orc_print_dump() package Youling Tang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1687247415-32057-2-git-send-email-tangyouling@loongson.cn \
    --to=tangyouling@loongson.cn \
    --cc=chenhuacai@kernel.org \
    --cc=chenzhongjin@huawei.com \
    --cc=jpoimboe@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=madvenka@linux.microsoft.com \
    --cc=peterz@infradead.org \
    --cc=tangyouling00@gmail.com \
    --cc=xry111@xry111.site \
    --cc=youling.tang@outlook.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).