Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/cpuctl/arch decode SMT parts for AMD family >= 0x17...



details:   https://anonhg.NetBSD.org/src/rev/4a75974b18aa
branches:  trunk
changeset: 990438:4a75974b18aa
user:      mrg <mrg%NetBSD.org@localhost>
date:      Wed Oct 27 04:15:41 2021 +0000

description:
decode SMT parts for AMD family >= 0x17, not just 0x17.

now zen3 systems are properly identified by cpu topology for the
scheduler and cpuctl identify.

diffstat:

 sys/arch/x86/x86/cpu_topology.c |  8 ++++----
 usr.sbin/cpuctl/arch/i386.c     |  6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diffs (56 lines):

diff -r fefc256998ee -r 4a75974b18aa sys/arch/x86/x86/cpu_topology.c
--- a/sys/arch/x86/x86/cpu_topology.c   Wed Oct 27 04:14:59 2021 +0000
+++ b/sys/arch/x86/x86/cpu_topology.c   Wed Oct 27 04:15:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu_topology.c,v 1.19 2020/02/15 07:20:41 skrll Exp $  */
+/*     $NetBSD: cpu_topology.c,v 1.20 2021/10/27 04:15:41 mrg Exp $    */
 
 /*-
  * Copyright (c) 2009 Mindaugas Rasiukevicius <rmind at NetBSD org>,
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_topology.c,v 1.19 2020/02/15 07:20:41 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_topology.c,v 1.20 2021/10/27 04:15:41 mrg Exp $");
 
 #include "acpica.h"
 
@@ -185,8 +185,8 @@
                }
        }
 
-       /* Family 0x17 supports SMT */
-       if (cpu_vendor == CPUVENDOR_AMD && cpu_family == 0x17) { /* XXX */
+       /* Family 0x17 and above support SMT */
+       if (cpu_vendor == CPUVENDOR_AMD && cpu_family >= 0x17) { /* XXX */
                x86_cpuid(0x8000001e, descs);
                const u_int threads = ((descs[1] >> 8) & 0xff) + 1;
 
diff -r fefc256998ee -r 4a75974b18aa usr.sbin/cpuctl/arch/i386.c
--- a/usr.sbin/cpuctl/arch/i386.c       Wed Oct 27 04:14:59 2021 +0000
+++ b/usr.sbin/cpuctl/arch/i386.c       Wed Oct 27 04:15:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i386.c,v 1.122 2021/10/07 13:04:18 msaitoh Exp $       */
+/*     $NetBSD: i386.c,v 1.123 2021/10/27 04:15:42 mrg Exp $   */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.122 2021/10/07 13:04:18 msaitoh Exp $");
+__RCSID("$NetBSD: i386.c,v 1.123 2021/10/27 04:15:42 mrg Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -1892,7 +1892,7 @@
        }
 #endif
 
-       if (cpu_family == 0x17) {
+       if (cpu_family >= 0x17) {
                x86_cpuid(0x8000001e, descs);
                const u_int threads = ((descs[1] >> 8) & 0xff) + 1;
                smt_bits = ilog2(threads);



Home | Main Index | Thread Index | Old Index