diff mbox series

perf: Make built-in libtraceevent plugins cohabit with external libtraceevent

Message ID 20230526012356.175746-1-raj.khem@gmail.com
State New
Headers show
Series perf: Make built-in libtraceevent plugins cohabit with external libtraceevent | expand

Commit Message

Khem Raj May 26, 2023, 1:23 a.m. UTC
This will package the plugins built by perf into kernel specific dir
under libdir, so it does not conflict with plugins from newly added
libtraceevent recipe

Fixes
do_sdk_depends: The file /usr/lib/traceevent/plugins/plugin_cfg80211.so is installed by both perf and libtraceevent, aborting

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Max Krummenacher <max.krummenacher@toradex.com>
---
 meta/recipes-kernel/perf/perf.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Max Krummenacher May 26, 2023, 2:44 a.m. UTC | #1
Hi Khem

On Friday, May 26, 2023, Khem Raj <raj.khem@gmail.com> wrote:
> This will package the plugins built by perf into kernel specific dir
> under libdir, so it does not conflict with plugins from newly added
> libtraceevent recipe
>
> Fixes
> do_sdk_depends: The file /usr/lib/traceevent/plugins/plugin_cfg80211.so
is installed by both perf and libtraceevent, aborting

Starting with kernel version 6.4 libtraceevent is removed from the kernel
sources and perf depends of an externally provided libtraceevent unless
explicitely opted out.

perf.bb with this patch will fail when built with a 6.4 kernel.

I guess as an interim solution building perf on 6.4 without traceevent
would fix the SDK issue you see with older kernels.
I could then try out how to build perf with an external libtraceevent also
for older kernels (LIBTRACEEVENT_DYNAMIC) so that it would work for all
kernel/perf versions.

Regards
Max
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> Cc: Max Krummenacher <max.krummenacher@toradex.com>
> ---
>  meta/recipes-kernel/perf/perf.bb | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/
perf.bb
> index 67b01a7f65a..d31f59f460b 100644
> --- a/meta/recipes-kernel/perf/perf.bb
> +++ b/meta/recipes-kernel/perf/perf.bb
> @@ -137,6 +137,8 @@ PERF_EXTRA_LDFLAGS:mipsarchn64el = "-m elf64ltsmip"
>  do_compile() {
>         # Linux kernel build system is expected to do the right thing
>         unset CFLAGS
> +       sed -i -e
's|\$(libdir)/traceevent/plugins|\$(libdir)/traceevent_${KERNEL_VERSION}/plugins|g'
${S}/tools/lib/traceevent/plugins/Makefile
> +       sed -i -e
's|\$(libdir)/traceevent/plugins|\$(libdir)/traceevent_${KERNEL_VERSION}/plugins|g'
${S}/tools/perf/Makefile.config
>         oe_runmake all
>  }
>
> @@ -364,7 +366,7 @@ RSUGGESTS_SCRIPTING =
"${@bb.utils.contains('PACKAGECONFIG', 'scripting', '${PN}
>  RSUGGESTS:${PN} += "${PN}-archive ${PN}-tests ${RSUGGESTS_SCRIPTING}"
>
>  FILES_SOLIBSDEV = ""
> -FILES:${PN} += "${libexecdir}/perf-core ${exec_prefix}/libexec/perf-core
${libdir}/traceevent ${libdir}/libperf-jvmti.so"
> +FILES:${PN} += "${libexecdir}/perf-core ${exec_prefix}/libexec/perf-core
${libdir}/traceevent* ${libdir}/libperf-jvmti.so"
>  FILES:${PN}-archive = "${libdir}/perf/perf-core/perf-archive"
>  FILES:${PN}-tests = "${libdir}/perf/perf-core/tests
${libexecdir}/perf-core/tests"
>  FILES:${PN}-python = " \
> --
> 2.40.1
>
>
Khem Raj May 26, 2023, 3:14 a.m. UTC | #2
On Thu, May 25, 2023 at 7:44 PM Max Krummenacher <max.oss.09@gmail.com>
wrote:

