summary refs log tree commit diff
path: root/sysdeps/x86/cpu-tunables.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-06-21 10:20:24 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-06-21 10:21:37 -0700
commit03feacb562650cc3d51e9e76cd97e80e648aad84 (patch)
tree48c97491d0be07b74c3ed358f82661577d9de4a7 /sysdeps/x86/cpu-tunables.c
parent9695dd0c9309712ed8e9c17a7040fe7af347f2dc (diff)
downloadglibc-03feacb562650cc3d51e9e76cd97e80e648aad84.tar.gz
glibc-03feacb562650cc3d51e9e76cd97e80e648aad84.tar.xz
glibc-03feacb562650cc3d51e9e76cd97e80e648aad84.zip
x86: Rename glibc.tune.ifunc to glibc.tune.hwcaps
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.
Diffstat (limited to 'sysdeps/x86/cpu-tunables.c')
-rw-r--r--sysdeps/x86/cpu-tunables.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/sysdeps/x86/cpu-tunables.c b/sysdeps/x86/cpu-tunables.c
index 9258fb41de..872dd1267f 100644
--- a/sysdeps/x86/cpu-tunables.c
+++ b/sysdeps/x86/cpu-tunables.c
@@ -31,16 +31,12 @@
 # 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