LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-29-2017, 12:09 AM   #1
barz_83_LQ
Member
 
Registered: Apr 2017
Posts: 31

Rep: Reputation: Disabled
echo 1 > /sys/kernel/debug/tracing/events/enable has no effect


I am working on user space profiling based on link (https://opensource.com/article/17/7/...space#comments).

When I try to enable trace using below command, it has no effect:

root@bbr:/home/bbr/work/xxxxxxxxxx/out# echo 1 > /sys/kernel/debug/tracing/events/uprobes/enable

root@bbr:/home/bbr/work/xxxxxxxxxx/out# cat /sys/kernel/debug/tracing/events/uprobes/enable
0

Second command should display 1.
Am I missing something? Nevertheless it should warn / throw error instead of simply having no effect.

Note: I am using Ubuntu 16.04, Kernel 4.4.x. Executed above as root only.

Thanks in advance.
 
Old 11-29-2017, 12:15 AM   #2
barz_83_LQ
Member
 
Registered: Apr 2017
Posts: 31

Original Poster
Rep: Reputation: Disabled
Oh, sorry. I just realized it doesnt work if there is no trace point set. Not sure why it is designed so, but it seems unless there is at least 1 trace point set, it ignores the enable..

So, if I did add tracepoint before doing this by:
echo 'p:func_entry test:0x332' > /sys/kernel/debug/tracing/uprobe_events

and then enabled the probe, it worked.
 
Old 11-29-2017, 01:23 AM   #3
barz_83_LQ
Member
 
Registered: Apr 2017
Posts: 31

Original Poster
Rep: Reputation: Disabled
And now,

After making multiple efforts, adding trace points and enabling uprobe, I couldn't see any thing in the trace file:
(Does this work only if the kernel has been built with specfic options (apart from the default enabled 'kernel debugging option'))


root@bbr:/home/bbr/xxxxxxxxxxxxxxx/out# cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 0/0 #P:2
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
root@bbr:/home/bbr/work/xxxxxxxxxxxxx/out#


Thanks in advance,
 
Old 11-29-2017, 02:43 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Best guess would be your offset is wrong.
 
Old 11-29-2017, 09:51 PM   #5
barz_83_LQ
Member
 
Registered: Apr 2017
Posts: 31

Original Poster
Rep: Reputation: Disabled
Dear sysg00 thank you for the response.

The issue was actually due to not enabling /sys/kernel/debug/tracing/events/enable which is master enable. What I enabled earlier was .../events/uprobes/enable.

Regards,
Bhargav
 
Old 11-29-2017, 10:00 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Shouldn't matter. I ran a quick test before I replied yesterday using that test.c and enabled .../events/uprobes/enable and it all ran fine.

I don't usually use uprobes, but the entire tracing framework is a little like topsy - bits have been added over time and there are some "interesting" nuances in how different things work in practice. Guess we users just have to live with it.
Glad you got it working.
 
1 members found this post helpful.
Old 11-29-2017, 10:13 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Hmmm; what does this return.
Code:
grep -i [ku]probe /boot/config-$(uname -r)
Adjust as necessary for the location of your config.
 
Old 11-29-2017, 10:49 PM   #8
barz_83_LQ
Member
 
Registered: Apr 2017
Posts: 31

Original Poster
Rep: Reputation: Disabled
The command output below:

root@bbr:/home/bbr/xxxxxxxxxxxxxxx/out# grep -i [ku]probe /boot/config-$(uname -r)
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_KPROBES=y
CONFIG_KPROBES_ON_FTRACE=y
CONFIG_UPROBES=y
CONFIG_HAVE_KPROBES=y
CONFIG_HAVE_KPROBES_ON_FTRACE=y
CONFIG_KPROBE_EVENT=y
CONFIG_UPROBE_EVENT=y
# CONFIG_KPROBES_SANITY_TEST is not set

I tried uprobes enabling again as per your response. As you mentioned, I realized that setting '...events/uprobes/enable' to 1 is enough, without manually setting '....events/enable' to 1. The trace log is getting overwritten by latest data ('....tracing/trace'), so I could not figure out my trace point was in log, when I did in my previous post above. Any way, I can increase the buffer size or control this behaviour?

Now, another observation I did (posted just another question per this) is '..events/enable' is getting set to 'X' when I try to set it to '1' from '0'. It seems to indicate it is enabled when its value is 'X'... and not enabled indicated as '0'. Why is it 'X' instead of '1'.


Regards,
Bhargav
 
  


Reply

Tags
probe, profiling, sysfs, userspace



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
echo 0 /proc/sys/kernel/hung_task_timeout finsh Linux - Server 3 07-18-2013 07:01 AM
Kernel Error echo 0 > /proc/sys/kernel/hung _task_timeout_secsin Redhat 5.8 LittleMaster Linux - Server 1 10-18-2012 09:32 AM
system not display /sys/ folder....in kernel compile how to enable sys in menuconfig dashang.trivedi Linux - Kernel 1 07-14-2011 05:00 AM
echo '214748364' > /proc/sys/kernel/shmmax rubendarioportillo SUSE / openSUSE 1 11-03-2005 06:05 PM
echo '214748364' > /proc/sys/kernel/shmmax SwannAnderson Linux - General 2 11-03-2005 02:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration