This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 6/8] tunables: Use glibc.tune.hwcap_mask tunable instead of _dl_hwcap_mask


On Thursday 11 May 2017 07:12 PM, Adhemerval Zanella wrote:
> On 10/05/2017 11:47, 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-cache.c: Include dl-tunables.h.
>> 	(_dl_load_cache_lookup)[HAVE_TUNABLES]: Read
>> 	glibc.tune.hwcap_mask.
>> 	* elf/dl-hwcaps.c: Include dl-tunables.h.
>> 	(_dl_important_hwcaps)[HAVE_TUNABLES]: Read and update
>> 	glibc.tune.hwcap_mask.
>> 	* sysdeps/sparc/sparc32/dl-machine.h: Likewise.
>> 	* elf/dl-support.c (_dl_hwcap2)[HAVE_TUNABLES]: Drop
>> 	_dl_hwcap_mask.
>> 	* elf/dl-tunables.c (__tunable_set_val): Make a hidden alias.
>> 	* elf/dl-tunables.h (__tunable_set_val): Likewise.
>> 	* 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.
> 
> This breaks x86 build with --enable-tunables:
> 
> In file included from ../sysdeps/x86_64/ldsodefs.h:54:0,
>                  from ../sysdeps/gnu/ldsodefs.h:46,
>                  from ../sysdeps/unix/sysv/linux/ldsodefs.h:25,
>                  from rtld.c:29:
> ../sysdeps/x86/cpu-features.c: In function ‘init_cpu_features’:
> ../sysdeps/generic/ldsodefs.h:451:36: error: ‘struct rtld_global_ro’ has no member named ‘_dl_hwcap_mask’; did you mean ‘_dl_debug_mask’?
>  #  define GLRO(name) _rtld_local_ro._##name
>                                     ^
> ../sysdeps/x86/cpu-features.c:319:3: note: in expansion of macro ‘GLRO’
>    GLRO(dl_hwcap_mask) = HWCAP_IMPORTANT;
>    ^~~~
> 
> I have tried an obvious patch:
> 
> diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
> index b481f50..51a6c20 100644
> --- a/sysdeps/x86/cpu-features.c
> +++ b/sysdeps/x86/cpu-features.c
> @@ -19,6 +19,7 @@
>  #include <cpuid.h>
>  #include <cpu-features.h>
>  #include <dl-hwcap.h>
> +#include <elf/dl-tunables.h>
>  
>  static void
>  get_common_indeces (struct cpu_features *cpu_features,
> @@ -316,7 +317,11 @@ no_cpuid:
>    /* Reuse dl_platform, dl_hwcap and dl_hwcap_mask for x86.  */
>    GLRO(dl_platform) = NULL;
>    GLRO(dl_hwcap) = 0;
> +#if HAVE_TUNABLES
> +  TUNABLE_UPDATE_VAL (glibc, tune, hwcap_mask, &(uint64_t){HWCAP_IMPORTANT});
> +#else
>    GLRO(dl_hwcap_mask) = HWCAP_IMPORTANT;
> +#endif
>  
>  # ifdef __x86_64__
>    if (cpu_features->kind == arch_kind_intel)
> 
> 
> But even though build succeeds, the elf/tst-env-setuid fails on x86_64 (still
> investigating why).

That's odd, I'm pretty sure I tested x86 before aarch64.  let me check too.

Thanks,
Siddhesh


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]