Discussion:
Bug#944138: ITP: libtraceevent -- The libtraceevent library provides APIs to access kernel tracepoint events
Add Reply
Sudip Mukherjee
2019-11-04 21:50:02 UTC
Reply
Permalink
Package: wnpp
Severity: wishlist
Owner: Sudip Mukherjee <***@gmail.com>
X-Debbugs-Cc: debian-***@lists.debian.org, debian-***@lists.debian.org

* Package name : libtraceevent
Version : 1.1.0
Upstream Author : Steven Rostedt (VMware) <***@goodmis.org>
* URL : NA
* License : GPL-2.0 and LGPL-2.1
Programming Lang: C
Description : The libtraceevent library provides APIs to access kernel tracepoint events,
located in the tracefs file system under the events directory.

The kernel tracepoints are now being used by multiple packages like trace-cmd, perf, powertop, rasdaemon.
And all of them have duplicate codes in them to use the tracepoints. libtraceevent is planned to move all
the duplicate codes in a single library so that the duplicate code will be removed from the next versions
of these packages and they can depend on libtraceevent.

The code for libtracevent lives in the kernel tree at
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git in tools/lib/traceevent folder.
And so, it will be great if kernel team will like to package and maintain it, if not, then I will
be happy to do it. But, if I am doing it then I will need a sponsor to upload it.

--
Regards
Sudip
Ben Hutchings
2019-11-08 20:10:02 UTC
Reply
Permalink
On Mon, 2019-11-04 at 21:44 +0000, Sudip Mukherjee wrote:
[...]
Post by Sudip Mukherjee
The code for libtracevent lives in the kernel tree at
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git in tools/lib/traceevent folder.
And so, it will be great if kernel team will like to package and maintain it, if not, then I will
be happy to do it. But, if I am doing it then I will need a sponsor to upload it.
If kernel.org's kernel source repository is the canonical location for
this code, not just a convenience copy, then the binary package should
be built from src:linux and not a separate source package.

I think src:linux already builds the library, but only as a static
library that's linked into perf.

I don't know exactly what changes you would need to make, but they
should be roughly along these lines:

1. Add debian/rules.d/tools/lib/traceevent/Makefile with a default
target that calls the upstream build system. This must build in
the current directory (somewhere under debian/build) and not the
source directory. It must enable printing of all build comamnds
by default.

2. Define the new binary packages and their build-dependencies in
debian/templates/control.tools-unversioned.in. These packages
must have "Build-Profiles: <!stage1 !pkg.linux.notools>".

3. Define build-libtraceevent and install-libtraceevent targets in
debian/rules.real, similarly to those for libcpupower.
Add those to the dependencies of the build-arch-arch and
binary-arch-arch targets, using the if_package macro to check
whether the packages should be built.

4. Generate the debian/libtraceevent<soversion>.symbols file recording
the shared library's exported symbols.

5. (Not sure if this is needed.) Modify
debian/rules.d/tools/perf/Makefile to make perf use the shared
library. Add libtraceevent<soversion> to the dependencies of
linux-perf-<version> in debian/templates/control.tools-versioned.in.

Ben.
--
Ben Hutchings
The two most common things in the universe are hydrogen and stupidity.
Sudip Mukherjee
2019-11-10 21:40:01 UTC
Reply
Permalink
Post by Ben Hutchings
[...]
Post by Sudip Mukherjee
The code for libtracevent lives in the kernel tree at
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git in tools/lib/traceevent folder.
And so, it will be great if kernel team will like to package and maintain it, if not, then I will
be happy to do it. But, if I am doing it then I will need a sponsor to upload it.
If kernel.org's kernel source repository is the canonical location for
this code, not just a convenience copy, then the binary package should
be built from src:linux and not a separate source package.
I think src:linux already builds the library, but only as a static
library that's linked into perf.
I don't know exactly what changes you would need to make, but they
<snip>
Post by Ben Hutchings
4. Generate the debian/libtraceevent<soversion>.symbols file recording
the shared library's exported symbols.
Thanks for your reply Ben.
I will try these steps and see how it goes.
Post by Ben Hutchings
5. (Not sure if this is needed.) Modify
debian/rules.d/tools/perf/Makefile to make perf use the shared
library. Add libtraceevent<soversion> to the dependencies of
linux-perf-<version> in debian/templates/control.tools-versioned.in.
This should not be needed as perf does not yet depend on libtraceevent.
The libtraceevent that perf is creating is only having the plugins.


