Re: [PATCH 02/11] x86: code shrink in paranoid_exit
From: Andy Lutomirski
Date: Wed Feb 11 2015 - 17:09:50 EST
On Wed, Feb 11, 2015 at 1:13 PM, Denys Vlasenko <dvlasenk@xxxxxxxxxx> wrote:
> On 02/11/2015 09:36 PM, Andy Lutomirski wrote:
>> On Wed, Jan 14, 2015 at 1:48 PM, Denys Vlasenko <dvlasenk@xxxxxxxxxx> wrote:
>>> RESTORE_EXTRA_REGS + RESTORE_C_REGS looks small, but it's
>>> a lot of instructions (fourteen). Let's reuse them.
>>> Signed-off-by: Denys Vlasenko <dvlasenk@xxxxxxxxxx>
>>> CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
>>> CC: Oleg Nesterov <oleg@xxxxxxxxxx>
>>> CC: Borislav Petkov <bp@xxxxxxxxx>
>>> CC: "H. Peter Anvin" <hpa@xxxxxxxxx>
>>> CC: Andy Lutomirski <luto@xxxxxxxxxxxxxx>
>>> CC: Frederic Weisbecker <fweisbec@xxxxxxxxx>
>>> CC: X86 ML <x86@xxxxxxxxxx>
>>> CC: Alexei Starovoitov <ast@xxxxxxxxxxxx>
>>> CC: Will Drewry <wad@xxxxxxxxxxxx>
>>> CC: Kees Cook <keescook@xxxxxxxxxxxx>
>>> CC: linux-kernel@xxxxxxxxxxxxxxx
>>> arch/x86/kernel/entry_64.S | 6 ++----
>>> 1 file changed, 2 insertions(+), 4 deletions(-)
>>> diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
>>> index a21b5b3..f5e815e 100644
>>> --- a/arch/x86/kernel/entry_64.S
>>> +++ b/arch/x86/kernel/entry_64.S
>>> @@ -1270,12 +1270,10 @@ ENTRY(paranoid_exit)
>>> jnz paranoid_restore
>>> TRACE_IRQS_IRETQ 0
>>> - RESTORE_EXTRA_REGS
>>> - RESTORE_C_REGS
>>> - REMOVE_PT_GPREGS_FROM_STACK 8
>>> - INTERRUPT_RETURN
>>> + jmp paranoid_restore1
>>> TRACE_IRQS_IRETQ_DEBUG 0
>>> REMOVE_PT_GPREGS_FROM_STACK 8
>> This is sort of a reply to the wrong thread, but wouldn't it be nicer
>> if we could pop a bunch of regs instead of using mov followed by add?
> I like this (pop instead of mov) too.
>> (Yes, this could be a followup, but it could be easier to spot now by
>> changing macros like RESTORE_XYZ.)
> I don't understand what this means.
> "Let's switch to pops now, in this patch"? Or something else?
You're replacing things like SAVE_XYZ with sequences like
ALLOC_SPACE_FOR_XYZ, RESTORE_XYZ, and replacing them with POP_XYZ
could be done in a single step.
That being said, let's not overcomplicate this. I'll review the patch
as is, and we can switch to push/pop (or not) later on.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/