> Hi Khem
>
> On Friday, May 26, 2023, Khem Raj <raj.khem@gmail.com> wrote:
> > This will package the plugins built by perf into kernel specific dir
> > under libdir, so it does not conflict with plugins from newly added
> > libtraceevent recipe
> >
> > Fixes
> > do_sdk_depends: The file /usr/lib/traceevent/plugins/plugin_cfg80211.so
> is installed by both perf and libtraceevent, aborting
>
> Starting with kernel version 6.4 libtraceevent is removed from the kernel
> sources and perf depends of an externally provided libtraceevent unless
> explicitely opted out.
>
> perf.bb with this patch will fail when built with a 6.4 kernel.
>

Why will it fail ?


> I guess as an interim solution building perf on 6.4 without traceevent
> would fix the SDK issue you see with older kernels.
> I could then try out how to build perf with an external libtraceevent also
> for older kernels (LIBTRACEEVENT_DYNAMIC) so that it would work for all
> kernel/perf versions.
>
> Regards
> Max
> >
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > Cc: Max Krummenacher <max.krummenacher@toradex.com>
> > ---
> >  meta/recipes-kernel/perf/perf.bb | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/meta/recipes-kernel/perf/perf.bb
> b/meta/recipes-kernel/perf/perf.bb
> > index 67b01a7f65a..d31f59f460b 100644
> > --- a/meta/recipes-kernel/perf/perf.bb
> > +++ b/meta/recipes-kernel/perf/perf.bb
> > @@ -137,6 +137,8 @@ PERF_EXTRA_LDFLAGS:mipsarchn64el = "-m elf64ltsmip"
> >  do_compile() {
> >         # Linux kernel build system is expected to do the right thing
> >         unset CFLAGS
> > +       sed -i -e
> 's|\$(libdir)/traceevent/plugins|\$(libdir)/traceevent_${KERNEL_VERSION}/plugins|g'
> ${S}/tools/lib/traceevent/plugins/Makefile
> > +       sed -i -e
> 's|\$(libdir)/traceevent/plugins|\$(libdir)/traceevent_${KERNEL_VERSION}/plugins|g'
> ${S}/tools/perf/Makefile.config
> >         oe_runmake all
> >  }
> >
> > @@ -364,7 +366,7 @@ RSUGGESTS_SCRIPTING =
> "${@bb.utils.contains('PACKAGECONFIG', 'scripting', '${PN}
> >  RSUGGESTS:${PN} += "${PN}-archive ${PN}-tests ${RSUGGESTS_SCRIPTING}"
> >
> >  FILES_SOLIBSDEV = ""
> > -FILES:${PN} += "${libexecdir}/perf-core
> ${exec_prefix}/libexec/perf-core ${libdir}/traceevent
> ${libdir}/libperf-jvmti.so"
> > +FILES:${PN} += "${libexecdir}/perf-core
> ${exec_prefix}/libexec/perf-core ${libdir}/traceevent*
> ${libdir}/libperf-jvmti.so"
> >  FILES:${PN}-archive = "${libdir}/perf/perf-core/perf-archive"
> >  FILES:${PN}-tests = "${libdir}/perf/perf-core/tests
> ${libexecdir}/perf-core/tests"
> >  FILES:${PN}-python = " \
> > --
> > 2.40.1
> >
> >
Max Krummenacher May 26, 2023, 5:09 a.m. UTC | #3
On Friday, May 26, 2023, Khem Raj <raj.khem@gmail.com> wrote:
>
>
> On Thu, May 25, 2023 at 7:44 PM Max Krummenacher <max.oss.09@gmail.com>
wrote:
>>
>> Hi Khem
>>
>> On Friday, May 26, 2023, Khem Raj <raj.khem@gmail.com> wrote:
>> > This will package the plugins built by perf into kernel specific dir
>> > under libdir, so it does not conflict with plugins from newly added
>> > libtraceevent recipe
>> >
>> > Fixes
>> > do_sdk_depends: The file
/usr/lib/traceevent/plugins/plugin_cfg80211.so is installed by both perf
and libtraceevent, aborting
>>
>> Starting with kernel version 6.4 libtraceevent is removed from the
kernel sources and perf depends of an externally provided libtraceevent
unless explicitely opted out.
>>
>> perf.bb with this patch will fail when built with a 6.4 kernel.
>
> Why will it fail ?

The file which sed works on, ${S}/tools/lib/traceevent/plugins/Makefile, no
longer exists.

