This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch hjl/ld.so/master created. glibc-2.23-324-g4292da1
- From: hjl at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 14 May 2016 16:20:07 -0000
- Subject: GNU C Library master sources branch hjl/ld.so/master created. glibc-2.23-324-g4292da1
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, hjl/ld.so/master has been created
at 4292da19f08b9d5e804909232489622bee6a60e3 (commit)
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=4292da19f08b9d5e804909232489622bee6a60e3
commit 4292da19f08b9d5e804909232489622bee6a60e3
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue May 10 05:42:49 2016 -0700
X86: Add cache info to _dl_x86_cpu_features
This patch adds cache info to _dl_x86_cpu_features to allow a processor
to override cache info derived from CPUID.
Tested on x86 and x86-64.
* sysdeps/x86/cacheinfo.c: Skip if not in libc.
(init_cacheinfo): Use raw_data_size, raw_shared_size and
shared_non_temporal_threshold from _dl_x86_cpu_features if
not zero.
* sysdeps/x86/cpu-features.h (cache_info): New.
(cpu_features): Add cache.
diff --git a/sysdeps/x86/cacheinfo.c b/sysdeps/x86/cacheinfo.c
index 8408624..e00e19f 100644
--- a/sysdeps/x86/cacheinfo.c
+++ b/sysdeps/x86/cacheinfo.c
@@ -16,6 +16,8 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#if IS_IN (libc)
+
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
@@ -656,6 +658,11 @@ init_cacheinfo (void)
#endif
}
+ const struct cache_info *cache = &GLRO(dl_x86_cpu_features).cache;
+
+ if (cache->raw_data_size != 0)
+ data = cache->raw_data_size;
+
if (data > 0)
{
__x86_raw_data_cache_size_half = data / 2;
@@ -666,6 +673,9 @@ init_cacheinfo (void)
__x86_data_cache_size = data;
}
+ if (cache->raw_shared_size != 0)
+ shared = cache->raw_shared_size;
+
if (shared > 0)
{
__x86_raw_shared_cache_size_half = shared / 2;
@@ -679,5 +689,10 @@ init_cacheinfo (void)
/* The large memcpy micro benchmark in glibc shows that 6 times of
shared cache size is the approximate value above which non-temporal
store becomes faster. */
- __x86_shared_non_temporal_threshold = __x86_shared_cache_size * 6;
+ __x86_shared_non_temporal_threshold
+ = (cache->shared_non_temporal_threshold != 0
+ ? cache->shared_non_temporal_threshold
+ : __x86_shared_cache_size * 6);
}
+
+#endif
diff --git a/sysdeps/x86/cpu-features.h b/sysdeps/x86/cpu-features.h
index 9529d61..335d96a 100644
--- a/sysdeps/x86/cpu-features.h
+++ b/sysdeps/x86/cpu-features.h
@@ -164,6 +164,18 @@
#else /* __ASSEMBLER__ */
+struct cache_info
+{
+ /* Data cache size for use in memory and string routines, typically
+ L1 size. */
+ long int raw_data_size;
+ /* Shared cache size for use in memory and string routines, typically
+ L2 or L3 size. */
+ long int raw_shared_size;
+ /* Threshold to use non temporal store. */
+ long int shared_non_temporal_threshold;
+};
+
enum
{
COMMON_CPUID_INDEX_1 = 0,
@@ -193,6 +205,7 @@ struct cpu_features
unsigned int family;
unsigned int model;
unsigned int feature[FEATURE_INDEX_MAX];
+ struct cache_info cache;
};
/* Used from outside of glibc to get access to the CPU features
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1fa001e37c3c62748b5ab00c30f9f3f0c7209286
commit 1fa001e37c3c62748b5ab00c30f9f3f0c7209286
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue May 10 05:17:15 2016 -0700
Add sysdeps/x86/dl-procinfo.c
linux/x86_64/dl-procinfo.[ch] includes i386 dl-procinfo.[ch] when
building ldconfig since sysdeps/x86_64/dl-procinfo.c doesn't support
ldconfig. Add sysdeps/x86/dl-procinfo.c to support ldconfig. This
also removes the unnecessary _dl_procinfo from x86-64 ldconfig. No
code changes in i686. No code changes in x86-64 libc.so and libc.a.
* sysdeps/i386/dl-procinfo.c (_SYSDEPS_DL_PROCINFO_C): New.
(_dl_x86_cpu_features): Removed.
Include <sysdeps/x86/dl-procinfo.c>.
* sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c: Removed.
* sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h: Likewise.
* sysdeps/x86/dl-procinfo.c: New file.
* sysdeps/x86_64//dl-procinfo.c (_SYSDEPS_DL_PROCINFO_C): New.
(_dl_x86_cpu_features): Removed.
Include <sysdeps/x86/dl-procinfo.c>.
diff --git a/sysdeps/i386/dl-procinfo.c b/sysdeps/i386/dl-procinfo.c
index ffa6b9d..b9f4b09 100644
--- a/sysdeps/i386/dl-procinfo.c
+++ b/sysdeps/i386/dl-procinfo.c
@@ -39,25 +39,13 @@
needed.
*/
+#define _SYSDEPS_DL_PROCINFO_C
+
#ifndef PROCINFO_CLASS
# define PROCINFO_CLASS
#endif
-#if !IS_IN (ldconfig)
-# if !defined PROCINFO_DECL && defined SHARED
- ._dl_x86_cpu_features
-# else
-PROCINFO_CLASS struct cpu_features _dl_x86_cpu_features
-# endif
-# ifndef PROCINFO_DECL
-= { }
-# endif
-# if !defined SHARED || defined PROCINFO_DECL
-;
-# else
-,
-# endif
-#endif
+#include <sysdeps/x86/dl-procinfo.c>
#if !defined PROCINFO_DECL && defined SHARED
._dl_x86_cap_flags
diff --git a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c b/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c
deleted file mode 100644
index a3c0c19..0000000
--- a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#if IS_IN (ldconfig)
-# include <sysdeps/i386/dl-procinfo.c>
-#else
-# include <sysdeps/x86_64/dl-procinfo.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h b/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h
deleted file mode 100644
index 7829e1c..0000000
--- a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#if IS_IN (ldconfig)
-# include <sysdeps/unix/sysv/linux/i386/dl-procinfo.h>
-#else
-# include <sysdeps/generic/dl-procinfo.h>
-#endif
diff --git a/sysdeps/x86_64/dl-procinfo.c b/sysdeps/x86/dl-procinfo.c
similarity index 79%
copy from sysdeps/x86_64/dl-procinfo.c
copy to sysdeps/x86/dl-procinfo.c
index 4625695..6e0d09c 100644
--- a/sysdeps/x86_64/dl-procinfo.c
+++ b/sysdeps/x86/dl-procinfo.c
@@ -1,5 +1,5 @@
-/* Data for x86-64 version of processor capability information.
- Copyright (C) 2015-2016 Free Software Foundation, Inc.
+/* Data for x86 version of processor capability information.
+ Copyright (C) 2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,6 +16,10 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#ifndef _SYSDEPS_DL_PROCINFO_C
+# error "Never include sysdeps/x86/dl-procinfo.c directly."
+#endif
+
/* If anything should be added here check whether the size of each string
is still ok with the given array size.
@@ -35,23 +39,18 @@
needed.
*/
-#ifndef PROCINFO_CLASS
-# define PROCINFO_CLASS
-#endif
-
-#if !defined PROCINFO_DECL && defined SHARED
+#if !IS_IN (ldconfig)
+# if !defined PROCINFO_DECL && defined SHARED
._dl_x86_cpu_features
-#else
+# else
PROCINFO_CLASS struct cpu_features _dl_x86_cpu_features
-#endif
-#ifndef PROCINFO_DECL
+# endif
+# ifndef PROCINFO_DECL
= { }
-#endif
-#if !defined SHARED || defined PROCINFO_DECL
+# endif
+# if !defined SHARED || defined PROCINFO_DECL
;
-#else
+# else
,
+# endif
#endif
-
-#undef PROCINFO_DECL
-#undef PROCINFO_CLASS
diff --git a/sysdeps/x86_64/dl-procinfo.c b/sysdeps/x86_64/dl-procinfo.c
index 4625695..42ebf7f 100644
--- a/sysdeps/x86_64/dl-procinfo.c
+++ b/sysdeps/x86_64/dl-procinfo.c
@@ -35,23 +35,13 @@
needed.
*/
+#define _SYSDEPS_DL_PROCINFO_C
+
#ifndef PROCINFO_CLASS
# define PROCINFO_CLASS
#endif
-#if !defined PROCINFO_DECL && defined SHARED
- ._dl_x86_cpu_features
-#else
-PROCINFO_CLASS struct cpu_features _dl_x86_cpu_features
-#endif
-#ifndef PROCINFO_DECL
-= { }
-#endif
-#if !defined SHARED || defined PROCINFO_DECL
-;
-#else
-,
-#endif
+#include <sysdeps/x86/dl-procinfo.c>
#undef PROCINFO_DECL
#undef PROCINFO_CLASS
-----------------------------------------------------------------------
hooks/post-receive
--
GNU C Library master sources