From nobody Thu Apr 16 15:28:22 2026 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 4fxMNX2ylGz6Zr3n for ; Thu, 16 Apr 2026 15:28:28 +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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fxMNW4hswz3FsW for ; Thu, 16 Apr 2026 15:28:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776353307; 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=YRwGIqNiZ1mV9427WFnhXshrdGNsaATJtNAzAW3NU14=; b=ID61AFZBQFjnxAEngbzUmBAvLcjifQP8Ws4UfmrCSm2ygpqCTlN3/Fs79p/1u1/+c6k9/J +Cmcfpbn+aWTTcgQ9aWW4FYMAfzemrcaxqP/LxrCk2Y3BkR8yObeClcaI4BHp1r2tVn8tH FiDMeOOI8Nol35myUSS79zXDckuIHddk+ZBZHNG95F1OGpczxmeGGk8nF62T5FBL7jEwFZ 7eUO3snVoHOPLAssdDUO3F5dUfwwgJBBNilQngHJJc11wutzy01f5iAewsWFT+s+nnsTQy IjIp82BBeD7+UbIgYZznmck7hQeiFrNjHjqTNdTZJS8oG8VBEk+MeNKmNVUf5g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776353307; a=rsa-sha256; cv=none; b=lb+Pk60OGX4z77BUwgNfAF8YFHzOkG6lB1f4Nam4f3ZRj4/MdBX5juzVQW6yYIY3bpTk8t b7MmyreZbN7angEnLSSen8E8M6jgcgso/ArtwZ0/v7FV0VrOa7RgnEuyI0sBpDwmKPA2Gh p1afcxmiskrDXcWM+2TiTk0GiMRsLL692npABwrRNDMtxDRXv4W6Ud2sa7sGXrdpr1MRnb f46njE6uLXJVpgOe+lfEfbXNDOlvs3wnoPJ307JLxNP86DP6bFDrDEBVSiQs0MGn4Xd284 rZeiXHLMuFRN459P5z7qgO3Jp2Dg/eoLLGnhSPyAzWlQ7P001DyOoYlSeY12Uw== 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=1776353307; 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=YRwGIqNiZ1mV9427WFnhXshrdGNsaATJtNAzAW3NU14=; b=RXxRiioOqrkxxrwbHtXtFH0svd91sXWX1pulnkL2y/gQQnZTYkN3sJCoMhhsUaqzG5C8yL JqYRrDUQwIFfSsMnPWeoxdDuY8JEP45UeqSKC+pnDwQGfEugov2upET82waGeOJFqEpXiU GK4YpGQlHyHiwuzdIehFWnyiAT2a3eiEaxB/jbqOheslu0UiQiiHbBrZfZDmG/tFnRuL5s 7UjeiApFinoAa8xlgXi9qUkgh+hdFmAgTIAUnQBZDgdS/4/ql+g2oGFx9pKwPbb4qIV/l6 0GvvdZR+euP93wHSra6jxmJlOLuRkrYi0RfdWoihGbl7pJmkkdhVnAkYuiidfg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fxMNW4JGzz1C8b for ; Thu, 16 Apr 2026 15:28:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 201ee by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 16 Apr 2026 15:28:22 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Ali Mashtizadeh From: Mitchell Horne Subject: git: f0b8806a73fd - stable/15 - libpmc: Fix the L3 counters for AMD Zen 1-4 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: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-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/15 X-Git-Reftype: branch X-Git-Commit: f0b8806a73fddef14757469dfb383130c636897f Auto-Submitted: auto-generated Date: Thu, 16 Apr 2026 15:28:22 +0000 Message-Id: <69e10016.201ee.a1ba7a4@gitrepo.freebsd.org> The branch stable/15 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=f0b8806a73fddef14757469dfb383130c636897f commit f0b8806a73fddef14757469dfb383130c636897f Author: Ali Mashtizadeh AuthorDate: 2026-01-23 05:34:13 +0000 Commit: Mitchell Horne CommitDate: 2026-04-16 15:10:59 +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 (cherry picked from commit c215eef345501ce7dda374909b3195d9d69a4e9f) --- 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); }