linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [tip:x86/asm 24/32] mm/migrate.o: warning: objtool: migrate_misplaced_transhuge_page()+0x71: unreachable instruction
@ 2017-11-03  3:36 kbuild test robot
  2017-11-03 15:50 ` Josh Poimboeuf
  0 siblings, 1 reply; 4+ messages in thread
From: kbuild test robot @ 2017-11-03  3:36 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: kbuild-all, linux-kernel, tipbuild, Ingo Molnar, Borislav Petkov

[-- Attachment #1: Type: text/plain, Size: 788 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/asm
head:   1e4c4f610f774df6088d7c065b2dd4d22adba698
commit: da51da189a24bb9b7e2d5a123be096e51a4695a5 [24/32] x86/entry/64: Pass SP0 directly to load_sp0()
config: x86_64-randconfig-in0-11031034 (attached as .config)
compiler: gcc-4.6 (Debian 4.6.4-7) 4.6.4
reproduce:
        git checkout da51da189a24bb9b7e2d5a123be096e51a4695a5
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

>> mm/migrate.o: warning: objtool: migrate_misplaced_transhuge_page()+0x71: unreachable instruction

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30752 bytes --]

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

* Re: [tip:x86/asm 24/32] mm/migrate.o: warning: objtool: migrate_misplaced_transhuge_page()+0x71: unreachable instruction
  2017-11-03  3:36 [tip:x86/asm 24/32] mm/migrate.o: warning: objtool: migrate_misplaced_transhuge_page()+0x71: unreachable instruction kbuild test robot
@ 2017-11-03 15:50 ` Josh Poimboeuf
  2017-11-03 22:19   ` [PATCH] objtool: Prevent GCC from merging annotate_unreachable(), take 2 Josh Poimboeuf
  0 siblings, 1 reply; 4+ messages in thread
From: Josh Poimboeuf @ 2017-11-03 15:50 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Andy Lutomirski, kbuild-all, linux-kernel, tipbuild, Ingo Molnar,
	Borislav Petkov

On Fri, Nov 03, 2017 at 11:36:50AM +0800, kbuild test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/asm
> head:   1e4c4f610f774df6088d7c065b2dd4d22adba698
> commit: da51da189a24bb9b7e2d5a123be096e51a4695a5 [24/32] x86/entry/64: Pass SP0 directly to load_sp0()
> config: x86_64-randconfig-in0-11031034 (attached as .config)
> compiler: gcc-4.6 (Debian 4.6.4-7) 4.6.4
> reproduce:
>         git checkout da51da189a24bb9b7e2d5a123be096e51a4695a5
>         # save the attached .config to linux build tree
>         make ARCH=x86_64 
> 
> All warnings (new ones prefixed by >>):
> 
> >> mm/migrate.o: warning: objtool: migrate_misplaced_transhuge_page()+0x71: unreachable instruction

I've got a fix for this one coming shortly.

-- 
Josh

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

* [PATCH] objtool: Prevent GCC from merging annotate_unreachable(), take 2
  2017-11-03 15:50 ` Josh Poimboeuf
@ 2017-11-03 22:19   ` Josh Poimboeuf
  2017-11-04 22:31     ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
  0 siblings, 1 reply; 4+ messages in thread
From: Josh Poimboeuf @ 2017-11-03 22:19 UTC (permalink / raw)
  To: x86
  Cc: Andy Lutomirski, kbuild-all, linux-kernel, tipbuild, Ingo Molnar,
	Borislav Petkov, kbuild test robot


This fixes the following warning with GCC 4.6:

  mm/migrate.o: warning: objtool: migrate_misplaced_transhuge_page()+0x71: unreachable instruction

The problem is that the compiler merged identical annotate_unreachable()
inline asm blocks, resulting in a missing 'unreachable' annotation.

This problem happened before, and was partially fixed with:

  3d1e236022cc ("objtool: Prevent GCC from merging annotate_unreachable()")

That commit tried to ensure that each instance of the
annotate_unreachable() inline asm statement has a unique label.  It used
the __LINE__ macro to generate the label number.  However, even the line
number isn't necessarily unique when used in an inline function with
multiple callers (in this case, __alloc_pages_node()'s use of
VM_BUG_ON).

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: 3d1e236022cc ("objtool: Prevent GCC from merging annotate_unreachable()")
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 include/linux/compiler.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index e95a2631e545..e9fe95b138cf 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -190,13 +190,13 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
 	asm("%c0:\n\t"							\
 	    ".pushsection .discard.reachable\n\t"			\
 	    ".long %c0b - .\n\t"					\
-	    ".popsection\n\t" : : "i" (__LINE__));			\
+	    ".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" (__LINE__));			\
+	    ".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/urgent] objtool: Prevent GCC from merging annotate_unreachable(), take 2
  2017-11-03 22:19   ` [PATCH] objtool: Prevent GCC from merging annotate_unreachable(), take 2 Josh Poimboeuf
@ 2017-11-04 22:31     ` tip-bot for Josh Poimboeuf
  0 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Josh Poimboeuf @ 2017-11-04 22:31 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, hpa, jpoimboe, fengguang.wu, mingo, tglx, bp, torvalds,
	linux-kernel, luto

Commit-ID:  ec1e1b6109171d1890a437481c35b2b56d2327b8
Gitweb:     https://git.kernel.org/tip/ec1e1b6109171d1890a437481c35b2b56d2327b8
Author:     Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Fri, 3 Nov 2017 17:19:41 -0500
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 4 Nov 2017 15:03:39 +0100

objtool: Prevent GCC from merging annotate_unreachable(), take 2

This fixes the following warning with GCC 4.6:

  mm/migrate.o: warning: objtool: migrate_misplaced_transhuge_page()+0x71: unreachable instruction

The problem is that the compiler merged identical annotate_unreachable()
inline asm blocks, resulting in a missing 'unreachable' annotation.

This problem happened before, and was partially fixed with:

  3d1e236022cc ("objtool: Prevent GCC from merging annotate_unreachable()")

That commit tried to ensure that each instance of the
annotate_unreachable() inline asm statement has a unique label.  It used
the __LINE__ macro to generate the label number.  However, even the line
number isn't necessarily unique when used in an inline function with
multiple callers (in this case, __alloc_pages_node()'s use of
VM_BUG_ON).

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: kbuild-all@01.org
Cc: tipbuild@zytor.com
Fixes: 3d1e236022cc ("objtool: Prevent GCC from merging annotate_unreachable()")
Link: http://lkml.kernel.org/r/20171103221941.cajpwszir7ujxyc4@treble
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/compiler.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index fd8697a..2027104 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -191,13 +191,13 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
 	asm("%c0:\n\t"							\
 	    ".pushsection .discard.reachable\n\t"			\
 	    ".long %c0b - .\n\t"					\
-	    ".popsection\n\t" : : "i" (__LINE__));			\
+	    ".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" (__LINE__));			\
+	    ".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-04 22:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-03  3:36 [tip:x86/asm 24/32] mm/migrate.o: warning: objtool: migrate_misplaced_transhuge_page()+0x71: unreachable instruction kbuild test robot
2017-11-03 15:50 ` Josh Poimboeuf
2017-11-03 22:19   ` [PATCH] objtool: Prevent GCC from merging annotate_unreachable(), take 2 Josh Poimboeuf
2017-11-04 22:31     ` [tip:core/urgent] " tip-bot for Josh Poimboeuf

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 NNTP newsgroup(s).