>>
>> I guess as an interim solution building perf on 6.4 without traceevent
would fix the SDK issue you see with older kernels.
>> I could then try out how to build perf with an external libtraceevent
also for older kernels (LIBTRACEEVENT_DYNAMIC) so that it would work for
all kernel/perf versions.
>>
>> Regards
>> Max
>> >
>> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> > Cc: Max Krummenacher <max.krummenacher@toradex.com>
>> > ---
>> >  meta/recipes-kernel/perf/perf.bb | 4 +++-
>> >  1 file changed, 3 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/meta/recipes-kernel/perf/perf.bb
b/meta/recipes-kernel/perf/perf.bb
>> > index 67b01a7f65a..d31f59f460b 100644
>> > --- a/meta/recipes-kernel/perf/perf.bb
>> > +++ b/meta/recipes-kernel/perf/perf.bb
>> > @@ -137,6 +137,8 @@ PERF_EXTRA_LDFLAGS:mipsarchn64el = "-m elf64ltsmip"
>> >  do_compile() {
>> >         # Linux kernel build system is expected to do the right thing
>> >         unset CFLAGS
>> > +       sed -i -e
's|\$(libdir)/traceevent/plugins|\$(libdir)/traceevent_${KERNEL_VERSION}/plugins|g'
${S}/tools/lib/traceevent/plugins/Makefile
>> > +       sed -i -e
's|\$(libdir)/traceevent/plugins|\$(libdir)/traceevent_${KERNEL_VERSION}/plugins|g'
${S}/tools/perf/Makefile.config
>> >         oe_runmake all
>> >  }
>> >
>> > @@ -364,7 +366,7 @@ RSUGGESTS_SCRIPTING =
"${@bb.utils.contains('PACKAGECONFIG', 'scripting', '${PN}
>> >  RSUGGESTS:${PN} += "${PN}-archive ${PN}-tests ${RSUGGESTS_SCRIPTING}"
>> >
>> >  FILES_SOLIBSDEV = ""
>> > -FILES:${PN} += "${libexecdir}/perf-core
${exec_prefix}/libexec/perf-core ${libdir}/traceevent
${libdir}/libperf-jvmti.so"
>> > +FILES:${PN} += "${libexecdir}/perf-core
${exec_prefix}/libexec/perf-core ${libdir}/traceevent*
${libdir}/libperf-jvmti.so"
>> >  FILES:${PN}-archive = "${libdir}/perf/perf-core/perf-archive"
>> >  FILES:${PN}-tests = "${libdir}/perf/perf-core/tests
${libexecdir}/perf-core/tests"
>> >  FILES:${PN}-python = " \
>> > --
>> > 2.40.1
>> >
>> >
Khem Raj May 26, 2023, 5:26 a.m. UTC | #4
On Thu, May 25, 2023 at 10:09 PM Max Krummenacher <max.oss.09@gmail.com> wrote:
>
>
>
> On Friday, May 26, 2023, Khem Raj <raj.khem@gmail.com> wrote:
> >
> >
> > On Thu, May 25, 2023 at 7:44 PM Max Krummenacher <max.oss.09@gmail.com> wrote:
> >>
> >> Hi Khem
> >>
> >> On Friday, May 26, 2023, Khem Raj <raj.khem@gmail.com> wrote:
> >> > This will package the plugins built by perf into kernel specific dir
> >> > under libdir, so it does not conflict with plugins from newly added
> >> > libtraceevent recipe
> >> >
> >> > Fixes
> >> > do_sdk_depends: The file /usr/lib/traceevent/plugins/plugin_cfg80211.so is installed by both perf and libtraceevent, aborting
> >>
> >> Starting with kernel version 6.4 libtraceevent is removed from the kernel sources and perf depends of an externally provided libtraceevent unless explicitely opted out.
> >>
> >> perf.bb with this patch will fail when built with a 6.4 kernel.
> >
> > Why will it fail ?
>
> The file which sed works on, ${S}/tools/lib/traceevent/plugins/Makefile, no longer exists.
>

Right, sent a v2 to address that

