diff options
author | Alexander Motin <mav@FreeBSD.org> | 2020-07-14 18:11:05 +0000 |
---|---|---|
committer | Alexander Motin <mav@FreeBSD.org> | 2020-07-14 18:11:05 +0000 |
commit | 1791cad0a99ffa1cba463ac97e4fde7cb78869e0 (patch) | |
tree | d1b169f3061906b412060708a4c3e7de0438dad2 | |
parent | 083c26289906f8c9628a5ad0abb4a6cf7cc14f1f (diff) | |
download | src-test2-1791cad0a99ffa1cba463ac97e4fde7cb78869e0.tar.gz src-test2-1791cad0a99ffa1cba463ac97e4fde7cb78869e0.zip |
Notes
-rw-r--r-- | lib/libpmc/libpmc_pmu_util.c | 6 | ||||
-rw-r--r-- | sys/dev/hwpmc/hwpmc_amd.c | 11 | ||||
-rw-r--r-- | sys/dev/hwpmc/hwpmc_intel.c | 4 |
3 files changed, 11 insertions, 10 deletions
diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index f451c37a0592..11949a3ad3cd 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -169,7 +169,7 @@ pmu_events_map_get(const char *cpuid) { regex_t re; regmatch_t pmatch[1]; - size_t s, len; + size_t s; char buf[64]; int match; const struct pmu_events_map *pme; @@ -193,8 +193,8 @@ pmu_events_map_get(const char *cpuid) match = regexec(&re, buf, 1, pmatch, 0); regfree(&re); if (match == 0) { - len = pmatch[0].rm_eo - pmatch[0].rm_so; - if(len == strlen(buf)) + if (pmatch[0].rm_so == 0 && (buf[pmatch[0].rm_eo] == 0 + || buf[pmatch[0].rm_eo] == '-')) return (pme); } } diff --git a/sys/dev/hwpmc/hwpmc_amd.c b/sys/dev/hwpmc/hwpmc_amd.c index c1b850d459fe..ca139b6fd8a6 100644 --- a/sys/dev/hwpmc/hwpmc_amd.c +++ b/sys/dev/hwpmc/hwpmc_amd.c @@ -1073,7 +1073,7 @@ pmc_amd_initialize(void) enum pmc_cputype cputype; struct pmc_mdep *pmc_mdep; enum pmc_class class; - int model; + int model, stepping; char *name; /* @@ -1086,12 +1086,13 @@ pmc_amd_initialize(void) name = NULL; model = ((cpu_id & 0xF0000) >> 12) | ((cpu_id & 0xF0) >> 4); + stepping = cpu_id & 0xF; if (CPUID_TO_FAMILY(cpu_id) == 0x17) - snprintf(pmc_cpuid, sizeof(pmc_cpuid), "AuthenticAMD-%d-%02X", - CPUID_TO_FAMILY(cpu_id), model); + snprintf(pmc_cpuid, sizeof(pmc_cpuid), "AuthenticAMD-%d-%02X-%X", + CPUID_TO_FAMILY(cpu_id), model, stepping); if (CPUID_TO_FAMILY(cpu_id) == 0x18) - snprintf(pmc_cpuid, sizeof(pmc_cpuid), "HygonGenuine-%d-%02X", - CPUID_TO_FAMILY(cpu_id), model); + snprintf(pmc_cpuid, sizeof(pmc_cpuid), "HygonGenuine-%d-%02X-%X", + CPUID_TO_FAMILY(cpu_id), model, stepping); switch (cpu_id & 0xF00) { #if defined(__i386__) diff --git a/sys/dev/hwpmc/hwpmc_intel.c b/sys/dev/hwpmc/hwpmc_intel.c index 7a4839e35964..c16d6f949670 100644 --- a/sys/dev/hwpmc/hwpmc_intel.c +++ b/sys/dev/hwpmc/hwpmc_intel.c @@ -94,8 +94,8 @@ pmc_intel_initialize(void) model = ((cpu_id & 0xF0000) >> 12) | ((cpu_id & 0xF0) >> 4); stepping = cpu_id & 0xF; - snprintf(pmc_cpuid, sizeof(pmc_cpuid), "GenuineIntel-%d-%02X", - (cpu_id & 0xF00) >> 8, model); + snprintf(pmc_cpuid, sizeof(pmc_cpuid), "GenuineIntel-%d-%02X-%X", + (cpu_id & 0xF00) >> 8, model, stepping); switch (cpu_id & 0xF00) { case 0x600: /* Pentium Pro, Celeron, Pentium II & III */ switch (model) { |