From nobody Mon Sep 11 19:20:11 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RkxPR5j0jz4sfdP; Mon, 11 Sep 2023 19:20:11 +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 4RkxPR5Httz3blM; Mon, 11 Sep 2023 19:20:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694460011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gqa9nQySvhcOzWgf5dMbWbB8DBSWGErAmtCecA8eU98=; b=btCGpEgXzhUL6kXEWFoEwNrq6dAW888UbXgcCOqrJF13GCBAniIp65tLy3N3vaOPRxDvUe onzrnXa4wLJR/DFf63HfJDqBZwj19QQWFGy6YI6//BcglKzAJF1qZXih6lvntBMVg0wj3c VDoprR7YyIXBvm7lCxpF21aSI6XlgR2Jiyxx4xXUMkz83aGqW2ww+Q4jXmQLXlqiVyYFK7 qvt7pGlWyN69Bt4UeupcKyyJx1IjV0mk7DWIXfk47B1eHMCDzQZtce1010LILYN0FfpkQW 84Uh8Z5HDdkQeexVCfgjk3KFVHZLGQ6CoqjydNJnFgoicQ5qmEDX0mbYPptY2Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694460011; a=rsa-sha256; cv=none; b=SLFDitTK8wyXjrAYg/9MrRWCleH49eBleeviDmsyK52FexrEqp48Ooh6HdsnQOt3qUcIPt pUmkWPqaFQ7kEkKCZkJGCDIDPZQiGnUtd8usBOk4f1/7ie6rSQmuuLvjdOhBLiMPKWOC7O h1JXd3XPqNEXCgOv66aX5kY+lJymtNSBYCDOvt8UwaGOcC9Ur/mdRJakX82+IbgRSTFdeb qK6ZjliKzS4lEVQjYvwXiMjRa5+n9NEHkEqUo0nn39E7tMDR7Xu7C28Ykc+ptuBUVrHAZk Tm1CaAPnmO+7tH8TNVB5MkUFFCFJreAF1dg6+L2wqUt6bCuJKiUQkZf3hisCoQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694460011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gqa9nQySvhcOzWgf5dMbWbB8DBSWGErAmtCecA8eU98=; b=Lv4wEtQFKe19IEn+EQGQxPMKlrcY5HIx+45a/HTKTjQ07PFrBmmhO1wbIt5INnbr0Rwfhc sCLEMAws5z61fYPq2Lpce3kYKLfGRt6/J6i7RNWgG6YXh7A1plBXaVt/nVkTsOTtoT0JGq XgkXU+ou3XyGWqeQsFRJvTuKxAf/+chqJwGSRxgUgqbn5MVCE0grDN6SqyDQBqhFaNzyNR YZb33jaI6SF8WieghwZMHYSc5mbE4b+jnLfSnlo1dgM6zhNcC7oBqySQD5uV8JiSZTISFP pQ5aI/5c1sHfCc465jNhzIxsp7naaMDQXkO4GR8mqjGDOBzI+undA/7qprTljQ== 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 4RkxPR4HhGz120Q; Mon, 11 Sep 2023 19:20:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38BJKBdF029648; Mon, 11 Sep 2023 19:20:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38BJKBgE029639; Mon, 11 Sep 2023 19:20:11 GMT (envelope-from git) Date: Mon, 11 Sep 2023 19:20:11 GMT Message-Id: <202309111920.38BJKBgE029639@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: 196bb0e152cf - stable/14 - libpmc: make pmc_pmu_pmcallocate() machine-independent List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org 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/14 X-Git-Reftype: branch X-Git-Commit: 196bb0e152cf2d3a0ba61bda8a2d09c8107a809a Auto-Submitted: auto-generated The branch stable/14 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=196bb0e152cf2d3a0ba61bda8a2d09c8107a809a commit 196bb0e152cf2d3a0ba61bda8a2d09c8107a809a Author: Mitchell Horne AuthorDate: 2023-06-19 22:32:22 +0000 Commit: Mitchell Horne CommitDate: 2023-09-11 19:19:58 +0000 libpmc: make pmc_pmu_pmcallocate() machine-independent Have it call the platform-dependent version. For better layering, move the reset logic inside the new function. This is mainly to facilitate an upcoming change. Reviewed by: jkoshy MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40752 (cherry picked from commit 45dcc17e2fb8f0f9838ba167b311f271a08fcea9) --- lib/libpmc/libpmc.c | 5 ----- lib/libpmc/libpmc_pmu_util.c | 34 ++++++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index 71fba89237ff..a7ed1c3d9ac8 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -1091,11 +1091,6 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, assert(pmc_config.pm_ev < PMC_EVENT_FIRST); goto found; } - - /* Otherwise, reset any changes */ - pmc_config.pm_ev = 0; - pmc_config.pm_caps = 0; - pmc_config.pm_class = 0; } free(spec_copy); spec_copy = NULL; diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index a61f81f7d2c7..772dec7a9d53 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -572,8 +572,8 @@ pmc_pmu_intel_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm, return (0); } -int -pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) +static int +pmc_pmu_pmcallocate_md(const char *event_name, struct pmc_op_pmcallocate *pm) { const struct pmu_event *pe; struct pmu_event_desc ped; @@ -604,8 +604,8 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) #elif defined(__powerpc64__) -int -pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) +static int +pmc_pmu_pmcallocate_md(const char *event_name, struct pmc_op_pmcallocate *pm) { const struct pmu_event *pe; struct pmu_event_desc ped; @@ -631,8 +631,8 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) #elif defined(__aarch64__) -int -pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) +static int +pmc_pmu_pmcallocate_md(const char *event_name, struct pmc_op_pmcallocate *pm) { const struct pmu_event *pe; struct pmu_event_desc ped; @@ -658,9 +658,27 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) #else -int -pmc_pmu_pmcallocate(const char *e __unused, struct pmc_op_pmcallocate *p __unused) +static int +pmc_pmu_pmcallocate_md(const char *e __unused, struct pmc_op_pmcallocate *p __unused) { return (EOPNOTSUPP); } #endif + +int +pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) +{ + int error; + + error = pmc_pmu_pmcallocate_md(event_name, pm); + if (error != 0) { + /* Reset any changes. */ + pm->pm_ev = 0; + pm->pm_caps = 0; + pm->pm_class = 0; + + return (error); + } + + return (0); +}