Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1498222pxb; Mon, 22 Feb 2021 03:38:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyn5Qel7gp8SqqkOLykDIQTX7Oa0HVszwbVoTjwwmOT4UeHwyhJwxlb+rE0FH0IkaJsYfB X-Received: by 2002:a17:907:9d6:: with SMTP id bx22mr20318882ejc.331.1613993920997; Mon, 22 Feb 2021 03:38:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613993920; cv=none; d=google.com; s=arc-20160816; b=Wzs9lU2hdafNdcE/ZTxx3PSKHKYnrKFBB6Fb2em3OpVG68ri6KFE1AFlCwcVqGhOoC fqEoLZcgt2P39v/L2rVqwmUL0MYTPwC5BX3GnpyKVXoFpHQOuehp/TBGqwDhUibJfGPx tVfH2kW1XUv1lTozNNFGxy8DUSgo5rYpfhd1JQ9mECEv01oeI/VKVNPGFVDZL0Ndadp9 1xLNdtdTldtXKlEH0kIfqttfw8wXd3bBDPfveIuHHzhYMETw/1GXGx+RpCnbvywqcET4 Tp/Ed7wraPaKUhUHtfzVJNusYgHrF7RPLQJMZiUJ4r26sInFG+HMHPDIOU11Yt2dgr8t px+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EEQvCQV49/AMZvFzjJj3SI49cboYpENekv5KWDAlwdQ=; b=B1HJBMGc5UflKptqgkpVhKJ8Ct2YMKi1KbE2hdVcW+DBdrFiGcmxOOf1LtFWXsuYaX dlhVjGGOd53Ye6O314iOIRul/OGBy/8Xtyk4F3mkUxXhEz9L/zQime3VueK5iavZ97GB LFgFqDYp+zsdmpUfSfm5yhzSGfOlQ8RfxYl7tUWMGKfEy/gICGIrPtGgosfeYGYZikOE ibtg7Wn51oyGTYj2+GbmQ/H64XT6HfmlC83YXrIlDPxG16Rq/F9F0XxSFeNQYtEl1Ijf ncVEuwqfBTI59MD0r/5+KKXklKJhxQPvrhpE4jcH2w/Y772jdTGkezA+wpJaPVWlPChZ Qi/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=CAJve6SW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w21si11057885edd.421.2021.02.22.03.38.17; Mon, 22 Feb 2021 03:38:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=CAJve6SW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230206AbhBVLhe (ORCPT + 99 others); Mon, 22 Feb 2021 06:37:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230189AbhBVLhd (ORCPT ); Mon, 22 Feb 2021 06:37:33 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2A3EC061574 for ; Mon, 22 Feb 2021 03:36:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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; bh=EEQvCQV49/AMZvFzjJj3SI49cboYpENekv5KWDAlwdQ=; b=CAJve6SWqgThcFBO6QJcWx1vzb Rol2SSN0wt+gFIfPvQVcDA2MRMa1yrvEibgMRsTGKPqpXVfCEzpDvDujL7SlkmR6Nz89NQ9xUCUAw Ml/7bvjcDimGm3USWe3cs8ZCmUNJGHcFUOBzIy8cKApgtX83PFA5Nh/g2CTTvMhF0DUDMbPv8LmrT 1d/xTL3AnG7qyogfWEjKurW1mffXjpxgf0UP3AAntdFvZdOAPrk33S7q5ohCOH8Evu+Bz2JlVihlX PCvwEViXe/YOr0gx4lyJJIIj5+wjPr5wvK7yBhjEPS2mqu9Z0iWcxNSvevh+qrfyyX+udksDi47Pa 8uScAuKw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1lE9W8-0005x6-Pq; Mon, 22 Feb 2021 11:36:44 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 5F577300DB4; Mon, 22 Feb 2021 12:36:43 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 31E482BC24B51; Mon, 22 Feb 2021 12:36:43 +0100 (CET) Date: Mon, 22 Feb 2021 12:36:43 +0100 From: Peter Zijlstra To: x86@kernel.org, tony.luck@intel.com, pjt@google.com Cc: linux-kernel@vger.kernel.org, r.marek@assembler.cz, jpoimboe@redhat.com, jikos@kernel.org Subject: Re: [RFC][PATCH 1/2] x86/retpoline: Simplify retpolines Message-ID: References: <20210218165938.213678824@infradead.org> <20210218172151.835108198@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210218172151.835108198@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 18, 2021 at 05:59:39PM +0100, Peter Zijlstra wrote: > Currently out retpolines consist of 2 symbols, > __x86_indirect_thunk_\reg, which is the compiler target, and > __x86_retpoline_\reg, which is the actual retpoline. Both are > consecutive in code and aligned such that for any one register they > both live in the same cacheline: > > 0000000000000000 <__x86_indirect_thunk_rax>: > 0: ff e0 jmpq *%rax > 2: 90 nop > 3: 90 nop > 4: 90 nop > > 0000000000000005 <__x86_retpoline_rax>: > 5: e8 07 00 00 00 callq 11 <__x86_retpoline_rax+0xc> > a: f3 90 pause > c: 0f ae e8 lfence > f: eb f9 jmp a <__x86_retpoline_rax+0x5> > 11: 48 89 04 24 mov %rax,(%rsp) > 15: c3 retq > 16: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0(%rax,%rax,1) > > The thunk is an alternative_2, where one option is a jmp to the > retpoline. So the reason I originally did that was because objtool could not deal with alternatives with stack ops. But we've recently fixed that.