Received: by 10.223.176.5 with SMTP id f5csp1167878wra; Tue, 6 Feb 2018 14:02:11 -0800 (PST) X-Google-Smtp-Source: AH8x227cgdiCeYkKXcN0O9Z0cNVHTJxadxRMBExYbjdL5P4JTXieGRZoihU1J/L5ULGwMlDPwsep X-Received: by 2002:a17:902:a588:: with SMTP id az8-v6mr3832636plb.10.1517954531460; Tue, 06 Feb 2018 14:02:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517954531; cv=none; d=google.com; s=arc-20160816; b=rGEs58UUTAhKCPzDxs3xWRI8wK6BMvaGd5XpfPnUsGF+fzHF1zS3cGFjg4R4iOyyxf Yd+5wEYy00PZWzm4JlBa1C5hLJK+6ixdsGE4MYhuzxYxEiWkc9FAcvca4GTDys7vakyB vKBQXDLobdiGwoNZEOiS1LLFLOVwN5JAqqG0mMJYkZh94AjEzKPmy3brzzDdPG8/ZPN7 sUPO2CxgMi1ukK5T+3EbjXhY9WEybJHo8nNj4EQsbqauXo6QMrZFwMQDkkymoXCQt9ox PT9B2FI+o+s2awTJvWqWmd7XwetAsiwuaOMm8KuFQ86nmUfXU5RrxbaJ7Oovdd6hOHRC E9Mw== 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:dkim-signature:arc-authentication-results; bh=xp8hQavziYlNevfu0WPqQwJNulYewkTUliHpYjUg1es=; b=y+YS68fyhNDG2P25tdxeM5Bvrkj89kItTXZ0m0XKWqH1o1qY7q8sSkUI5Vcc3ESJxg dVDP//IZDh3O47kH58+vleWaNuiCk28fhPMxJL6phFCqGG9s+Vv1GJ/U15tJZp5FbNsV HhjIweYh4+fe6jQQltLQ8Txhkn6hmnR8sjlTlrMIM4ik6GHIZvOMl8GdPPf3rEQVx80S QCc0o07MUgRtb3MMLiA69LwAaT47GHQtSTUXFBrDzal0itA6yVDC7PeLknIylARycd7G pSGfLIF2neVj4U24W2WO07BLdpPL7LqSD6CrsLgNUtTPVFGggcDe2JSncpxufDWWyP9u jgZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QYYvn1HM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z9si12262pfl.34.2018.02.06.14.01.56; Tue, 06 Feb 2018 14:02:11 -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; dkim=pass header.i=@chromium.org header.s=google header.b=QYYvn1HM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753368AbeBFV7p (ORCPT + 99 others); Tue, 6 Feb 2018 16:59:45 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:34022 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753289AbeBFV7n (ORCPT ); Tue, 6 Feb 2018 16:59:43 -0500 Received: by mail-pg0-f68.google.com with SMTP id s73so1672160pgc.1 for ; Tue, 06 Feb 2018 13:59:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=xp8hQavziYlNevfu0WPqQwJNulYewkTUliHpYjUg1es=; b=QYYvn1HMbzZUB6pDpSVDrK3+fIPhkmCLmS4q/UPM5PfV8RxjDbP2iqgYFM6dEtKS/p VoA0Jqn6UUxOIlu01EJLJEESVwQu7956zcZw+i5iMrSbqv6CpQSuHdfZgcy5JkCCWan0 2oG4vOC2MIMIztEgd17yZrhrMUoLtCgiuBUXw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=xp8hQavziYlNevfu0WPqQwJNulYewkTUliHpYjUg1es=; b=lgoklIBvF2vwqJlM8Rpv0VKbgrqpqqiu+Te/T7cYcf9FReMzd88UeKJnOnhJ7t/8aR H45QP1nusAs3tvq6DN6lhW6pXQiv5HwRbEKn/5h2i/UBqCDoKF4aIeeQ5sNGyc/CVk4z mpG6lR1i2wVeBVTuOHDbZvu0+4LNsAjWf4zrS9X98ZRSUswRCKaWHduwWGrg7wIOIXwp aWQwAvlU3wZ6eHpD/gYAJz2VOhde9iWAoaZAjel3WjDE1Su3NzEvlHmC6VYvFK+ANZTJ mbshS/35uEBDrPCRTRM1y7GGhoY7QVvi0LN4r4+BNL5p0s1iQ0WYlvNmnGhbh/jcGydk dq1w== X-Gm-Message-State: APf1xPBpnfSOVA78IWi3G7SPaiYrrCd5ulsOUv+NSNZj3nxXFIYXZ6Xv OJkDxjL/d0wKumJ8hJTy77I7Fg== X-Received: by 10.101.99.203 with SMTP id n11mr2971606pgv.78.1517954382941; Tue, 06 Feb 2018 13:59:42 -0800 (PST) Received: from localhost ([2620:0:1000:1600:5ff4:666d:2881:a60]) by smtp.gmail.com with ESMTPSA id e9sm17999614pgv.14.2018.02.06.13.59.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2018 13:59:42 -0800 (PST) Date: Tue, 6 Feb 2018 13:59:41 -0800 From: Matthias Kaehlcke To: Greg Kroah-Hartman 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: <20180206215941.GA99249@google.com> References: <20180122083910.299610926@linuxfoundation.org> <20180122083910.527513802@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180122083910.527513802@linuxfoundation.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks Matthias