From owner-svn-src-all@freebsd.org Mon Jul 20 13:50:12 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 75A6F35FAE6; Mon, 20 Jul 2020 13:50:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B9NQW6nqbz445V; Mon, 20 Jul 2020 13:50:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44EEDDBB6; Mon, 20 Jul 2020 13:50:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 06KDoBmP091310; Mon, 20 Jul 2020 13:50:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06KDoAb2091306; Mon, 20 Jul 2020 13:50:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202007201350.06KDoAb2091306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Jul 2020 13:50:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363366 - in stable/12: lib/libpmc lib/libpmc/pmu-events/arch/x86 sys/dev/hwpmc X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12: lib/libpmc lib/libpmc/pmu-events/arch/x86 sys/dev/hwpmc X-SVN-Commit-Revision: 363366 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jul 2020 13:50:12 -0000 Author: mav Date: Mon Jul 20 13:50:10 2020 New Revision: 363366 URL: https://svnweb.freebsd.org/changeset/base/363366 Log: MFC r363144, r363188: Add stepping to the kern.hwpmc.cpuid string on x86. It follows the equivalent Linux change to be able to differentiate skylakex and cascadelakex, sharing the same model but not stepping. Modified: stable/12/lib/libpmc/libpmc_pmu_util.c stable/12/lib/libpmc/pmu-events/arch/x86/mapfile.csv stable/12/sys/dev/hwpmc/hwpmc_amd.c stable/12/sys/dev/hwpmc/hwpmc_intel.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libpmc/libpmc_pmu_util.c ============================================================================== --- stable/12/lib/libpmc/libpmc_pmu_util.c Mon Jul 20 13:37:14 2020 (r363365) +++ stable/12/lib/libpmc/libpmc_pmu_util.c Mon Jul 20 13:50:10 2020 (r363366) @@ -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); } } Modified: stable/12/lib/libpmc/pmu-events/arch/x86/mapfile.csv ============================================================================== --- stable/12/lib/libpmc/pmu-events/arch/x86/mapfile.csv Mon Jul 20 13:37:14 2020 (r363365) +++ stable/12/lib/libpmc/pmu-events/arch/x86/mapfile.csv Mon Jul 20 13:50:10 2020 (r363366) @@ -24,19 +24,15 @@ GenuineIntel-6-1E,v2,nehalemep,core GenuineIntel-6-1F,v2,nehalemep,core GenuineIntel-6-1A,v2,nehalemep,core GenuineIntel-6-2E,v2,nehalemex,core -GenuineIntel-6-4E,v24,skylake,core -GenuineIntel-6-5E,v24,skylake,core -GenuineIntel-6-8E,v24,skylake,core -GenuineIntel-6-9E,v24,skylake,core +GenuineIntel-6-[4589]E,v24,skylake,core GenuineIntel-6-37,v13,silvermont,core GenuineIntel-6-4D,v13,silvermont,core GenuineIntel-6-4C,v13,silvermont,core GenuineIntel-6-2A,v15,sandybridge,core GenuineIntel-6-2C,v2,westmereep-dp,core -GenuineIntel-6-2C,v2,westmereep-dp,core GenuineIntel-6-25,v2,westmereep-sp,core GenuineIntel-6-2F,v2,westmereex,core -GenuineIntel-6-55,v1,skylakex,core +GenuineIntel-6-55-[01234],v1,skylakex,core GenuineIntel-6-55-[56789ABCDEF],v1,cascadelakex,core GenuineIntel-6-7D,v1,icelake,core GenuineIntel-6-7E,v1,icelake,core Modified: stable/12/sys/dev/hwpmc/hwpmc_amd.c ============================================================================== --- stable/12/sys/dev/hwpmc/hwpmc_amd.c Mon Jul 20 13:37:14 2020 (r363365) +++ stable/12/sys/dev/hwpmc/hwpmc_amd.c Mon Jul 20 13:50:10 2020 (r363366) @@ -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__) Modified: stable/12/sys/dev/hwpmc/hwpmc_intel.c ============================================================================== --- stable/12/sys/dev/hwpmc/hwpmc_intel.c Mon Jul 20 13:37:14 2020 (r363365) +++ stable/12/sys/dev/hwpmc/hwpmc_intel.c Mon Jul 20 13:50:10 2020 (r363366) @@ -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) {