AMD Zen4 Bergamo CPU support in libpfm

This commit is contained in:
William Cohen 2023-06-12 15:29:47 -04:00 committed by root
parent b55b221c0e
commit dfd1326a7e
3 changed files with 36 additions and 1 deletions

1
.libpfm.metadata Normal file
View File

@ -0,0 +1 @@
bcb52090f02bc7bcb5ac066494cd55bbd5084e65 libpfm-4.13.0.tar.gz

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

@ -12,7 +12,7 @@
Name: libpfm
Version: 4.13.0
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Library to encode performance events for use by perf tool
@ -21,6 +21,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
BuildRequires: make
BuildRequires: gcc
@ -73,6 +74,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}
@ -126,6 +128,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a
%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 #2186927.