Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1494907pxb; Mon, 22 Feb 2021 03:32:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUzcy1xlFA9UKwwlcy9D6tFqIAJ3pWttXUVpnHVZ45QFtW84q3P98yIzVJnH3iMqQ3743W X-Received: by 2002:a50:cf02:: with SMTP id c2mr21823382edk.333.1613993564938; Mon, 22 Feb 2021 03:32:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613993564; cv=none; d=google.com; s=arc-20160816; b=FIIbBRY+AQZPIAqkG1v0FfK/GZjwxEOYTynLEedvmAjQaB+GUSOwOUq8Q7CneL+73F cRc551VwhAhHREfkopCra3tK5AzygkF7VqB4ozrNsTNSPRrfo+lhm9VtF7DxFfLXP8br Xo6oUg/ihHqUw/c9kSj9XG0EUw6tpAsVFRs9zC5bcchMStg1TVVafoDcOb//InqhNay4 rjdCRJYNeTDqC13UaXzGy1tKddEx12cNXFehids3FZb44FxZoQV7pAIjcsKmkOqgG6xQ 6549nIGXXFltBVEp2sBGHziRny/zKAfoKKFhoqLVwSTOy0rvLaY69FOZDRWCsdJS5tJx +crA== 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=AKMkOQRxL9OZt3xWljPnbeyEIC+Pe8fINfC5tAIFSyk=; b=Lqm1OPUY3f9BNj7IMegBRpKlFsBy7UkB7w/XmT71gLRW3vq1bTWJm598Hm9jKh2KX1 EFFmFnbpDc5HrPXaP5s0x+bWtDu9H3oKkROqyr13kByRcXJgh+OT8Xg4qNzT7txiqH2M YgqZORpuEl6nBerNBZPpCVSGqGd3arewfMBr7i78Shxb0gzJkmDAR2IqbxEkHuwJ5drU SnwlbdzW3HvK1Ax4L2PHJfVPYofEu+B8646picz1szy/p3hIxggwgBlyklC1v/vxDR5a PHO6zE1TxlAjCCwqfDM9aqxG2NudlHXLPMUfs4oe30FwhKvR5A4YOlmuI5/H7pdySqs2 cZcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=l0RrpAdm; 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 j16si11337746edv.27.2021.02.22.03.32.22; Mon, 22 Feb 2021 03:32:44 -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=l0RrpAdm; 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 S230467AbhBVL3J (ORCPT + 99 others); Mon, 22 Feb 2021 06:29:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230469AbhBVL2o (ORCPT ); Mon, 22 Feb 2021 06:28:44 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EF0FC061574 for ; Mon, 22 Feb 2021 03:28:04 -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=AKMkOQRxL9OZt3xWljPnbeyEIC+Pe8fINfC5tAIFSyk=; b=l0RrpAdm85BLG2uw5wVe5Yfuqk oo83Ax1nhPHHmXR3bqNiC6JEx15qoq1uUqqkYvkqUKYGj8tLTtGlSgBWm4OCdGvy3hYwPnttcApbl RQqfxCD1hBY3H4JsGijkQTovC7daa1QNUqB9B/nCU+A7AjixOrKxyePpO6K59Mwa1sYh6K2tUTMzd v6LjPRr6I6TQ/KI1GCY8I/QSqkHrG2SGvX25Z4OIUxHlVIwsnwUmWG5h88DBFnUBxq5esX3+f5H3D jpla6Zd/btj6LjcLCXlwuxSNVS2LR9Yw8OtcPSUpGl95DfPUSE6mzyQU4tT7R8FB7KGfvqlWycwuJ Vg46Ao7w==; 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 1lE9NM-0005OG-Oc; Mon, 22 Feb 2021 11:27:41 +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 686B43013E5; Mon, 22 Feb 2021 12:27:36 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 52B422BC3285F; Mon, 22 Feb 2021 12:27:36 +0100 (CET) Date: Mon, 22 Feb 2021 12:27:36 +0100 From: Peter Zijlstra To: Borislav Petkov Cc: x86@kernel.org, tony.luck@intel.com, pjt@google.com, linux-kernel@vger.kernel.org, r.marek@assembler.cz, jpoimboe@redhat.com, jikos@kernel.org, andrew.cooper3@citrix.com Subject: Re: [RFC][PATCH 2/2] x86/retpoline: Compress retpolines Message-ID: References: <20210218165938.213678824@infradead.org> <20210218172151.942060087@infradead.org> <20210219071439.GA26778@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210219071439.GA26778@zn.tnic> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 19, 2021 at 08:14:39AM +0100, Borislav Petkov wrote: > On Thu, Feb 18, 2021 at 05:59:40PM +0100, Peter Zijlstra wrote: > > By using int3 as a speculation fence instead of lfence, we can shrink > > the longest alternative to just 15 bytes: > > > > 0: e8 05 00 00 00 callq a <.altinstr_replacement+0xa> > > 5: f3 90 pause > > 7: cc int3 > > 8: eb fb jmp 5 <.altinstr_replacement+0x5> > > a: 48 89 04 24 mov %rax,(%rsp) > > e: c3 retq > > > > This means we can change the alignment from 32 to 16 bytes and get 4 > > retpolines per cacheline, $I win. > > You mean I$ :) Typin' so hard. > In any case, for both: > > Reviewed-by: Borislav Petkov Thanks, except I've been told there is a performance implication. But since all that happened in sekrit, none of that is recorded :/ I was hoping for some people (Tony, Paul) to respond with more data. Also, Andrew said that if we ditch the lfence we could also ditch the pause. So people, please speak up, and if possible share any data you still might have from back when retpolines were developed such that we can have it on record.