Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1503743rwb; Fri, 19 Aug 2022 05:02:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Xnv5u2kf8IzlTE4OKYBR4ioI8s+1EgdoC0JlF1rDarCmeA9kyHeuKWWRh4/Wb5ImBOQEi X-Received: by 2002:a17:902:ec90:b0:16d:d156:2c01 with SMTP id x16-20020a170902ec9000b0016dd1562c01mr7531093plg.114.1660910528384; Fri, 19 Aug 2022 05:02:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660910528; cv=none; d=google.com; s=arc-20160816; b=oN86iVY0jusZnm5aI06+41XZEms1KGgP4cbjd18FlyTOu9B5n3sgnb8ibSjNvRlqyr Y7ufwgPuT02IzTrGTc/GAxNMzJZ7KFmFzGBKOEbDXSVRvKJFbXmGant6PF6OUPwuYcx3 rAy1Mx79Ukr0O5KILuKp8xUEImrwnwMnRDuVt7rfvrfWo5J7okZFQ7Fe+/nh9RIw43hP IPmXMPZjvQv9203mh1uWbog0AvJPkmfjT1m4fP17+1xMia1jx/x/SwvHTZ5Wk3Qbq8FI TvYYsWzXHbqt5jVl7dMHtPxqXpBGZueykCIauCGXo06RKIWc578dOelTLD7fYS4VDWmB PbqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :date:cc:to:from:subject:message-id; bh=ucajbuDKQin8TkpVsrRSoWzxWfahSmdWO5AcCRjx074=; b=btSTwgwVliN8UCOMNROVOveOc8LKagjBUGQChcKWP6pDEaQhQ/GLOhy0Tnex30bcpX 6iTMuiVDuTkwCzX9e3HU5Eps9LPQHPedvPNKHCp6qo+Ayq3P+uQNRdmmHxfLZmg/S9c8 /homd7LjIdO2fAZTbURCt0WaFY/7NmSP1WI54Ik+BB+4MYasib4CWVukJiaAC3KbLC+b hJtkzWxMEyT8bCqmfsRNz6F6FUJCeX5NZx8Sh+y0EgoKSFIaD6GBMSFNEfc+yYbS1H/6 Q5iqhSPVbNdyJ893A77h8n6ezPNKvr2R4OwB92KANgIx6MXXGl+9FkGn//gjZQMcjkKj jc0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p5-20020a63c145000000b00415d8740505si3516786pgi.499.2022.08.19.05.01.56; Fri, 19 Aug 2022 05:02:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348508AbiHSLiq (ORCPT + 99 others); Fri, 19 Aug 2022 07:38:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346618AbiHSLin (ORCPT ); Fri, 19 Aug 2022 07:38:43 -0400 Received: from maynard.decadent.org.uk (maynard.decadent.org.uk [95.217.213.242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0118E1260A; Fri, 19 Aug 2022 04:38:40 -0700 (PDT) Received: from 213.219.160.184.adsl.dyn.edpnet.net ([213.219.160.184] helo=deadeye) by maynard with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oP0Ke-0003FT-Gc; Fri, 19 Aug 2022 13:38:32 +0200 Received: from ben by deadeye with local (Exim 4.96) (envelope-from ) id 1oP0Kd-000b3h-39; Fri, 19 Aug 2022 13:38:31 +0200 Message-ID: <9395338630e3313c1bf0393ae507925d1f9af870.camel@decadent.org.uk> Subject: Re: [PATCH] x86/speculation: Avoid LFENCE in FILL_RETURN_BUFFER on CPUs that lack it From: Ben Hutchings To: Peter Zijlstra Cc: x86@kernel.org, linux-kernel@vger.kernel.org, 1017425@bugs.debian.org, =?ISO-8859-1?Q?Martin-=C9ric?= Racine , stable@vger.kernel.org, regressions@lists.linux.dev, Daniel Sneddon , Pawan Gupta Date: Fri, 19 Aug 2022 13:38:27 +0200 In-Reply-To: References: Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-nQrCdQRVr0v9wcLsIe/Y" User-Agent: Evolution 3.44.3-1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 213.219.160.184 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on maynard); SAEximRunCond expanded to false X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-nQrCdQRVr0v9wcLsIe/Y Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2022-08-19 at 13:01 +0200, Peter Zijlstra wrote: > On Fri, Aug 19, 2022 at 10:47:21AM +0200, Peter Zijlstra wrote: > > On Fri, Aug 19, 2022 at 02:33:08AM +0200, Ben Hutchings wrote: > > > From: Ben Hutchings > > >=20 > > > The mitigation for PBRSB includes adding LFENCE instructions to the > > > RSB filling sequence. However, RSB filling is done on some older CPU= s > > > that don't support the LFENCE instruction. > > >=20 > >=20 > > Wait; what? There are chips that enable the RSB mitigations and DONT > > have LFENCE ?!? >=20 > So I gave in and clicked on the horrible bugzilla thing. Apparently this > is P3/Athlon64 era crud. >=20 > Anyway, the added LFENCE isn't because of retbleed; it is because you > can steer the jnz and terminate the loop early and then not actually > complete the RSB stuffing. I know, I corrected that further down. > New insights etc.. So it's a geniune fix for the existing rsb stuffing. >=20 > I'm not entirly sure what to do here. On the one hand, it's 32bit, so > who gives a crap, otoh we shouldn't break these ancient chips either I > suppose. >=20 > How's something like so then? It goes on top of my other patch cleaning > up this RSB mess: >=20 > https://lkml.kernel.org/r/Yv9m%2FhuNJLuyviIn%40worktop.programming.kick= s-ass.net [...] That should be: https://lore.kernel.org/all/Yv9m%2FhuNJLuyviIn@worktop.programming.kicks-as= s.net/ (the redirector unescapes the URL-escaped /). So that puts the whole __FILL_RETURN_BUFFER inside an alternative, and we can't have nested alternatives. That's unfortunate. Ben. --=20 Ben Hutchings Beware of bugs in the above code; I have only proved it correct, not tried it. - Donald Knuth --=-nQrCdQRVr0v9wcLsIe/Y Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEErCspvTSmr92z9o8157/I7JWGEQkFAmL/djMACgkQ57/I7JWG EQlHpg/9FbaeEJKro9Qcmw+qk86shNJCNfyfeGVeLs0aiM6KgDOp17SaTPzAleea Y4UeZYgu36lGTPh+RnK9Llb6bJgqlG3ad90VyUO0fBcY7uuJF/uTxHtNQVRNYRHL pqmH36qNzJ8FGsHYbl6ikhpIiw5Ail4js4WbCiW0f5eL8BWyAKj2seKHkRpIkd2I eq8/Ux9YXRhGhGnPj+1XRhl/nqw7Hb1KUMjtGqUwKIjp/1NkubbzFnqRsQPL0w0i fLi/dbdtepWlcg8zy6xKa9B1xHqfPOnjldD4G2CDLrpprWacjkTZIoHY2WJmqv4+ aU+q3XinoxZHODeqxD2DJ+r7TzJcBiSj+ypf3HxwR8YHReQVjUbdMLmMe6bXYX/f EyDNw1OaJUaxbbEPQM1dJaJOLKGPHGUgKQuucMJq1R6kcKqhnLfWIoPBaL/gKbHk xo6Tyg2WAMN14UzzDFzqTFwndU5zlA95J/Xi1RiS3muKdNkcpu33NnbEG45tpEiM P+N/xqZr1dvJ9BYYWlkA8OAdDcSnmL9vkHxuzWuHTyh1gxnW99C6IWosr5sIVc2G REAhuTXssLSMXsfm3plqmtPyXaJIm7vHSmB/d1OV9LylZOCOcqsGjmE1H0CbkVf9 dPdEFxXudTWbOb9965rEzhQYMn3OWsv6Ik17S3S3ZAdeo4hMDEY= =P7Kd -----END PGP SIGNATURE----- --=-nQrCdQRVr0v9wcLsIe/Y--