All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] objtool: Add a comment for the unreachable annotation macros
@ 2017-11-06 13:17 Josh Poimboeuf
  2017-11-06 13:17 ` [PATCH 2/2] objtool: Make unreachable annotation inline asms explicitly volatile Josh Poimboeuf
  2017-11-07  9:51 ` [tip:core/objtool] objtool: Add a comment for the unreachable annotation macros tip-bot for Josh Poimboeuf
  0 siblings, 2 replies; 4+ messages in thread
From: Josh Poimboeuf @ 2017-11-06 13:17 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Linus Torvalds

Add a comment for the unreachable annotation macros to explain their
purpose and the '__COUNTER__' label hack.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 include/linux/compiler.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 3672353a0acd..b863e5ad91a3 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -88,6 +88,11 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
 
 /* Unreachable code */
 #ifdef CONFIG_STACK_VALIDATION
+/*
+ * These macros help objtool understand GCC code flow for unreachable code.
+ * The __COUNTER__ based labels are a hack to make each instance of the macros
+ * unique, to convince GCC not to merge duplicate inline asm statements.
+ */
 #define annotate_reachable() ({						\
 	asm("%c0:\n\t"							\
 	    ".pushsection .discard.reachable\n\t"			\
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] objtool: Make unreachable annotation inline asms explicitly volatile
  2017-11-06 13:17 [PATCH 1/2] objtool: Add a comment for the unreachable annotation macros Josh Poimboeuf
@ 2017-11-06 13:17 ` Josh Poimboeuf
  2017-11-07  9:52   ` [tip:core/objtool] " tip-bot for Josh Poimboeuf
  2017-11-07  9:51 ` [tip:core/objtool] objtool: Add a comment for the unreachable annotation macros tip-bot for Josh Poimboeuf
  1 sibling, 1 reply; 4+ messages in thread
From: Josh Poimboeuf @ 2017-11-06 13:17 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Linus Torvalds

Add 'volatile' to the unreachable annotation macro inline asm
statements.  They're already implicitly volatile because they don't have
output constraints, but it's clearer and more robust to make them
explicitly volatile.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 include/linux/compiler.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index b863e5ad91a3..188ed9f65517 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -94,16 +94,16 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
  * unique, to convince GCC not to merge duplicate inline asm statements.
  */
 #define annotate_reachable() ({						\
-	asm("%c0:\n\t"							\
-	    ".pushsection .discard.reachable\n\t"			\
-	    ".long %c0b - .\n\t"					\
-	    ".popsection\n\t" : : "i" (__COUNTER__));			\
+	asm volatile("%c0:\n\t"						\
+		     ".pushsection .discard.reachable\n\t"		\
+		     ".long %c0b - .\n\t"				\
+		     ".popsection\n\t" : : "i" (__COUNTER__));		\
 })
 #define annotate_unreachable() ({					\
-	asm("%c0:\n\t"							\
-	    ".pushsection .discard.unreachable\n\t"			\
-	    ".long %c0b - .\n\t"					\
-	    ".popsection\n\t" : : "i" (__COUNTER__));			\
+	asm volatile("%c0:\n\t"						\
+		     ".pushsection .discard.unreachable\n\t"		\
+		     ".long %c0b - .\n\t"				\
+		     ".popsection\n\t" : : "i" (__COUNTER__));		\
 })
 #define ASM_UNREACHABLE							\
 	"999:\n\t"							\
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [tip:core/objtool] objtool: Add a comment for the unreachable annotation macros
  2017-11-06 13:17 [PATCH 1/2] objtool: Add a comment for the unreachable annotation macros Josh Poimboeuf
  2017-11-06 13:17 ` [PATCH 2/2] objtool: Make unreachable annotation inline asms explicitly volatile Josh Poimboeuf
