Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp502374imn; Fri, 29 Jul 2022 13:46:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sjLX/QcxuTlOcCcASUP5IGNjS3NYJK9oQYRzH4suG8iynxIut5ubD0RCWnf8pLm4KdVHMX X-Received: by 2002:a63:c049:0:b0:41b:823d:43a8 with SMTP id z9-20020a63c049000000b0041b823d43a8mr4181456pgi.283.1659127612416; Fri, 29 Jul 2022 13:46:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659127612; cv=none; d=google.com; s=arc-20160816; b=W+Sspu9GbBnYlMd+HtyJrdWHf2ETu/EuAyO6zGaDstovsYpTc6BwfI7pjx+McwcpVG q/RR2yaL16s+o9593vPz1hs6tWJmOWZ43CKeYbChx2nR4xK6pH8tIGBYo/yyXWn9Gqlw zMC5JgQddlpD53Cm1+aESFGFrhANmtIYuc5emz6jT7IF9OVdrun29asDuw0wEe9FkpTe CK6GGPvBMOOMriO5HGn6E1EB/1wu/jXjVFfe4E15MY/feclFXe+OcP9tjJnJfinAceD1 L/hefNVIqakehRSY4dTr0cPKGMjxt6SoHyIBqjKRrz/JiaDZ01yoBAF4+ow/28s4eyD8 CgUg== 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=Reva7c533rvViROlencOmIQvzuYlzhCaWdAsP+xz+QM=; b=UpkrLtJLUK2RexyUNNcbBKx5f8+igFBPM8WZ1ocAgS18eWXJjfcbD75TwWFyT0/7va BdVtCM4EELl8TaPoGLukdXeEwdGyIhqJqINLabgqsfMTBPCGgUhu5pC0Js6+HgaD8fQ7 4/EA2vTajKmvqFF62aJEK2c23N84YKMCCKc/40DUAIj77+KGnDlxs8gBWTL3WAgXQvoK zOt6DkoNnY3wKRtl9Bei+OhEwwQiQDkwu6D9h97QYNpElNSls7sl7iBycXSneUK7yU8Y 3IqPe0G7b+TGcVjJ6jNehoZK67eFTKm3IxjGQedXMHpxBGm/gLMyMzHlt+HtgEA7LK0H 9eHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=DgUX22PS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f8-20020a655908000000b004157aa8707csi5429427pgu.110.2022.07.29.13.46.38; Fri, 29 Jul 2022 13:46:52 -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; dkim=pass header.i=@alien8.de header.s=dkim header.b=DgUX22PS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238987AbiG2Ua6 (ORCPT + 99 others); Fri, 29 Jul 2022 16:30:58 -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> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 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