From nobody Tue Feb 3 15:29:31 2026 X-Original-To: dev-commits-src-all@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 4f56q50xn7z6PjHW for ; Tue, 03 Feb 2026 15:29:37 +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 4f56q50D33z44Dd for ; Tue, 03 Feb 2026 15:29:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770132577; 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=qvHz4y/RJZNvxc88fVigQyOYxFcT09amNGMMdiNH5gW9LEk66YZGMg460mHRxVLNcK6Ozy Ey2WG8vAgu1D4FtWZlZds4cS1fc0j55MEkTE/7ZturIZYMwVSWCASwlIScaVdB18OQ1K3i cnG1UyladYDaa3B0kO621Ql1/lPiiTshm81qoiuuA5OsMzoamEf14DKbELv0cikk6ZL+nq s9my7goLEmJThrli6daaKiHKEowkh9i97qu/gR3xpAvG7CAcIZD9+KD3fwjXsQSHy89diy LC4BfpovZC7FQH2LiwOfuq5zSYj2LWaP2bxR8AEDahlGy+m7IxfW0qDWgaNJqA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1770132577; a=rsa-sha256; cv=none; b=KV6z0kzvBDyDLd9YeX97tMUzquxhH/+v0WSfSCF+u5Ey8HluG2DtQMoVjsFT7oqiJK3ZeN 2H7w+kloHPKDw2/9mpvr1lfvW+pw4puA5kpwfIMMeK0U3L2aSWwe0N5Xpg3wMeh3W+iMgm J/QJ5GfZ13bDpU5DFhA3+os+Fx9abbL5EQS6rSsVlkZI000gJEWOmZm+En6nj+3pNlRHgq yMOQ6e6RE+plBm2d2FUx4KwGT6YaTtw1rg8ZXwqNNveFq/K0ksOvSRr7rGxCXsDeMTwI7n SJoi2k9adHhdJkiyuS1xpdW3kTBSFzkGmCXjfbD8JHGtkfqggTTVUI3w7hH5aA== 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=1770132577; 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=fxcOFVRje1TR3Hx73Cb6GjINlPgn18s1cl2G/bDdVhY1xYMgcrDmbVFdhNjXBMCx3LYZyh sGLNimWSn31zTKPU8lWP1EYLs5193UI8UamnQTQiCffJ/MYLI8AT0AuX3n4YVl7o2ffuZJ Rg1rd77PNx7OZnLUwEKQlaNrtWoc+oETaEjqxtYCwUWMo1hJD42U6bc7BfZ/+0zFYAjg7D jdWOKG3Dx5ewlRvd1s/6dBdMwPwUzGmiQJbXol70+jqIVu0/hHe5Sp80jyqHSYjrhnzBN0 u96VQB/UU8NF5QYPIxAKUrd4RalsMY90XbzFnYT4Kk60MyaUgbs2XpJCGzrsbQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4f56pz6YhMz3vc 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 all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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); }