[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 4/5] x86: Read MSR_ARCH_CAPS immediately after early_microcode_init()



On Mon, Jun 19, 2023 at 05:57:14PM +0200, Jan Beulich wrote:
> > +     * We might have exposed MSR_ARCH_CAPS after the microcode update.
> 
> I'm struggling a little with this sentence, but not being a native speaker
> it may be me, not the sentence. I would perhaps have said "MSR_ARCH_CAPS
> may have appeared with the microcode update."
Sure, works for me.

> I also wonder whether you wouldn't want to insert "e.g.", since iirc with
> the next patch tsx_init() isn't going to be the only user anymore.
tsx_init() is the only user, as far as I have seen. DIS_MCU_LOAD is checked
before the update, using the cached data read in early_cpu_init()

> 
> > +     */
> > +    if ( boot_cpu_data.cpuid_level >= 7 )
> > +        boot_cpu_data.x86_capability[FEATURESET_7d0]
> > +            = cpuid_count_edx(7, 0);
> 
> I take it we assume the maximum CPUID level won't go from below 7 to 7
> or higher with the ucode update?
Do you mean from >=7 to <7 instead? Otherwise it just works and I don't
undertand the concern.

If so, that's an impossibly unlikely case and the current code does not try
to clean up in that case.

> 
> > --- a/xen/arch/x86/tsx.c
> > +++ b/xen/arch/x86/tsx.c
> > @@ -39,9 +39,9 @@ void tsx_init(void)
> >      static bool __read_mostly once;
> >  
> >      /*
> > -     * This function is first called between microcode being loaded, and 
> > CPUID
> > -     * being scanned generally.  Read into boot_cpu_data.x86_capability[] 
> > for
> > -     * the cpu_has_* bits we care about using here.
> > +     * This function is first called between microcode being loaded, and
> > +     * CPUID being scanned generally. early_microcode_init() has already
> > +     * prepared the feature bits needed here after the microcode update.
> 
> Is this true in all cases? early_microcode_init() may have bailed
> early, so I think you need to further transform early_microcode_init()
> (and as a personal request of mine preferably without goto).
> 
> Jan
The series is eventually correct because MSR_ARCH_CAPS are also collected
in early_cpu_init(). Alas, that's not the case here. You're right. I'll
move the early MSR_ARCH_CAPS read to this patch as well.

Alejandro



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.