Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5201642imm; Tue, 18 Sep 2018 06:02:51 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZtEqlWVX4lB+zK8N7GpfySrXIgwSVnAx1GHC+p9W9mFM7BChBnHkPdXui5k5EguyqzrDev X-Received: by 2002:a62:2459:: with SMTP id r86-v6mr30979151pfj.31.1537275771693; Tue, 18 Sep 2018 06:02:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537275771; cv=none; d=google.com; s=arc-20160816; b=n4znSPEMv1e9EehLAO4rYN2RyVXZLSoJzPnpHVwQ+ms9yrOZEuuTiDP/sLx5IHSX8A lxJSRj4DZkagEEFgodVC1L41AssOATBp/5//q+sLJum5/hdNO0ZJaJY0XQJVDdmRDLEB ojG0paFOqvFsj8molCf3l5RDo3uPFO9glJHt9LV//HgXbV99J24Bysfn5Jk1uqBcPV3f DfA488jcRmjt/vaOdZoW01EOEN/PLa7Dic9EluH6hFdjcJlYERjztCtx3u6wQ0R05Ugx dE0sQIVZVGT42kOeu++87h4y2t+HLFj6UJxoN8isfkp0cLIkryrwcoi6CTv/SGajP2jx sVIg== 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; bh=+WS/wrqU/zCp7qOOa37J/9jKkMTW3g6Jn9uAdCqpAH8=; b=xSYOTum+KeuefAzWX1/tlKEn5Qc159Uc/OZI3057inqOa6nxTmq8Ssg72frp/iiPU5 P3VOvAZoi8o+07kPU01sAXGdArb9ABDGk3ycBCpByJ5DcU0GEfeZsFeEnoqMY+kYs4Dw 8qVGsLnSKfhHqH0MOfqAlZ9uDg0tfjgoXP35F2nh22HZhVW+AUljQPESud/OVNwavYyl zx7Zzy7DjUbC5CKQgIRWuKe0TUcgrgVannPyrjsUQ4E5bXIqHT5diJGH7YlE24s0E5GA OjROL40BrofO6EtHjsGR+n5PGeCA1ArkoEleACJLaSANMnYYX+uuTFHt8Bi4LiDowTEc bGGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=kTS3YjIA; 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 m32-v6si17729075pld.404.2018.09.18.06.02.22; Tue, 18 Sep 2018 06:02:51 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=kTS3YjIA; 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 S1729573AbeIRSdm (ORCPT + 99 others); Tue, 18 Sep 2018 14:33:42 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:33844 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726037AbeIRSdm (ORCPT ); Tue, 18 Sep 2018 14:33:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+WS/wrqU/zCp7qOOa37J/9jKkMTW3g6Jn9uAdCqpAH8=; b=kTS3YjIAfu2LOlQuyKLl0FnYU kOmdRkKIBn58Yvb3xOGR/VC64BDbZrENTCXfXArt6E0txIOp+zg/0NX8+kSpzjSvGP1MnkgCdyM72 C1JE/M/yfuG5DhgwZST/xeuxUlY+nB7NOhd8RyDlaxJWtngQiSctZMM92qUSpzA/0ESgRXFJ8kzLT m+05H7GaYPABZGotR1IPM3glOmUtdc31sKyoJgeJJy8Psyq60NGRfSVPZQ0pGTvM5TaOYxlVEizYy VftbOyMNddqEZghCQ4WfSqZaqVWg1e5hsYc7yiLbHWaG0LnVbhnKP+u5+pGW1mzCmk6RL/lRKkuNz 8zwfjMxzg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2Fcj-00028O-R0; Tue, 18 Sep 2018 13:01:01 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6404B202C1A32; Tue, 18 Sep 2018 15:00:58 +0200 (CEST) Date: Tue, 18 Sep 2018 15:00:58 +0200 From: Peter Zijlstra To: Zhenzhong Duan Cc: linux-kernel@vger.kernel.org, mingo@redhat.com, konrad.wilk@oracle.com, x86@kernel.org, dwmw@amazon.co.uk, tglx@linutronix.de, Srinivas REDDY Eeda , bp@suse.de, hpa@zytor.com, dhaval.giani@oracle.com Subject: Re: [PATCH] x86/speculation: Use AMD specific retpoline for inline asm on AMD Message-ID: <20180918130058.GM24106@hirez.programming.kicks-ass.net> References: <87411705-893f-46d3-b899-b09ed9fa8d1b@default> <20180918095015.GE19234@hirez.programming.kicks-ass.net> <3fcc1453-1618-9a79-71c9-5eede0023775@oracle.com> <20180918105939.GK24106@hirez.programming.kicks-ass.net> <1c6ca05f-094e-03e9-b21a-866aaf80cebb@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1c6ca05f-094e-03e9-b21a-866aaf80cebb@oracle.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 18, 2018 at 08:04:44PM +0800, Zhenzhong Duan wrote: > On 2018/9/18 18:59, Peter Zijlstra wrote: > > On Tue, Sep 18, 2018 at 06:31:07PM +0800, Zhenzhong Duan wrote: > > > On 2018/9/18 17:50, Peter Zijlstra wrote: > > > > On Mon, Sep 17, 2018 at 10:17:30PM -0700, Zhenzhong Duan wrote: > > > > > -#elif defined(CONFIG_X86_32) && defined(CONFIG_RETPOLINE) > > > > > +#elif defined(CONFIG_RETPOLINE) > > > > > > > > This doesn't make any sense.. > > > This change is used for x86_64 to have minimal Retpoline support when > > > CONFIG_RETPOLINE is defined but RETPOLINE isn't defined, or I missed > > > something? > > > > No it doesn't. > > > > #if defined(X86_64) && defined(RETPOLINE) > > > > /* x86_64 retpoline goes here */ > > > > #elif defined(RETPOLINE) > > > > /* !x86_64 retpoline goes here */ > > > > #else > > > > /* !retpoline goes here > > > > #endif > > Sorry, but I am confused. > So where is 'if defined(x86_64) && !defined(RETPOLINE) && > defined(CONFIG_RETPOLINE)' go? Argh, CONFIG_RETPOLINE vs RETPOLINE :/ The thing is, the one you modify has a comment on that explains why it is i386 only. CET and retpolines don't like one another much. And the x86_64 version uses %V which requires new GCC. So I'm all for fixing the RETPOLINE_AMD thing, but at this point nobody should use the minimal stuff, that's just delusional. > In original code, it will go to "call *%[thunk_target]\n" while > we have set SPECTRE_V2_RETPOLINE_MINIMAL or > SPECTRE_V2_RETPOLINE_MINIMAL_AMD. Is this expected? Yes, that is exactly right -- it does that with or without your change though.