All of lore.kernel.org
 help / color / mirror / Atom feed
From: Noah Goldstein <goldstein.w.n@gmail.com>
To: Borislav Petkov <bp@alien8.de>
Cc: tglx@linutronix.de, mingo@redhat.com, X86 ML <x86@kernel.org>,
	hpa@zytor.com, Andy Lutomirski <luto@kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 2/2] x86/xstate: Make AVX512 status tracking more accurate
Date: Wed, 27 Oct 2021 12:37:16 -0500	[thread overview]
Message-ID: <CAFUsyf+Y76TxLnxMSfHiNqY3OOZPtBR4m_EbTcow=N65nvGdKA@mail.gmail.com> (raw)
In-Reply-To: <YXmIP2EPg12N7foP@zn.tnic>

On Wed, Oct 27, 2021 at 12:11 PM Borislav Petkov <bp@alien8.de> wrote:
>
> On Wed, Oct 27, 2021 at 11:26:15AM -0500, Noah Goldstein wrote:
> > diff --git a/arch/x86/include/asm/fpu/types.h b/arch/x86/include/asm/fpu/types.h
> > index f5a38a5f3ae1..cb10909fa3da 100644
> > --- a/arch/x86/include/asm/fpu/types.h
> > +++ b/arch/x86/include/asm/fpu/types.h
> > @@ -330,11 +330,21 @@ struct fpu {
> >       unsigned int                    last_cpu;
> >
> >       /*
> > -      * @avx512_timestamp:
> > +      * @avx512_ZMM_Hi256_timestamp:
> >        *
> > -      * Records the timestamp of AVX512 use during last context switch.
> > +      * Records the timestamp of AVX512 use in the ZMM_Hi256 xfeature
> > +      * set. This include zmm0...zmm15.
> >        */
> > -     unsigned long                   avx512_timestamp;
> > +     unsigned long                   avx512_ZMM_Hi256_timestamp;
> > +
> > +     /*
> > +      * @avx512_Hi16_ZMM_timestamp:
> > +      *
> > +      * Records the timestamp of AVX512 use in the Hi16_ZMM xfeature
> > +      * set. This includes usage of any of the hi16 xmm, ymm, or zmm
> > +      * registers.
> > +      */
> > +     unsigned long                   avx512_Hi16_ZMM_timestamp;
>
> No, not more of this but less.
>
> That was a bad idea to begin with as exposing this to userspace would
> cause exactly this: but but, I need to track my special use case more
> precisely.
>
> But the feature mask can't give you that precision so it'll be only an
> approximation no matter what you do.
>
> And I'm being told future cores won't have this "problem" so on them
> that file becomes actively misleading.

What I've heard is it's a lot better on Rocket Lake (only extra downclocking
on multicore usage) and TBD for Saphire Rapids.
>
> If you really wanna track performance drop precisely or AVX use or
> whatnot, there's performance counters for that which can give you
> exactly what you wanna know.
>
> So I'll take a simple patch carving out that into a function and which
> removes the opmask and otherwise let that thing die. And on future cores
> which are not affected, that thing will report only 0 anyway.

What about just splitting off a field for 'AVX512_ZMM_Hi256'? That field
seems like it can give meaningful information.

I think mostly like 'AVX512_Hi16_ZMM' will almost always be set because
GLIBC's ifunc uses EVEX implementations for all string/memory functions
on CPUs with avx512.

But if you insist will do.
>
> Thx.
>
> --
> Regards/Gruss,
>     Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette

  reply	other threads:[~2021-10-27 17:37 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20  5:39 [PATCH v1] x86/fpu: Remove opmask state from avx512_timestamp check Noah Goldstein
2021-09-27 18:02 ` Noah Goldstein
2021-10-13 22:36   ` Noah Goldstein
2021-10-14  8:28     ` Borislav Petkov
2021-10-14 15:49       ` Noah Goldstein
2021-10-15 14:40         ` Borislav Petkov
2021-10-15 15:25         ` Dave Hansen
2021-10-15 17:30           ` Noah Goldstein
2021-10-15 20:47 ` [PATCH v2 1/2] x86/fpu: Add helper function for tracking AVX512 status Noah Goldstein
2021-10-26 23:15   ` Noah Goldstein
2021-10-15 20:47 ` [PATCH v2 2/2] x86/xstate: Make AVX512 status tracking more accurate Noah Goldstein
2021-10-27 11:07   ` Borislav Petkov
2021-10-27 16:28     ` Noah Goldstein
2021-10-27 16:58       ` Borislav Petkov
2021-10-27 17:18         ` Noah Goldstein
2021-10-27 16:26 ` [PATCH v3 1/2] x86/fpu: Add helper function for tracking AVX512 status Noah Goldstein
2021-10-27 16:26   ` [PATCH v3 2/2] x86/xstate: Make AVX512 status tracking more accurate Noah Goldstein
2021-10-27 17:11     ` Borislav Petkov
2021-10-27 17:37       ` Noah Goldstein [this message]
2021-10-27 17:45         ` Borislav Petkov
2021-10-27 18:21           ` Noah Goldstein
2021-11-03 20:22             ` Noah Goldstein
2021-11-03 20:48               ` Borislav Petkov
2021-11-03 20:56                 ` Noah Goldstein
2021-10-27 17:17 ` [PATCH v4 1/2] x86/fpu: Add helper function for tracking AVX512 status Noah Goldstein
2021-10-27 17:17   ` [PATCH v4 2/2] x86/xstate: Make AVX512 status tracking more accurate Noah Goldstein
2021-10-27 18:21 ` [PATCH v5 1/2] x86/fpu: Add helper function for tracking AVX512 status Noah Goldstein
2021-10-27 18:21   ` [PATCH v5 2/2] x86/xstate: Make AVX512 status tracking more accurate Noah Goldstein
2021-11-16 16:21     ` [PATCH] x86/fpu: Correct AVX512 state tracking Borislav Petkov
2021-11-16 16:49       ` Noah Goldstein
2021-11-17 18:29 ` [tip: x86/fpu] " tip-bot2 for Noah Goldstein

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='CAFUsyf+Y76TxLnxMSfHiNqY3OOZPtBR4m_EbTcow=N65nvGdKA@mail.gmail.com' \
    --to=goldstein.w.n@gmail.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.