--
Regards
Sudip
Ben Hutchings
2019-11-10 22:10:02 UTC
Reply
Permalink
Post by Sudip Mukherjee
Post by Ben Hutchings
[...]
Post by Sudip Mukherjee
The code for libtracevent lives in the kernel tree at
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git in tools/lib/traceevent folder.
And so, it will be great if kernel team will like to package and maintain it, if not, then I will
be happy to do it. But, if I am doing it then I will need a sponsor to upload it.
If kernel.org's kernel source repository is the canonical location for
this code, not just a convenience copy, then the binary package should
be built from src:linux and not a separate source package.
I think src:linux already builds the library, but only as a static
library that's linked into perf.
I don't know exactly what changes you would need to make, but they
<snip>
Post by Ben Hutchings
4. Generate the debian/libtraceevent<soversion>.symbols file recording
the shared library's exported symbols.
Thanks for your reply Ben.
I will try these steps and see how it goes.
Post by Ben Hutchings
5. (Not sure if this is needed.) Modify
debian/rules.d/tools/perf/Makefile to make perf use the shared
library. Add libtraceevent<soversion> to the dependencies of
linux-perf-<version> in debian/templates/control.tools-versioned.in.
This should not be needed as perf does not yet depend on libtraceevent.
The libtraceevent that perf is creating is only having the plugins.
I'm pretty sure it does; look for "libtraceevent.a" in
<https://buildd.debian.org/status/fetch.php?pkg=linux&arch=amd64&ver=5.3.9-1&stamp=1573349194&raw=1>.

