public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix elf: Do not duplicate the GLIBC_TUNABLES string
@ 2023-12-20  0:04 H.J. Lu
  2023-12-20  0:31 ` H.J. Lu
  0 siblings, 1 reply; 5+ messages in thread
From: H.J. Lu @ 2023-12-20  0:04 UTC (permalink / raw)
  To: libc-alpha

commit 2a969b53c0b02fed7e43473a92f219d737fd217a
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Dec 6 10:24:01 2023 -0300

    elf: Do not duplicate the GLIBC_TUNABLES string

has

@@ -38,7 +39,7 @@
    which isn't available.  */
 #define CHECK_GLIBC_IFUNC_PREFERRED_OFF(f, cpu_features, name, len) \
   _Static_assert (sizeof (#name) - 1 == len, #name " != " #len); \
-  if (memcmp (f, #name, len) == 0)             \
+  if (tunable_str_comma_strcmp_cte (&f, #name) == 0)       \
     {                           \
       cpu_features->preferred[index_arch_##name]        \
   &= ~bit_arch_##name;                \
@@ -46,12 +47,11 @@

Fix it by removing "== 0" after tunable_str_comma_strcmp_cte.
---
 sysdeps/x86/cpu-tunables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysdeps/x86/cpu-tunables.c b/sysdeps/x86/cpu-tunables.c
index ef96148d30..142c6b9240 100644
--- a/sysdeps/x86/cpu-tunables.c
+++ b/sysdeps/x86/cpu-tunables.c
@@ -39,7 +39,7 @@
    which isn't available.  */
 #define CHECK_GLIBC_IFUNC_PREFERRED_OFF(f, cpu_features, name, len)	\
   _Static_assert (sizeof (#name) - 1 == len, #name " != " #len);	\
-  if (tunable_str_comma_strcmp_cte (&f, #name) == 0)			\
+  if (tunable_str_comma_strcmp_cte (&f, #name))				\
     {									\
       cpu_features->preferred[index_arch_##name]			\
 	&= ~bit_arch_##name;						\
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix elf: Do not duplicate the GLIBC_TUNABLES string
  2023-12-20  0:04 [PATCH] Fix elf: Do not duplicate the GLIBC_TUNABLES string H.J. Lu
@ 2023-12-20  0:31 ` H.J. Lu
  2023-12-20 12:28   ` Adhemerval Zanella Netto
  0 siblings, 1 reply; 5+ messages in thread
From: H.J. Lu @ 2023-12-20  0:31 UTC (permalink / raw)
  To: libc-alpha

On Tue, Dec 19, 2023 at 4:04 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> commit 2a969b53c0b02fed7e43473a92f219d737fd217a
> Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> Date:   Wed Dec 6 10:24:01 2023 -0300
>
>     elf: Do not duplicate the GLIBC_TUNABLES string
>
> has
>
> @@ -38,7 +39,7 @@
>     which isn't available.  */
>  #define CHECK_GLIBC_IFUNC_PREFERRED_OFF(f, cpu_features, name, len) \
>    _Static_assert (sizeof (#name) - 1 == len, #name " != " #len); \
> -  if (memcmp (f, #name, len) == 0)             \
> +  if (tunable_str_comma_strcmp_cte (&f, #name) == 0)       \
>      {                           \
>        cpu_features->preferred[index_arch_##name]        \
>    &= ~bit_arch_##name;                \
> @@ -46,12 +47,11 @@
>
> Fix it by removing "== 0" after tunable_str_comma_strcmp_cte.
> ---
>  sysdeps/x86/cpu-tunables.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sysdeps/x86/cpu-tunables.c b/sysdeps/x86/cpu-tunables.c
> index ef96148d30..142c6b9240 100644
> --- a/sysdeps/x86/cpu-tunables.c
> +++ b/sysdeps/x86/cpu-tunables.c
> @@ -39,7 +39,7 @@
>     which isn't available.  */
>  #define CHECK_GLIBC_IFUNC_PREFERRED_OFF(f, cpu_features, name, len)    \
>    _Static_assert (sizeof (#name) - 1 == len, #name " != " #len);       \
> -  if (tunable_str_comma_strcmp_cte (&f, #name) == 0)                   \
> +  if (tunable_str_comma_strcmp_cte (&f, #name))                                \
>      {                                                                  \
>        cpu_features->preferred[index_arch_##name]                       \
>         &= ~bit_arch_##name;                                            \
> --
> 2.43.0
>

I  am checking it in.

-- 
H.J.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix elf: Do not duplicate the GLIBC_TUNABLES string
  2023-12-20  0:31 ` H.J. Lu
@ 2023-12-20 12:28   ` Adhemerval Zanella Netto
  0 siblings, 0 replies; 5+ messages in thread
From: Adhemerval Zanella Netto @ 2023-12-20 12:28 UTC (permalink / raw)
  To: H.J. Lu, libc-alpha



On 19/12/23 21:31, H.J. Lu wrote:
> On Tue, Dec 19, 2023 at 4:04 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>>
>> commit 2a969b53c0b02fed7e43473a92f219d737fd217a
>> Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
>> Date:   Wed Dec 6 10:24:01 2023 -0300
>>
>>     elf: Do not duplicate the GLIBC_TUNABLES string
>>
>> has
>>
>> @@ -38,7 +39,7 @@
>>     which isn't available.  */
>>  #define CHECK_GLIBC_IFUNC_PREFERRED_OFF(f, cpu_features, name, len) \
>>    _Static_assert (sizeof (#name) - 1 == len, #name " != " #len); \
>> -  if (memcmp (f, #name, len) == 0)             \
>> +  if (tunable_str_comma_strcmp_cte (&f, #name) == 0)       \
>>      {                           \
>>        cpu_features->preferred[index_arch_##name]        \
>>    &= ~bit_arch_##name;                \
>> @@ -46,12 +47,11 @@
>>
>> Fix it by removing "== 0" after tunable_str_comma_strcmp_cte.
>> ---
>>  sysdeps/x86/cpu-tunables.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/sysdeps/x86/cpu-tunables.c b/sysdeps/x86/cpu-tunables.c
>> index ef96148d30..142c6b9240 100644
>> --- a/sysdeps/x86/cpu-tunables.c
>> +++ b/sysdeps/x86/cpu-tunables.c
>> @@ -39,7 +39,7 @@
>>     which isn't available.  */
>>  #define CHECK_GLIBC_IFUNC_PREFERRED_OFF(f, cpu_features, name, len)    \
>>    _Static_assert (sizeof (#name) - 1 == len, #name " != " #len);       \
>> -  if (tunable_str_comma_strcmp_cte (&f, #name) == 0)                   \
>> +  if (tunable_str_comma_strcmp_cte (&f, #name))                                \
>>      {                                                                  \
>>        cpu_features->preferred[index_arch_##name]                       \
>>         &= ~bit_arch_##name;                                            \
>> --
>> 2.43.0
>>
> 
> I  am checking it in.
> 

LGTM, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix elf: Do not duplicate the GLIBC_TUNABLES string
  2023-12-19 21:27 H.J. Lu
@ 2023-12-19 21:35 ` Adhemerval Zanella Netto
  0 siblings, 0 replies; 5+ messages in thread
From: Adhemerval Zanella Netto @ 2023-12-19 21:35 UTC (permalink / raw)
  To: H.J. Lu, GNU C Library; +Cc: Siddhesh Poyarekar



On 19/12/23 18:27, H.J. Lu wrote:
> Fix issues in sysdeps/x86/tst-hwcap-tunables.c added by
> 
> Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> Date:   Wed Dec 6 10:24:01 2023 -0300
> 
>     elf: Do not duplicate the GLIBC_TUNABLES string
> 
> 1. -AVX,-AVX2,-AVX512F should be used to disable AVX, AVX2 and AVX512.
> 2. AVX512 IFUNC functions check AVX512VL.  -AVX512VL should be added
> to disable these functions.
> 
> This fixed:
> 
> FAIL: elf/tst-hwcap-tunables
> ...
> [0] Spawned test for -Prefer_ERMS,-Prefer_FSRM,-AVX,-AVX2,-AVX_Usable,-AVX2_Usable,-AVX512F_Usable,-SSE4_1,-SSE4_2,-SSSE3,-Fast_Unaligned_Load,-ERMS,-AVX_Fast_Unaligned_Load
> error: subprocess failed: tst-tunables
> error:   unexpected output from subprocess
> ../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
>    left: 1 (0x1); from: impls[i].usable
>   right: 0 (0x0); from: false
> ../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
>    left: 1 (0x1); from: impls[i].usable
>   right: 0 (0x0); from: false
> ../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
>    left: 1 (0x1); from: impls[i].usable
>   right: 0 (0x0); from: false
> ../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
>    left: 1 (0x1); from: impls[i].usable
>   right: 0 (0x0); from: false
> ../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
>    left: 1 (0x1); from: impls[i].usable
>   right: 0 (0x0); from: false
> 
> [1] Spawned test for ,-,-Prefer_ERMS,-Prefer_FSRM,-AVX,-AVX2,-AVX_Usable,-AVX2_Usable,-AVX512F_Usable,-SSE4_1,-SSE4_2,,-SSSE3,-Fast_Unaligned_Load,,-,-ERMS,-AVX_Fast_Unaligned_Load,-,
> error: subprocess failed: tst-tunables
> error:   unexpected output from subprocess
> ../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
>    left: 1 (0x1); from: impls[i].usable
>   right: 0 (0x0); from: false
> ../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
>    left: 1 (0x1); from: impls[i].usable
>   right: 0 (0x0); from: false
> ../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
>    left: 1 (0x1); from: impls[i].usable
>   right: 0 (0x0); from: false
> ../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
>    left: 1 (0x1); from: impls[i].usable
>   right: 0 (0x0); from: false
> ../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
>    left: 1 (0x1); from: impls[i].usable
>   right: 0 (0x0); from: false
> 
> error: 2 test failures
> 
> on Intel Tiger Lake.
> 
> I am checking it in as an obvious fix.
> 
> H.J.
> ---
>  sysdeps/x86/tst-hwcap-tunables.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/sysdeps/x86/tst-hwcap-tunables.c b/sysdeps/x86/tst-hwcap-tunables.c
> index 01a9377f7e..4e36aa077d 100644
> --- a/sysdeps/x86/tst-hwcap-tunables.c
> +++ b/sysdeps/x86/tst-hwcap-tunables.c
> @@ -58,17 +58,17 @@ static const struct test_t
>  {
>    {
>      /* Disable everything.  */
> -    "-Prefer_ERMS,-Prefer_FSRM,-AVX,-AVX2,-AVX_Usable,-AVX2_Usable,"
> -    "-AVX512F_Usable,-SSE4_1,-SSE4_2,-SSSE3,-Fast_Unaligned_Load,-ERMS,"
> +    "-Prefer_ERMS,-Prefer_FSRM,-AVX,-AVX2,-AVX512F,-AVX512VL,"
> +    "-SSE4_1,-SSE4_2,-SSSE3,-Fast_Unaligned_Load,-ERMS,"
>      "-AVX_Fast_Unaligned_Load",
>      test_1,
>      array_length (test_1)
>    },
>    {
>      /* Same as before, but with some empty suboptions.  */
> -    ",-,-Prefer_ERMS,-Prefer_FSRM,-AVX,-AVX2,-AVX_Usable,-AVX2_Usable,"
> -    "-AVX512F_Usable,-SSE4_1,-SSE4_2,,-SSSE3,-Fast_Unaligned_Load,,-,-ERMS,"
> -    "-AVX_Fast_Unaligned_Load,-,",
> +    ",-,-Prefer_ERMS,-Prefer_FSRM,-AVX,-AVX2,-AVX512F,-AVX512VL,"
> +    "-SSE4_1,-SSE4_2,-SSSE3,-Fast_Unaligned_Load,,-,"
> +    "-ERMS,-AVX_Fast_Unaligned_Load,-,",
>      test_1,
>      array_length (test_1)
>    }

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Fix elf: Do not duplicate the GLIBC_TUNABLES string
@ 2023-12-19 21:27 H.J. Lu
  2023-12-19 21:35 ` Adhemerval Zanella Netto
  0 siblings, 1 reply; 5+ messages in thread
From: H.J. Lu @ 2023-12-19 21:27 UTC (permalink / raw)
  To: GNU C Library; +Cc: Adhemerval Zanella, Siddhesh Poyarekar

Fix issues in sysdeps/x86/tst-hwcap-tunables.c added by

Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Dec 6 10:24:01 2023 -0300

    elf: Do not duplicate the GLIBC_TUNABLES string

1. -AVX,-AVX2,-AVX512F should be used to disable AVX, AVX2 and AVX512.
2. AVX512 IFUNC functions check AVX512VL.  -AVX512VL should be added
to disable these functions.

This fixed:

FAIL: elf/tst-hwcap-tunables
...
[0] Spawned test for -Prefer_ERMS,-Prefer_FSRM,-AVX,-AVX2,-AVX_Usable,-AVX2_Usable,-AVX512F_Usable,-SSE4_1,-SSE4_2,-SSSE3,-Fast_Unaligned_Load,-ERMS,-AVX_Fast_Unaligned_Load
error: subprocess failed: tst-tunables
error:   unexpected output from subprocess
../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
   left: 1 (0x1); from: impls[i].usable
  right: 0 (0x0); from: false
../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
   left: 1 (0x1); from: impls[i].usable
  right: 0 (0x0); from: false
../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
   left: 1 (0x1); from: impls[i].usable
  right: 0 (0x0); from: false
../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
   left: 1 (0x1); from: impls[i].usable
  right: 0 (0x0); from: false
../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
   left: 1 (0x1); from: impls[i].usable
  right: 0 (0x0); from: false

[1] Spawned test for ,-,-Prefer_ERMS,-Prefer_FSRM,-AVX,-AVX2,-AVX_Usable,-AVX2_Usable,-AVX512F_Usable,-SSE4_1,-SSE4_2,,-SSSE3,-Fast_Unaligned_Load,,-,-ERMS,-AVX_Fast_Unaligned_Load,-,
error: subprocess failed: tst-tunables
error:   unexpected output from subprocess
../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
   left: 1 (0x1); from: impls[i].usable
  right: 0 (0x0); from: false
../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
   left: 1 (0x1); from: impls[i].usable
  right: 0 (0x0); from: false
../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
   left: 1 (0x1); from: impls[i].usable
  right: 0 (0x0); from: false
../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
   left: 1 (0x1); from: impls[i].usable
  right: 0 (0x0); from: false
../sysdeps/x86/tst-hwcap-tunables.c:91: numeric comparison failure
   left: 1 (0x1); from: impls[i].usable
  right: 0 (0x0); from: false

error: 2 test failures

on Intel Tiger Lake.

I am checking it in as an obvious fix.

H.J.
---
 sysdeps/x86/tst-hwcap-tunables.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sysdeps/x86/tst-hwcap-tunables.c b/sysdeps/x86/tst-hwcap-tunables.c
index 01a9377f7e..4e36aa077d 100644
--- a/sysdeps/x86/tst-hwcap-tunables.c
+++ b/sysdeps/x86/tst-hwcap-tunables.c
@@ -58,17 +58,17 @@ static const struct test_t
 {
   {
     /* Disable everything.  */
-    "-Prefer_ERMS,-Prefer_FSRM,-AVX,-AVX2,-AVX_Usable,-AVX2_Usable,"
-    "-AVX512F_Usable,-SSE4_1,-SSE4_2,-SSSE3,-Fast_Unaligned_Load,-ERMS,"
+    "-Prefer_ERMS,-Prefer_FSRM,-AVX,-AVX2,-AVX512F,-AVX512VL,"
+    "-SSE4_1,-SSE4_2,-SSSE3,-Fast_Unaligned_Load,-ERMS,"
     "-AVX_Fast_Unaligned_Load",
     test_1,
     array_length (test_1)
   },
   {
     /* Same as before, but with some empty suboptions.  */
-    ",-,-Prefer_ERMS,-Prefer_FSRM,-AVX,-AVX2,-AVX_Usable,-AVX2_Usable,"
-    "-AVX512F_Usable,-SSE4_1,-SSE4_2,,-SSSE3,-Fast_Unaligned_Load,,-,-ERMS,"
-    "-AVX_Fast_Unaligned_Load,-,",
+    ",-,-Prefer_ERMS,-Prefer_FSRM,-AVX,-AVX2,-AVX512F,-AVX512VL,"
+    "-SSE4_1,-SSE4_2,-SSSE3,-Fast_Unaligned_Load,,-,"
+    "-ERMS,-AVX_Fast_Unaligned_Load,-,",
     test_1,
     array_length (test_1)
   }
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-20 12:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-20  0:04 [PATCH] Fix elf: Do not duplicate the GLIBC_TUNABLES string H.J. Lu
2023-12-20  0:31 ` H.J. Lu
2023-12-20 12:28   ` Adhemerval Zanella Netto
  -- strict thread matches above, loose matches on Subject: below --
2023-12-19 21:27 H.J. Lu
2023-12-19 21:35 ` Adhemerval Zanella Netto

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).