From: Fenghua Yu <fenghua.yu@intel.com>
To: Borislav Petkov <bp@alien8.de>, g@romley-ivt3.sc.intel.com
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, H Peter Anvin <hpa@zytor.com>,
Ravi V Shankar <ravi.v.shankar@intel.com>,
linux-kernel <linux-kernel@vger.kernel.org>, x86 <x86@kernel.org>
Subject: Re: [RFC PATCH] x86/cpufeatures: Enumerate new AVX512 bfloat16 instructions
Date: Tue, 11 Jun 2019 15:28:22 -0700 [thread overview]
Message-ID: <20190611222822.GD180343@romley-ivt3.sc.intel.com> (raw)
In-Reply-To: <20190611194701.GJ31772@zn.tnic>
On Tue, Jun 11, 2019 at 09:47:02PM +0200, Borislav Petkov wrote:
> On Tue, Jun 11, 2019 at 11:19:20AM -0700, Fenghua Yu wrote:
> > So can I re-organize word 11 and 12 as follows?
> >
> > 1. Change word 11 to host scattered features.
> > 2. Move the previos features in word 11 and word 12 to word 11:
> > /*
> > * Extended auxiliary flags: Linux defined - For features scattered in various
> > * CPUID levels and sub-leaves like CPUID level 7 and sub-leaf 1, etc, word 19.
> > */
> > #define X86_FEATURE_CQM_LLC (11*32+ 0) /* LLC QoS if 1 */
> > #define X86_FEATURE_CQM_OCCUP_LLC (11*32+ 1) /* LLC occupancy monitoring */
> > #define X86_FEATURE_CQM_MBM_TOTAL (11*32+ 2) /* LLC Total MBM monitoring */
> > #define X86_FEATURE_CQM_MBM_LOCAL (11*32+ 3) /* LLC Local MBM monitoring */
>
> Yap.
>
> > 3. Change word 12 to host CPUID.(EAX=7,ECX=1):EAX:
> > /* Intel-defined CPU features, CPUID level 0x7:1 (EAX), word 12 */
> > #define X86_FEATURE_AVX512_BF16 (12*32+ 0) /* BFLOAT16 instructions */
>
> This needs to be (12*32+ 5) if word 12 is going to map leaf
> CPUID.(EAX=7,ECX=1):EAX.
>
> At least judging from the arch extensions doc which lists EAX as:
>
> Bits 04-00: Reserved.
> Bit 05: AVX512_BF16. Vector Neural Network Instructions supporting BFLOAT16 inputs and conversion instructions from IEEE single precision.
> Bits 31-06: Reserved.
Yes, you are absolutely right. I'll defint it as (12*32+ 5).
>
> > 4. Do other necessary changes to match the new word 11 and word 12.
>
> But split in two patches: first does steps 1+2, second patch adds the
> new leaf to word 12.
There are two varialbes defined in cpuinfo_x86: x86_cache_max_rmid and
x86_cache_occ_scale. c->x86_cache_max_rmid is read from CPUID.0xf.1:ECX
and c->x86_cache_occ_scale is read from CPUID.0xf.1:EBX.
After getting X86_FEATURE_CQM_* from scattered, the two variables need
to be read from CPUID again. So the code of reading the two variables
need to be moved from before init_scattered_cpuid_features(c) to after
the function. This make the get_cpu_cap() code awkward.
And the two variables are ONLY used in resctrl monitoring configuration.
There is no need to store them in cpuinfo_x86 on each CPU.
I'm thinking to simplify and clean this part of code:
1. In patch #1:
- remove the definitions of x86_cache_max_rmid and x86_cache_occ_scale
from cpuinfo_x86
- remove assignment of c->x86_cache_max_rmid and c->x86_cache_occ_scale
from get_cpu_cap(c)
- get r->mon_scale and r->num_rmid in rdt_get_mon_l3_config(r) directly
from CPUID.0xf.1:EBX and CPUID.0xf.1:ECX.
2. In patch #2: do steps 1+2 to recycle word 11. After patch #1, I can
totally remove the code to get c->x86_cache_max_rmd and
c->x86_cache_occ_scale in get_cpu_cap(c). And patch #2 is cleaner.
3. In patch #3: add new word 12 to host CPUID.7.1:EAX
Do you think the patch #1 is necessary and this is a right patch set?
Thanks.
-Fenghua
next prev parent reply other threads:[~2019-06-11 22:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 17:02 Fenghua Yu
2019-06-10 19:20 ` Borislav Petkov
2019-06-11 18:19 ` Fenghua Yu
2019-06-11 19:47 ` Borislav Petkov
2019-06-11 22:28 ` Fenghua Yu [this message]
2019-06-12 3:29 ` Yu, Fenghua
2019-06-12 3:59 ` Borislav Petkov
2019-06-12 17:41 ` Fenghua Yu
2019-06-12 3:32 ` Fenghua Yu
2019-06-12 4:02 ` Borislav Petkov
2019-06-12 14:10 ` Sean Christopherson
2019-06-12 17:04 ` Fenghua Yu
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=20190611222822.GD180343@romley-ivt3.sc.intel.com \
--to=fenghua.yu@intel.com \
--cc=bp@alien8.de \
--cc=g@romley-ivt3.sc.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=ravi.v.shankar@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®