Received: by 10.223.176.5 with SMTP id f5csp1210349wra; Tue, 6 Feb 2018 14:54:55 -0800 (PST) X-Google-Smtp-Source: AH8x225YL0zBXpd3SodTjYCK8HUDhq8Iy5p8TjnsEiXMBzg9/+9O8NOLv3UK2MgC1u49pRxQMQO+ X-Received: by 2002:a17:902:595d:: with SMTP id e29-v6mr3935018plj.436.1517957695725; Tue, 06 Feb 2018 14:54:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517957695; cv=none; d=google.com; s=arc-20160816; b=E3U0tk4JDxefU7O1Bhxz7dlqjQ1orJD/lCS7KkBxu4Z9Eth5W2bBQWD2yDq+FNP0OA 4iMoWm7jTjNsIA78TN2Rsz+KoHV2uGEcG+1X9aG0ewFYXTlY3T0J62Jq8arKsjjr8R6+ VPPQZ04vTiOZjYQtgB/8zJgezjijjNgYaq/JqDt8VNllY7YNSaqBeD4ocV32sh/LKNWT 7CcK/0eDxhJxhMtyKaM2MFFN5OqksDvYGuGRnyaqxMK9MqGYmwbZJPEISi0NuhEEOU3l UV55l/390/bIIzlOf6lnOKc+lIt2TUDOoW/HlM9VI1A4CyjPZgL74Q6I37nGfMh6kB5a Q8FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=xOCUPAHTi5SbSBOGEb1JP/VkEiKN+D2KMDAC1XKoYI8=; b=UI1cuTOSPpBqbz6lr6s52QKRVCToN/97wiLbunQtoD0LY62gQFU4KEJVm4QPsNRWYZ IwFSt6r4ETFYrOaVwg0CQiUR1Wf5T2t7WgBJTXD9jnLxx3WWspeLjJKEXbZVvUbTGV2y vUKNJC4OdOFgubzWKbsGIcj6TDyQkdPzBslQYOl7bnNBIejdN2ibR9RYF1JJwb+oaTDL 2z8Z8W99+xkui52xlOzxyz4IFGiLvxoo/vZx3eC6AhAgyqEzcj8z0lS245bJog1lzP9S J1c4jVb8Kc4g+lABfIyHvl1lNK2h/P1AWk5xMqh2kQRjv94zCm1XJMzhRVax0n8Ij0Yh 0q9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c14si40388pgu.337.2018.02.06.14.54.41; Tue, 06 Feb 2018 14:54:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753705AbeBFWwp (ORCPT + 99 others); Tue, 6 Feb 2018 17:52:45 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:37204 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753571AbeBFWwo (ORCPT ); Tue, 6 Feb 2018 17:52:44 -0500 Received: from localhost (unknown [104.133.2.98]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3AD76FB2; Tue, 6 Feb 2018 22:52:44 +0000 (UTC) Date: Tue, 6 Feb 2018 14:52:43 -0800 From: Greg Kroah-Hartman To: Matthias Kaehlcke Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Andrey Ryabinin , Josh Poimboeuf , Andy Lutomirski , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , David Woodhouse , Razvan Ghitulete , Guenter Roeck , Nick Desaulniers , Greg Hackmann Subject: Re: [PATCH 4.4 05/53] x86/asm: Use register variable to get stack pointer value Message-ID: <20180206225243.GA7743@kroah.com> References: <20180122083910.299610926@linuxfoundation.org> <20180122083910.527513802@linuxfoundation.org> <20180206215941.GA99249@google.com> <20180206223706.GC23990@kroah.com> <20180206224845.GA116483@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180206224845.GA116483@google.com> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 06, 2018 at 02:48:45PM -0800, Matthias Kaehlcke wrote: > El Tue, Feb 06, 2018 at 02:37:06PM -0800 Greg Kroah-Hartman ha dit: > > > On Tue, Feb 06, 2018 at 01:59:41PM -0800, Matthias Kaehlcke wrote: > > > Hi Greg, > > > > > > El Mon, Jan 22, 2018 at 09:39:57AM +0100 Greg Kroah-Hartman ha dit: > > > > > > > 4.4-stable review patch. If anyone has any objections, please let me know. > > > > > > > > ------------------ > > > > > > > > From: Andrey Ryabinin > > > > > > > > commit 196bd485ee4f03ce4c690bfcf38138abfcd0a4bc upstream. > > > > > > > > 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 a 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 the removed function. > > > > > > > > Signed-off-by: Andrey Ryabinin > > > > Reviewed-by: Josh Poimboeuf > > > > Cc: Andy Lutomirski > > > > Cc: Linus Torvalds > > > > Cc: Peter Zijlstra > > > > Cc: Thomas Gleixner > > > > Link: http://lkml.kernel.org/r/20170929141537.29167-1-aryabinin@virtuozzo.com > > > > Signed-off-by: Ingo Molnar > > > > [dwmw2: We want ASM_CALL_CONSTRAINT for retpoline] > > > > Signed-off-by: David Woodhouse > > > > Signed-off-by: Razvan Ghitulete > > > > Signed-off-by: Greg Kroah-Hartman > > > > > > We recently merged this patch to the Chrome OS kernel tree and it > > > broke our x86 builds with clang: > > > > > > arch/x86/include/asm/asm.h:116:50: error: register 'rsp' unsuitable for global register variables on this target > > > register unsigned long current_stack_pointer asm(_ASM_SP); > > > ^ > > > arch/x86/include/asm/asm.h:41:18: note: expanded from macro '_ASM_SP' > > > #define _ASM_SP __ASM_REG(sp) > > > ^ > > > arch/x86/include/asm/asm.h:24:32: note: expanded from macro '__ASM_REG' > > > #define __ASM_REG(reg) __ASM_SEL_RAW(e##reg, r##reg) > > > ^ > > > arch/x86/include/asm/asm.h:19:29: note: expanded from macro '__ASM_SEL_RAW' > > > # define __ASM_SEL_RAW(a,b) __ASM_FORM_RAW(b) > > > ^ > > > arch/x86/include/asm/asm.h:10:32: note: expanded from macro '__ASM_FORM_RAW' > > > # define __ASM_FORM_RAW(x) #x > > > ^ > > > :4:1: note: expanded from here > > > "rsp" > > > ^ > > > 1 error generated. > > > > > > > > > This can be fixed by also integrating the following patch: > > > > > > commit 520a13c530aeb5f63e011d668c42db1af19ed349 > > > Author: Josh Poimboeuf > > > Date: Thu Sep 28 16:58:26 2017 -0500 > > > > > > x86/asm: Fix inline asm call constraints for GCC 4.4 > > > > > > > > > Admittedly a v4.4 kernel built with clang + LTS merges is a very > > > special case and we can fix this in Chrome OS by integrating the above > > > patch locally. Still it would be good to get it into stable to avoid > > > others from running into this, especially since the fix is very > > > simple. > > > > > > Actually I just noticed that the patch also isn't in v4.9, which could > > > extend the number of affected 'users' significantly, so I think we > > > almost certainly want Josh's patch in stable. > > > > That patch doesn't apply cleanly to the 4.4.y or 4.9.y trees anymore. > > It seems that only one hunk of it is really needed, the #ifndef change, > > right? If so, I'll be glad to apply that portion. > > Indeed, only the #ifndef change is needed. Great, thanks for verifying, now queued up. greg k-h