Received: by 10.213.65.68 with SMTP id h4csp868392imn; Tue, 27 Mar 2018 10:14:41 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+E7nzi2aEQRDMDus5ik+n7S12dbw0fJynTNQit2BkPBkzRIlIhW8dbqpzV2YQI7GTBdUI7 X-Received: by 2002:a17:902:534f:: with SMTP id b73-v6mr182650pli.148.1522170881017; Tue, 27 Mar 2018 10:14:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522170880; cv=none; d=google.com; s=arc-20160816; b=BVH6fJsWQgNTQQT4E7fcGeB64pSD0qLST0dFhbMLg7kFN9jZbGSgk6i8h6tbarRVig RMtJkgB/LBoTes1sSIp7qMp09ewogqq+ycqaQUSxPw7p8KaXV2Ll9OgAed8rkgxzoLAS J6SSpWWxLPFO5Iqt06l6uoHjvQ69lIhy4+MJ2FhjvKjwQXlfULP2/AC0ywhe9zVXj+vY 1VxJdlYQ+v61c+6rxo9660Aj1MUBcbzEOuAz4TfzzxJWS8GCawjQ2PN+VB4QvymypnDl 5XmjApTm2u8XB1pFWTxHAiKznfK6KDXPquNZQaeQvixn5J57VEfKDVCWjFUR02GphX1R rgjA== 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=3LkzhyNfTX8veUp7VoLRxaU3qVHx6Ipmcul6RgIvfBA=; b=FiU2/ebmXjLKFEpXcizBTKuilMzk+3Klg0SLcc+rXKjLAaKnRYUOk+H8ViRj2n9JJF A8clC1a5fELSiy78i4Oxxp0gCoGd6JtAg9YoQxIS1rFdbgX5i41l8JR1nPHtaqluhnN1 59cveGtt7zHBW/e2ZpXz8hkU3/5bIctSPTcT7toRAi4WjGi5N0sB7gpWVlbT/67B13/O c6Qu5jyyJkssRhwm9RGXaeMo148pNSuIucmWn2nI2sI2A4R317fjDhQptNup15GnN41H g22QG3r63Ox6CoycxCL8sPKjgbK0o8z7i3BOPTkIl4W9KL1xWZEUICZwY9CLaBEa94Vn 6++g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WvF+U7dF; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9si1086775pgq.598.2018.03.27.10.14.25; Tue, 27 Mar 2018 10:14:40 -0700 (PDT) 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=@linaro.org header.s=google header.b=WvF+U7dF; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755383AbeC0RLx (ORCPT + 99 others); Tue, 27 Mar 2018 13:11:53 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:36648 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750937AbeC0RLu (ORCPT ); Tue, 27 Mar 2018 13:11:50 -0400 Received: by mail-lf0-f65.google.com with SMTP id z143-v6so34396006lff.3 for ; Tue, 27 Mar 2018 10:11:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=3LkzhyNfTX8veUp7VoLRxaU3qVHx6Ipmcul6RgIvfBA=; b=WvF+U7dFdQgNOTK9dpi7jkj5m5ROIO4yBXilswyq6OFa3JIbS7zmE8//w2SK24au6B TX3CiX7wk4qlAzNJ6A9oSMfBUbJ1MqcUuzNXP19AI6qdyp5Qtpu9fq6lRb7ylXsWMwZP zxwGyyYpsOparjQ3BytPu8VSUuilZNgrhHAXg= 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=3LkzhyNfTX8veUp7VoLRxaU3qVHx6Ipmcul6RgIvfBA=; b=Cd9Z9e7QvWmxA1Aer2Ao/Jq4R6ZgegZNJDo/bnfuhygIUEz1qfZSitFc4b3gOYSNtM adhT4GAoIzEvI448x1AH6bx5b8Z8hIpIr684qABf0zJ44NJUEbSqFX1+FEdLG+s8uENd h0YH/QxcUOUBeuRhfc6IJ+NUjZoIBOh90/Ncfs1rUCjzzo84Xu0i/XrOld307pRVz/ip Aom1a0LBTve2Trbca/hv5Op/kSXW7t2Xfr6N2ycVA8jtVdgtW0aQ1wDlE7F6+jA+mY23 /PLoMnNfXrhuJPBSi+bPNalfMLgUqU1Bf8rH9O9wgMVnEZawzukLpg3r762kSyiZLPCT E9Jg== X-Gm-Message-State: AElRT7FH3Sf3sGQLqzmk/7wyskvzGEbOx936l5PpbZpMBE4y74miAV3N 8GQS0x7gGM87UerIhcQkJkJ0MA== X-Received: by 10.46.151.136 with SMTP id y8mr126912lji.84.1522170708361; Tue, 27 Mar 2018 10:11:48 -0700 (PDT) Received: from localhost.localdomain (c-4c3770d5.07-21-73746f28.cust.bredbandsbolaget.se. [213.112.55.76]) by smtp.gmail.com with ESMTPSA id v4sm302516lji.15.2018.03.27.10.11.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Mar 2018 10:11:47 -0700 (PDT) Date: Tue, 27 Mar 2018 18:43:43 +0200 From: Anders Roxell To: Peter Zijlstra Cc: Thomas Gleixner , mingo@kernel.org, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org Subject: Re: [PATCH 1/2] x86: Force asm-goto Message-ID: <20180327164343.GA4002@localhost.localdomain> References: <20180319154124.337947038@infradead.org> <20180319154717.652679334@infradead.org> <20180319201327.GJ4043@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180319201327.GJ4043@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-03-19 21:13, Peter Zijlstra wrote: > On Mon, Mar 19, 2018 at 08:57:48PM +0100, Thomas Gleixner wrote: > > On Mon, 19 Mar 2018, Peter Zijlstra wrote: > > > > > We want to start using asm-goto to guarantee the absence of dynamic > > > branches (and thus speculation). > > > > > > A primary prerequisite for this is of course that the compiler > > > supports asm-goto. This effecively lifts the minimum GCC version to > > > build an x86 kernel to gcc-4.5. > > > > > > Signed-off-by: Peter Zijlstra (Intel) > > > --- > > > Makefile | 13 +++++++------ > > > arch/x86/Makefile | 4 ++++ > > > 2 files changed, 11 insertions(+), 6 deletions(-) > > > > > > --- a/Makefile > > > +++ b/Makefile > > > @@ -494,6 +494,13 @@ RETPOLINE_CFLAGS_CLANG := -mretpoline-ex > > > RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG))) > > > export RETPOLINE_CFLAGS > > > > > > +# check for 'asm goto' > > > +ifeq ($(shell $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) > > > > Why are you not using the shell-cached version which you remove further > > down? > > Bah, I'm an idiot. I fixed that up at least two times, but clearly I > forgot to check that again before sending. > > --- > Subject: x86: Force asm-goto > From: Peter Zijlstra > Date: Wed Jan 17 11:42:07 CET 2018 > > We want to start using asm-goto to guarantee the absence of dynamic > branches (and thus speculation). > > A primary prerequisite for this is of course that the compiler > supports asm-goto. This effecively lifts the minimum GCC version to > build an x86 kernel to gcc-4.5. With this patch applied I'm not able to do "make kernelversion" without any toolchain to get the kernel version, I was able to do that before. Cheers, Anders > > Signed-off-by: Peter Zijlstra (Intel) > --- > Makefile | 13 +++++++------ > arch/x86/Makefile | 4 ++++ > 2 files changed, 11 insertions(+), 6 deletions(-) > > --- a/Makefile > +++ b/Makefile > @@ -494,6 +494,13 @@ RETPOLINE_CFLAGS_CLANG := -mretpoline-ex > RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG))) > export RETPOLINE_CFLAGS > > +# check for 'asm goto' > +ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) > + CC_HAVE_ASM_GOTO := 1 > + KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO > + KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO > +endif > + > ifeq ($(config-targets),1) > # =========================================================================== > # *config targets only - make sure prerequisites are updated, and descend > @@ -658,12 +665,6 @@ KBUILD_CFLAGS += $(call cc-ifversion, -l > # Tell gcc to never replace conditional load with a non-conditional one > KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) > > -# check for 'asm goto' > -ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) > - KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO > - KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO > -endif > - > include scripts/Makefile.kcov > include scripts/Makefile.gcc-plugins > > --- a/arch/x86/Makefile > +++ b/arch/x86/Makefile > @@ -181,6 +181,10 @@ ifdef CONFIG_FUNCTION_GRAPH_TRACER > endif > endif > > +ifndef CC_HAVE_ASM_GOTO > + $(error Compiler lacks asm-goto support.) > +endif > + > # > # Jump labels need '-maccumulate-outgoing-args' for gcc < 4.5.2 to prevent a > # GCC bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46226). There's no way