> >>
> >> I guess as an interim solution building perf on 6.4 without traceevent would fix the SDK issue you see with older kernels.
> >> I could then try out how to build perf with an external libtraceevent also for older kernels (LIBTRACEEVENT_DYNAMIC) so that it would work for all kernel/perf versions.
> >>
> >> Regards
> >> Max
> >> >
> >> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> >> > Cc: Max Krummenacher <max.krummenacher@toradex.com>
> >> > ---
> >> >  meta/recipes-kernel/perf/perf.bb | 4 +++-
> >> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >> >
> >> > diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
> >> > index 67b01a7f65a..d31f59f460b 100644
> >> > --- a/meta/recipes-kernel/perf/perf.bb
> >> > +++ b/meta/recipes-kernel/perf/perf.bb
> >> > @@ -137,6 +137,8 @@ PERF_EXTRA_LDFLAGS:mipsarchn64el = "-m elf64ltsmip"
> >> >  do_compile() {
> >> >         # Linux kernel build system is expected to do the right thing
> >> >         unset CFLAGS
> >> > +       sed -i -e 's|\$(libdir)/traceevent/plugins|\$(libdir)/traceevent_${KERNEL_VERSION}/plugins|g' ${S}/tools/lib/traceevent/plugins/Makefile
> >> > +       sed -i -e 's|\$(libdir)/traceevent/plugins|\$(libdir)/traceevent_${KERNEL_VERSION}/plugins|g' ${S}/tools/perf/Makefile.config
> >> >         oe_runmake all
> >> >  }
> >> >
> >> > @@ -364,7 +366,7 @@ RSUGGESTS_SCRIPTING = "${@bb.utils.contains('PACKAGECONFIG', 'scripting', '${PN}
> >> >  RSUGGESTS:${PN} += "${PN}-archive ${PN}-tests ${RSUGGESTS_SCRIPTING}"
> >> >
> >> >  FILES_SOLIBSDEV = ""
> >> > -FILES:${PN} += "${libexecdir}/perf-core ${exec_prefix}/libexec/perf-core ${libdir}/traceevent ${libdir}/libperf-jvmti.so"
> >> > +FILES:${PN} += "${libexecdir}/perf-core ${exec_prefix}/libexec/perf-core ${libdir}/traceevent* ${libdir}/libperf-jvmti.so"
> >> >  FILES:${PN}-archive = "${libdir}/perf/perf-core/perf-archive"
> >> >  FILES:${PN}-tests = "${libdir}/perf/perf-core/tests ${libexecdir}/perf-core/tests"
> >> >  FILES:${PN}-python = " \
> >> > --
> >> > 2.40.1
> >> >
> >> >
diff mbox series

Patch

diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
index 67b01a7f65a..d31f59f460b 100644
--- a/meta/recipes-kernel/perf/perf.bb
+++ b/meta/recipes-kernel/perf/perf.bb
@@ -137,6 +137,8 @@  PERF_EXTRA_LDFLAGS:mipsarchn64el = "-m elf64ltsmip"
 do_compile() {
 	# Linux kernel build system is expected to do the right thing
 	unset CFLAGS
+	sed -i -e 's|\$(libdir)/traceevent/plugins|\$(libdir)/traceevent_${KERNEL_VERSION}/plugins|g' ${S}/tools/lib/traceevent/plugins/Makefile
+	sed -i -e 's|\$(libdir)/traceevent/plugins|\$(libdir)/traceevent_${KERNEL_VERSION}/plugins|g' ${S}/tools/perf/Makefile.config
 	oe_runmake all
 }
 
@@ -364,7 +366,7 @@  RSUGGESTS_SCRIPTING = "${@bb.utils.contains('PACKAGECONFIG', 'scripting', '${PN}
 RSUGGESTS:${PN} += "${PN}-archive ${PN}-tests ${RSUGGESTS_SCRIPTING}"
 
 FILES_SOLIBSDEV = ""
-FILES:${PN} += "${libexecdir}/perf-core ${exec_prefix}/libexec/perf-core ${libdir}/traceevent ${libdir}/libperf-jvmti.so"
+FILES:${PN} += "${libexecdir}/perf-core ${exec_prefix}/libexec/perf-core ${libdir}/traceevent* ${libdir}/libperf-jvmti.so"
 FILES:${PN}-archive = "${libdir}/perf/perf-core/perf-archive"
 FILES:${PN}-tests = "${libdir}/perf/perf-core/tests ${libexecdir}/perf-core/tests"
 FILES:${PN}-python = " \