V3: [PATCH] x86: Update CPU feature detection [BZ #26149]
H.J. Lu
hjl.tools@gmail.com
Mon Jun 22 13:00:02 GMT 2020
On Sat, Jun 20, 2020 at 10:21 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Thu, Jun 18, 2020 at 8:09 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Thu, Jun 18, 2020 at 1:09 AM Florian Weimer <fweimer@redhat.com> wrote:
> > >
> > > * H. J. Lu via Libc-alpha:
> > >
> > > > 1. Add COMMON_CPUID_INDEX_7_ECX_1 for AVX512_BF16.
> > >
> > > Do you expect similar changes in the future? This changes the layout of
> > > struct cpu_features.
> > >
> > > If __x86_get_cpu_features is exported, such a change will require a new
> > > symbol version for __x86_get_cpu_features and can therefore only be made
> > > at a release boundary. Even then, statically linked libraries will
> > > silently use the old layout of struct cpu_features, silently giving
> > > incorrect results if linked against a newer glibc version.
> > >
> >
> > Here is the updated patch with:
> >
> > 1. Divide architecture features into the usable features and the preferred
> > features. The usable features are for correctness and can be exported in
> > a stable ABI. The preferred features are for performance and only for
> > glibc internal use.
> > 2. Change struct cpu_features to
> >
> > struct cpu_features
> > {
> > struct cpu_features_basic basic;
> > unsigned int usable[USABLE_FEATURE_INDEX_MAX];
> > struct cpuid_registers cpuid[COMMON_CPUID_INDEX_MAX];
> > unsigned int preferred[PREFERRED_FEATURE_INDEX_MAX];
> > ...
> > };
> >
> > so that
> >
> > struct cpu_features
> > {
> > struct cpu_features_basic basic;
> > unsigned int usable[USABLE_FEATURE_INDEX_MAX];
> > struct cpuid_registers cpuid[COMMON_CPUID_INDEX_MAX];
> > };
> >
> > can be exported via a stable ABI. Currently there are 70 unused bits in
> > the usable array. They should be sufficient for future use. The cpuid
> > array can be expanded with backward binary compatibility for both .o and
> > .so files.
> >
>
> I will check it in on Monday if there are no further comments:
>
> https://sourceware.org/pipermail/libc-alpha/2020-June/115171.html
>
> Thanks.
This is the updated patch I am checking in. It checks if PKU is usable.
--
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-x86-Update-CPU-feature-detection-BZ-26149.patch
Type: text/x-patch
Size: 45509 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20200622/6f6382a1/attachment-0001.bin>
More information about the Libc-alpha
mailing list