[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180221024214.lhl5jfgw33c4vz3m@treble>
Date: Tue, 20 Feb 2018 20:42:14 -0600
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Dominik Brodowski <linux@...inikbrodowski.net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
the arch/x86 maintainers <x86@...nel.org>,
Brian Gerst <brgerst@...il.com>,
Andrew Lutomirski <luto@...nel.org>,
Andi Kleen <ak@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Dan Williams <dan.j.williams@...el.com>
Subject: [PATCH] x86/entry/64: Simplify ENCODE_FRAME_POINTER
On Tue, Feb 20, 2018 at 02:25:03PM -0800, Linus Torvalds wrote:
> On Tue, Feb 20, 2018 at 1:01 PM, Dominik Brodowski
> <linux@...inikbrodowski.net> wrote:
> > +ENTRY(interrupt_entry)
> > + UNWIND_HINT_FUNC
> > +
> > + PUSH_AND_CLEAR_REGS save_ret=1
> > + ENCODE_FRAME_POINTER 8
> > +
> > + ret
> > +END(interrupt_entry)
>
> There's nothing wrong with this patch, but it does expose what a nasty
> hack our "ENCODE_FRAME_POINTER" thing is.
>
> It generates (when there is an offset, like this):
>
> leaq \ptregs_offset(%rsp), %rbp
> orq $0x1, %rbp
>
> and I would _really_ hope that the stack pointer is always aligned on
> interrupt entry, so I don't see why it's not just
>
> leaq 1+\ptregs_offset(%rsp), %rbp
>
> instead.
>
> I dunno. Let's ask Josh what the reason for the separate "or" was.
>
> But this is an independent issue of this patch, really.
Indeed, how about this?
----
From: Josh Poimboeuf <jpoimboe@...hat.com>
Subject: [PATCH] x86/entry/64: Simplify ENCODE_FRAME_POINTER
On 64-bit, the stack pointer is always aligned on interrupt, so instead
of setting the LSB of the pt_regs address, we can just add 1 to it.
Suggested-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>
---
arch/x86/entry/calling.h | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h
index dce7092ab24a..400cea8bbf4b 100644
--- a/arch/x86/entry/calling.h
+++ b/arch/x86/entry/calling.h
@@ -172,12 +172,7 @@ For 32-bit we have the following conventions - kernel is built with
*/
.macro ENCODE_FRAME_POINTER ptregs_offset=0
#ifdef CONFIG_FRAME_POINTER
- .if \ptregs_offset
- leaq \ptregs_offset(%rsp), %rbp
- .else
- mov %rsp, %rbp
- .endif
- orq $0x1, %rbp
+ leaq 1+\ptregs_offset(%rsp), %rbp
#endif
.endm
--
2.14.3
Powered by blists - more mailing lists