Received: by 2002:ab2:7988:0:b0:1f4:b336:87c4 with SMTP id g8csp26660lqj; Thu, 11 Apr 2024 09:00:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWu6vOqEd9IxvLtI6OEGdZjz5aWJ38hnUjc7EMIXRxvSkFCdtwuSmMCoADqy1v44j9d96dGP5Og3cPFc8xE2xeegrvJyS+embNRP+k3ag== X-Google-Smtp-Source: AGHT+IFL4QOgBRd4d6WVSNTqs7+Czvg6IOhH6zuf8UctbenUq4YIRDDvaA8/J6jna6KA98zqJDm3 X-Received: by 2002:a17:90b:1d01:b0:2a0:9c1c:50f4 with SMTP id on1-20020a17090b1d0100b002a09c1c50f4mr5790364pjb.4.1712851249588; Thu, 11 Apr 2024 09:00:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712851249; cv=pass; d=google.com; s=arc-20160816; b=i2tOms0FZFl9tCN5/4bmaAhQ/E6nukMFTV51xV9Y9PqnyJZtw0KNInyTklt/jCJwc0 iRNyhWUyDkcvjrKphBiyRacauATnjNa4oAm7CBAL1J+Yh+821kcuwxBkILuorlrW5VoQ qh/N+q3JSo8Gv9A8BC62kOSrdLSt7seYTfbDEVqSgMUkpql+P5fvwLZUxKYKxKbzK1Qp wX51J1YE/R0A+N6oVUU4a75YPflpEGDX8ouqn0MHGd5bpFaZZ6eqJbMua6KL0Q0BVg+p yd7ezG/ef2ViMpp8TsbSlxn6ZBLC6Q/Ad2HRkAuEvq7EeJMbGs5IQXTuUVOb9Tr69O/a wmeA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kPMCMwC2zBBgJrqvoNVLYPZdHCld6il1tkrvPlOLNNI=; fh=ji7HrPcp1r+OOLDs18P5kihpvOHr0fK0iabYdOu6QE8=; b=HsFiWIAER4MMV3GKawWmBSzn4XES50sffHXH41tA/okvhY3NoMFNnZQbxtzh/GyOCl 2ovTmuSE5QDCBun+Ncz92E8Nqzb6qIc1AGvvCJ/2mWeGYdBSds4s23CfveF9EuEj4ZnM ekBPJEb7tKYAWa7W8jU7vZ3w6nBVsoCOVtqPMsC34T3nIfafDRmQFug97Xy83YRY/UZm c694rMXj7tAU5Yktotm5fZ5w6rDc2b7Z/8vcTM9AVEzKbBCYPk3QduCu+K6PDJnuY3QK apFafDlngcd3I4FUdRwtyAQ4Ec4agYQhsGBbXPvl8IZFXm8JfwkW4PA8IXIrzSqJTyVM Q29w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TsKroPqu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-140857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140857-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id pf2-20020a17090b1d8200b002a503b8a00bsi3813446pjb.160.2024.04.11.09.00.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 09:00:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TsKroPqu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-140857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140857-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 23CCA280D6C for ; Thu, 11 Apr 2024 16:00:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BA54613956D; Thu, 11 Apr 2024 15:34:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TsKroPqu" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E30C51386B3 for ; Thu, 11 Apr 2024 15:34:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712849666; cv=none; b=DUyeQ5opV1z3xdCUH9VHvhEEDzkp9GOb6v2STsb+uxEwxNzPvq5DSljG7mHRfGe3usZCdveCO5otBfBl/GhoxHKlUZUKPlZJCWxuFNINsAYQP9Z+plvNP3liH3lEVeePbzFICB1SwgfPFzxw3i9ZBPqJL5uElexh7kXdmsF2wis= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712849666; c=relaxed/simple; bh=YuahbXm5K4d78BIJVxJtPpmqTY2F+D+qHk/aXZOQcK0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mYg67Ay2k2jVi+MR+462Kz//ZgKA2GQMM5lB7LK3in8jECGumPc8idMEKprOGAQXHd1O4I3kQsdfDZqQy3acZhz/Ht2cBL8FEYLtJqSj2sdNWYteMVI/SY9lvf+VklIzOdJuyUzR81L7RrVHK2dk2MnAxjewrvXNmX+acX4QFFo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TsKroPqu; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9704C072AA; Thu, 11 Apr 2024 15:34:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712849665; bh=YuahbXm5K4d78BIJVxJtPpmqTY2F+D+qHk/aXZOQcK0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TsKroPqupbSVei8wIXh/rCDph/186G/6XSinWmH51RZRs3XsWiDI795Vo3M5sgcLt CFCh4pTDBu8zEW/GKJFn7dlYqC5uT9qjrtLDUwlxa7HE8RkAjcpq+NUAQkLnPVsitz pHQV9OU5rKwT/cmntNigeKhydhv33kkpvsT3cAG/ORLrakBGMyZ7uyMdOBXbUmqYK+ 8T/UG3ucar9c92RxVWgnG9fqAipB8T9K4r1KeDWrE6E+t/ItdNqxWkPP2s2IPncEYl E4JBA5U6wlZufMmhpbNXbJo+yr4rqaQO2J3iwGq4k7125yEHw1aoTrrXR/PHHeEvWR NVCN4uhUfEIZA== Date: Thu, 11 Apr 2024 08:34:23 -0700 From: Josh Poimboeuf To: Andrew Cooper Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds , Daniel Sneddon , Pawan Gupta , Thomas Gleixner , Alexandre Chartre , Konrad Rzeszutek Wilk , Peter Zijlstra , Greg Kroah-Hartman , Sean Christopherson , Dave Hansen , Nikolay Borisov , KP Singh , Waiman Long , Borislav Petkov Subject: Re: [PATCH 3/7] x86/bugs: Fix BHI handling of RRSBA Message-ID: <20240411153423.6oolchbhjvnk2jm3@treble> References: <6f56f13da34a0834b69163467449be7f58f253dc.1712813475.git.jpoimboe@kernel.org> <997d9bf9-2a8b-452f-b458-2fa15f92918e@citrix.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <997d9bf9-2a8b-452f-b458-2fa15f92918e@citrix.com> On Thu, Apr 11, 2024 at 11:02:42AM +0100, Andrew Cooper wrote: > > /* Disable in-kernel use of non-RSB RET predictors */ > > static void __init spec_ctrl_disable_kernel_rrsba(void) > > { > > - u64 ia32_cap; > > + if (rrsba_disabled) > > + return; > > + > > + if (!(ia32_cap & ARCH_CAP_RRSBA)) { > > + rrsba_disabled = true; > > + return; > > + } > > You'll take this path if you have out-of-date microcode. > > RRSBA is only enumerated from September last year, IIRC.  (Definitely > from this point on some CPUs.) > > When RRSBA was introduced, I was under the (false) impression that all > eIBRS systems suffered RRSBA, but it turns out that select parts > (ICX,TGL,RKL) are non-RRSBA despite not having RRSBA_CTRL. Hm, so the original code here had this problem too, right? if (cpu_feature_enabled(X86_FEATURE_RETPOLINE) && !(x86_read_arch_cap_msr() & ARCH_CAP_RRSBA)) return; At this point I'm having a hard time caring about 7 months out-of-date microcode, but is there a reasonable way to check for that? -- Josh