From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5372FC04A68 for ; Fri, 29 Jul 2022 20:30:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239285AbiG2Ua5 (ORCPT ); Fri, 29 Jul 2022 16:30:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239250AbiG2Uaz (ORCPT ); Fri, 29 Jul 2022 16:30:55 -0400 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8CE81BEA0; Fri, 29 Jul 2022 13:30:48 -0700 (PDT) Received: from zn.tnic (p57969665.dip0.t-ipconnect.de [87.150.150.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 260A81EC06C1; Fri, 29 Jul 2022 22:30:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1659126643; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=Reva7c533rvViROlencOmIQvzuYlzhCaWdAsP+xz+QM=; b=DgUX22PSlqWuOAtG4DrDV1QmWPRHYB4omO7lDFv3A7P+FPsbl4tg9KNrU+dwi9B3eUyLSD 55gFZu+S7B+Sxu1a8NAhxime5YCGlcdlvYNA6bhdwFwSpZdR56cXbZGPbzYErWUSzRu7+q tTcN1t6mL1Mya1vmA9pnQ4i5P1djT70= Date: Fri, 29 Jul 2022 22:30:38 +0200 From: Borislav Petkov To: Pawan Gupta Cc: Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, tony.luck@intel.com, antonio.gomez.iglesias@linux.intel.com, Daniel Sneddon , andrew.cooper3@citrix.com, Josh Poimboeuf Subject: Re: [RESEND RFC PATCH] x86/bugs: Add "unknown" reporting for MMIO Stale Data Message-ID: References: <20220729022851.mdj3wuevkztspodh@desk> <20220729173609.45o7lllpvsgjttqt@desk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220729173609.45o7lllpvsgjttqt@desk> Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Fri, Jul 29, 2022 at 10:36:09AM -0700, Pawan Gupta wrote: > Does this look okay: > > - if (cpu_matches(cpu_vuln_blacklist, MMIO) && > - !arch_cap_mmio_immune(ia32_cap)) > - setup_force_cpu_bug(X86_BUG_MMIO_STALE_DATA); > + if (!boot_cpu_has_bug(X86_BUG_MMIO_UNKNOWN)) { > + if (cpu_matches(cpu_vuln_blacklist, MMIO) && > + !arch_cap_mmio_immune(ia32_cap)) { > + setup_force_cpu_bug(X86_BUG_MMIO_STALE_DATA); > + } > + } Yeah, I had initially X86_BUG_MMIO_UNKNOWN set unconditionally on all. Then I thought I should set it only on older but as dhansen said, Intel is going in and out of servicing period so we better set it on all initially and then clear it when the CPU is not in the vuln blacklist. > > > if (!cpu_has(c, X86_FEATURE_BTC_NO)) { > > if (cpu_matches(cpu_vuln_blacklist, RETBLEED) || (ia32_cap & ARCH_CAP_RSBA)) > > diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c > > index 663f6e6dd288..5b2508adc38a 100644 > > --- a/arch/x86/kernel/cpu/intel.c > > +++ b/arch/x86/kernel/cpu/intel.c > > @@ -372,6 +372,10 @@ static void early_init_intel(struct cpuinfo_x86 *c) > > static void bsp_init_intel(struct cpuinfo_x86 *c) > > { > > resctrl_cpu_detect(c); > > + > > + /* Set on older crap */ > > + if (c->x86_model < INTEL_FAM6_IVYBRIDGE) i.e., remove this check. > > + setup_force_cpu_bug(X86_BUG_MMIO_UNKNOWN); > > Thanks for suggesting this approach. You're welcome. I'm assuming you're gonna finish it or should I? Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette