x86: Restore processing of cache size tunables in init_cacheinfo

Message ID 87v9euv0zn.fsf@oldenburg2.str.redhat.com
State New
Headers show
Series
  • x86: Restore processing of cache size tunables in init_cacheinfo
Related show

Commit Message

H.J. Lu via Libc-alpha Oct. 28, 2020, 3:11 p.m.
Fixes and partially reverts commit 59803e81f96b479c17f583b31eac44b5
("x86: Optimizing memcpy for AMD Zen architecture.").

---
 sysdeps/x86/cacheinfo.h | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)


-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill

Comments

H.J. Lu via Libc-alpha Oct. 28, 2020, 3:14 p.m. | #1
LGTM. Thanks.

On Wed, Oct 28, 2020, 8:12 AM Florian Weimer <fweimer@redhat.com> wrote:

> Fixes and partially reverts commit 59803e81f96b479c17f583b31eac44b5

> ("x86: Optimizing memcpy for AMD Zen architecture.").

>

> ---

>  sysdeps/x86/cacheinfo.h | 12 ++++--------

>  1 file changed, 4 insertions(+), 8 deletions(-)

>

> diff --git a/sysdeps/x86/cacheinfo.h b/sysdeps/x86/cacheinfo.h

> index 1296c93b2b..0aec0e2875 100644

> --- a/sysdeps/x86/cacheinfo.h

> +++ b/sysdeps/x86/cacheinfo.h

> @@ -354,11 +354,9 @@ init_cacheinfo (void)

>        }

>      }

>

> +  /* Prefer cache size configure via tuning.  */

>    if (cpu_features->data_cache_size != 0)

> -    {

> -      if (data == 0 || cpu_features->basic.kind != arch_kind_amd)

> -        data = cpu_features->data_cache_size;

> -    }

> +    data = cpu_features->data_cache_size;

>

>    if (data > 0)

>      {

> @@ -370,11 +368,9 @@ init_cacheinfo (void)

>        __x86_data_cache_size = data;

>      }

>

> +  /* Prefer cache size configure via tuning.  */

>    if (cpu_features->shared_cache_size != 0)

> -    {

> -      if (shared == 0 || cpu_features->basic.kind != arch_kind_amd)

> -        shared = cpu_features->shared_cache_size;

> -    }

> +    shared = cpu_features->shared_cache_size;

>

>    if (shared > 0)

>      {

>

> --

> Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,

> Commercial register: Amtsgericht Muenchen, HRB 153243,

> Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael

> O'Neill

>

>
Karumanchi, Sajan Oct. 30, 2020, 6:46 a.m. | #2
[AMD Public Use]

Thanks, Florian for the quick fix.

Thanks & Regards,
Sajan K.

From: H.J. Lu <hjl.tools@gmail.com>

Sent: Wednesday, October 28, 2020 8:45 PM
To: Florian Weimer <fweimer@redhat.com>
Cc: GNU C Library <libc-alpha@sourceware.org>; Karumanchi, Sajan <Sajan.Karumanchi@amd.com>; Mallappa, Premachandra <Premachandra.Mallappa@amd.com>
Subject: Re: [PATCH] x86: Restore processing of cache size tunables in init_cacheinfo

[CAUTION: External Email]
LGTM. Thanks.

On Wed, Oct 28, 2020, 8:12 AM Florian Weimer <fweimer@redhat.com<mailto:fweimer@redhat.com>> wrote:
Fixes and partially reverts commit 59803e81f96b479c17f583b31eac44b5
("x86: Optimizing memcpy for AMD Zen architecture.").

---
 sysdeps/x86/cacheinfo.h | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/sysdeps/x86/cacheinfo.h b/sysdeps/x86/cacheinfo.h
index 1296c93b2b..0aec0e2875 100644
--- a/sysdeps/x86/cacheinfo.h
+++ b/sysdeps/x86/cacheinfo.h
@@ -354,11 +354,9 @@ init_cacheinfo (void)
       }
     }

+  /* Prefer cache size configure via tuning.  */
   if (cpu_features->data_cache_size != 0)
-    {
-      if (data == 0 || cpu_features->basic.kind != arch_kind_amd)
-        data = cpu_features->data_cache_size;
-    }
+    data = cpu_features->data_cache_size;

   if (data > 0)
     {
@@ -370,11 +368,9 @@ init_cacheinfo (void)
       __x86_data_cache_size = data;
     }

+  /* Prefer cache size configure via tuning.  */
   if (cpu_features->shared_cache_size != 0)
-    {
-      if (shared == 0 || cpu_features->basic.kind != arch_kind_amd)
-        shared = cpu_features->shared_cache_size;
-    }
+    shared = cpu_features->shared_cache_size;

   if (shared > 0)
     {

--
Red Hat GmbH, https://de.redhat.com/<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fde.redhat.com%2F&data=04%7C01%7Csajan.karumanchi%40amd.com%7Ce17694913cf54bc7244a08d87b543a14%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637394948964874160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=yV0WP1iAMLzWGpFstXdbqen6ZObCxAoH1b7fBl5l5Wo%3D&reserved=0> , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill

Patch

diff --git a/sysdeps/x86/cacheinfo.h b/sysdeps/x86/cacheinfo.h
index 1296c93b2b..0aec0e2875 100644
--- a/sysdeps/x86/cacheinfo.h
+++ b/sysdeps/x86/cacheinfo.h
@@ -354,11 +354,9 @@  init_cacheinfo (void)
       }
     }
 
+  /* Prefer cache size configure via tuning.  */
   if (cpu_features->data_cache_size != 0)
-    {
-      if (data == 0 || cpu_features->basic.kind != arch_kind_amd)
-        data = cpu_features->data_cache_size;
-    }
+    data = cpu_features->data_cache_size;
 
   if (data > 0)
     {
@@ -370,11 +368,9 @@  init_cacheinfo (void)
       __x86_data_cache_size = data;
     }
 
+  /* Prefer cache size configure via tuning.  */
   if (cpu_features->shared_cache_size != 0)
-    {
-      if (shared == 0 || cpu_features->basic.kind != arch_kind_amd)
-        shared = cpu_features->shared_cache_size;
-    }
+    shared = cpu_features->shared_cache_size;
 
   if (shared > 0)
     {