]> sourceware.org Git - glibc.git/commitdiff
x86: Rename glibc.tune.ifunc to glibc.tune.hwcaps
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 21 Jun 2017 17:20:24 +0000 (10:20 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 21 Jun 2017 17:21:37 +0000 (10:21 -0700)
Rename glibc.tune.ifunc to glibc.tune.hwcaps and move it to
sysdeps/x86/dl-tunables.list since it is x86 specicifc.  Also
change type of data_cache_size, data_cache_size and
non_temporal_threshold to unsigned long int to match size_t.
Remove usage DEFAULT_STRLEN from cpu-tunables.c.

* elf/dl-tunables.list (glibc.tune.ifunc): Removed.
* sysdeps/x86/dl-tunables.list (glibc.tune.hwcaps): New.
Remove security_level on all fields.
* manual/tunables.texi: Replace ifunc with hwcaps.
* sysdeps/x86/cpu-features.c (TUNABLE_CALLBACK (set_ifunc)):
Renamed to ..
(TUNABLE_CALLBACK (set_hwcaps)): This.
(init_cpu_features): Updated.
* sysdeps/x86/cpu-features.h (cpu_features): Change type of
data_cache_size, data_cache_size and non_temporal_threshold to
unsigned long int.
* sysdeps/x86/cpu-tunables.c (DEFAULT_STRLEN): Removed.
(TUNABLE_CALLBACK (set_ifunc)): Renamed to ...
(TUNABLE_CALLBACK (set_hwcaps)): This.  Update comments.  Don't
use DEFAULT_STRLEN.

ChangeLog
elf/dl-tunables.list
manual/tunables.texi
sysdeps/x86/cpu-features.c
sysdeps/x86/cpu-features.h
sysdeps/x86/cpu-tunables.c
sysdeps/x86/dl-tunables.list

index 2d07c200fe374f155af22b6536b9cbbfc43075ef..a0d07fd13d8dcc59c6857e4252bac3fec671647a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2017-06-21  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elf/dl-tunables.list (glibc.tune.ifunc): Removed.
+       * sysdeps/x86/dl-tunables.list (glibc.tune.hwcaps): New.
+       Remove security_level on all fields.
+       * manual/tunables.texi: Replace ifunc with hwcaps.
+       * sysdeps/x86/cpu-features.c (TUNABLE_CALLBACK (set_ifunc)):
+       Renamed to ..
+       (TUNABLE_CALLBACK (set_hwcaps)): This.
+       (init_cpu_features): Updated.
+       * sysdeps/x86/cpu-features.h (cpu_features): Change type of
+       data_cache_size, data_cache_size and non_temporal_threshold to
+       unsigned long int.
+       * sysdeps/x86/cpu-tunables.c (DEFAULT_STRLEN): Removed.
+       (TUNABLE_CALLBACK (set_ifunc)): Renamed to ...
+       (TUNABLE_CALLBACK (set_hwcaps)): This.  Update comments.  Don't
+       use DEFAULT_STRLEN.
+
 2017-06-21  Florian Weimer  <fweimer@redhat.com>
 
        * intl/dcigettext.c (DCIGETTEXT): Use getcwd (NULL, 0) and
index b8b0ce565ce5e5265d58a9943e8c997110de77d9..df4f9622b4d89160205da0648249e7bccb087891 100644 (file)
@@ -83,9 +83,5 @@ glibc {
       env_alias: LD_HWCAP_MASK
       default: HWCAP_IMPORTANT
       }
-    ifunc {
-      type: STRING
-      security_level: SXID_IGNORE
-    }
   }
 }
index 3263f944c530f6dbfad2cd38c2c72a5f4d4d66fa..689e8941e748011fe9b98f0618f0b24a3420068e 100644 (file)
@@ -198,8 +198,8 @@ is 8 times the number of cores online.
 @cindex hardware capability tunables
 @cindex hwcap tunables
 @cindex tunables, hwcap
-@cindex ifunc tunables
-@cindex tunables, ifunc
+@cindex hwcaps tunables
+@cindex tunables, hwcaps
 @cindex data_cache_size tunables
 @cindex tunables, data_cache_size
 @cindex shared_cache_size tunables
@@ -222,8 +222,8 @@ extensions available in the processor at runtime for some architectures.  The
 capabilities at runtime, thus disabling use of those extensions.
 @end deftp
 
-@deftp Tunable glibc.tune.ifunc
-The @code{glibc.tune.ifunc=-xxx,yyy,-zzz...} tunable allows the user to
+@deftp Tunable glibc.tune.hwcaps
+The @code{glibc.tune.hwcaps=-xxx,yyy,-zzz...} tunable allows the user to
 enable CPU/ARCH feature @code{yyy}, disable CPU/ARCH feature @code{xxx}
 and @code{zzz} where the feature name is case-sensitive and has to match
 the ones in @code{sysdeps/x86/cpu-features.h}.
index 76f053af80b59e656867e0b5a1717f891e282de6..1d087ea732bb921b0abb2af462441d6853d9306f 100644 (file)
@@ -25,7 +25,7 @@
 # include <unistd.h>           /* Get STDOUT_FILENO for _dl_printf.  */
 # include <elf/dl-tunables.h>
 
-extern void TUNABLE_CALLBACK (set_ifunc) (tunable_val_t *)
+extern void TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *)
   attribute_hidden;
 #endif
 