Ben.
--
Ben Hutchings
Humans are not rational beings; they are rationalising beings.
Sudip Mukherjee
2019-11-11 21:40:01 UTC
Reply
Permalink
Hi Ben,
Post by Ben Hutchings
Post by Sudip Mukherjee
Post by Ben Hutchings
[...]
Post by Sudip Mukherjee
The code for libtracevent lives in the kernel tree at
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git in tools/lib/traceevent folder.
And so, it will be great if kernel team will like to package and maintain it, if not, then I will
be happy to do it. But, if I am doing it then I will need a sponsor to upload it.
If kernel.org's kernel source repository is the canonical location for
this code, not just a convenience copy, then the binary package should
be built from src:linux and not a separate source package.
I think src:linux already builds the library, but only as a static
library that's linked into perf.
I don't know exactly what changes you would need to make, but they
<snip>
Post by Ben Hutchings
4. Generate the debian/libtraceevent<soversion>.symbols file recording
the shared library's exported symbols.
Thanks for your reply Ben.
I will try these steps and see how it goes.
Post by Ben Hutchings
5. (Not sure if this is needed.) Modify
debian/rules.d/tools/perf/Makefile to make perf use the shared
library. Add libtraceevent<soversion> to the dependencies of
linux-perf-<version> in debian/templates/control.tools-versioned.in.
This should not be needed as perf does not yet depend on libtraceevent.
The libtraceevent that perf is creating is only having the plugins.
I'm pretty sure it does; look for "libtraceevent.a" in
<https://buildd.debian.org/status/fetch.php?pkg=linux&arch=amd64&ver=5.3.9-1&stamp=1573349194&raw=1>.
iiuc, perf used tools/lib/traceevent to generate "libtraceevent.a"
which is a static library and perf is building against that. It is
also using the plugins generated by traceevent. But it is not using
"libtraceevent.so" which is generated. So, as a result all the
traceevent code is statically linked in perf when it builds.
If I see the installation folder of perf I am only seeing
"lib64/traceevent/plugins" and I am not seeing the dynamic library
created by traceevent.
Moreover if I do "ldd perf" it is not showing that it is linked to
libtraceevent.so. But, in anycase, I will need to modify the rules as
the plugins will be installed by traceevent which will be used by
perf.
I hope I was able to explain properly. But, let me make the changes
and test first and then I can show you what I did.
Thanks for your help.
--
Regards
Sudip
Ben Hutchings
2019-11-12 02:50:01 UTC
Reply
Permalink
Post by Sudip Mukherjee
Hi Ben,
Post by Ben Hutchings
Post by Sudip Mukherjee
Post by Ben Hutchings
[...]
Post by Sudip Mukherjee
The code for libtracevent lives in the kernel tree at
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git in tools/lib/traceevent folder.
And so, it will be great if kernel team will like to package and maintain it, if not, then I will
be happy to do it. But, if I am doing it then I will need a sponsor to upload it.
If kernel.org's kernel source repository is the canonical location for
this code, not just a convenience copy, then the binary package should
be built from src:linux and not a separate source package.
I think src:linux already builds the library, but only as a static
library that's linked into perf.
I don't know exactly what changes you would need to make, but they
<snip>
Post by Ben Hutchings
4. Generate the debian/libtraceevent<soversion>.symbols file recording
the shared library's exported symbols.
Thanks for your reply Ben.
I will try these steps and see how it goes.
Post by Ben Hutchings
5. (Not sure if this is needed.) Modify
debian/rules.d/tools/perf/Makefile to make perf use the shared
library. Add libtraceevent<soversion> to the dependencies of
linux-perf-<version> in debian/templates/control.tools-versioned.in.
This should not be needed as perf does not yet depend on libtraceevent.
The libtraceevent that perf is creating is only having the plugins.
I'm pretty sure it does; look for "libtraceevent.a" in
<https://buildd.debian.org/status/fetch.php?pkg=linux&arch=amd64&ver=5.3.9-1&stamp=1573349194&raw=1>;.
iiuc, perf used tools/lib/traceevent to generate "libtraceevent.a"
which is a static library and perf is building against that. It is
also using the plugins generated by traceevent. But it is not using
"libtraceevent.so" which is generated.
[...]

Yes, exactly. And it is usual practice in Debian to link with shared
libraries where possible. (I thought that was actually in policy, but
it doesn't seem to be.)

Ben.
--
Ben Hutchings
I'm not a reverse psychological virus.
Please don't copy me into your signature.
Sudip Mukherjee
2019-11-15 11:50:01 UTC
Reply
Permalink
iiuc, Debian kernel can only have patches accepted upstream. And, so
this is now blocked on:
https://patchwork.kernel.org/patch/11243801/
https://patchwork.kernel.org/patch/11246125/
https://patchwork.kernel.org/patch/11246127/

I will wait till they are accepted and appears on linux-next.

--
Regards
Sudip
Sudip Mukherjee
2019-12-08 00:30:01 UTC
Reply
Permalink
Post by Sudip Mukherjee
iiuc, Debian kernel can only have patches accepted upstream. And, so
https://patchwork.kernel.org/patch/11243801/
https://patchwork.kernel.org/patch/11246125/
https://patchwork.kernel.org/patch/11246127/
I will wait till they are accepted and appears on linux-next.
wip merge request has been opened in salsa at:
https://salsa.debian.org/kernel-team/linux/merge_requests/192

Another patch had to be sent upstream, and once I get the Ack for that
the wip: can be removed from the merge request.

@Ben: if you get some time can you please have an initial look at this.

--
Regards
Sudip

Loading...