[PATCH v2] x86: Check RTM_ALWAYS_ABORT for RTM [BZ #28033]

H.J. Lu hjl.tools@gmail.com
Thu Jul 1 17:11:37 GMT 2021


On Thu, Jul 1, 2021 at 9:27 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu via Libc-alpha:
>
> > From
> >
> > https://www.intel.com/content/www/us/en/support/articles/000059422/processors.html
> >
> > A new CPUID bit CPUID.07H.0H.EDX[11](RTM_ALWAYS_ABORT) will be enumerated,
> > which is set to indicate to updated software that the loaded microcode is
> > forcing RTM abort.
> >
> > 1. Add RTM_ALWAYS_ABORT to CPUID features.
> > 2. Set RTM usable only if RTM_ALWAYS_ABORT isn't set.
> > 3. Check RTM feature, instead of usability, against /proc/cpuinfo.
>
> Maybe not that this fixes the string/tst-memchr-rtm etc. test cases
> after a microcde update?

I changed it to

1. Add RTM_ALWAYS_ABORT to CPUID features.
2. Set RTM usable only if RTM_ALWAYS_ABORT isn't set.  This skips the
string/tst-memchr-rtm etc. testcases on the affected processors, which
always fail after a microcde update.
3. Check RTM feature, instead of usability, against /proc/cpuinfo.

> > diff --git a/manual/platform.texi b/manual/platform.texi
> > index 4cd029cfad..8ec7f385e9 100644
> > --- a/manual/platform.texi
> > +++ b/manual/platform.texi
> > @@ -525,6 +525,9 @@ capability.
> >  @item
> >  @code{RTM} -- RTM instruction extensions.
> >
> > +@item
> > +@code{RTM_ALWAYS_ABORT} -- Abort all transactions.
>
> I think this means “Transactions always abort, making RTM unusable.”
> (with unusable in both senses, !CPU_FEATURE_USABLE, and not useful).

Fixed.

> > diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
> > index a1d8d11cc4..d9093f11ac 100644
> > --- a/sysdeps/x86/cpu-features.c
> > +++ b/sysdeps/x86/cpu-features.c
> > @@ -67,7 +67,6 @@ update_usable (struct cpu_features *cpu_features)
> >    CPU_FEATURE_SET_USABLE (cpu_features, HLE);
> >    CPU_FEATURE_SET_USABLE (cpu_features, BMI2);
> >    CPU_FEATURE_SET_USABLE (cpu_features, ERMS);
> > -  CPU_FEATURE_SET_USABLE (cpu_features, RTM);
> >    CPU_FEATURE_SET_USABLE (cpu_features, RDSEED);
> >    CPU_FEATURE_SET_USABLE (cpu_features, ADX);
> >    CPU_FEATURE_SET_USABLE (cpu_features, CLFLUSHOPT);
> > @@ -97,6 +96,9 @@ update_usable (struct cpu_features *cpu_features)
> >    CPU_FEATURE_SET_USABLE (cpu_features, FSRCS);
> >    CPU_FEATURE_SET_USABLE (cpu_features, PTWRITE);
> >
> > +  if (!CPU_FEATURES_CPU_P (cpu_features, RTM_ALWAYS_ABORT))
> > +    CPU_FEATURE_SET_USABLE (cpu_features, RTM);
> > +
> >  #if CET_ENABLED
> >    CPU_FEATURE_SET_USABLE (cpu_features, IBT);
> >    CPU_FEATURE_SET_USABLE (cpu_features, SHSTK);
>
> Is some change necessary to copy RTM_ALWAYS_ABORT to USABLE as well?

Added.

> Any idea why the microcode update doesn't just clear the RPM bit in
> CPUID?  This is a bit awkward.

I asked it internally.

> Thanks,
> Florian
>

Here is the v2 patch.  OK for master?

Thanks.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v2-0001-x86-Check-RTM_ALWAYS_ABORT-for-RTM-BZ-28033.patch
Type: text/x-patch
Size: 6950 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20210701/4ede9b45/attachment-0001.bin>


More information about the Libc-alpha mailing list