From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752826AbbCDVlC (ORCPT ); Wed, 4 Mar 2015 16:41:02 -0500 Received: from mail-wi0-f171.google.com ([209.85.212.171]:34679 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751428AbbCDVlA (ORCPT ); Wed, 4 Mar 2015 16:41:00 -0500 Date: Wed, 4 Mar 2015 22:40:55 +0100 From: Ingo Molnar To: Andy Lutomirski Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Borislav Petkov , Oleg Nesterov , Denys Vlasenko , Linus Torvalds , Steven Rostedt , "H. Peter Anvin" , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook Subject: Re: [PATCH 15/16] x86: entry.S: simplify optimistic SYSRET Message-ID: <20150304214055.GB7247@gmail.com> References: <1aef69b346a6db0d99cdfb0f5ba83e8c985e27d7.1424989793.git.luto@amacapital.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1aef69b346a6db0d99cdfb0f5ba83e8c985e27d7.1424989793.git.luto@amacapital.net> 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 * Andy Lutomirski wrote: > From: Denys Vlasenko > > Avoid redundant load of %r11 (it is already loaded a few instructions before). Note, this comment is incorrect: > Do not needlessly increment %rsp - we are going to return to > userspace via SYSRET, this insn doesn't use stack for return. The reason we don't need to increment %rsp because in the very next instruction we are restoring it, and then do we execute a SYSRET: So instead of: add $0x80, %rsp mov 0x18(%rsp), %rsp we can do a simplified: mov 0x98(%rsp), %rsp to get the same result. (I've clarified the changelog with this when applying the patch.) Thanks, Ingo