mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: tglx@linutronix.de
Cc: jpoimboe@redhat.com, x86@kernel.org,
	linux-kernel@vger.kernel.org, luto@kernel.org,
	peterz@infradead.org
Subject: [RFC][PATCH 2/3] x86/entry: Provide ASM_INSTR_{BEGIN,END}
Date: Thu, 07 May 2020 18:10:22 +0200	[thread overview]
Message-ID: <20200507161828.741881602@infradead.org> (raw)
In-Reply-To: <20200507161020.783541450@infradead.org>

To reduce clutter.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 arch/x86/include/asm/irq_stack.h |   10 ++--------
 arch/x86/include/asm/kvm_host.h  |   10 ++--------
 include/linux/compiler.h         |   14 ++++++++++++++
 3 files changed, 18 insertions(+), 16 deletions(-)

--- a/arch/x86/include/asm/irq_stack.h
+++ b/arch/x86/include/asm/irq_stack.h
@@ -24,15 +24,9 @@ do {									\
 	asm volatile(							\
 		"movq	%%rsp, (%[ts])				\n"	\
 		"movq	%[ts], %%rsp				\n"	\
-		"1:						\n"	\
-		"	.pushsection .discard.instr_begin	\n"	\
-		"	.long 1b - .				\n"	\
-		"	.popsection				\n"	\
+		ASM_INSTR_BEGIN						\
 		_asm "                                          \n"	\
-		"2:						\n"	\
-		"	.pushsection .discard.instr_end		\n"	\
-		"	.long 2b - .				\n"	\
-		"	.popsection				\n"	\
+		ASM_INSTR_END						\
 		"popq	%%rsp					\n"	\
 		:							\
 		: [ts] "r" (tos), ##__VA_ARGS__				\
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -1601,15 +1601,9 @@ asmlinkage void kvm_spurious_fault(void)
 	insn "\n\t"							\
 	"jmp	668f \n\t"						\
 	"667: \n\t"							\
-	"1: \n\t"							\
-	".pushsection .discard.instr_begin \n\t"			\
-	".long 1b - . \n\t"						\
-	".popsection \n\t"						\
+	ASM_INSTR_BEGIN							\
 	"call	kvm_spurious_fault \n\t"				\
-	"1: \n\t"							\
-	".pushsection .discard.instr_end \n\t"				\
-	".long 1b - . \n\t"						\
-	".popsection \n\t"						\
+	ASM_INSTR_END							\
 	"668: \n\t"							\
 	_ASM_EXTABLE(666b, 667b)
 
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -135,12 +135,26 @@ void ftrace_likely_update(struct ftrace_
 		     ".popsection\n\t" : : "i" (__COUNTER__));		\
 })
 
+#define ASM_INSTR_BEGIN							\
+	"999:\n\t"							\
+	".pushsection .discard.instr_begin\n\t"				\
+	".long 999b - .\n\t"						\
+	".popsection\n\t"
+
+#define ASM_INSTR_END							\
+	"999:\n\t"							\
+	".pushsection .discard.instr_end\n\t"				\
+	".long 999b - .\n\t"						\
+	".popsection\n\t"
+
 #else
 #define annotate_reachable()
 #define annotate_unreachable()
 #define __annotate_jump_table
 #define instr_begin()		do { } while(0)
 #define instr_end()		do { } while(0)
+#define ASM_INSTR_BEGIN
+#define ASM_INSTR_END
 #endif
 
 #ifndef ASM_UNREACHABLE



  parent reply	other threads:[~2020-05-07 16:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07 16:10 [RFC][PATCH 0/3] objtool vs irqstack swizzles Peter Zijlstra
2020-05-07 16:10 ` [RFC][PATCH 1/3] x86/entry: Collapse the 3 IRQ stack instances into a single macro Peter Zijlstra
2020-05-07 16:10 ` Peter Zijlstra [this message]
2020-05-07 16:10 ` [RFC][PATCH 3/3] x86/entry, ORC: Teach objtool/unwind_orc about stack irq swizzles Peter Zijlstra
2020-05-07 17:38   ` Peter Zijlstra
2020-05-07 18:30     ` Josh Poimboeuf
2020-05-07 21:24       ` Thomas Gleixner
2020-05-08 10:12         ` Peter Zijlstra
2020-05-08 12:26           ` Thomas Gleixner
2020-05-08 12:40             ` Peter Zijlstra
2020-05-08 12:44             ` Thomas Gleixner

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=20200507161828.741881602@infradead.org \
    --to=peterz@infradead.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®