public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: "H.J. Lu via Libc-alpha" <libc-alpha@sourceware.org>
Subject: Re: [PATCH] x86: Check RTM_ALWAYS_ABORT for RTM [BZ #28033]
Date: Thu, 01 Jul 2021 18:27:11 +0200	[thread overview]
Message-ID: <87a6n62e5c.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20210630183919.1004153-1-hjl.tools@gmail.com> (H. J. Lu via Libc-alpha's message of "Wed, 30 Jun 2021 11:39:19 -0700")

* 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?

> 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).

> 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?

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

Thanks,
Florian


  reply	other threads:[~2021-07-01 16:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-30 18:39 H.J. Lu
2021-07-01 16:27 ` Florian Weimer [this message]
2021-07-01 17:11   ` [PATCH v2] " H.J. Lu
2021-07-01 17:24     ` Florian Weimer
2021-07-01 19:22     ` H.J. Lu
2021-07-02  8:40       ` Florian Weimer
2021-07-02 15:03         ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6n62e5c.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).