perf tracepoints for regular user?
Hi,
I am trying to use 'perf stat -e uprobes:xyz' on a tracepoint that I have previously set, but with no success.
I thought that I should be able to do that when allowing my user access to debugfs, but this is what I get:
$ id -u;id -g 1001 1001 $ mount|grep debug none on /sys/kernel/debug type debugfs (rw,uid=1001,gid=1001) $ ls /sys/kernel/debug acpi bluetooth cleancache dell_laptop dri extfrag ... $ ls /sys/kernel/debug/tracing/ ls: cannot open directory /sys/kernel/debug/tracing/: Permission denied
So, my user can't look in the tracing subdirectory and perf list doesn't show the uprobes either.
I have also tried to ´sudo setcap cap_sys_admin+eip $(which perf)´, also without success.
Any ideas?
Thanks,
Benjamin King
Quoted 17 lines · On Freitag, 15. Januar 2016 22:05:16 CET Benjamin King wrote:
Hi,
I am trying to use 'perf stat -e uprobes:xyz' on a tracepoint that I have previously set, but with no success.
I thought that I should be able to do that when allowing my user access to debugfs, but this is what I get:$ id -u;id -g 1001 1001 $ mount|grep debug none on /sys/kernel/debug type debugfs (rw,uid=1001,gid=1001) $ ls /sys/kernel/debug acpi bluetooth cleancache dell_laptop dri extfrag ... $ ls /sys/kernel/debug/tracing/ ls: cannot open directory /sys/kernel/debug/tracing/: Permission denied
Quoted 5 lines
So, my user can't look in the tracing subdirectory and perf list doesn't show the uprobes either.
I have also tried to ´sudo setcap cap_sys_admin+eip $(which perf)´, also without success.
Try these commands:
$ sudo mount -o remount,mode=755 /sys/kernel/debug $ sudo mount -o remount,mode=755 /sys/kernel/debug/tracing $ echo \"-1\" | sudo tee /proc/sys/kernel/perf_event_paranoid
HTH
Signature · 4 lines
Milian Wolff | [email protected] | Software Engineer KDAB (Deutschland) GmbH&Co KG, a KDAB Group company Tel: +49-30-521325470 KDAB - The Qt Experts
Quoted 21 lines · On Sonntag, 17. Januar 2016 22:20:00 CET Milian Wolff wrote:
Quoted 20 lines · On Freitag, 15. Januar 2016 22:05:16 CET Benjamin King wrote:
Hi,
I am trying to use 'perf stat -e uprobes:xyz' on a tracepoint that I have previously set, but with no success.
I thought that I should be able to do that when allowing my user access to debugfs, but this is what I get:$ id -u;id -g 1001 1001 $ mount|grep debug none on /sys/kernel/debug type debugfs (rw,uid=1001,gid=1001) $ ls /sys/kernel/debug acpi bluetooth cleancache dell_laptop dri extfrag ... $ ls /sys/kernel/debug/tracing/ ls: cannot open directory /sys/kernel/debug/tracing/: Permission deniedSo, my user can't look in the tracing subdirectory and perf list doesn't show the uprobes either.
Quoted 8 lines
Quoted 2 lines
I have also tried to ´sudo setcap cap_sys_admin+eip $(which perf)´, also without success.
Try these commands:
$ sudo mount -o remount,mode=755 /sys/kernel/debug $ sudo mount -o remount,mode=755 /sys/kernel/debug/tracing $ echo \"-1\" | sudo tee /proc/sys/kernel/perf_event_paranoid
(minus the escaping, copy'n'paste fail from a slide of mine)
Signature · 4 lines
Milian Wolff | [email protected] | Software Engineer KDAB (Deutschland) GmbH&Co KG, a KDAB Group company Tel: +49-30-521325470 KDAB - The Qt Experts
Hi Milian,
Quoted 8 lines · Milian Wolff
Quoted 2 lines · On Freitag, 15. Januar 2016 22:05:16 CET Benjamin King wrote:
I am trying to use 'perf stat -e uprobes:xyz' on a tracepoint that I have previously set, but with no success.
Try these commands:
$ sudo mount -o remount,mode=755 /sys/kernel/debug $ sudo mount -o remount,mode=755 /sys/kernel/debug/tracing $ echo \"-1\" | sudo tee /proc/sys/kernel/perf_event_paranoid
Hm, that does not work for me. I can do the first remount, but not the second:
-----
$ sudo mount -o remount,mode=755 /sys/kernel/debug/tracing mount: can't find /sys/kernel/debug/tracing in /etc/fstab $ mount|grep debug none on /sys/kernel/debug type debugfs (rw,mode=755,mode=755) -----
And then, I still can not see tracepoints as a regular user:
-----
$ perf list tracepoint
List of pre-defined events (to be used in -e):
$ -----
If this works for you, then maybe it's my version? I'm on 4.2.3
Cheers,
Benjamin
Em Tue, Jan 19, 2016 at 06:02:44AM +0100, Benjamin King escreveu:
Quoted 12 lines
Hi Milian,
Quoted 8 lines · Milian Wolff
Quoted 2 lines · On Freitag, 15. Januar 2016 22:05:16 CET Benjamin King wrote:
I am trying to use 'perf stat -e uprobes:xyz' on a tracepoint that I have previously set, but with no success.
Try these commands:
$ sudo mount -o remount,mode=755 /sys/kernel/debug $ sudo mount -o remount,mode=755 /sys/kernel/debug/tracing $ echo \"-1\" | sudo tee /proc/sys/kernel/perf_event_paranoid
Quoted 8 lines
Hm, that does not work for me. I can do the first remount, but not the second:
-----$ sudo mount -o remount,mode=755 /sys/kernel/debug/tracing mount: can't find /sys/kernel/debug/tracing in /etc/fstab $ mount|grep debug none on /sys/kernel/debug type debugfs (rw,mode=755,mode=755) -----
Ok, your kernel is old and doesn't have the tracefs:
[acme@zoo ~]$ mount | egrep \(debug\|trace\)fs
debugfs on /sys/kernel/debug type debugfs (rw,relatime,seclabel,mode=755) tracefs on /sys/kernel/debug/tracing type tracefs (rw,relatime,mode=755) [acme@zoo ~]$
Quoted 9 lines
And then, I still can not see tracepoints as a regular user:
-----$ perf list tracepointList of pre-defined events (to be used in -e):
$ -----If this works for you, then maybe it's my version? I'm on 4.2.3
[acme@zoo ~]$ uname -r
4.3.0+
But on another machine, oops, I thought it was older, in fact it is newer :-\
[root@jouet images]# uname -r
4.3.3-300.fc23.x86_64
[root@jouet images]# mount | egrep \(trace\|debug\)fs debugfs on /sys/kernel/debug type debugfs (rw,relatime,seclabel) tracefs on /sys/kernel/debug/tracing type tracefs (rw,relatime) [root@jouet images]#
Hi Arnaldo,
Quoted 8 lines
Quoted 4 lines
$ sudo mount -o remount,mode=755 /sys/kernel/debug/tracing mount: can't find /sys/kernel/debug/tracing in /etc/fstab $ mount|grep debug none on /sys/kernel/debug type debugfs (rw,mode=755,mode=755)Ok, your kernel is old and doesn't have the tracefs:
Quoted 6 lines
[acme@zoo ~]$ mount | egrep \(debug\|trace\)fs
debugfs on/sys/kernel/debugtype debugfs (rw,relatime,seclabel,mode=755) tracefs on/sys/kernel/debug/tracingtype tracefs (rw,relatime,mode=755) [...]
[acme@zoo ~]$ uname -r
4.3.0+
That's odd. According to kernelnewbies.org (Yes, I am that much of a kernel hacker :-) ), tracefs should be in since 4.1 and I'm on 4.2, but I can only find CONFIG_DEBUG_FS in my kernel configuration. There is no mentioning of a corresponding CONFIG_TRACE_FS there.
I'll try to upgrade to a more recent kernel and stop bugging you guys until then.
Cheers,
Benjamin
Em Wed, Jan 20, 2016 at 12:50:33PM +0100, Benjamin King escreveu:
Quoted 8 lines
Hi Arnaldo,
Quoted 6 lines
Quoted 4 lines
$ sudo mount -o remount,mode=755 /sys/kernel/debug/tracing mount: can't find /sys/kernel/debug/tracing in /etc/fstab $ mount|grep debug none on /sys/kernel/debug type debugfs (rw,mode=755,mode=755)Ok, your kernel is old and doesn't have the tracefs:
Not having tracefs, if that is indeed the case, only means that the remount isn't needed, as what is in tracefs is what, before its existence, lived in a debugfs directory, /sys/kernel/debug/tracing, i.e. remounting just /sys/kernel/debug/ would then be enough.
Quoted 13 lines
Quoted 6 lines
[acme@zoo ~]$ mount | egrep \(debug\|trace\)fs
debugfs on/sys/kernel/debugtype debugfs (rw,relatime,seclabel,mode=755) tracefs on/sys/kernel/debug/tracingtype tracefs (rw,relatime,mode=755) [...]
[acme@zoo ~]$ uname -r
4.3.0+That's odd. According to kernelnewbies.org (Yes, I am that much of a kernel hacker :-) ), tracefs should be in since 4.1 and I'm on 4.2, but I can only find
CONFIG_DEBUG_FSin my kernel configuration. There is no mentioning of a correspondingCONFIG_TRACE_FSthere.I'll try to upgrade to a more recent kernel and stop bugging you guys until then.
Quoted 4 lines · Arnaldo Carvalho de Melo
Not having tracefs, if that is indeed the case, only means that the remount isn't needed, as what is in tracefs is what, before its existence, lived in a debugfs directory,
/sys/kernel/debug/tracing, i.e. remounting just/sys/kernel/debug/would then be enough.
I could not make /sys/kernel/debug/tracing available to a regular users even after upgrading to kernel 4.4, so I just did a desperate system upgrade and - lo and behold - it now works, by which I mean
1) tracefs is mounted and when remounted world readable...
2) ...regular users can read /sys/kernel/debug/tracing/uprobe_events and...
3) ...see the probes in perf and...
4) ...use them for tracing.
So it was all my fault, being too lazy to upgrade, thanks for the help and sorry for the noise!
Cheers,
Benjamin