From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755121AbbBKVO2 (ORCPT ); Wed, 11 Feb 2015 16:14:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34388 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752928AbbBKVO0 (ORCPT ); Wed, 11 Feb 2015 16:14:26 -0500 Message-ID: <54DBC615.5080802@redhat.com> Date: Wed, 11 Feb 2015 22:13:57 +0100 From: Denys Vlasenko User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Andy Lutomirski CC: Linus Torvalds , Oleg Nesterov , Borislav Petkov , "H. Peter Anvin" , Frederic Weisbecker , X86 ML , Alexei Starovoitov , Will Drewry , Kees Cook , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 02/11] x86: code shrink in paranoid_exit References: <1421272101-16847-1-git-send-email-dvlasenk@redhat.com> <1421272101-16847-2-git-send-email-dvlasenk@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/11/2015 09:36 PM, Andy Lutomirski wrote: > On Wed, Jan 14, 2015 at 1:48 PM, Denys Vlasenko 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 >> CC: Linus Torvalds >> CC: Oleg Nesterov >> CC: Borislav Petkov >> CC: "H. Peter Anvin" >> CC: Andy Lutomirski >> CC: Frederic Weisbecker >> CC: X86 ML >> CC: Alexei Starovoitov >> CC: Will Drewry >> CC: Kees Cook >> CC: linux-kernel@vger.kernel.org >> --- >> 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 >> SWAPGS_UNSAFE_STACK >> - RESTORE_EXTRA_REGS >> - RESTORE_C_REGS >> - REMOVE_PT_GPREGS_FROM_STACK 8 >> - INTERRUPT_RETURN >> + jmp paranoid_restore1 >> paranoid_restore: >> TRACE_IRQS_IRETQ_DEBUG 0 >> +paranoid_restore1: >> RESTORE_EXTRA_REGS >> RESTORE_C_REGS >> 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?