From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linutronix.de (193.142.43.55:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 14 Apr 2020 16:23:40 -0000 Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jOOLb-0007LP-SW for speck@linutronix.de; Tue, 14 Apr 2020 18:23:39 +0200 From: Thomas Gleixner Subject: Re: [PATCH 3/4] V7 more sampling fun 3 In-Reply-To: <20200414034843.GA5995@mtg-dev.jf.intel.com> References: <20200414034843.GA5995@mtg-dev.jf.intel.com> Date: Tue, 14 Apr 2020 18:23:38 +0200 Message-ID: <87h7xmniid.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: Mark, speck for mark gross writes: > On Thu, Jan 16, 2020 at 02:16:07PM -0800, speck for mark gross wrote: >> + /* >> + * Check to see if this is one of the MDS_NO systems supporting >> + * TSX that are only exposed to SRBDS when TSX is enabled. >> + */ >> + ia32_cap = x86_read_arch_cap_msr(); >> + if ((ia32_cap & ARCH_CAP_MDS_NO) && !boot_cpu_has(X86_FEATURE_RTM)) { >> + srbds_mitigation = SRBDS_MITIGATION_NOT_AFFECTED_TSX_OFF; >> + goto out; >> + } >> + >> + if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) { >> + srbds_mitigation = SRBDS_MITIGATION_HYPERVISOR; >> + goto out; >> + } >> + >> + if (!boot_cpu_has(X86_FEATURE_SRBDS_CTRL)) { >> + srbds_mitigation = SRBDS_MITIGATION_UCODE_NEEDED; >> + goto out; >> + } >> + >> + if (cpu_mitigations_off() || srbds_off) { >> + if (srbds_mitigation != SRBDS_MITIGATION_NOT_AFFECTED_TSX_OFF) >> + srbds_mitigation = SRBDS_MITIGATION_OFF; >> + } >> +out: > The test for cpu_mitigations_off or srbds off needs to be after out: > Otherwise when TSX is off and srbds=off will report the wrong answer. If the CPU has SRBDS_IF_TSX and TSX is disabled then the correct answer is: Not affected (TSX off) That's what we do with other issues as well. If the CPU is not affected then we print this even with mitigation disabled (all or particular). Thanks, tglx