This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 3/6] tunables: Use glibc.tune.hwcap_mask tunable instead of _dl_hwcap_mask
On 01/06/2017 17:12, Siddhesh Poyarekar wrote:
> Drop _dl_hwcap_mask when building with tunables. This completes the
> transition of hwcap_mask reading from _dl_hwcap_mask to tunables.
>
> * elf/dl-hwcaps.h: New file.
> * elf/dl-hwcaps.c: Include it.
> (_dl_important_hwcaps)[HAVE_TUNABLES]: Read and update
> glibc.tune.hwcap_mask.
> * elf/dl-cache.c: Include dl-hwcaps.h.
> (_dl_load_cache_lookup)[HAVE_TUNABLES]: Read
> glibc.tune.hwcap_mask.
> * sysdeps/sparc/sparc32/dl-machine.h: Likewise.
> * elf/dl-support.c (_dl_hwcap2)[HAVE_TUNABLES]: Drop
> _dl_hwcap_mask.
> * elf/rtld.c (rtld_global_ro)[HAVE_TUNABLES]: Drop
> _dl_hwcap_mask.
> (process_envvars)[HAVE_TUNABLES]: Likewise.
> * sysdeps/generic/ldsodefs.h (rtld_global_ro)[HAVE_TUNABLES]:
> Likewise.
> * sysdeps/x86/cpu-features.c (init_cpu_features): Don't
> initialize dl_hwcap_mask when tunables are enabled.
LGTM.
> diff --git a/elf/dl-hwcaps.c b/elf/dl-hwcaps.c
> @@ -125,7 +127,12 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
> LD_HWCAP_MASK environment variable (or default HWCAP_IMPORTANT).
> So there is no way to request ignoring an OS-supplied dsocap
> string and bit like you can ignore an OS-supplied HWCAP bit. */
> - GLRO(dl_hwcap_mask) |= (uint64_t) mask << _DL_FIRST_EXTRA;
> + hwcap_mask |= (uint64_t) mask << _DL_FIRST_EXTRA;
> +#if HAVE_TUNABLES
> + TUNABLE_SET (glibc, tune, hwcap_mask, uint64_t, hwcap_mask);
> +#else
> + GLRO(dl_hwcap_mask) = hwcap_mask;
> +#endif
I would add macro for both get/set, as for GET_HWCAP_MASK, but we can live with it.