From owner-dev-commits-src-branches@freebsd.org Thu Jul 29 15:25:18 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 91A7B675BCD; Thu, 29 Jul 2021 15:25:18 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbDqf2lTtz4t2s; Thu, 29 Jul 2021 15:25:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26F47141E9; Thu, 29 Jul 2021 15:25:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16TFPIbe009678; Thu, 29 Jul 2021 15:25:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16TFPI03009677; Thu, 29 Jul 2021 15:25:18 GMT (envelope-from git) Date: Thu, 29 Jul 2021 15:25:18 GMT Message-Id: <202107291525.16TFPI03009677@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 57caeb5109ee - stable/13 - libpmc: remove PMC_MDEP_TABLE logic MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 57caeb5109ee3f385fbabb667eca9588588bcc52 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:25:18 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=57caeb5109ee3f385fbabb667eca9588588bcc52 commit 57caeb5109ee3f385fbabb667eca9588588bcc52 Author: Mitchell Horne AuthorDate: 2021-05-13 19:00:07 +0000 Commit: Mitchell Horne CommitDate: 2021-07-29 15:01:09 +0000 libpmc: remove PMC_MDEP_TABLE logic This logic was added for handling some of the complicated relationships between events and x86 CPU models. Since that logic has been mostly removed from libpmc(3) in favor of pmu-events, this no longer serves much of a purpose. Mapping CPU types to event tables is already handled by the switch statement in pmc_init(). Reviewed by: ray, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30196 (cherry picked from commit da13ef6aa0565c8d79326bba5606671062033bbf) --- lib/libpmc/libpmc.c | 54 ++++------------------------------------------------- 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index e66ec5822226..6636c974cb73 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -177,32 +177,6 @@ static const struct pmc_event_descr cortex_a76_event_table[] = __PMC_EV_ALIAS_ARMV8_CORTEX_A76() }; -/* - * PMC_MDEP_TABLE(NAME, PRIMARYCLASS, ADDITIONAL_CLASSES...) - * - * Map a CPU to the PMC classes it supports. - */ -#define PMC_MDEP_TABLE(N,C,...) \ - static const enum pmc_class N##_pmc_classes[] = { \ - PMC_CLASS_##C, __VA_ARGS__ \ - } - -PMC_MDEP_TABLE(k8, K8, PMC_CLASS_SOFT, PMC_CLASS_TSC); -PMC_MDEP_TABLE(beri, BERI, PMC_CLASS_SOFT, PMC_CLASS_BERI); -PMC_MDEP_TABLE(cortex_a8, ARMV7, PMC_CLASS_SOFT, PMC_CLASS_ARMV7); -PMC_MDEP_TABLE(cortex_a9, ARMV7, PMC_CLASS_SOFT, PMC_CLASS_ARMV7); -PMC_MDEP_TABLE(cortex_a53, ARMV8, PMC_CLASS_SOFT, PMC_CLASS_ARMV8); -PMC_MDEP_TABLE(cortex_a57, ARMV8, PMC_CLASS_SOFT, PMC_CLASS_ARMV8); -PMC_MDEP_TABLE(cortex_a76, ARMV8, PMC_CLASS_SOFT, PMC_CLASS_ARMV8); -PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_SOFT, PMC_CLASS_MIPS24K); -PMC_MDEP_TABLE(mips74k, MIPS74K, PMC_CLASS_SOFT, PMC_CLASS_MIPS74K); -PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_SOFT, PMC_CLASS_OCTEON); -PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_SOFT, PMC_CLASS_PPC7450, PMC_CLASS_TSC); -PMC_MDEP_TABLE(ppc970, PPC970, PMC_CLASS_SOFT, PMC_CLASS_PPC970, PMC_CLASS_TSC); -PMC_MDEP_TABLE(power8, POWER8, PMC_CLASS_SOFT, PMC_CLASS_POWER8, PMC_CLASS_TSC); -PMC_MDEP_TABLE(e500, E500, PMC_CLASS_SOFT, PMC_CLASS_E500, PMC_CLASS_TSC); -PMC_MDEP_TABLE(generic, SOFT, PMC_CLASS_SOFT); - static const struct pmc_event_descr tsc_event_table[] = { __PMC_EV_TSC() @@ -264,9 +238,6 @@ static struct pmc_class_descr soft_class_table_descr = static const struct pmc_class_descr **pmc_class_table; #define PMC_CLASS_TABLE_SIZE cpu_info.pm_nclass -static const enum pmc_class *pmc_mdep_class_list; -static size_t pmc_mdep_class_list_size; - /* * Mapping tables, mapping enumeration values to human readable * strings. @@ -985,17 +956,6 @@ pmc_match_event_class(const char *name, return (NULL); } -static int -pmc_mdep_is_compatible_class(enum pmc_class pc) -{ - size_t n; - - for (n = 0; n < pmc_mdep_class_list_size; n++) - if (pmc_mdep_class_list[n] == pc) - return (1); - return (0); -} - /* * API entry points */ @@ -1070,9 +1030,8 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, ev = NULL; for (n = 0; n < PMC_CLASS_TABLE_SIZE; n++) { pcd = pmc_class_table[n]; - if (pcd && pmc_mdep_is_compatible_class(pcd->pm_evc_class) && - strncasecmp(ctrname, pcd->pm_evc_name, - pcd->pm_evc_name_size) == 0) { + if (pcd != NULL && strncasecmp(ctrname, pcd->pm_evc_name, + pcd->pm_evc_name_size) == 0) { if ((ev = pmc_match_event_class(ctrname + pcd->pm_evc_name_size, pcd)) == NULL) { errno = EINVAL; @@ -1088,7 +1047,7 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, */ for (n = 0; ev == NULL && n < PMC_CLASS_TABLE_SIZE; n++) { pcd = pmc_class_table[n]; - if (pcd && pmc_mdep_is_compatible_class(pcd->pm_evc_class)) + if (pcd != NULL) ev = pmc_match_event_class(ctrname, pcd); } @@ -1444,12 +1403,7 @@ pmc_init(void) pmc_class_table[n++] = &tsc_class_table_descr; #endif -#define PMC_MDEP_INIT(C) do { \ - pmc_mdep_event_aliases = C##_aliases; \ - pmc_mdep_class_list = C##_pmc_classes; \ - pmc_mdep_class_list_size = \ - PMC_TABLE_SIZE(C##_pmc_classes); \ - } while (0) +#define PMC_MDEP_INIT(C) pmc_mdep_event_aliases = C##_aliases /* Configure the event name parser. */ switch (cpu_info.pm_cputype) {