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 ; 16 Apr 2020 22:45:29 -0000 Received: from mga03.intel.com ([134.134.136.65]) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jPDG9-0007be-J1 for speck@linutronix.de; Fri, 17 Apr 2020 00:45:27 +0200 Date: Thu, 16 Apr 2020 15:45:18 -0700 From: mark gross Subject: [MODERATED] Re: [PATCH 3/4] V8 more sampling fun 3 Message-ID: <20200416224518.GA2583@u1904> Reply-To: mgross@linux.intel.com References: <20200416171723.zk3lzznvslmtt4zf@treble> <20200416174452.GG21456@zn.tnic> <20200416180108.bjbhdl24nrlbfans@treble> MIME-Version: 1.0 In-Reply-To: <20200416180108.bjbhdl24nrlbfans@treble> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Thu, Apr 16, 2020 at 01:01:08PM -0500, speck for Josh Poimboeuf wrote: > On Thu, Apr 16, 2020 at 07:44:52PM +0200, speck for Borislav Petkov wrote: > > static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c) > > { > > u64 ia32_cap = x86_read_arch_cap_msr(); > > @@ -1142,6 +1174,27 @@ static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c) > > (ia32_cap & ARCH_CAP_TSX_CTRL_MSR))) > > setup_force_cpu_bug(X86_BUG_TAA); > > > > + /* > > + * Some parts on the list don't have RDRAND or RDSEED. Make sure > > + * they show as "Not affected". > > + */ > > + if (cpu_has(c, X86_FEATURE_RDRAND) || cpu_has(c, X86_FEATURE_RDSEED)) { > > + if (!cpu_matches(cpu_vuln_blacklist, SRBDS)) > > + goto srbds_not_affected; > > + > > + /* > > + * Parts in the blacklist that enumerate MDS_NO are only > > + * vulnerable if TSX can be used. To handle cases where TSX > > + * gets fused off check to see if TSX is fused off and thus not > > + * affected. > > + */ > > + if ((ia32_cap & ARCH_CAP_MDS_NO) && tsx_fused_off(c, ia32_cap)) > > + goto srbds_not_affected; > > + > > + setup_force_cpu_bug(X86_BUG_SRBDS); > > + } > > + > > +srbds_not_affected: > > I still strongly dislike this and would much prefer my more compact > non-goto version. FWIW I did think pretty hard about doing it way you proposed without the goto a few emails back but felt the readability was really poor with the complexity of the conditional that results. But, I'm not going to fight you on it. > > Otherwise everything looks good :-) thanks. --mark > -- > Josh