* [PATCH 1/2] x86: Automate generation of PREFERRED_FEATURE_INDEX_1 bitfield
@ 2021-03-02 14:23 Florian Weimer
2021-03-02 14:32 ` [PATCH v3 2/2] x86: Add CPU-specific diagnostics to ld.so --list-diagnostics Florian Weimer
2021-03-02 14:33 ` [PATCH 1/2] x86: Automate generation of PREFERRED_FEATURE_INDEX_1 bitfield H.J. Lu
0 siblings, 2 replies; 4+ messages in thread
From: Florian Weimer @ 2021-03-02 14:23 UTC (permalink / raw)
To: libc-alpha
Use a .def file to define the bitfield layout, so that it is possible
to iterate over field members using the preprocessor.
---
.../cpu-features-preferred_feature_index_1.def | 34 +++++++++++++++
sysdeps/x86/include/cpu-features.h | 51 ++++++++--------------
2 files changed, 51 insertions(+), 34 deletions(-)
diff --git a/sysdeps/x86/include/cpu-features-preferred_feature_index_1.def b/sysdeps/x86/include/cpu-features-preferred_feature_index_1.def
new file mode 100644
index 0000000000..06af1a8dd5
--- /dev/null
+++ b/sysdeps/x86/include/cpu-features-preferred_feature_index_1.def
@@ -0,0 +1,34 @@
+/* Bits in the PREFERRED_FEATURE_INDEX_1 bitfield of <cpu-features.h>.
+ Copyright (C) 2020-2021 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+BIT (Fast_Rep_String)
+BIT (Fast_Copy_Backward)
+BIT (Slow_BSF)
+BIT (Fast_Unaligned_Load)
+BIT (Prefer_PMINUB_for_stringop)
+BIT (Fast_Unaligned_Copy)
+BIT (I586)
+BIT (I686)
+BIT (Slow_SSE4_2)
+BIT (AVX_Fast_Unaligned_Load)
+BIT (Prefer_MAP_32BIT_EXEC)
+BIT (Prefer_No_VZEROUPPER)
+BIT (Prefer_ERMS)
+BIT (Prefer_No_AVX512)
+BIT (MathVec_Prefer_No_AVX512)
+BIT (Prefer_FSRM)
diff --git a/sysdeps/x86/include/cpu-features.h b/sysdeps/x86/include/cpu-features.h
index ae5cb24be5..0fb988ead0 100644
--- a/sysdeps/x86/include/cpu-features.h
+++ b/sysdeps/x86/include/cpu-features.h
@@ -772,40 +772,23 @@ enum
/* EBX. */
#define reg_PTWRITE ebx
-/* PREFERRED_FEATURE_INDEX_1. */
-#define bit_arch_I586 (1u << 0)
-#define bit_arch_I686 (1u << 1)
-#define bit_arch_Fast_Rep_String (1u << 2)
-#define bit_arch_Fast_Copy_Backward (1u << 3)
-#define bit_arch_Fast_Unaligned_Load (1u << 4)
-#define bit_arch_Fast_Unaligned_Copy (1u << 5)
-#define bit_arch_Slow_BSF (1u << 6)
-#define bit_arch_Slow_SSE4_2 (1u << 7)
-#define bit_arch_AVX_Fast_Unaligned_Load (1u << 8)
-#define bit_arch_Prefer_MAP_32BIT_EXEC (1u << 9)
-#define bit_arch_Prefer_PMINUB_for_stringop (1u << 10)
-#define bit_arch_Prefer_No_VZEROUPPER (1u << 11)
-#define bit_arch_Prefer_ERMS (1u << 12)
-#define bit_arch_Prefer_FSRM (1u << 13)
-#define bit_arch_Prefer_No_AVX512 (1u << 14)
-#define bit_arch_MathVec_Prefer_No_AVX512 (1u << 15)
-
-#define index_arch_Fast_Rep_String PREFERRED_FEATURE_INDEX_1
-#define index_arch_Fast_Copy_Backward PREFERRED_FEATURE_INDEX_1
-#define index_arch_Slow_BSF PREFERRED_FEATURE_INDEX_1
-#define index_arch_Fast_Unaligned_Load PREFERRED_FEATURE_INDEX_1
-#define index_arch_Prefer_PMINUB_for_stringop PREFERRED_FEATURE_INDEX_1
-#define index_arch_Fast_Unaligned_Copy PREFERRED_FEATURE_INDEX_1
-#define index_arch_I586 PREFERRED_FEATURE_INDEX_1
-#define index_arch_I686 PREFERRED_FEATURE_INDEX_1
-#define index_arch_Slow_SSE4_2 PREFERRED_FEATURE_INDEX_1
-#define index_arch_AVX_Fast_Unaligned_Load PREFERRED_FEATURE_INDEX_1
-#define index_arch_Prefer_MAP_32BIT_EXEC PREFERRED_FEATURE_INDEX_1
-#define index_arch_Prefer_No_VZEROUPPER PREFERRED_FEATURE_INDEX_1
-#define index_arch_Prefer_ERMS PREFERRED_FEATURE_INDEX_1
-#define index_arch_Prefer_No_AVX512 PREFERRED_FEATURE_INDEX_1
-#define index_arch_MathVec_Prefer_No_AVX512 PREFERRED_FEATURE_INDEX_1
-#define index_arch_Prefer_FSRM PREFERRED_FEATURE_INDEX_1
+/* PREFERRED_FEATURE_INDEX_1. First define the bitindex values
+ sequentially, then define the bit_arch* and index_arch_* lookup
+ constants. */
+enum
+ {
+#define BIT(x) _bitindex_arch_##x ,
+#include "cpu-features-preferred_feature_index_1.def"
+#undef BIT
+ };
+enum
+ {
+#define BIT(x) \
+ bit_arch_##x = 1u << _bitindex_arch_##x , \
+ index_arch_##x = PREFERRED_FEATURE_INDEX_1,
+#include "cpu-features-preferred_feature_index_1.def"
+#undef BIT
+ };
/* XCR0 Feature flags. */
#define bit_XMM_state (1u << 1)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v3 2/2] x86: Add CPU-specific diagnostics to ld.so --list-diagnostics
2021-03-02 14:23 [PATCH 1/2] x86: Automate generation of PREFERRED_FEATURE_INDEX_1 bitfield Florian Weimer
@ 2021-03-02 14:32 ` Florian Weimer
2021-03-02 14:34 ` H.J. Lu
2021-03-02 14:33 ` [PATCH 1/2] x86: Automate generation of PREFERRED_FEATURE_INDEX_1 bitfield H.J. Lu
1 sibling, 1 reply; 4+ messages in thread
From: Florian Weimer @ 2021-03-02 14:32 UTC (permalink / raw)
To: libc-alpha
---
v2: Adjustments to generic changes. Add comments to cpu-features.h
pointing towards the diagnostics printer.
v3: Use the new bit iterator. Add _static_assert.
sysdeps/x86/dl-diagnostics-cpu.c | 118 +++++++++++++++++++++++++++++++++++++
sysdeps/x86/include/cpu-features.h | 2 +
2 files changed, 120 insertions(+)
diff --git a/sysdeps/x86/dl-diagnostics-cpu.c b/sysdeps/x86/dl-diagnostics-cpu.c
new file mode 100644
index 0000000000..5d9713f8d9
--- /dev/null
+++ b/sysdeps/x86/dl-diagnostics-cpu.c
@@ -0,0 +1,118 @@
+/* Print CPU diagnostics data in ld.so. x86 version.
+ Copyright (C) 2021 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <dl-diagnostics.h>
+#include <ldsodefs.h>
+
+static void
+print_cpu_features_value (const char *label, uint64_t value)
+{
+ _dl_printf ("x86.cpu_features.");
+ _dl_diagnostics_print_labeled_value (label, value);
+}
+
+static void
+print_cpu_feature_internal (unsigned int index, const char *kind,
+ unsigned int reg, uint32_t value)
+{
+ _dl_printf ("x86.cpu_features.features[0x%x].%s[0x%x]=0x%x\n",
+ index, kind, reg, value);
+}
+
+static void
+print_cpu_feature_preferred (const char *label, unsigned int flag)
+{
+ _dl_printf("x86.cpu_features.preferred.%s=0x%x\n", label, flag);
+}
+
+void
+_dl_diagnostics_cpu (void)
+{
+ const struct cpu_features *cpu_features = __get_cpu_features ();
+
+ print_cpu_features_value ("basic.kind", cpu_features->basic.kind);
+ print_cpu_features_value ("basic.max_cpuid", cpu_features->basic.max_cpuid);
+ print_cpu_features_value ("basic.family", cpu_features->basic.family);
+ print_cpu_features_value ("basic.model", cpu_features->basic.model);
+ print_cpu_features_value ("basic.stepping", cpu_features->basic.stepping);
+
+ for (unsigned int index = 0; index < CPUID_INDEX_MAX; ++index)
+ {
+ /* The index values are part of the ABI via
+ <sys/platform/x86.h>, so translating them to strings is not
+ necessary. */
+ for (unsigned int reg = 0; reg < 4; ++reg)
+ print_cpu_feature_internal
+ (index, "cpuid", reg,
+ cpu_features->features[index].cpuid_array[reg]);
+ for (unsigned int reg = 0; reg < 4; ++reg)
+ print_cpu_feature_internal
+ (index, "usable", reg,
+ cpu_features->features[index].usable_array[reg]);
+ }
+
+ /* The preferred indicators are not part of the ABI and need to be
+ translated. */
+#define BIT(x) \
+ print_cpu_feature_preferred (#x, CPU_FEATURE_PREFERRED_P (cpu_features, x));
+#include "cpu-features-preferred_feature_index_1.def"
+#undef BIT
+
+ print_cpu_features_value ("isa_1", cpu_features->isa_1);
+ 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 ("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_movsb_stop_threshold",
+ cpu_features->rep_movsb_stop_threshold);
+ print_cpu_features_value ("rep_stosb_threshold",
+ cpu_features->rep_stosb_threshold);
+ print_cpu_features_value ("level1_icache_size",
+ cpu_features->level1_icache_size);
+ print_cpu_features_value ("level1_dcache_size",
+ cpu_features->level1_dcache_size);
+ print_cpu_features_value ("level1_dcache_assoc",
+ cpu_features->level1_dcache_assoc);
+ print_cpu_features_value ("level1_dcache_linesize",
+ cpu_features->level1_dcache_linesize);
+ print_cpu_features_value ("level2_cache_size",
+ cpu_features->level2_cache_size);
+ print_cpu_features_value ("level2_cache_assoc",
+ cpu_features->level2_cache_assoc);
+ print_cpu_features_value ("level2_cache_linesize",
+ cpu_features->level2_cache_linesize);
+ print_cpu_features_value ("level3_cache_size",
+ cpu_features->level3_cache_size);
+ print_cpu_features_value ("level3_cache_assoc",
+ cpu_features->level3_cache_assoc);
+ print_cpu_features_value ("level3_cache_linesize",
+ cpu_features->level3_cache_linesize);
+ print_cpu_features_value ("level4_cache_size",
+ cpu_features->level4_cache_size);
+ _Static_assert (offsetof (struct cpu_features, level4_cache_size)
+ + sizeof (cpu_features->level4_cache_size)
+ == sizeof (*cpu_features),
+ "last cpu_features field has been printed");
+}
diff --git a/sysdeps/x86/include/cpu-features.h b/sysdeps/x86/include/cpu-features.h
index 0fb988ead0..c5a779ba32 100644
--- a/sysdeps/x86/include/cpu-features.h
+++ b/sysdeps/x86/include/cpu-features.h
@@ -839,6 +839,8 @@ struct cpuid_feature_internal
};
};
+/* NB: When adding new fields, update sysdeps/x86/dl-diagnostics-cpu.c
+ to print them. */
struct cpu_features
{
struct cpu_features_basic basic;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] x86: Automate generation of PREFERRED_FEATURE_INDEX_1 bitfield
2021-03-02 14:23 [PATCH 1/2] x86: Automate generation of PREFERRED_FEATURE_INDEX_1 bitfield Florian Weimer
2021-03-02 14:32 ` [PATCH v3 2/2] x86: Add CPU-specific diagnostics to ld.so --list-diagnostics Florian Weimer
@ 2021-03-02 14:33 ` H.J. Lu
1 sibling, 0 replies; 4+ messages in thread
From: H.J. Lu @ 2021-03-02 14:33 UTC (permalink / raw)
To: Florian Weimer; +Cc: GNU C Library
On Tue, Mar 2, 2021 at 6:23 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> Use a .def file to define the bitfield layout, so that it is possible
> to iterate over field members using the preprocessor.
>
> ---
> .../cpu-features-preferred_feature_index_1.def | 34 +++++++++++++++
> sysdeps/x86/include/cpu-features.h | 51 ++++++++--------------
> 2 files changed, 51 insertions(+), 34 deletions(-)
>
> diff --git a/sysdeps/x86/include/cpu-features-preferred_feature_index_1.def b/sysdeps/x86/include/cpu-features-preferred_feature_index_1.def
> new file mode 100644
> index 0000000000..06af1a8dd5
> --- /dev/null
> +++ b/sysdeps/x86/include/cpu-features-preferred_feature_index_1.def
> @@ -0,0 +1,34 @@
> +/* Bits in the PREFERRED_FEATURE_INDEX_1 bitfield of <cpu-features.h>.
> + Copyright (C) 2020-2021 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
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <https://www.gnu.org/licenses/>. */
> +
> +BIT (Fast_Rep_String)
> +BIT (Fast_Copy_Backward)
> +BIT (Slow_BSF)
> +BIT (Fast_Unaligned_Load)
> +BIT (Prefer_PMINUB_for_stringop)
> +BIT (Fast_Unaligned_Copy)
> +BIT (I586)
> +BIT (I686)
> +BIT (Slow_SSE4_2)
> +BIT (AVX_Fast_Unaligned_Load)
> +BIT (Prefer_MAP_32BIT_EXEC)
> +BIT (Prefer_No_VZEROUPPER)
> +BIT (Prefer_ERMS)
> +BIT (Prefer_No_AVX512)
> +BIT (MathVec_Prefer_No_AVX512)
> +BIT (Prefer_FSRM)
> diff --git a/sysdeps/x86/include/cpu-features.h b/sysdeps/x86/include/cpu-features.h
> index ae5cb24be5..0fb988ead0 100644
> --- a/sysdeps/x86/include/cpu-features.h
> +++ b/sysdeps/x86/include/cpu-features.h
> @@ -772,40 +772,23 @@ enum
> /* EBX. */
> #define reg_PTWRITE ebx
>
> -/* PREFERRED_FEATURE_INDEX_1. */
> -#define bit_arch_I586 (1u << 0)
> -#define bit_arch_I686 (1u << 1)
> -#define bit_arch_Fast_Rep_String (1u << 2)
> -#define bit_arch_Fast_Copy_Backward (1u << 3)
> -#define bit_arch_Fast_Unaligned_Load (1u << 4)
> -#define bit_arch_Fast_Unaligned_Copy (1u << 5)
> -#define bit_arch_Slow_BSF (1u << 6)
> -#define bit_arch_Slow_SSE4_2 (1u << 7)
> -#define bit_arch_AVX_Fast_Unaligned_Load (1u << 8)
> -#define bit_arch_Prefer_MAP_32BIT_EXEC (1u << 9)
> -#define bit_arch_Prefer_PMINUB_for_stringop (1u << 10)
> -#define bit_arch_Prefer_No_VZEROUPPER (1u << 11)
> -#define bit_arch_Prefer_ERMS (1u << 12)
> -#define bit_arch_Prefer_FSRM (1u << 13)
> -#define bit_arch_Prefer_No_AVX512 (1u << 14)
> -#define bit_arch_MathVec_Prefer_No_AVX512 (1u << 15)
> -
> -#define index_arch_Fast_Rep_String PREFERRED_FEATURE_INDEX_1
> -#define index_arch_Fast_Copy_Backward PREFERRED_FEATURE_INDEX_1
> -#define index_arch_Slow_BSF PREFERRED_FEATURE_INDEX_1
> -#define index_arch_Fast_Unaligned_Load PREFERRED_FEATURE_INDEX_1
> -#define index_arch_Prefer_PMINUB_for_stringop PREFERRED_FEATURE_INDEX_1
> -#define index_arch_Fast_Unaligned_Copy PREFERRED_FEATURE_INDEX_1
> -#define index_arch_I586 PREFERRED_FEATURE_INDEX_1
> -#define index_arch_I686 PREFERRED_FEATURE_INDEX_1
> -#define index_arch_Slow_SSE4_2 PREFERRED_FEATURE_INDEX_1
> -#define index_arch_AVX_Fast_Unaligned_Load PREFERRED_FEATURE_INDEX_1
> -#define index_arch_Prefer_MAP_32BIT_EXEC PREFERRED_FEATURE_INDEX_1
> -#define index_arch_Prefer_No_VZEROUPPER PREFERRED_FEATURE_INDEX_1
> -#define index_arch_Prefer_ERMS PREFERRED_FEATURE_INDEX_1
> -#define index_arch_Prefer_No_AVX512 PREFERRED_FEATURE_INDEX_1
> -#define index_arch_MathVec_Prefer_No_AVX512 PREFERRED_FEATURE_INDEX_1
> -#define index_arch_Prefer_FSRM PREFERRED_FEATURE_INDEX_1
> +/* PREFERRED_FEATURE_INDEX_1. First define the bitindex values
> + sequentially, then define the bit_arch* and index_arch_* lookup
> + constants. */
> +enum
> + {
> +#define BIT(x) _bitindex_arch_##x ,
> +#include "cpu-features-preferred_feature_index_1.def"
> +#undef BIT
> + };
> +enum
> + {
> +#define BIT(x) \
> + bit_arch_##x = 1u << _bitindex_arch_##x , \
> + index_arch_##x = PREFERRED_FEATURE_INDEX_1,
> +#include "cpu-features-preferred_feature_index_1.def"
> +#undef BIT
> + };
>
> /* XCR0 Feature flags. */
> #define bit_XMM_state (1u << 1)
>
OK.
Thanks.
--
H.J.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3 2/2] x86: Add CPU-specific diagnostics to ld.so --list-diagnostics
2021-03-02 14:32 ` [PATCH v3 2/2] x86: Add CPU-specific diagnostics to ld.so --list-diagnostics Florian Weimer
@ 2021-03-02 14:34 ` H.J. Lu
0 siblings, 0 replies; 4+ messages in thread
From: H.J. Lu @ 2021-03-02 14:34 UTC (permalink / raw)
To: Florian Weimer; +Cc: GNU C Library
On Tue, Mar 2, 2021 at 6:32 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> ---
> v2: Adjustments to generic changes. Add comments to cpu-features.h
> pointing towards the diagnostics printer.
> v3: Use the new bit iterator. Add _static_assert.
>
> sysdeps/x86/dl-diagnostics-cpu.c | 118 +++++++++++++++++++++++++++++++++++++
> sysdeps/x86/include/cpu-features.h | 2 +
> 2 files changed, 120 insertions(+)
>
> diff --git a/sysdeps/x86/dl-diagnostics-cpu.c b/sysdeps/x86/dl-diagnostics-cpu.c
> new file mode 100644
> index 0000000000..5d9713f8d9
> --- /dev/null
> +++ b/sysdeps/x86/dl-diagnostics-cpu.c
> @@ -0,0 +1,118 @@
> +/* Print CPU diagnostics data in ld.so. x86 version.
> + Copyright (C) 2021 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
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <https://www.gnu.org/licenses/>. */
> +
> +#include <dl-diagnostics.h>
> +#include <ldsodefs.h>
> +
> +static void
> +print_cpu_features_value (const char *label, uint64_t value)
> +{
> + _dl_printf ("x86.cpu_features.");
> + _dl_diagnostics_print_labeled_value (label, value);
> +}
> +
> +static void
> +print_cpu_feature_internal (unsigned int index, const char *kind,
> + unsigned int reg, uint32_t value)
> +{
> + _dl_printf ("x86.cpu_features.features[0x%x].%s[0x%x]=0x%x\n",
> + index, kind, reg, value);
> +}
> +
> +static void
> +print_cpu_feature_preferred (const char *label, unsigned int flag)
> +{
> + _dl_printf("x86.cpu_features.preferred.%s=0x%x\n", label, flag);
> +}
> +
> +void
> +_dl_diagnostics_cpu (void)
> +{
> + const struct cpu_features *cpu_features = __get_cpu_features ();
> +
> + print_cpu_features_value ("basic.kind", cpu_features->basic.kind);
> + print_cpu_features_value ("basic.max_cpuid", cpu_features->basic.max_cpuid);
> + print_cpu_features_value ("basic.family", cpu_features->basic.family);
> + print_cpu_features_value ("basic.model", cpu_features->basic.model);
> + print_cpu_features_value ("basic.stepping", cpu_features->basic.stepping);
> +
> + for (unsigned int index = 0; index < CPUID_INDEX_MAX; ++index)
> + {
> + /* The index values are part of the ABI via
> + <sys/platform/x86.h>, so translating them to strings is not
> + necessary. */
> + for (unsigned int reg = 0; reg < 4; ++reg)
> + print_cpu_feature_internal
> + (index, "cpuid", reg,
> + cpu_features->features[index].cpuid_array[reg]);
> + for (unsigned int reg = 0; reg < 4; ++reg)
> + print_cpu_feature_internal
> + (index, "usable", reg,
> + cpu_features->features[index].usable_array[reg]);
> + }
> +
> + /* The preferred indicators are not part of the ABI and need to be
> + translated. */
> +#define BIT(x) \
> + print_cpu_feature_preferred (#x, CPU_FEATURE_PREFERRED_P (cpu_features, x));
> +#include "cpu-features-preferred_feature_index_1.def"
> +#undef BIT
> +
> + print_cpu_features_value ("isa_1", cpu_features->isa_1);
> + 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 ("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_movsb_stop_threshold",
> + cpu_features->rep_movsb_stop_threshold);
> + print_cpu_features_value ("rep_stosb_threshold",
> + cpu_features->rep_stosb_threshold);
> + print_cpu_features_value ("level1_icache_size",
> + cpu_features->level1_icache_size);
> + print_cpu_features_value ("level1_dcache_size",
> + cpu_features->level1_dcache_size);
> + print_cpu_features_value ("level1_dcache_assoc",
> + cpu_features->level1_dcache_assoc);
> + print_cpu_features_value ("level1_dcache_linesize",
> + cpu_features->level1_dcache_linesize);
> + print_cpu_features_value ("level2_cache_size",
> + cpu_features->level2_cache_size);
> + print_cpu_features_value ("level2_cache_assoc",
> + cpu_features->level2_cache_assoc);
> + print_cpu_features_value ("level2_cache_linesize",
> + cpu_features->level2_cache_linesize);
> + print_cpu_features_value ("level3_cache_size",
> + cpu_features->level3_cache_size);
> + print_cpu_features_value ("level3_cache_assoc",
> + cpu_features->level3_cache_assoc);
> + print_cpu_features_value ("level3_cache_linesize",
> + cpu_features->level3_cache_linesize);
> + print_cpu_features_value ("level4_cache_size",
> + cpu_features->level4_cache_size);
> + _Static_assert (offsetof (struct cpu_features, level4_cache_size)
> + + sizeof (cpu_features->level4_cache_size)
> + == sizeof (*cpu_features),
> + "last cpu_features field has been printed");
> +}
> diff --git a/sysdeps/x86/include/cpu-features.h b/sysdeps/x86/include/cpu-features.h
> index 0fb988ead0..c5a779ba32 100644
> --- a/sysdeps/x86/include/cpu-features.h
> +++ b/sysdeps/x86/include/cpu-features.h
> @@ -839,6 +839,8 @@ struct cpuid_feature_internal
> };
> };
>
> +/* NB: When adding new fields, update sysdeps/x86/dl-diagnostics-cpu.c
> + to print them. */
> struct cpu_features
> {
> struct cpu_features_basic basic;
>
OK.
Thanks.
--
H.J.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-03-02 14:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-02 14:23 [PATCH 1/2] x86: Automate generation of PREFERRED_FEATURE_INDEX_1 bitfield Florian Weimer
2021-03-02 14:32 ` [PATCH v3 2/2] x86: Add CPU-specific diagnostics to ld.so --list-diagnostics Florian Weimer
2021-03-02 14:34 ` H.J. Lu
2021-03-02 14:33 ` [PATCH 1/2] x86: Automate generation of PREFERRED_FEATURE_INDEX_1 bitfield H.J. Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).