Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753368AbbBXWz4 (ORCPT ); Tue, 24 Feb 2015 17:55:56 -0500 Received: from mail-la0-f54.google.com ([209.85.215.54]:39183 "EHLO mail-la0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752234AbbBXWzx (ORCPT ); Tue, 24 Feb 2015 17:55:53 -0500 MIME-Version: 1.0 In-Reply-To: <1424803895-4420-4-git-send-email-dvlasenk@redhat.com> References: <1424803895-4420-1-git-send-email-dvlasenk@redhat.com> <1424803895-4420-4-git-send-email-dvlasenk@redhat.com> From: Andy Lutomirski Date: Tue, 24 Feb 2015 14:55:31 -0800 Message-ID: Subject: Re: [PATCH 4/4] x86: save user %rsp in pt_regs->sp To: Denys Vlasenko Cc: Linus Torvalds , Steven Rostedt , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , X86 ML , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1302 Lines: 32 On Tue, Feb 24, 2015 at 10:51 AM, Denys Vlasenko wrote: > PER_CPU(old_rsp) usage is simplified - now it is used only > as temp storage, and userspace stack pointer is immediately stored > in pt_regs->sp on syscall entry, instead of being used later, > on syscall exit. This allows to get rid of thread_struct::usersp. I'm not seeing any performance loss here, which is good. This is a nice cleanup. > @@ -253,11 +247,13 @@ GLOBAL(system_call_after_swapgs) > */ > ENABLE_INTERRUPTS(CLBR_NONE) > ALLOC_PT_GPREGS_ON_STACK 6*8 /* 6*8: space for orig_ax and iret frame */ > + movq %rcx,RIP(%rsp) > + movq %r11,EFLAGS(%rsp) > + movq PER_CPU_VAR(old_rsp),%rcx > + movq %rcx,RSP(%rsp) It's a bit unfortunate that this adds two instructions instead of just one. I guess this gets fix when we start using push instead of mov here. (And, if we use push, then we can fix up the RCX slot for free, too.) Acked-by me, but I won't apply it until v2 to avoid messy rebases. --Andy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/