public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Noah Goldstein <goldstein.w.n@gmail.com>
Cc: Fabian Vogt <fvogt@suse.de>,
	libc-alpha@sourceware.org, aurelien@aurel32.net
Subject: Re: [PATCH] x86: include OSXSAVE in x86-64-v3 level
Date: Fri, 9 Dec 2022 14:52:37 -0800	[thread overview]
Message-ID: <CAMe9rOqHQ7kf7CRiPKrYcGgDPv4BrtG-Wau5ojyonCi-8bEVQQ@mail.gmail.com> (raw)
In-Reply-To: <CAFUsyfLBwbw-TnD1Sg1OoJHy1+kOrrbWOv_+9R_PHh5U6OFquQ@mail.gmail.com>

On Fri, Dec 9, 2022 at 1:09 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> On Fri, Dec 9, 2022 at 12:26 PM H.J. Lu via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
> >
> > On Fri, Dec 9, 2022 at 2:36 AM Fabian Vogt <fvogt@suse.de> wrote:
> > >
> > > For some reason the initial x86-64-v3 detection code was missing checks for
> > > BMI, BMI2 and OSXSAVE, which are all required for that level to be met.
> > > BMI and BMI2 got added recently, but OSXSAVE was still missing. Add it.
> > >
> > > Signed-off-by: Fabian Vogt <fvogt@suse.de>
> > > ---
> > >  sysdeps/x86/get-isa-level.h | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/sysdeps/x86/get-isa-level.h b/sysdeps/x86/get-isa-level.h
> > > index 5b4dd5f062..d62bf92cde 100644
> > > --- a/sysdeps/x86/get-isa-level.h
> > > +++ b/sysdeps/x86/get-isa-level.h
> > > @@ -52,7 +52,8 @@ get_isa_level (const struct cpu_features *cpu_features)
> > >               && CPU_FEATURE_USABLE_P (cpu_features, F16C)
> > >               && CPU_FEATURE_USABLE_P (cpu_features, FMA)
> > >               && CPU_FEATURE_USABLE_P (cpu_features, LZCNT)
> > > -             && CPU_FEATURE_USABLE_P (cpu_features, MOVBE))
> > > +             && CPU_FEATURE_USABLE_P (cpu_features, MOVBE)
> > > +             && CPU_FEATURE_USABLE_P (cpu_features, OSXSAVE))
> >
> > If OSXSAVE isn't usable, all AVX/AVX512 features shouldn't be usable.
> > Am I missing something?
>
> Seems like better to err on side of caution here.

We will have serious issues in many places if we don't get it correctly.
CPU_FEATURE_USABLE_P is set according to the states supported
by OSXSAVE.  Checking OSXSAVE isn't needed here.

> Skipping the extra check seems prone to bugs like BZ #29611.



-- 
H.J.

  reply	other threads:[~2022-12-09 22:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 10:36 Fabian Vogt
2022-12-09 17:14 ` Noah Goldstein
2022-12-09 23:53   ` Florian Weimer
2022-12-09 20:25 ` H.J. Lu
2022-12-09 21:09   ` Noah Goldstein
2022-12-09 22:52     ` H.J. Lu [this message]
2022-12-14 15:23       ` Fabian Vogt
2022-12-14 16:11         ` 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=CAMe9rOqHQ7kf7CRiPKrYcGgDPv4BrtG-Wau5ojyonCi-8bEVQQ@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=aurelien@aurel32.net \
    --cc=fvogt@suse.de \
    --cc=goldstein.w.n@gmail.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).