From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752501AbdI2TQK (ORCPT ); Fri, 29 Sep 2017 15:16:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57660 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752338AbdI2TQJ (ORCPT ); Fri, 29 Sep 2017 15:16:09 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com F01984E4CA Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jpoimboe@redhat.com Date: Fri, 29 Sep 2017 14:16:07 -0500 From: Josh Poimboeuf To: Andy Lutomirski Cc: Andrey Ryabinin , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , X86 ML , Peter Zijlstra , Linus Torvalds , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] x86: use register variable to get stack pointer value Message-ID: <20170929191607.nfl2nat6xi4mpb6f@treble> References: <20170929141537.29167-1-aryabinin@virtuozzo.com> <20170929153828.rtxwllhsjgiaeaos@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 29 Sep 2017 19:16:09 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 29, 2017 at 11:37:52AM -0700, Andy Lutomirski wrote: > On Fri, Sep 29, 2017 at 8:38 AM, Josh Poimboeuf wrote: > > On Fri, Sep 29, 2017 at 05:15:36PM +0300, Andrey Ryabinin wrote: > >> Currently we use current_stack_pointer() function to get the value > >> of the stack pointer register. Since commit f5caf621ee35 > >> ("x86/asm: Fix inline asm call constraints for Clang") we have stack > >> register variable declared. It can be used instead of current_stack_pointer() > >> function which allows to optimize away some excessive "mov %rsp, %" > >> instructions: > >> > >> -mov %rsp,%rdx > >> -sub %rdx,%rax > >> -cmp $0x3fff,%rax > >> -ja ffffffff810722fd > >> > >> +sub %rsp,%rax > >> +cmp $0x3fff,%rax > >> +ja ffffffff810722fa > >> > >> Remove current_stack_pointer(), rename __asm_call_sp to current_stack_pointer > >> and use it instead of removed function. > >> > >> Signed-off-by: Andrey Ryabinin > > > > Reviewed-by: Josh Poimboeuf > > > Ok with me. As an alternative, you could leave it as > current_stack_pointer(), but either way is fine. Good point, I think changing current_stack_pointer() to return the global variable would be cleaner. -- Josh