d304f5706a
Resolves: RHEL-21997
113 lines
5.1 KiB
Diff
113 lines
5.1 KiB
Diff
This downstream-only patch compensates for the missing backport of
|
|
commit 2d651eb9265d1366d7b9e881bfddd46db9c1ecc4 ("x86: Move
|
|
x86 processor cache info to cpu_features"). Without it,
|
|
ld.so --list-diagnostics prints values that have not been properly
|
|
initalized from CPUID data.
|
|
|
|
diff --git a/sysdeps/x86/cacheinfo.h b/sysdeps/x86/cacheinfo.h
|
|
index 10ebadd819d9efff..d8421fab83ab08ac 100644
|
|
--- a/sysdeps/x86/cacheinfo.h
|
|
+++ b/sysdeps/x86/cacheinfo.h
|
|
@@ -19,31 +19,42 @@
|
|
#include <assert.h>
|
|
#include <unistd.h>
|
|
|
|
+/* When building ld.so, do not export any of the variables. They are
|
|
+ only used for diagnostics and are not initialized during regular
|
|
+ operation. */
|
|
+#if IS_IN (rtld)
|
|
+# define CACHEINFO_VARIABLE(name, initializer) \
|
|
+ static long int name = initializer
|
|
+#else
|
|
+# define CACHEINFO_VARIABLE(name, initializer) \
|
|
+ long int name attribute_hidden = initializer
|
|
+#endif
|
|
+
|
|
/* Data cache size for use in memory and string routines, typically
|
|
L1 size, rounded to multiple of 256 bytes. */
|
|
-long int __x86_data_cache_size_half attribute_hidden = 32 * 1024 / 2;
|
|
-long int __x86_data_cache_size attribute_hidden = 32 * 1024;
|
|
+CACHEINFO_VARIABLE (__x86_data_cache_size_half, 32 * 1024 / 2);
|
|
+CACHEINFO_VARIABLE (__x86_data_cache_size, 32 * 1024);
|
|
/* Similar to __x86_data_cache_size_half, but not rounded. */
|
|
-long int __x86_raw_data_cache_size_half attribute_hidden = 32 * 1024 / 2;
|
|
+CACHEINFO_VARIABLE (__x86_raw_data_cache_size_half, 32 * 1024 / 2);
|
|
/* Similar to __x86_data_cache_size, but not rounded. */
|
|
-long int __x86_raw_data_cache_size attribute_hidden = 32 * 1024;
|
|
+CACHEINFO_VARIABLE (__x86_raw_data_cache_size, 32 * 1024);
|
|
/* Shared cache size for use in memory and string routines, typically
|
|
L2 or L3 size, rounded to multiple of 256 bytes. */
|
|
-long int __x86_shared_cache_size_half attribute_hidden = 1024 * 1024 / 2;
|
|
-long int __x86_shared_cache_size attribute_hidden = 1024 * 1024;
|
|
+CACHEINFO_VARIABLE (__x86_shared_cache_size_half, 1024 * 1024 / 2);
|
|
+CACHEINFO_VARIABLE (__x86_shared_cache_size, 1024 * 1024);
|
|
/* Similar to __x86_shared_cache_size_half, but not rounded. */
|
|
-long int __x86_raw_shared_cache_size_half attribute_hidden = 1024 * 1024 / 2;
|
|
+CACHEINFO_VARIABLE (__x86_raw_shared_cache_size_half, 1024 * 1024 / 2);
|
|
/* Similar to __x86_shared_cache_size, but not rounded. */
|
|
-long int __x86_raw_shared_cache_size attribute_hidden = 1024 * 1024;
|
|
+CACHEINFO_VARIABLE (__x86_raw_shared_cache_size, 1024 * 1024);
|
|
|
|
/* Threshold to use non temporal store. */
|
|
-long int __x86_shared_non_temporal_threshold attribute_hidden;
|
|
+CACHEINFO_VARIABLE (__x86_shared_non_temporal_threshold, 0);
|
|
|
|
/* Threshold to use Enhanced REP MOVSB. */
|
|
-long int __x86_rep_movsb_threshold attribute_hidden = 2048;
|
|
+CACHEINFO_VARIABLE (__x86_rep_movsb_threshold, 2048);
|
|
|
|
/* Threshold to use Enhanced REP STOSB. */
|
|
-long int __x86_rep_stosb_threshold attribute_hidden = 2048;
|
|
+CACHEINFO_VARIABLE (__x86_rep_stosb_threshold, 2048);
|
|
|
|
static void
|
|
get_common_cache_info (long int *shared_ptr, long int * shared_per_thread_ptr, unsigned int *threads_ptr,
|
|
diff --git a/sysdeps/x86/dl-diagnostics-cpu.c b/sysdeps/x86/dl-diagnostics-cpu.c
|
|
index 0ba286a828b69937..9215604ecf22344c 100644
|
|
--- a/sysdeps/x86/dl-diagnostics-cpu.c
|
|
+++ b/sysdeps/x86/dl-diagnostics-cpu.c
|
|
@@ -19,6 +19,13 @@
|
|
#include <dl-diagnostics.h>
|
|
#include <ldsodefs.h>
|
|
|
|
+#include <assert.h>
|
|
+#include <unistd.h>
|
|
+#include <cpu-features.h>
|
|
+#include <cpuid.h>
|
|
+#include <dl-cacheinfo.h>
|
|
+#include <cacheinfo.h>
|
|
+
|
|
static void
|
|
print_cpu_features_value (const char *label, uint64_t value)
|
|
{
|
|
@@ -81,19 +88,21 @@ _dl_diagnostics_cpu (void)
|
|
#include "cpu-features-preferred_feature_index_1.def"
|
|
#undef BIT
|
|
|
|
+ /* The cache information variables are only used for diagnostics and
|
|
+ are not initialized during startup. The values used at run time
|
|
+ are only in libc.so.6. */
|
|
+ init_cacheinfo ();
|
|
+
|
|
print_cpu_features_value ("xsave_state_size",
|
|
cpu_features->xsave_state_size);
|
|
print_cpu_features_value ("xsave_state_full_size",
|
|
cpu_features->xsave_state_full_size);
|
|
- print_cpu_features_value ("data_cache_size", cpu_features->data_cache_size);
|
|
- print_cpu_features_value ("shared_cache_size",
|
|
- cpu_features->shared_cache_size);
|
|
+ print_cpu_features_value ("data_cache_size", __x86_data_cache_size);
|
|
+ print_cpu_features_value ("shared_cache_size", __x86_shared_cache_size);
|
|
print_cpu_features_value ("non_temporal_threshold",
|
|
- cpu_features->non_temporal_threshold);
|
|
- print_cpu_features_value ("rep_movsb_threshold",
|
|
- cpu_features->rep_movsb_threshold);
|
|
- print_cpu_features_value ("rep_stosb_threshold",
|
|
- cpu_features->rep_stosb_threshold);
|
|
+ __x86_shared_non_temporal_threshold);
|
|
+ print_cpu_features_value ("rep_movsb_threshold", __x86_rep_movsb_threshold);
|
|
+ print_cpu_features_value ("rep_stosb_threshold", __x86_rep_stosb_threshold);
|
|
_Static_assert (offsetof (struct cpu_features, rep_stosb_threshold)
|
|
+ sizeof (cpu_features->rep_stosb_threshold)
|
|
== sizeof (*cpu_features),
|