[MODERATED] Re: [PATCH 2/3] v4 more sampling fun 2

mark gross <[email protected]> Fri, 27 Mar 2020 12:12:16 -0700
Newsgroups org.kernel.lore.historical-speck
Message-ID <[email protected]>
On Fri, Mar 27, 2020 at 10:23:56AM -0700, speck for Luck, Tony wrote:
> On Fri, Mar 27, 2020 at 09:20:41AM -0700, speck for mark gross wrote:
> > On Wed, Mar 25, 2020 at 10:19:23PM -0500, speck for Josh Poimboeuf wrote:
> > > > +static void __init srbds_select_mitigation(void)
> > > > +{
> > > > +	u64 ia32_cap;
> > > > +
> > > > +	if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) {
> > > > +		srbds_mitigation = SRBDS_HYPERVISOR;
> > > > +		return;
> > > > +	}
> > > 
> > > It's confusing that this comes before the X86_BUG_SRBDS check.  Is that
> > > on purpose?
> > VM vendors on keybase wanted it so.
> 
> No. They don't want this. It results in all multi-socket servers
> (which are not affected by SRBDS) saying the mitigation status is
> unknown.
> 
> The preferred order to check is:
> 
> 1) Am I on the affected list?
> 
> 2) Am I running under a hypervisor?
> 
> 
> Initially Andrew Cooper had asked for the hypervisor check to come
> first. But he has since relented.  Below is a comment to explain
> why it is practially better to check for prescence on the affected
> list *before* checking for hypervisor:
> 
> /*
>  * This test relies on the CPUID values of vendor, family, model,
>  * stepping which might not reflect the real hardware when we are
>  * running as a guest. But VMM vendors have asked that we do this
>  * before the X86_FEATURE_HYPERVISOR test since this provides better
>  * guidance to users in most real situations.
>  */

Ok, I'll change it.

--mark