AMD Zen4 Bergamo CPU support in libpfm

Related: #2111973
This commit is contained in:
William Cohen 2023-06-12 15:49:31 -04:00
parent 920e240af3
commit 1d152fc597
2 changed files with 35 additions and 1 deletions

29
libpfm-zen4.patch Normal file
View File

@ -0,0 +1,29 @@
commit 1befa3d200cc17d5a278fcb2f597c4876c58f949
Author: Stephane Eranian <eranian@gmail.com>
Date: Tue Apr 25 00:35:41 2023 -0700
fix AMD Zen3/Zen4 detection
To cover more models of Zen4.
Signed-off-by: Stephane Eranian <eranian@gmail.com>
diff --git a/lib/pfmlib_amd64.c b/lib/pfmlib_amd64.c
index e51a43d..0c6702d 100644
--- a/lib/pfmlib_amd64.c
+++ b/lib/pfmlib_amd64.c
@@ -181,10 +181,10 @@ amd64_get_revision(pfm_amd64_config_t *cfg)
} else if (cfg->family == 22) { /* family 16h */
rev = PFM_PMU_AMD64_FAM16H;
} else if (cfg->family == 25) { /* family 19h */
- if (cfg->model <= 0x0f || (cfg->model >= 0x20 && cfg->model <= 0x5f)) {
- rev = PFM_PMU_AMD64_FAM19H_ZEN3;
- } else if (cfg->model == 17) {
- rev = PFM_PMU_AMD64_FAM19H_ZEN4;
+ if (cfg->model >= 0x60 || (cfg->model >= 0x10 && cfg->model <= 0x1f)) {
+ rev = PFM_PMU_AMD64_FAM19H_ZEN4;
+ } else {
+ rev = PFM_PMU_AMD64_FAM19H_ZEN3;
}
}

View File

@ -10,7 +10,7 @@
Name: libpfm
Version: 4.13.0
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Library to encode performance events for use by perf tool
@ -20,6 +20,7 @@ URL: http://perfmon2.sourceforge.net/
Source0: http://sourceforge.net/projects/perfmon2/files/libpfm4/%{name}-%{version}.tar.gz
Patch2: libpfm-python3-setup.patch
Patch3: libpfm-initp.patch
Patch4: libpfm-zen4.patch
%if %{with python}
BuildRequires: python3
@ -71,6 +72,7 @@ Python bindings for libpfm4 and perf_event_open system call.
%setup -q
%patch2 -p1 -b .python3
%patch3 -p1 -b .test
%patch4 -p1 -b .zen4
%build
%if %{with python}
@ -119,6 +121,9 @@ make \
%endif
%changelog
* Mon Jun 12 2023 William cohen <wcohen@redhat.com> - 4.13.0-4
- Identify AMD Bergamo processors.
* Wed May 3 2023 William cohen <wcohen@redhat.com> - 4.13.0-3
- Rebuild for rhbz #2161146.