@ 2017-11-07  9:51 ` tip-bot for Josh Poimboeuf
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Josh Poimboeuf @ 2017-11-07  9:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, linux-kernel, peterz, mingo, tglx, torvalds, jpoimboe

Commit-ID:  d0c2e691d1cbe43662df3a08a4933f13acc352c3
Gitweb:     https://git.kernel.org/tip/d0c2e691d1cbe43662df3a08a4933f13acc352c3
Author:     Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Mon, 6 Nov 2017 07:17:37 -0600
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 7 Nov 2017 10:48:22 +0100

objtool: Add a comment for the unreachable annotation macros

Add a comment for the unreachable annotation macros to explain their
purpose and the '__COUNTER__' label hack.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1570e48d9f87e0fc6f0126c32e7e1de6e109cb67.1509974104.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/compiler.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 2027104..f8734fc 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -187,6 +187,11 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
 
 /* Unreachable code */
 #ifdef CONFIG_STACK_VALIDATION
+/*
+ * These macros help objtool understand GCC code flow for unreachable code.
+ * The __COUNTER__ based labels are a hack to make each instance of the macros
+ * unique, to convince GCC not to merge duplicate inline asm statements.
+ */
 #define annotate_reachable() ({						\
 	asm("%c0:\n\t"							\
 	    ".pushsection .discard.reachable\n\t"			\

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [tip:core/objtool] objtool: Make unreachable annotation inline asms explicitly volatile
  2017-11-06 13:17 ` [PATCH 2/2] objtool: Make unreachable annotation inline asms explicitly volatile Josh Poimboeuf
@ 2017-11-07  9:52   ` tip-bot for Josh Poimboeuf
  0 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Josh Poimboeuf @ 2017-11-07  9:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: jpoimboe, tglx, peterz, torvalds, linux-kernel, mingo, hpa

Commit-ID:  10259821ac47dbefa6f83ae57f1fa9f1f2c54b3d
Gitweb:     https://git.kernel.org/tip/10259821ac47dbefa6f83ae57f1fa9f1f2c54b3d
Author:     Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Mon, 6 Nov 2017 07:17:38 -0600
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 7 Nov 2017 10:48:22 +0100

objtool: Make unreachable annotation inline asms explicitly volatile

Add 'volatile' to the unreachable annotation macro inline asm
statements.  They're already implicitly volatile because they don't have
output constraints, but it's clearer and more robust to make them
explicitly volatile.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/28659257b7a6adf4a7f65920dad70b2b0226e996.1509974104.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/compiler.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index f8734fc..4fac29c 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -193,16 +193,16 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
  * unique, to convince GCC not to merge duplicate inline asm statements.
  */
 #define annotate_reachable() ({						\
-	asm("%c0:\n\t"							\
-	    ".pushsection .discard.reachable\n\t"			\
-	    ".long %c0b - .\n\t"					\
-	    ".popsection\n\t" : : "i" (__COUNTER__));			\
+	asm volatile("%c0:\n\t"						\
+		     ".pushsection .discard.reachable\n\t"		\
+		     ".long %c0b - .\n\t"				\
+		     ".popsection\n\t" : : "i" (__COUNTER__));		\
 })
 #define annotate_unreachable() ({					\
-	asm("%c0:\n\t"							\
-	    ".pushsection .discard.unreachable\n\t"			\
-	    ".long %c0b - .\n\t"					\
-	    ".popsection\n\t" : : "i" (__COUNTER__));			\
+	asm volatile("%c0:\n\t"						\
+		     ".pushsection .discard.unreachable\n\t"		\
+		     ".long %c0b - .\n\t"				\
+		     ".popsection\n\t" : : "i" (__COUNTER__));		\
 })
 #define ASM_UNREACHABLE							\
 	"999:\n\t"							\

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-07  9:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-06 13:17 [PATCH 1/2] objtool: Add a comment for the unreachable annotation macros Josh Poimboeuf
2017-11-06 13:17 ` [PATCH 2/2] objtool: Make unreachable annotation inline asms explicitly volatile Josh Poimboeuf
2017-11-07  9:52   ` [tip:core/objtool] " tip-bot for Josh Poimboeuf
2017-11-07  9:51 ` [tip:core/objtool] objtool: Add a comment for the unreachable annotation macros tip-bot for Josh Poimboeuf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.