Re: Remaining randconfig objtool warnings, linux-next-20200428
From: Josh Poimboeuf
Date: Tue Apr 28 2020 - 18:48:56 EST
On Wed, Apr 29, 2020 at 12:33:27AM +0200, Peter Zijlstra wrote:
> On Tue, Apr 28, 2020 at 05:03:53PM -0500, Josh Poimboeuf wrote:
> > On Tue, Apr 28, 2020 at 11:55:54PM +0200, Peter Zijlstra wrote:
>
> > > binutils.git/gas/configure/tc-i386.c:i386_generate_nops
> > >
> > > When there's too many NOPs (as here) it generates a JMP across the NOPS.
> > > It makes some sort of sense, at some point executing NOPs is going to be
> > > more expensive than a branch.. But shees..
> >
> > Urgh. Even if I tell it specifically to pad with NOPs, it still does
> > this "trick". I have no idea how to deal with this in objtool.
>
> This is horrible... but it _might_ just work.
HAHA, nice.
This seems to work:
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 3063aa9090f9..afdf43c9bac1 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -597,8 +597,13 @@ SYM_CODE_START_LOCAL(common_spurious)
SYM_CODE_END(common_spurious)
_ASM_NOKPROBE(common_spurious)
+.macro P2ALIGN_NOPS shift
+ .p2align \shift-1
+ .p2align \shift
+.endm
+
/* common_interrupt is a hotpath. Align it */
- .p2align CONFIG_X86_L1_CACHE_SHIFT
+P2ALIGN_NOPS shift=CONFIG_X86_L1_CACHE_SHIFT
SYM_CODE_START_LOCAL(common_interrupt)
addq $-0x80, (%rsp) /* Adjust vector to [-256, -1] range */
call interrupt_entry