summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@joyent.com>2019-06-08 01:15:14 +0000
committerRobert Mustacchi <rm@joyent.com>2019-06-24 20:45:42 +0000
commit394dadbc86535e5075b260851683ccbb3f571c6d (patch)
treea87e70276f4d843dce356ea17b8a3079d5f08ab5 /usr
parent3d280bd5aa877a68b01b0b5dc7cb0f92843e8b41 (diff)
downloadillumos-joyent-394dadbc86535e5075b260851683ccbb3f571c6d.tar.gz
OS-7850 AMD F17 core topology is per process node
Reviewed by: John Levon <john.levon@joyent.com> Reviewed by: Patrick Mooney <patrick.mooney@joyent.com> Approved by: John Levon <john.levon@joyent.com>
Diffstat (limited to 'usr')
-rw-r--r--usr/src/uts/i86pc/os/cpuid.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/usr/src/uts/i86pc/os/cpuid.c b/usr/src/uts/i86pc/os/cpuid.c
index 40d5586c08..a5e66c2ee3 100644
--- a/usr/src/uts/i86pc/os/cpuid.c
+++ b/usr/src/uts/i86pc/os/cpuid.c
@@ -2024,18 +2024,27 @@ cpuid_amd_getids(cpu_t *cpu, uchar_t *features)
cpi->cpi_clogid = cpi->cpi_apicid & ((1 << coreidsz) - 1);
/*
- * The package core ID varies depending on the family. For family 17h,
- * we can get this directly from leaf CPUID_LEAF_EXT_1e. Otherwise, we
- * can use the clogid as is. When family 17h is virtualized, the clogid
- * should be sufficient as if we don't have valid data in the leaf, then
- * we won't think we have SMT, in which case the cpi_clogid should be
+ * The package core ID varies depending on the family. While it may be
+ * tempting to use the CPUID_LEAF_EXT_1e %ebx core id, unfortunately,
+ * this value is the core id in the given node. For non-virtualized
+ * family 17h, we need to take the logical core id and shift off the
+ * threads like we do when getting the core id. Otherwise, we can use
+ * the clogid as is. When family 17h is virtualized, the clogid should
+ * be sufficient as if we don't have valid data in the leaf, then we
+ * won't think we have SMT, in which case the cpi_clogid should be
* sufficient.
*/
if (cpi->cpi_family >= 0x17 &&
is_x86_feature(x86_featureset, X86FSET_TOPOEXT) &&
cpi->cpi_xmaxeax >= CPUID_LEAF_EXT_1e &&
cpi->cpi_extd[0x1e].cp_ebx != 0) {
- cpi->cpi_pkgcoreid = BITX(cpi->cpi_extd[0x1e].cp_ebx, 7, 0);
+ uint_t nthreads = BITX(cpi->cpi_extd[0x1e].cp_ebx, 15, 8) + 1;
+ if (nthreads > 1) {
+ VERIFY3U(nthreads, ==, 2);
+ cpi->cpi_pkgcoreid = cpi->cpi_clogid >> 1;
+ } else {
+ cpi->cpi_pkgcoreid = cpi->cpi_clogid;
+ }
} else {
cpi->cpi_pkgcoreid = cpi->cpi_clogid;
}