From owner-svn-src-all@freebsd.org Thu May 31 22:26:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB232F789B0; Thu, 31 May 2018 22:26:51 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 898D983E6E; Thu, 31 May 2018 22:26:51 +0000 (UTC) (envelope-from mmacy@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 6A9152043B; Thu, 31 May 2018 22:26:51 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VMQptJ065919; Thu, 31 May 2018 22:26:51 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VMQp92065918; Thu, 31 May 2018 22:26:51 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805312226.w4VMQp92065918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Thu, 31 May 2018 22:26:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334454 - head/lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/lib/libpmc X-SVN-Commit-Revision: 334454 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.26 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: Thu, 31 May 2018 22:26:52 -0000 Author: mmacy Date: Thu May 31 22:26:50 2018 New Revision: 334454 URL: https://svnweb.freebsd.org/changeset/base/334454 Log: libpmc: add pmu support for uncore events Modified: head/lib/libpmc/libpmc_pmu_util.c (contents, props changed) Modified: head/lib/libpmc/libpmc_pmu_util.c ============================================================================== --- head/lib/libpmc/libpmc_pmu_util.c Thu May 31 22:20:31 2018 (r334453) +++ head/lib/libpmc/libpmc_pmu_util.c Thu May 31 22:26:50 2018 (r334454) @@ -63,6 +63,18 @@ static struct pmu_alias pmu_alias_table[] = { {NULL, NULL}, }; +#ifdef notyet +static struct pmc_event_alias core2_aliases_without_iaf[] = { + EV_ALIAS("branches", "iap-br-inst-retired.any"), + EV_ALIAS("branch-mispredicts", "iap-br-inst-retired.mispred"), + EV_ALIAS("cycles", "tsc-tsc"), + EV_ALIAS("ic-misses", "iap-l1i-misses"), + EV_ALIAS("instructions", "iap-inst-retired.any_p"), + EV_ALIAS("interrupts", "iap-hw-int-rcv"), + EV_ALIAS("unhalted-cycles", "iap-cpu-clk-unhalted.core_p"), + EV_ALIAS(NULL, NULL) +}; +#endif static const char *fixed_mode_cntrs[] = { "inst_retired.any", "cpu_clk_unhalted.thread", @@ -300,7 +312,6 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc int idx, isfixed; iap = &pm->pm_md.pm_iap; - iaf = &pm->pm_md.pm_iaf; isfixed = 0; bzero(iap, sizeof(*iap)); event_name = pmu_alias_get(event_name); @@ -318,6 +329,8 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc if (strcmp(fixed_mode_cntrs[idx], event_name) == 0) isfixed = 1; if (isfixed) { + iaf = &pm->pm_md.pm_iaf; + pm->pm_class = PMC_CLASS_IAF; if (strcasestr(pe->desc, "retired") != NULL) pm->pm_ev = PMC_EV_IAF_INSTR_RETIRED_ANY; else if (strcasestr(pe->desc, "core") != NULL || @@ -330,11 +343,14 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc iaf->pm_iaf_flags |= IAF_ANY; if (pm->pm_caps & PMC_CAP_INTERRUPT) iaf->pm_iaf_flags |= IAF_PMI; - pm->pm_class = PMC_CLASS_IAF; return (0); + } else if (strcasestr(event_name, "UNC_") == event_name || + strcasestr(event_name, "uncore") != NULL) { + pm->pm_class = PMC_CLASS_UCP; + } else { + pm->pm_caps |= PMC_CAP_QUALIFIER; + pm->pm_class = PMC_CLASS_IAP; } - pm->pm_caps |= PMC_CAP_QUALIFIER; - pm->pm_class = PMC_CLASS_IAP; pm->pm_ev = idx; iap->pm_iap_config |= IAP_EVSEL(ped.ped_event); iap->pm_iap_config |= IAP_UMASK(ped.ped_umask);