[MODERATED] Re: [PATCH 3/4] V8 more sampling fun 3

mark gross <[email protected]> Thu, 16 Apr 2020 15:45:18 -0700
Newsgroups org.kernel.lore.historical-speck
Message-ID <20200416224518.GA2583@u1904>
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