From: Michael Petlan mpetlan@redhat.com
[redhat] perf: enable CoreSight support
Bugzilla: https://bugzilla.redhat.com/1877192
Decoding CoreSight needs opencsd-devel package at build-time and opencsd package as runtime dependency. This feature is aarch64-only.
Signed-off-by: Michael Petlan mpetlan@redhat.com
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template index blahblah..blahblah 100755 --- a/redhat/kernel.spec.template +++ b/redhat/kernel.spec.template @@ -550,6 +550,9 @@ BuildRequires: libtraceevent-devel %ifnarch %{arm} s390x BuildRequires: numactl-devel %endif +%ifarch aarch64 +BuildRequires: opencsd-devel >= 1.0.0-2 +%endif %endif %if %{with_tools} BuildRequires: gettext ncurses-devel @@ -2073,8 +2076,11 @@ InitBuildVars %endif %endif
+%ifarch aarch64 +%global perf_build_extra_opts CORESIGHT=1 +%endif %global perf_make \ - %{__make} %{?make_opts} EXTRA_CFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags}" %{?cross_opts} -C tools/perf V=1 NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 NO_BIONIC=1 LIBBPF_DYNAMIC=1 LIBTRACEEVENT_DYNAMIC=1 prefix=%{_prefix} PYTHON=%{__python3} + %{__make} %{?make_opts} EXTRA_CFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags}" %{?cross_opts} -C tools/perf V=1 NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 NO_BIONIC=1 LIBBPF_DYNAMIC=1 LIBTRACEEVENT_DYNAMIC=1 %{?perf_build_extra_opts} prefix=%{_prefix} PYTHON=%{__python3} %if %{with_perf} # perf # make sure check-headers.sh is executable
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1167
From: Mark Salter on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1167#note_5958162...
Acked-by: Mark Salter msalter@redhat.com (via approve button)
From: Justin Forbes on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1167#note_5958255...
Curious on this, as Fedora has been building with CORESIGHT for a bit now (since July 2020). We did not case the changes on arch, and simply added openscd-devel as a buildreq for everyone and pass CORESIGHT=1 to perf_make. This builds fine across all arches, even though it is unnecessary. As coresight is an arm specific thing, it is really only used in arch/arm/util/ files and shouldn't be a problem for other architectures. Which makes me ask, do we trade spec complexity for more specific build command line, or do we go the simple spec route and expect it to continue working?
From: Michael Petlan on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1167#note_5965007...
Justin Forbes commented:
Curious on this, as Fedora has been building with CORESIGHT for a bit now
(since July 2020). We did not case the changes on arch, and simply added openscd-devel as a buildreq for everyone and pass CORESIGHT=1
to perf_make. This builds fine across all arches, even though it is
unnecessary. As coresight is an arm specific thing, it is really only used in arch/arm/util/ files and shouldn't be a problem for other
architectures. Which makes me ask, do we trade spec complexity for more
specific build command line, or do we go the simple spec route and expect it to continue working?
I prefer cutting this down to be arm-specific and "trade the spec file complexity", since I see no reason for x86 (and other arch) customers (which I believe is a majority) to install completely useless packages.
I tend to the idea that we should keep RHEL composes tiny, since it looks that this is the strategy for it as a platform. And sacrificing few more lines in spec to this is not that high price. Also, there already are arch- specific build-reqs.
A better question is, whether linking opencsd would allow the x86 users to e.g. analyse the coresight trace from perf.data obtained on aarch64. In such case, it would make sense. But, to be honest, I don't see this ability there, I haven't noticed any customer interest in that, any mention in the docs about it (maybe I am missing something!), so I decided this way.
But as I say, extended functionality is an argument for linking it everywhere, spec simplicity seems not to be enough in my opinion.
From: Justin Forbes on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1167#note_5967804...
I prefer cutting this down to be arm-specific and "trade the spec file
complexity", since I see no reason for x86 (and other arch) customers (which I believe is a majority) to install completely useless packages.
This is valid. I wasn't thinking about the dep on install, only the build side. As I didn't make the original change in Fedora, I was just verifying that we had this functionality and saw how it was put in.
A better question is, whether linking opencsd would allow the x86 users to
e.g. analyse the coresight trace from perf.data obtained on aarch64. In such case, it would make sense.
I would have to look at the code to see, or Fedora has been built this way for about a year, so any existing Fedora perf package should be a valid way to test.
From: Justin Forbes on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1167#note_5967813...
Acked-by: Justin Forbes jforbes@fedoraproject.org (via approve button)
kernel@lists.fedoraproject.org