public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org
Subject: Re: [PATCH 5/7] tunables: Use glibc.tune.hwcap_mask tunable instead of _dl_hwcap_mask
Date: Wed, 17 May 2017 15:29:00 -0000	[thread overview]
Message-ID: <6b4bb6a1-6220-22b7-8235-5b11c31e8ffc@linaro.org> (raw)
In-Reply-To: <1494514306-4167-6-git-send-email-siddhesh@sourceware.org>



On 11/05/2017 11:51, 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.
> 	* sysdeps/x86/cpu-features.c (init_cpu_features): Don't
> 	initialize dl_hwcap_mask when tunables are enabled.

I would recommend to incorporate the fix for LD_HWCAP_MASK on tst-end-setuid
you sent before [1] to avoid this fail on some configuration (mine for
instance).  Also I think we should open a bugzilla to iron out the
elf/dl-hwcaps.c allocation scheme which is triggering this issue.

[1] https://sourceware.org/ml/libc-alpha/2017-05/msg00340.html


> diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
> index f26a8b2..695ac24 100644
> --- a/sysdeps/generic/ldsodefs.h
> +++ b/sysdeps/generic/ldsodefs.h
> @@ -515,8 +515,10 @@ struct rtld_global_ro
>    /* Mask for hardware capabilities that are available.  */
>    EXTERN uint64_t _dl_hwcap;
>  
> +#if !HAVE_TUNABLES
>    /* Mask for important hardware capabilities we honour. */
>    EXTERN uint64_t _dl_hwcap_mask;
> +#endif
>  
>  #ifdef HAVE_AUX_VECTOR
>    /* Pointer to the auxv list supplied to the program at startup.  */
> diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
> index cf7272f..6923e47 100644
> --- a/sysdeps/sparc/sparc32/dl-machine.h
> +++ b/sysdeps/sparc/sparc32/dl-machine.h
> @@ -39,7 +39,12 @@ elf_machine_matches_host (const Elf32_Ehdr *ehdr)
>        /* XXX The following is wrong!  Dave Miller rejected to implement it
>  	 correctly.  If this causes problems shoot *him*!  */
>  #ifdef SHARED
> -      return GLRO(dl_hwcap) & GLRO(dl_hwcap_mask) & HWCAP_SPARC_V9;
> +# if HAVE_TUNABLES
> +      uint64_t hwcap_mask = TUNABLE_GET (glibc, tune, hwcap_mask);

You are missing '#include <elf/dl-tunables.h>' and the final type argument for
TUNABLE_GET (it fails to build for sparcv9 with tunable enabled).

> +# else
> +      uint64_t hwcap_mask = GLRO(dl_hwcap_mask);
> +# endif
> +      return GLRO(dl_hwcap) & hwcap_mask & HWCAP_SPARC_V9;
>  #else
>        return GLRO(dl_hwcap) & HWCAP_SPARC_V9;
>  #endif
> diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
> index b481f50..4fe58bf 100644
> --- a/sysdeps/x86/cpu-features.c
> +++ b/sysdeps/x86/cpu-features.c
> @@ -316,7 +316,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
> +  /* The glibc.tune.hwcap_mask tunable is initialized already, so no need to do
> +     this.  */
>    GLRO(dl_hwcap_mask) = HWCAP_IMPORTANT;
> +#endif
>  
>  # ifdef __x86_64__
>    if (cpu_features->kind == arch_kind_intel)
> 

  parent reply	other threads:[~2017-05-17 15:29 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-11 14:51 [PATCH v1.1 0/7] aarch64: Allow overriding HWCAP_CPUID feature check Siddhesh Poyarekar
2017-05-11 14:52 ` [PATCH 1/7] tunables: Specify a default value for tunables Siddhesh Poyarekar
2017-05-15 21:13   ` Adhemerval Zanella
2017-05-15 21:55     ` Adhemerval Zanella
2017-05-11 14:52 ` [PATCH 3/7] tunables: Add hooks to get and update tunables Siddhesh Poyarekar
2017-05-16 20:30   ` Adhemerval Zanella
2017-05-17  7:17     ` Siddhesh Poyarekar
2017-05-17 13:53       ` Adhemerval Zanella
2017-05-11 14:52 ` [PATCH 5/7] tunables: Use glibc.tune.hwcap_mask tunable instead of _dl_hwcap_mask Siddhesh Poyarekar
2017-05-17 15:29   ` Adhemerval Zanella
2017-05-17 15:29   ` Adhemerval Zanella [this message]
2017-05-18 20:20     ` Siddhesh Poyarekar
2017-05-11 14:52 ` [PATCH 2/7] tunables: Add support for tunables of uint64_t type Siddhesh Poyarekar
2017-05-15 22:09   ` Adhemerval Zanella
2017-05-17  7:07     ` Siddhesh Poyarekar
2017-05-17 13:49       ` Adhemerval Zanella
2017-05-11 14:52 ` [PATCH 6/7] Delay initialization of CPU features struct in static binaries Siddhesh Poyarekar
2017-05-17 19:20   ` Adhemerval Zanella
2017-05-11 14:52 ` [PATCH 7/7] aarch64: Allow overriding HWCAP_CPUID feature check using HWCAP_MASK Siddhesh Poyarekar
2017-05-17 19:22   ` Adhemerval Zanella
2017-05-18 20:44     ` Siddhesh Poyarekar
2017-05-11 14:52 ` [PATCH 4/7] tunables: Add LD_HWCAP_MASK to tunables Siddhesh Poyarekar
2017-05-16 20:35   ` Adhemerval Zanella
2017-05-17  7:18     ` Siddhesh Poyarekar
2017-05-17  9:44       ` Siddhesh Poyarekar
2017-05-17 13:53         ` Adhemerval Zanella
2017-05-11 15:38 ` [PATCH v1.1 0/7] aarch64: Allow overriding HWCAP_CPUID feature check Adhemerval Zanella
2017-05-11 16:49   ` Siddhesh Poyarekar
2017-05-12 12:10     ` Szabolcs Nagy
2017-05-12 13:44       ` Siddhesh Poyarekar
2017-05-12 13:55         ` Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b4bb6a1-6220-22b7-8235-5b11c31e8ffc@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).