From nobody Tue Feb 3 15:29:31 2026 X-Original-To: dev-commits-src-main@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 4f56q01VpLz6PjBf for ; Tue, 03 Feb 2026 15:29:32 +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 "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4f56q00Rgbz446f for ; Tue, 03 Feb 2026 15:29:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770132572; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ke9ytzhvfaZex6aL2t2eXssCfQGbmsdqzOpBIADKZqw=; b=qrLY3FclTY+dgZSzbHqBKYZD6piahyDLjHJJ2KklU0xXdu4qeXYD4fcyE3YK0tIe+gaFFq Ws1Yr5Y/8zo9D6cR9NthlNxdy5/yTqC9B2j4QbsfRT6jZ50QGj5tPc62HliNwEVotIQsrX VEHy8X5y7Untb2+eppxAWC5UAujVD8kHOH/NIYDm5+rNGMDEyMQB1W4LtgM9fkcolA4t5V 7nPFBPxRKy0WwDxPYhenkjqqVAA8Ayq07R6NuMzGZuS92sxdEYodjPQ16B9G6nejU8xQDM PB/ODmtbba/osck2BUge0FqMlLDi0S5S9xqDiHreA+QWn5YAafV2yPZq6vIlpQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1770132572; a=rsa-sha256; cv=none; b=g1YiLqVNBfmgAp59xT6pyBzlDNVpFXRL4JQh8AMoaJJLep8AZbhNH5tq/jY0BTosvyOj+z vWc7yTAv2zpOqWup1umoU0oHSxnecebhb40hSB4Tw4CUQi805Tgma2gyu/2b76HElB5pM7 Y6sdxTGC7KNByUX2+r1cM7v0pJgl+3cd3CtSK+MhH4/fWbPQNIU3N8bX2bwDjK4IINq0FG pKC1yLzGseU33uaZUDoF0ufGY3tIlPKrgadE5INRGjSgDut31ITJuZuMPiDI163HWc8MO4 vt2bx2ZN2/OIHp1bh34U7UKEFYi1D5o9DCWpjJlqC3EJ/OFjMHCMKQalm6vIpA== 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=1770132572; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ke9ytzhvfaZex6aL2t2eXssCfQGbmsdqzOpBIADKZqw=; b=IT6sCf9eiJSyxgCJV+Rl+4vGG/ByskXia9xWU6iUEfwcdMKfTpKrUiVyoJ3rjN1WJXCHvk Wth6Cu6yN1bB8qetEDdseBErFo+fpKpyVicaBG+ojequom5tjI/ANacHu6WrPJsAtTxRKG JsbWr23y+m2ajE39wbP+ADdx7+itEakBYeBX2JAn8cgLLwOANvkJTbw+W+zjzYTKulsQIN l3jorUpD3CkHYHb01ziy68dvYBawRosWed2cvwXymECGA2oEc8HJFsA7K/QkrS9SzLuoTl WY7V3UoeqmrN5nsgw/L9kC7T+7vMKaPgvBgegqK480zHuZZI1ECPcYAVythsPQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4f56pz6c8Mz3vd for ; Tue, 03 Feb 2026 15:29:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 432d5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 03 Feb 2026 15:29:31 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Ali Mashtizadeh From: Mitchell Horne Subject: git: c215eef34550 - main - libpmc: Fix the L3 counters for AMD Zen 1-4 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: c215eef345501ce7dda374909b3195d9d69a4e9f Auto-Submitted: auto-generated Date: Tue, 03 Feb 2026 15:29:31 +0000 Message-Id: <6982145b.432d5.1111fadc@gitrepo.freebsd.org> The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=c215eef345501ce7dda374909b3195d9d69a4e9f commit c215eef345501ce7dda374909b3195d9d69a4e9f Author: Ali Mashtizadeh AuthorDate: 2026-01-23 05:34:13 +0000 Commit: Mitchell Horne CommitDate: 2026-02-03 15:21:50 +0000 libpmc: Fix the L3 counters for AMD Zen 1-4 On AMD processors libpmc was using the topic field (based on filename) to determine the counter's subclass. Unfortunately, the JSON definitions for AMD Zen 1-4 have the L3 counters in files shared with other counters. This change has libpmc to use the pmu field (which is derived from the Unit field in JSON) to determine the correct counter subclass. Reviewed by: mhorne MFC after: 2 weeks Sponsored by: Netflix Pull Request: https://github.com/freebsd/freebsd-src/pull/1984 --- lib/libpmc/libpmc_pmu_util.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index 74a93ae963d7..de642aa71a18 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -498,18 +498,7 @@ pmc_pmu_amd_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm, pm->pm_class = PMC_CLASS_K8; pe = pmu_event_get(NULL, event_name, &idx); - if (strcmp("l3cache", pe->topic) == 0){ - amd->pm_amd_config |= AMD_PMC_TO_EVENTMASK(ped->ped_event); - amd->pm_amd_sub_class = PMC_AMD_SUB_CLASS_L3_CACHE; - amd->pm_amd_config |= AMD_PMC_TO_L3SLICE(ped->ped_l3_slice); - amd->pm_amd_config |= AMD_PMC_TO_L3CORE(ped->ped_l3_thread); - } - else if (strcmp("data fabric", pe->topic) == 0){ - - amd->pm_amd_config |= AMD_PMC_TO_EVENTMASK_DF(ped->ped_event); - amd->pm_amd_sub_class = PMC_AMD_SUB_CLASS_DATA_FABRIC; - } - else{ + if (pe->pmu == NULL) { amd->pm_amd_config |= AMD_PMC_TO_EVENTMASK(ped->ped_event); amd->pm_amd_sub_class = PMC_AMD_SUB_CLASS_CORE; if ((pm->pm_caps & (PMC_CAP_USER|PMC_CAP_SYSTEM)) == 0 || @@ -526,7 +515,19 @@ pmc_pmu_amd_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm, amd->pm_amd_config |= AMD_PMC_INVERT; if (pm->pm_caps & PMC_CAP_INTERRUPT) amd->pm_amd_config |= AMD_PMC_INT; + } else if (strcmp("amd_l3", pe->pmu) == 0) { + amd->pm_amd_config |= AMD_PMC_TO_EVENTMASK(ped->ped_event); + amd->pm_amd_sub_class = PMC_AMD_SUB_CLASS_L3_CACHE; + amd->pm_amd_config |= AMD_PMC_TO_L3SLICE(ped->ped_l3_slice); + amd->pm_amd_config |= AMD_PMC_TO_L3CORE(ped->ped_l3_thread); + } else if (strcmp("amd_df", pe->pmu) == 0) { + amd->pm_amd_config |= AMD_PMC_TO_EVENTMASK_DF(ped->ped_event); + amd->pm_amd_sub_class = PMC_AMD_SUB_CLASS_DATA_FABRIC; + } else { + printf("PMC pmu '%s' is not supported!\n", pe->pmu); + return (EOPNOTSUPP); } + return (0); }