@@ -322,7 +322,7 @@ no_cpuid:
   cpu_features->kind = kind;
 
 #if HAVE_TUNABLES
-  TUNABLE_GET (ifunc, tunable_val_t *, TUNABLE_CALLBACK (set_ifunc));
+  TUNABLE_GET (hwcaps, tunable_val_t *, TUNABLE_CALLBACK (set_hwcaps));
   cpu_features->non_temporal_threshold
     = TUNABLE_GET (x86_non_temporal_threshold, long int, NULL);
   cpu_features->data_cache_size
index fef5e1894f8990002e5b0fdd7b1d7d491da76f15..3ed67f580029c74dd19fc720745c6b37e604c4bc 100644 (file)
@@ -217,12 +217,12 @@ struct cpu_features
   unsigned int feature[FEATURE_INDEX_MAX];
   /* Data cache size for use in memory and string routines, typically
      L1 size.  */
-  long int data_cache_size;
+  unsigned long int data_cache_size;
   /* Shared cache size for use in memory and string routines, typically
      L2 or L3 size.  */
-  long int shared_cache_size;
+  unsigned long int shared_cache_size;
   /* Threshold to use non temporal store.  */
-  long int non_temporal_threshold;
+  unsigned long int non_temporal_threshold;
 };
 
 /* Used from outside of glibc to get access to the CPU features
index 9258fb41de1aca440b6eedfd896e36ad8c72d395..872dd1267f1cc4c2db3215d1e31dc376339653d8 100644 (file)
 # if defined USE_MULTIARCH && !defined SHARED
 #  ifdef __x86_64__
 #   define DEFAULT_MEMCMP      __memcmp_sse2
-#   define DEFAULT_STRLEN      __strlen_sse2
 #  else
 #   define DEFAULT_MEMCMP      __memcmp_ia32
-#   define DEFAULT_STRLEN      strlen
 #  endif
 extern __typeof (memcmp) DEFAULT_MEMCMP;
-extern __typeof (strlen) DEFAULT_STRLEN;
 # else
 #  define DEFAULT_MEMCMP       memcmp
-#  define DEFAULT_STRLEN       strlen
 # endif
 
 # define CHECK_GLIBC_IFUNC_CPU_OFF(f, cpu_features, name, len)         \
@@ -112,30 +108,27 @@ extern __typeof (strlen) DEFAULT_STRLEN;
 
 attribute_hidden
 void
-TUNABLE_CALLBACK (set_ifunc) (tunable_val_t *valp)
+TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp)
 {
   /* The current IFUNC selection is based on microbenchmarks in glibc.
      It should give the best performance for most workloads.  But other
      choices may have better performance for a particular workload or on
      the hardware which wasn't available when the selection was made.
-     The environment variable, GLIBC_IFUNC=-xxx,yyy,-zzz...., can be
-     used to enable CPU/ARCH feature yyy, disable CPU/ARCH feature yyy
-     and zzz, where the feature name is case-sensitive and has to match
-     the ones in cpu-features.h.  It can be used by glibc developers to
-     tune for a new processor or override the IFUNC selection to improve
-     performance for a particular workload.
+     The environment variable:
 
-     Since all CPU/ARCH features are hardware optimizations without
-     security implication, except for Prefer_MAP_32BIT_EXEC, which can
-     only be disabled, we check GLIBC_IFUNC for programs, including
-     set*id ones.
+     GLIBC_TUNABLES=glibc.tune.hwcaps=-xxx,yyy,-zzz,....
+
+     can be used to enable CPU/ARCH feature yyy, disable CPU/ARCH feature
+     yyy and zzz, where the feature name is case-sensitive and has to
+     match the ones in cpu-features.h.  It can be used by glibc developers
+     to tune for a new processor or override the IFUNC selection to
+     improve performance for a particular workload.
 
      NOTE: the IFUNC selection may change over time.  Please check all
      multiarch implementations when experimenting.  */
 
   const char *p = valp->strval;
   struct cpu_features *cpu_features = &GLRO(dl_x86_cpu_features);
-  const char *end = p + DEFAULT_STRLEN (p);
   size_t len;
 
   do
@@ -145,7 +138,7 @@ TUNABLE_CALLBACK (set_ifunc) (tunable_val_t *valp)
       size_t nl;
 
       for (c = p; *c != ','; c++)
-       if (c >= end)
+       if (*c == '\0')
          break;
 
       len = c - p;
@@ -325,6 +318,6 @@ TUNABLE_CALLBACK (set_ifunc) (tunable_val_t *valp)
        }
       p += len + 1;
     }
-  while (p < end);
+  while (*p != '\0');
 }
 #endif
index 50c130a4379c3c120ecdd1d391f8734777d7eda2..99a9cc42b11bf7f3632e7e361fe001769359f13c 100644 (file)
 
 glibc {
   tune {
+    hwcaps {
+      type: STRING
+    }
     x86_non_temporal_threshold {
       type: SIZE_T
-      security_level: SXID_IGNORE
     }
     x86_data_cache_size {
       type: SIZE_T
-      security_level: SXID_IGNORE
     }
     x86_shared_cache_size {
       type: SIZE_T
-      security_level: SXID_IGNORE
     }
   }
 }
This page took 0.248167 seconds and 5 git commands to generate.