]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
aarch64: Remove HWCAP_CPUID from HWCAP_IMPORTANT
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Thu, 28 Jun 2018 13:43:07 +0000 (14:43 +0100)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Fri, 6 Jul 2018 14:57:18 +0000 (15:57 +0100)
This partially reverts

commit f82e9672ad89ea1ef40bbe1af71478e255e87c5e
Author:     Siddhesh Poyarekar <siddhesh@sourceware.org>

    aarch64: Allow overriding HWCAP_CPUID feature check using HWCAP_MASK

The idea was to make it possible to disable cpuid based ifunc resolution
in glibc by changing the hwcap mask which the user could already control.

However the hwcap mask has an orthogonal role: it specifies additional
library search paths for the dynamic linker.  So "cpuid" got added to
the search paths when it was set in the default mask (HWCAP_IMPORTANT),
which is not useful behaviour, the hwcap masking should not be reused
in the cpu features code.

Meanwhile there is a tunable to set the cpu explicitly so it is possible
to disable the cpuid based dispatch without using a hwcap mask:

  GLIBC_TUNABLES=glibc.tune.cpu=generic

* sysdeps/unix/sysv/linux/aarch64/cpu-features.c (init_cpu_features):
Use dl_hwcap without masking.
* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h (HWCAP_IMPORTANT):
Remove HWCAP_CPUID.

ChangeLog
sysdeps/unix/sysv/linux/aarch64/cpu-features.c
sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h

index 13c729325313686dadb717d785daab49645515ba..9cb3ddab0353a707709f8919c9e8f46eb9fbc395 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2018-07-06  Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+       * sysdeps/unix/sysv/linux/aarch64/cpu-features.c (init_cpu_features):
+       Use dl_hwcap without masking.
+       * sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h (HWCAP_IMPORTANT):
+       Remove HWCAP_CPUID.
+
 2018-07-06  Florian Weimer  <fweimer@redhat.com>
 
        * conform/conformtest.pl (checknamespace): Escape literal braces
index 203f839408b134af8b556e30b2098baee43ebce6..39eba0186f55b5de72c325d26a58dda32cce8330 100644 (file)
@@ -53,9 +53,6 @@ get_midr_from_mcpu (const char *mcpu)
 static inline void
 init_cpu_features (struct cpu_features *cpu_features)
 {
-  uint64_t hwcap_mask = GET_HWCAP_MASK();
-  uint64_t hwcap = GLRO (dl_hwcap) & hwcap_mask;
-
   register uint64_t midr = UINT64_MAX;
 
 #if HAVE_TUNABLES
@@ -69,7 +66,7 @@ init_cpu_features (struct cpu_features *cpu_features)
      allows it.  */
   if (midr == UINT64_MAX)
     {
-      if (hwcap & HWCAP_CPUID)
+      if (GLRO (dl_hwcap) & HWCAP_CPUID)
        asm volatile ("mrs %0, midr_el1" : "=r"(midr));
       else
        midr = 0;
index 68877131492267a3aac24282bfbe97132bae9fef..c0dcce15a26d7146fff285f78bf131eab5f722ae 100644 (file)
@@ -27,9 +27,8 @@
 /* We cannot provide a general printing function.  */
 #define _dl_procinfo(type, word) -1
 
-/* HWCAP_CPUID should be available by default to influence IFUNC as well as
-   library search.  */
-#define HWCAP_IMPORTANT HWCAP_CPUID
+/* No additional library search paths.  */
+#define HWCAP_IMPORTANT 0
 
 static inline const char *
 __attribute__ ((unused))