aarch64: add HWCAP_ATOMICS to HWCAP_IMPORTANT

Adhemerval Zanella adhemerval.zanella@linaro.org
Thu Apr 19 14:38:00 GMT 2018



On 19/04/2018 08:51, Szabolcs Nagy wrote:
> This enables searching shared libraries in atomics/ when the hardware
> supports LSE atomics of armv8.1 so one can provide optimized variants
> of libraries in a portable way.
> 
> LSE atomics does not affect library abi, the new instructions can
> interoperate with old ones.
> 
> I'm not familiar with how this feature of the dynamic linker is used
> in practice by distros or others so comments are welcome.

Clearlinux seems to use this to provide optimized Intel libraries [1].

> 
> 2018-04-19  Szabolcs Nagy  <szabolcs.nagy@arm.com>
> 
>     * sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h (HWCAP_IMPORTANT): Add
>     HWCAP_ATOMICS.

I think what you want is something what x86_64 has done [2]: on cpu-features.c
the code creates a list of possible processor specific paths and sets it do
GLRO(dl_platform) (for instance on x86_64 if the underlying system is a haswell
it will add the haswell folder path).

Currently since AArch64 do not change dl_platform_init, it adds 'aarch64' from
AT_PLATFORM and 'cpuid' because of HWCAP_IMPORTANT.  IMHO neither does make
sense as search paths, I would expect at least the 'cpu_list' from aarch 
cpu-features.c (maybe by excluding the 'generic' field).

So I suggest to rework how aarch64 obtain the search path by setting the
dl_platform in cpu-features.c:

  - We can get the cpu_list if HWCAP_CPUID, so add only current cpu folder
    if it the case.

  - If HWCAP_ATOMICS is set add 'lse'.

  - Any more required?

[1] https://clearlinux.org/blogs/transparent-use-library-packages-optimized-intel-architecture
[2] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=1432d38ea04ab5e96f21a38;hp=3b5f801ddb838311b5b05c218caac3bdb00d7c95



More information about the Libc-alpha mailing list