From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751550AbbCTQhO (ORCPT ); Fri, 20 Mar 2015 12:37:14 -0400 Received: from mail.skyhub.de ([78.46.96.112]:54732 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751252AbbCTQhK (ORCPT ); Fri, 20 Mar 2015 12:37:10 -0400 Date: Fri, 20 Mar 2015 17:35:29 +0100 From: Borislav Petkov To: Denys Vlasenko Cc: Andy Lutomirski , Linus Torvalds , Steven Rostedt , Ingo Molnar , "H. Peter Anvin" , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/5] x86/entry_64.S: use PUSH insns to build pt_regs on stack Message-ID: <20150320163529.GG17058@pd.tnic> References: <1426785469-15125-1-git-send-email-dvlasenk@redhat.com> <1426785469-15125-3-git-send-email-dvlasenk@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1426785469-15125-3-git-send-email-dvlasenk@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 19, 2015 at 06:17:47PM +0100, Denys Vlasenko wrote: > With this change, on SYSCALL64 code path we are now populating > pt_regs->cs, pt_regs->ss and pt_regs->rcx unconditionally and > therefore don't need to do that in FIXUP_TOP_OF_STACK. > > We lose a number of large insns there: > > text data bss dec hex filename > 13298 0 0 13298 33f2 entry_64_before.o > 12978 0 0 12978 32b2 entry_64.o > > What's more important, we convert two "MOVQ $imm,off(%rsp)" to "PUSH $imm" > (the ones which fill pt_regs->cs,ss). > > Before this patch, placing them on fast path was slowing it down by two cycles: > this form of MOV is very large, 12 bytes, and this probably reduces decode bandwidth > to one insn per cycle when CPU sees them. > > Therefore they were living in FIXUP_TOP_OF_STACK instead (away from fast path). > > "PUSH $imm" is a small 2-byte insn. Moving it to fast path does not slow it down > in my measurements. > > Signed-off-by: Denys Vlasenko > CC: Linus Torvalds > CC: Steven Rostedt > CC: Ingo Molnar > CC: Borislav Petkov > CC: "H. Peter Anvin" > CC: Andy Lutomirski > CC: Oleg Nesterov > CC: Frederic Weisbecker > CC: Alexei Starovoitov > CC: Will Drewry > CC: Kees Cook > CC: x86@kernel.org > CC: linux-kernel@vger.kernel.org > --- > > Changes since last version: reformulate old comment which was > mostly failing to explain why we don't have TRACE_IRQS_OFF/ONs > around a irq-off section in SYSCALL64 code path. > > arch/x86/kernel/entry_64.S | 54 +++++++++++++++++++++++++++------------------- > 1 file changed, 32 insertions(+), 22 deletions(-) Acked-by: Borislav Petkov -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --