V4 [PATCH] x86: Add <sys/platform/x86.h>

Florian Weimer fweimer@redhat.com
Thu Sep 20 12:43:00 GMT 2018


* H. J. Lu:

> On Thu, Sep 20, 2018 at 4:41 AM, Florian Weimer <fweimer@redhat.com> wrote:
>> * H. J. Lu:
>>
>>> Add <sys/platform/x86.h> to provide an API to access x86 specific platform
>>> features.  It makes raw and derived CPUID information available to
>>> applications so that programmers can avoid complicated steps to retrieve
>>> the same information with CPUID instructions.
>>
>> Sorry, I still think that this patch semantically depends on delayed
>> IFUNC processing.
>>
>> Furthermore, I strongly prefer a simplified interface, like:
>>
>>   enum {
>>     X86_FEATURE_MMX,
>>     X86_FEATURE_SSE,
>>     X86_FEATURE_SSE2,
>>>>     X86_FEATURE_AVX512F,
>>>>   };
>>
>>   _Bool x86_feature_usable (int index) __attribute__ ((pure));
>>
>> Applications could then do something like this:
>>
>>   if (x86_feature_usable (X86_FEATURE_AVX512F))
>>     return &__matmul_avx512f;
>>
>> I don't think there is value in exposing the CPUID data directly.  If
>> programmers need it, they can use <cpuid.h> from GCC instead, without
>> needing to worry how glibc populates its data structures.
>>
>
> You have 2 concerns.  Which one is the primary concern?  Or
> are both blockers for you?

The design of the API is more important.

We can implement delayed IFUNC processing later to support this feature
(and others).

Thanks,
Florian



More information about the Libc-alpha mailing list