From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752189AbdI2Pib (ORCPT ); Fri, 29 Sep 2017 11:38:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40788 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751349AbdI2Pia (ORCPT ); Fri, 29 Sep 2017 11:38:30 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6CC2F4E028 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 10:38:28 -0500 From: Josh Poimboeuf To: Andrey Ryabinin Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Peter Zijlstra , Andy Lutomirski , Linus Torvalds , linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86: use register variable to get stack pointer value Message-ID: <20170929153828.rtxwllhsjgiaeaos@treble> References: <20170929141537.29167-1-aryabinin@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20170929141537.29167-1-aryabinin@virtuozzo.com> 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 15:38:30 +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 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 -- Josh