debugfs:Fix terminology inconsistency of dir name to mount debugfs filesystem.
Subsystems (12)
RFC PATCH 1/1 debugfs:Fix terminology inconsistency of dir name to mount debugfs filesystem.
Hi all,
I want to hear your opinions about this proposal for consistency of mount directory to mount debugfs filesystem that need by ftrace infrastructure. Um... I appended "RFC" word in the subject because this mail is my proposal just.
commit 1766a83645706100b1829bb422f852ec757c6f4b
Author: GeunSik,Lim <[email protected]> Date: Tue May 26 13:49:23 2009 +0900
Fix terminology inconsistency of dir name to mount debugfs filesystem.
Many developers use "/debug/" directory name to mount debugfs filesystem for ftrace according to ./Documentation/tracers/ftrace.txt file.
But, two directory names(ex:/debug/, /debugfs/) is existed in kernel source like ftrace, DRM, Wireless, Network[sky2]files to mount debugfs filesystem. I think that we don't have to select either "/debug/" directory name or "/debugfs/" directory name for terminology consistency.
debugfs means debug filesystem for debugging easy to use by greg kroah hartman. "/debug/" name is suitable as directory name of debugfs for tracing using ftrace like "/sys/" of sysfs(system filesystem). -debugfs related reference: http://lwn.net/Articles/115405/
Fix inconsistency of directory name according to duplicated expression to mount debugfs.
--- Documentation/DocBook/debugobjects.tmpl | 2 +- drivers/block/pktcdvd.c | 2 +- drivers/gpu/drm/drm_debugfs.c | 12 ++++++------ drivers/gpu/drm/drm_drv.c | 2 +- drivers/gpu/drm/drm_stub.c | 2 +- drivers/net/Kconfig | 4 ++-- drivers/net/wimax/i2400m/i2400m.h | 2 +- drivers/net/wireless/libertas/README | 12 ++++++------ include/linux/kernel.h | 2 +- kernel/trace/Kconfig | 10 +++++----- kernel/trace/trace.c | 2 +- 11 files changed, 26 insertions(+), 26 deletions(-)
Documentation/DocBook/debugobjects.tmpl +1 -1
@@ -106,7 +106,7 @@ number of errors are printk'ed including a full stack trace. </para> <para> - The statistics are available via debugfs/debug_objects/stats. + The statistics are available via /debug/debug_objects/stats. They provide information about the number of warnings and the number of successful fixups along with information about the usage of the internal tracking objects and the state of the
drivers/block/pktcdvd.c +1 -1
@@ -430,7 +430,7 @@ static void pkt_sysfs_cleanup(void)/******************************************************************** entries in debugfs -/debugfs/pktcdvd[0-7]/ +/debug/pktcdvd[0-7]/ info *******************************************************************/
drivers/gpu/drm/drm_debugfs.c +6 -6
@@ -105,7 +105,7 @@ int drm_debugfs_create_files(struct drm_info_list *files, int count, ent =debugfs_create_file (files[i].name,S_IFREG |S_IRUGO , root, tmp, &drm_debugfs_fops);if (!ent) { -DRM_ERROR ("Cannot create /debugfs/dri/%s/%s\n" , +DRM_ERROR ("Cannot create /debug/dri/%s/%s\n" , name, files[i].name);drm_free (tmp,sizeof (struct drm_info_node ), _DRM_DRIVER);
@@ -133,9 +133,9 @@ EXPORT_SYMBOL(drm_debugfs_create_files);* \param minor device minor number * \param root DRI debugfs dir entry. * -* Create the DRI debugfs root entry "/debugfs/dri", the device debugfs root entry -* "/debugfs/dri/%minor%/", and each entry in debugfs_list as -* "/debugfs/dri/%minor%/%name%". +* Create the DRI debugfs root entry "/debug/dri", the device debugfs root entry +* "/debug/dri/%minor%/", and each entry in debugfs_list as +* "/debug/dri/%minor%/%name%". */ int drm_debugfs_init (struct drm_minor *minor,int minor_id,struct dentry *root)
@@ -148,7 +148,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,sprintf (name,"%d" , minor_id); minor->debugfs_root =debugfs_create_dir (name, root);if (!minor->debugfs_root) { -DRM_ERROR ("Cannot create /debugfs/dri/%s\n" , name); +DRM_ERROR ("Cannot create /debug/dri/%s\n" , name);return -1 ; }
@@ -165,7 +165,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, ret = dev->driver->debugfs_init (minor);if (ret) {DRM_ERROR ("DRM: Driver failed to initialize " -"/debugfs/dri.\n" ); +"/debug/dri.\n" );return ret; } }
drivers/gpu/drm/drm_drv.c +1 -1
@@ -339,7 +339,7 @@ static int __init drm_core_init(void) drm_debugfs_root =debugfs_create_dir ("dri" ,NULL );if (!drm_debugfs_root) { -DRM_ERROR ("Cannot create /debugfs/dri\n" ); +DRM_ERROR ("Cannot create /debug/dri\n" ); ret =-1 ; goto err_p3; }
drivers/gpu/drm/drm_stub.c +1 -1
@@ -328,7 +328,7 @@ static int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int t#if defined(CONFIG_DEBUG_FS ) ret =drm_debugfs_init (new_minor, minor_id, drm_debugfs_root);if (ret) { -DRM_ERROR ("DRM: Failed to initialize /debugfs/dri.\n" ); +DRM_ERROR ("DRM: Failed to initialize /debug/dri.\n" ); goto err_g2; }#endif
drivers/net/Kconfig +2 -2
@@ -2200,7 +2200,7 @@ config SKGE_DEBUG depends on SKGE && DEBUG_FS help This option adds the ability to dump driver state for debugging. - The file debugfs/skge/ethX displays the state of the internal + The file /debug/skge/ethX displays the state of the internal transmit and receive rings. If unsure, say N.
@@ -2226,7 +2226,7 @@ config SKY2_DEBUG depends on SKY2 && DEBUG_FS help This option adds the ability to dump driver state for debugging. - The file debugfs/sky2/ethX displays the state of the internal + The file /debug/sky2/ethX displays the state of the internal transmit and receive rings. If unsure, say N.
drivers/net/wimax/i2400m/i2400m.h +1 -1
@@ -389,7 +389,7 @@ struct i2400m { unsigned ready:1; /* all probing steps done */ unsigned rx_reorder:1; /* RX reorder is enabled */u8 trace_msg_from_user;/* echo rx msgs to 'trace' pipe */ -/* typed u8 so debugfs/u8 can tweak */ +/* typed u8 so /debug/u8 can tweak */ enum i2400m_system_state state;wait_queue_head_t state_wq;/* Woken up when on state updates */
drivers/net/wireless/libertas/README +6 -6
@@ -72,7 +72,7 @@ rdrf location that is to be read. This parameter must be specified in hexadecimal (its possible to preceed preceding the number with a "0x"). - Path: /debugfs/libertas_wireless/ethX/registers/ + Path: /debug/libertas_wireless/ethX/registers/ Usage: echo "0xa123" > rdmac ; cat rdmac
@@ -95,7 +95,7 @@ wrrf sleepparams This command is used to set the sleepclock configurations - Path: /debugfs/libertas_wireless/ethX/ + Path: /debug/libertas_wireless/ethX/ Usage: cat sleepparams: reads the current sleepclock configuration
@@ -115,7 +115,7 @@ subscribed_events The subscribed_events directory contains the interface for the subscribed events API. - Path: /debugfs/libertas_wireless/ethX/subscribed_events/ + Path: /debug/libertas_wireless/ethX/subscribed_events/ Each event is represented by a filename. Each filename consists of the following three fields:
@@ -165,7 +165,7 @@ subscribed_events extscan This command is used to do a specific scan. - Path: /debugfs/libertas_wireless/ethX/ + Path: /debug/libertas_wireless/ethX/ Usage: echo "SSID" > extscan
@@ -179,7 +179,7 @@ getscantable Display the current contents of the driver scan table (ie. get the scan results). - Path: /debugfs/libertas_wireless/ethX/ + Path: /debug/libertas_wireless/ethX/ Usage: cat getscantable
@@ -188,7 +188,7 @@ setuserscan Initiate a customized scan and retrieve the results - Path: /debugfs/libertas_wireless/ethX/ + Path: /debug/libertas_wireless/ethX/ Usage: echo "[ARGS]" > setuserscan
include/linux/kernel.h +1 -1
@@ -406,7 +406,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte)* * Use tracing_on/tracing_off when you want to quickly turn on or off * tracing. It simply enables or disables the recording of the trace events. -* This also corresponds to the user space debugfs/tracing/tracing_on +* This also corresponds to the user space /debug/tracing/tracing_on * file, which gives a means for the kernel and userspace to interact. * Place a tracing_off() in the kernel where you want tracing to end. * From user space, examine the trace, and then echo 1 > tracing_on
kernel/trace/Kconfig +5 -5
@@ -120,7 +120,7 @@ config IRQSOFF_TRACER disabled by default and can be runtime (re-)started via: - echo 0 > /debugfs/tracing/tracing_max_latency + echo 0 > /debug/tracing/tracing_max_latency (Note that kernel size and overhead increases with this option enabled. This option and the preempt-off timing option can be
@@ -141,7 +141,7 @@ config PREEMPT_TRACER disabled by default and can be runtime (re-)started via: - echo 0 > /debugfs/tracing/tracing_max_latency + echo 0 > /debug/tracing/tracing_max_latency (Note that kernel size and overhead increases with this option enabled. This option and the irqs-off timing option can be
@@ -213,7 +213,7 @@ config TRACE_BRANCH_PROFILING This tracer profiles all the the likely and unlikely macros in the kernel. It will display the results in: - /debugfs/tracing/profile_annotated_branch + /debug/tracing/profile_annotated_branch Note: this will add a significant overhead, only turn this on if you need to profile the system's use of these macros.
@@ -228,7 +228,7 @@ config PROFILE_ALL_BRANCHES taken in the kernel is recorded whether it hit or miss. The results will be displayed in: - /debugfs/tracing/profile_branch + /debug/tracing/profile_branch This configuration, when enabled, will impose a great overhead on the system. This should only be enabled when the system
@@ -276,7 +276,7 @@ config STACK_TRACER select KALLSYMS help This special tracer records the maximum stack footprint of the - kernel and displays it in debugfs/tracing/stack_trace. + kernel and displays it in /debug/tracing/stack_trace. This tracer works by hooking into every function call that the kernel executes, and keeping a maximum stack depth value and
kernel/trace/trace.c +1 -1
@@ -335,7 +335,7 @@ static raw_spinlock_t ftrace_max_lock =/* * Copy the new maximum trace into the separate maximum-trace * structure. (this way the maximum trace is permanently saved, -* for later retrieval via /debugfs/tracing/latency_trace) +* for later retrieval via /debug/tracing/latency_trace) */ static void __update_max_tr (struct trace_array *tr,struct task_struct *tsk,int cpu)
-----------------------------------------------
To unsubscribe from this list: send the line "unsubscribe linux-***" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
GeunSik Lim (ELS - OS Group - S/W Lab - SAIT - SAMSUNG) e-Mail :1) [email protected]
2) [email protected] , [email protected]
HomePage: http://intomail.dnip.net/invain/me/
-----------------------------------------------
Quoted 27 lines · GeunSik Lim
Hi all,
I want to hear your opinions about this proposal for consistency of mount directory to mount debugfs filesystem that need by ftrace
infrastructure. Um... I appended "RFC" word in the subject because this mail is my proposal just.commit
1766a83645706100b1829bb422f852ec757c6f4bAuthor: GeunSik,Lim <[email protected]> Date: Tue May 26 13:49:23 2009 +0900Fix terminology inconsistency of dir name to mount debugfs filesystem.
Many developers use "/debug/" directory name to mount debugfs
filesystem for ftrace according to./Documentation/tracers/ftrace.txtfile.But, two directory
names(ex:/debug/, /debugfs/)is existed in kernel
source like ftrace, DRM, Wireless, Network[sky2]files to mount debugfs filesystem. I think that we don't have to select either "/debug/" directory name or "/debugfs/" directory name for terminology consistency.debugfs means debug filesystem for debugging easy to use by greg
kroah hartman. "/debug/" name is suitable as directory name of debugfs for tracing using ftrace like "/sys/" of sysfs(system filesystem). -debugfs related reference: http://lwn.net/Articles/115405/
Quoted 4 lines
Fix inconsistency of directory name according to duplicated
expression to mount debugfs.Signed-off-by GeunSik Lim <[email protected]>
For the WiMAX part, not really an issue:
Steven Rostedt
maintainerQuoted 28 lines · GeunSik Lim
Hi all,
I want to hear your opinions about this proposal for consistency of mount directory to mount debugfs filesystem that need by ftrace infrastructure. Um... I appended "RFC" word in the subject because this mail is my proposal just.
commit
1766a83645706100b1829bb422f852ec757c6f4bAuthor: GeunSik,Lim <[email protected]> Date: Tue May 26 13:49:23 2009 +0900Fix terminology inconsistency of dir name to mount debugfs filesystem.
Many developers use "/debug/" directory name to mount debugfs filesystem for ftrace according to
./Documentation/tracers/ftrace.txtfile.But, two directory
names(ex:/debug/, /debugfs/)is existed in kernel source like ftrace, DRM, Wireless, Network[sky2]files to mount debugfs filesystem. I think that we don't have to select either "/debug/" directory name or "/debugfs/" directory name for terminology consistency.debugfs means debug filesystem for debugging easy to use by greg kroah hartman. "/debug/" name is suitable as directory name of debugfs for tracing using ftrace like "
/sys/" of sysfs(system filesystem). -debugfs related reference: http://lwn.net/Articles/115405/
Quoted 4 lines
Fix inconsistency of directory name according to duplicated expression to mount debugfs.
Signed-off-by GeunSik Lim <[email protected]>
I'm guilty of using both /debug and /debugfs in comments. In practice, I only use /debug.
But...
The filesystem Nazi's out there will argue that the proper place to mount the debugfs filesystem is /sys/kernel/debug. I personally find that location annoying.
-- Steve
Quoted 36 lines · Steven Rostedt
Quoted 28 lines · GeunSik Lim
Hi all,
I want to hear your opinions about this proposal for consistency of mount directory to mount debugfs filesystem that need by ftrace infrastructure. Um... I appended "RFC" word in the subject because this mail is my proposal just.
commit
1766a83645706100b1829bb422f852ec757c6f4bAuthor: GeunSik,Lim <[email protected]> Date: Tue May 26 13:49:23 2009 +0900Fix terminology inconsistency of dir name to mount debugfs filesystem.
Many developers use "/debug/" directory name to mount debugfs filesystem for ftrace according to
./Documentation/tracers/ftrace.txtfile.But, two directory
names(ex:/debug/, /debugfs/)is existed in kernel source like ftrace, DRM, Wireless, Network[sky2]files to mount debugfs filesystem. I think that we don't have to select either "/debug/" directory name or "/debugfs/" directory name for terminology consistency.debugfs means debug filesystem for debugging easy to use by greg kroah hartman. "/debug/" name is suitable as directory name of debugfs for tracing using ftrace like "
/sys/" of sysfs(system filesystem). -debugfs related reference: http://lwn.net/Articles/115405/Quoted 4 lines
Fix inconsistency of directory name according to duplicated expression to mount debugfs.
Signed-off-by GeunSik Lim <[email protected]>
Quoted 8 lines
I'm guilty of using both /debug and /debugfs in comments. In practice, I only use /debug.
But...
The filesystem Nazi's out there will argue that the proper place to mount the debugfs filesystem is
/sys/kernel/debug. I personally find that location annoying.
Why?
When I created debugfs, I was told that I had to pick a place to mount it so that everyone could write scripts that "knew" where it would be.
So we picked /sys/kernel/debug/ and the code creates the mount point to put it there. Now distros actually mount debugfs at that location.
So, now you don't like this? After it's become a standard? Ick.
Becides, /debug/ is pretty presumptious, it's as if debugging the kernel is a system-wide thing :)
So please, don't use /debug/ use the standard, defined, and ACTUALLY USED BY DISTROS TODAY mount point of /sys/kernel/debug/
If you want to create your own symlink from /debug/ to that location to make it easier to type, feel free, but do not hard code any scripts to use that location, or they are going to break.
thanks,
greg k-h
Steven Rostedt
maintainerQuoted 6 lines · Greg KH
Quoted 4 lines
The filesystem Nazi's out there will argue that the proper place to mount the debugfs filesystem is
/sys/kernel/debug. I personally find that location annoying.Why?
Because it is too much to type ;-)
Quoted 12 lines
When I created debugfs, I was told that I had to pick a place to mount it so that everyone could write scripts that "knew" where it would be.
So we picked
/sys/kernel/debug/and the code creates the mount point to put it there. Now distros actually mount debugfs at that location.So, now you don't like this? After it's become a standard? Ick.
Becides, /debug/ is pretty presumptious, it's as if debugging the kernel is a system-wide thing :)
Quoted 6 lines
So please, don't use /debug/ use the standard, defined, and ACTUALLY USED BY DISTROS TODAY mount point of
/sys/kernel/debug/If you want to create your own symlink from /debug/ to that location to make it easier to type, feel free, but do not hard code any scripts to use that location, or they are going to break.
All my scripts search /proc/mounts to find where debugfs is mounted, then it uses that.
Hmm, Not sure what packages in the distros use the default. I don't see the debugfs in /etc/fstab in any of my machines.
-- Steve
Quoted 2 lines · Steven Rostedt
All my scripts search
/proc/mountsto find where debugfs is mounted, then it uses that.
Good.
Quoted 2 lines
Hmm, Not sure what packages in the distros use the default. I don't see the debugfs in
/etc/fstabin any of my machines.
It's in mine, I don't know what packages use it at the moment.
thanks,
greg k-h
Quoted 10 lines · Steven Rostedt
Quoted 6 lines · Greg KH
Quoted 4 lines
The filesystem Nazi's out there will argue that the proper place to mount the debugfs filesystem is
/sys/kernel/debug. I personally find that location annoying.Why?
Because it is too much to type ;-)
I think so. But, when we consider many developers that use linux kernel source all over the world, I think that a regular rules or consistency is important
as greg k-h explained.
Recently, I read "ftrace-world.odp" presentation file of steven rostedt.
For example, about Mounting debugfs...
#> mount -t debugfs nodev /sys/kernel/debug
OR
#> mkdir /debug
#> mount -t debugfs nodev /debug
I want that we will reach a consensus about mount directory name of debugfs filesystem to avoid confusing among the kernel developers.
/debug/ ?
or /sys/kernel/debug/?
.....
Frankly speaking, I like /sys/kernel/debug/ rule is better than /debug/ rule for consistency.
Quoted 20 lines
Quoted 13 lines
When I created debugfs, I was told that I had to pick a place to mount it so that everyone could write scripts that "knew" where it would be.
So we picked
/sys/kernel/debug/and the code creates the mount point to put it there. Now distros actually mount debugfs at that location.So, now you don't like this? After it's become a standard? Ick.
Becides, /debug/ is pretty presumptious, it's as if debugging the kernel is a system-wide thing :)
Quoted 6 lines
So please, don't use /debug/ use the standard, defined, and ACTUALLY USED BY DISTROS TODAY mount point of
/sys/kernel/debug/If you want to create your own symlink from /debug/ to that location to make it easier to type, feel free, but do not hard code any scripts to use that location, or they are going to break.
Quoted 6 lines
All my scripts search
/proc/mountsto find where debugfs is mounted, then it uses that.Hmm, Not sure what packages in the distros use the default. I don't see the debugfs in
/etc/fstabin any of my machines.
Yes.. In my case, I use linux distributions like Ubuntu 8.10, Fedora 9/10, CENTOS 5.3 currently. This distributions use proc , tmpfs, devpts, sysfs for official release
by default.
Quoted 3 lines
-- Steve
Signature · 7 lines
Regards, GeunSik Lim -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Steven Rostedt
maintainerQuoted 27 lines · GeunSik Lim
Quoted 10 lines · Steven Rostedt
Quoted 6 lines · Greg KH
Quoted 4 lines
The filesystem Nazi's out there will argue that the proper place to mount the debugfs filesystem is
/sys/kernel/debug. I personally find that location annoying.Why?
Because it is too much to type ;-)
I think so. But, when we consider many developers that use linux kernel source all over the world, I think that a regular rules or consistency is important
as greg k-h explained.Recently, I read "ftrace-world.odp" presentation file of steven rostedt.
For example, about Mounting debugfs...
#> mount -t debugfs nodev/sys/kernel/debug
OR
#> mkdir /debug
#> mount -t debugfs nodev /debugI want that we will reach a consensus about mount directory name of debugfs filesystem to avoid confusing among the kernel developers.
Quoted 6 lines
/debug/ ?
or/sys/kernel/debug/?
.....Frankly speaking, I like
/sys/kernel/debug/rule is better than /debug/ rule for consistency.
And this is why I always mention that directory.
Quoted 24 lines
Quoted 24 lines
Quoted 14 lines
When I created debugfs, I was told that I had to pick a place to mount it so that everyone could write scripts that "knew" where it would be.
So we picked
/sys/kernel/debug/and the code creates the mount point to put it there. Now distros actually mount debugfs at that location.So, now you don't like this? After it's become a standard? Ick.
Becides, /debug/ is pretty presumptious, it's as if debugging the kernel is a system-wide thing :)
Quoted 6 lines
So please, don't use /debug/ use the standard, defined, and ACTUALLY USED BY DISTROS TODAY mount point of
/sys/kernel/debug/If you want to create your own symlink from /debug/ to that location to make it easier to type, feel free, but do not hard code any scripts to use that location, or they are going to break.
All my scripts search
/proc/mountsto find where debugfs is mounted, then it uses that.
Quoted 8 lines
Quoted 3 lines
Hmm, Not sure what packages in the distros use the default. I don't see the debugfs in
/etc/fstabin any of my machines.Yes.. In my case, I use linux distributions like Ubuntu 8.10, Fedora 9/10, CENTOS 5.3 currently. This distributions use proc , tmpfs, devpts, sysfs for official release
by default.
The key thing is not to have scripts depend on a path. When debugfs is enabled in a kernel, you automatically get /sys/kernel/debug, so that is a natural place to mount it.
I have also suggested to people (as Greg suggested earlier to me) that you can mount it there and then make a soft link to it. Which also works.
I personally just mount it at /debug.
To handle the scripts problem, all my scripts start with:
# grep debugfs /proc/mounts | cut -d ' ' -f 2
I also have a C function to do a search for debugfs in /proc/mounts.
If you look in Documentation/trace/ftrace.txt I have:
===
To mount the debugfs system:
# mkdir /debug # mount -t debugfs nodev /debug
( Note: it is more common to mount at /sys/kernel/debug, but for
simplicity this document will use /debug)
===
Thus it is a personal preference of mine to put it at /debug. But I do not hide the fact that it is recommended to be in /sys/kernel/debug. Heck, I'm the one that brought to light that path in this thread. I just curse it everytime I have to say it ;-)
-- Steve
Quoted 97 lines · Steven Rostedt
Quoted 27 lines · GeunSik Lim
Quoted 10 lines · Steven Rostedt
Quoted 6 lines · Greg KH
Quoted 4 lines
The filesystem Nazi's out there will argue that the proper place to mount the debugfs filesystem is
/sys/kernel/debug. I personally find that location annoying.Why?
Because it is too much to type ;-)
I think so. But, when we consider many developers that use linux kernel source all over the world, I think that a regular rules or consistency is important
as greg k-h explained.Recently, I read "ftrace-world.odp" presentation file of steven rostedt.
For example, about Mounting debugfs...
#> mount -t debugfs nodev/sys/kernel/debug
OR
#> mkdir /debug
#> mount -t debugfs nodev /debugI want that we will reach a consensus about mount directory name of debugfs filesystem to avoid confusing among the kernel developers.
Quoted 6 lines
/debug/ ?
or/sys/kernel/debug/?
.....Frankly speaking, I like
/sys/kernel/debug/rule is better than /debug/ rule for consistency.And this is why I always mention that directory.
Quoted 24 lines
Quoted 24 lines
Quoted 14 lines
When I created debugfs, I was told that I had to pick a place to mount it so that everyone could write scripts that "knew" where it would be.
So we picked
/sys/kernel/debug/and the code creates the mount point to put it there. Now distros actually mount debugfs at that location.So, now you don't like this? After it's become a standard? Ick.
Becides, /debug/ is pretty presumptious, it's as if debugging the kernel is a system-wide thing :)
Quoted 6 lines
So please, don't use /debug/ use the standard, defined, and ACTUALLY USED BY DISTROS TODAY mount point of
/sys/kernel/debug/If you want to create your own symlink from /debug/ to that location to make it easier to type, feel free, but do not hard code any scripts to use that location, or they are going to break.
All my scripts search
/proc/mountsto find where debugfs is mounted, then it uses that.Quoted 8 lines
Quoted 3 lines
Hmm, Not sure what packages in the distros use the default. I don't see the debugfs in
/etc/fstabin any of my machines.Yes.. In my case, I use linux distributions like Ubuntu 8.10, Fedora 9/10, CENTOS 5.3 currently. This distributions use proc , tmpfs, devpts, sysfs for official release
by default.The key thing is not to have scripts depend on a path. When debugfs is enabled in a kernel, you automatically get
/sys/kernel/debug, so that is a natural place to mount it.I have also suggested to people (as Greg suggested earlier to me) that you can mount it there and then make a soft link to it. Which also works.
I personally just mount it at /debug.
To handle the scripts problem, all my scripts start with:
# grep debugfs /proc/mounts | cut -d ' ' -f 2I also have a C function to do a search for debugfs in
/proc/mounts.If you look in
Documentation/trace/ftrace.txtI have:===
To mount the debugfs system:# mkdir /debug # mount -t debugfs nodev /debug
Quoted 8 lines
( Note: it is more common to mount at
/sys/kernel/debug, but for simplicity this document will use /debug)
===Thus it is a personal preference of mine to put it at /debug. But I do not hide the fact that it is recommended to be in
/sys/kernel/debug. Heck, I'm the one that brought to light that path in this thread. I just curse it everytime I have to say it ;-)
Thank you for explanation about history of "/debug/" and "/sys/kernel/debug/" in the ./Documentations/trace/ftrace.txt file.
Do I have to change contents of patch file from "/debug/***" to "debug/***" to consider both "/debug/"directory and
"/sys/kernel/debug/ (initial directory by debugfs)" directory in the my patch file?
Or,
Do I have to keep "/" character of "/debug" in my patch file that I proposed because many contributors already use "/debugfs/" or "/debug/" in their patch files?
Steven, Can you advise me?
Quoted 3 lines
-- Steve
Signature · 10 lines
Regards, GeunSik Lim ( SAMSUNG ELECTRONICS) Blog : http://blog.naver.com/invain/ e-Mail: [email protected] [email protected] , [email protected] -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Hello Steve,
Quoted 5 lines · Steven Rostedt
If you look in
Documentation/trace/ftrace.txtI have:===
To mount the debugfs system:
Quoted 7 lines
# mkdir /debug # mount -t debugfs nodev /debug( Note: it is more common to mount at
/sys/kernel/debug, but for
simplicity this document will use /debug)
===
Please standardize Documentation/trace/ftrace.txt and avoid confusion to users:
===
To mount the debugfs system:
# mount -t debugfs nodev /sys/kernel/debug ===
Thanks,
--
JSR
Steven Rostedt
maintainerQuoted 17 lines · Jaswinder Singh Rajput
Hello Steve,
Quoted 5 lines · Steven Rostedt
If you look in
Documentation/trace/ftrace.txtI have:===
To mount the debugfs system:Quoted 7 lines
# mkdir /debug # mount -t debugfs nodev /debug( Note: it is more common to mount at
/sys/kernel/debug, but for
simplicity this document will use /debug)
===
Quoted 8 lines
Please standardize
Documentation/trace/ftrace.txtand avoid confusion to users:===
To mount the debugfs system:# mount -t debugfs nodev /sys/kernel/debug ===
I really don't want to do that. Then I would need to show
# echo function_graph > /sys/kernel/debug/current_trace
Which I really do not like. I state that the common place to mount it is in /sys/kernel/debug, But my examples are much easier to understand if I just do: # echo function_graph > /debug/current_trace
-- Steve
Quoted 29 lines · Steven Rostedt
Quoted 17 lines · Jaswinder Singh Rajput
Hello Steve,
Quoted 5 lines · Steven Rostedt
If you look in
Documentation/trace/ftrace.txtI have:===
To mount the debugfs system:Quoted 7 lines
# mkdir /debug # mount -t debugfs nodev /debug( Note: it is more common to mount at
/sys/kernel/debug, but for
simplicity this document will use /debug)
===Quoted 8 lines
Please standardize
Documentation/trace/ftrace.txtand avoid confusion to users:===
To mount the debugfs system:# mount -t debugfs nodev /sys/kernel/debug ===
Quoted 7 lines
I really don't want to do that. Then I would need to show
# echo function_graph > /sys/kernel/debug/current_traceWhich I really do not like. I state that the common place to mount it is in
/sys/kernel/debug, But my examples are much easier to understand if I just do: # echofunction_graph> /debug/current_trace
It's not just the "common" place, it is the DOCUMENTED PLACE.
I'm sorry you have to type a long path, perhaps you wish to invest in a tab key for auto-completion :)
Again, distros already mount debugfs at this location, please don't confuse people just because you are annoyed at the length of the path.
thanks,
greg k-h
Steven Rostedt
maintainerQuoted 8 lines · Greg KH
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
( Note: it is more common to mount at
/sys/kernel/debug, but for
simplicity this document will use /debug)
===I really don't want to do that. Then I would need to show
Quoted 7 lines
Quoted 5 lines
# echo function_graph > /sys/kernel/debug/current_traceWhich I really do not like. I state that the common place to mount it is in
/sys/kernel/debug, But my examples are much easier to understand if I just do: # echofunction_graph> /debug/current_traceIt's not just the "common" place, it is the DOCUMENTED PLACE.
I can change the wording to be "documented" or "distro mounted".
Quoted 6 lines
I'm sorry you have to type a long path, perhaps you wish to invest in a tab key for auto-completion :)
Again, distros already mount debugfs at this location, please don't confuse people just because you are annoyed at the length of the path.
Have you found which packages do that?
The point is that the document is more interested in showing the files that are being used, and if I add /sys/kernel/debug/ in front of every file, that just distracts from the eye. As stated:
"but for simplicity this document will use /debug"
I'll update ftrace.txt to explain it better.
Something like:
=====
Debugfs is mounted by some packages at /sys/kernel/debugfs. If it is not you can mount it by adding
debugfs /sys/kernel/debug debugfs defaults 0 0
to your /etc/fstab, or by manually mounting it:
# mount -t debugfs nodev /sys/kernel/debugfs
For simplicity, this document will assume that you also added the following symbolic link:
# ln -s /sys/kernel/debugfs /debug =====
Then I can keep the document simplistic and still have the "DOCUMENTED" locating specified.
-- Steve
Quoted 7 lines · Steven Rostedt
Quoted 5 lines
I'm sorry you have to type a long path, perhaps you wish to invest in a tab key for auto-completion :)
Again, distros already mount debugfs at this location, please don't confuse people just because you are annoyed at the length of the path.
Have you found which packages do that?
The base system packages on all openSUSE and SLE11 releases. Possibly SLE10 also does it, but I don't have a running instance of that at the moment.
Quoted 5 lines
The point is that the document is more interested in showing the files that are being used, and if I add
/sys/kernel/debug/in front of every file, that just distracts from the eye. As stated:"but for simplicity this document will use /debug"
Sorry for the "distraction", but that goes against documentation on your machine:
$ man mount | grep -A 3 "Mount options for debugfs" Mount options for debugfs The debugfs file system is a pseudo file system, traditionally mounted on /sys/kernel/debug. There are no mount options.
It's not only a documented standard, it's a "tradition" :)
Please fix your documentation.
thanks,
greg k-h
Quoted 29 lines · Steven Rostedt
Quoted 8 lines · Greg KH
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
( Note: it is more common to mount at
/sys/kernel/debug, but for simplicity this document will use /debug)
===I really don't want to do that. Then I would need to show
Quoted 7 lines
Quoted 5 lines
# echo function_graph > /sys/kernel/debug/current_traceWhich I really do not like. I state that the common place to mount it is in
/sys/kernel/debug, But my examples are much easier to understand if I just do: # echofunction_graph> /debug/current_traceIt's not just the "common" place, it is the DOCUMENTED PLACE.
I can change the wording to be "documented" or "distro mounted".
Quoted 6 lines
I'm sorry you have to type a long path, perhaps you wish to invest in a tab key for auto-completion :)
Again, distros already mount debugfs at this location, please don't confuse people just because you are annoyed at the length of the path.
Have you found which packages do that?
Quoted 7 lines
The point is that the document is more interested in showing the files that are being used, and if I add
/sys/kernel/debug/in front of every file, that just distracts from the eye. As stated:"but for simplicity this document will use /debug"
I'll update ftrace.txt to explain it better.
Thank you for the decision to update debufs filesystem realted contents.
Quoted 11 lines
Something like:
=====
Debugfs is mounted by some packages at/sys/kernel/debugfs. If it is not you can mount it by addingdebugfs
/sys/kernel/debugdebugfs defaults 0 0to your
/etc/fstab, or by manually mounting it:
Quoted 7 lines
# mount -t debugfs nodev /sys/kernel/debugfsFor simplicity, this document will assume that you also added the following symbolic link:
# ln -s /sys/kernel/debugfs /debug =====
About typo in the above statements./sys/kernel/debugfs --> /sys/kenrel/debug
Default directory of debugfs filesystem is /sys/kernel/debug/ as you know.
Quoted 7 lines
Then I can keep the document simplistic and still have the "DOCUMENTED" locating specified.
-- Steve
Signature · 10 lines
Regards, GeunSik Lim ( SAMSUNG ELECTRONICS) Blog : http://blog.naver.com/invain/ e-Mail: [email protected] [email protected] , [email protected] -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RFC PATCH v2 1/1 debugfs:Fix terminology inconsistency of dir name to mount debugfs filesystem.
In reply to GeunSik LimDear Greg and Steen,
Thanks your advices and opinions about a confusion according to
too many mount directory names for debugfs. I made rfc v2 patch file again like belows. Can I hear your advices about below patch contents?.
Regards,
GeunSik Lim.
Subject: [PATCH] Fix terminology inconsistency of dir name to mount debugfs filesystem.
Many developers use "/debug/" or "/debugfs/ directory name to mount debugfs filesystem for ftrace according to ./Documentation/tracers/ftrace.txt file.
And, three directory names(ex:/debug/, /debugfs/, /sys/kernel/debug/) is existed in kernel source like ftrace, DRM, Wireless, Network[sky2]files to mount debugfs filesystem.
debugfs means debug filesystem for debugging easy to use by greg kroah hartman. "/sys/kernel/debug/" name is suitable as directory name of debugfs filesystem.
-debugfs related reference: http://lwn.net/Articles/115405/
Fix inconsistency of directory name to mount debugfs filesystem.
--- Documentation/DocBook/debugobjects.tmpl | 2 +- Documentation/cdrom/packet-writing.txt | 2 +- Documentation/fault-injection/fault-injection.txt | 70 +++++----- Documentation/kprobes.txt | 6 +- Documentation/trace/ftrace.txt | 166 ++++++++++---------- Documentation/trace/mmiotrace.txt | 26 ++-- drivers/block/pktcdvd.c | 2 +- drivers/gpu/drm/drm_debugfs.c | 12 +- drivers/gpu/drm/drm_drv.c | 2 +- drivers/gpu/drm/drm_stub.c | 2 +- drivers/net/Kconfig | 4 +- drivers/net/wimax/i2400m/i2400m.h | 2 +- drivers/net/wireless/ath5k/Kconfig | 6 +- drivers/net/wireless/libertas/README | 12 +- drivers/scsi/lpfc/lpfc_debugfs.c | 4 +- include/linux/kernel.h | 2 +- include/linux/tracepoint.h | 4 +- kernel/trace/Kconfig | 10 +- kernel/trace/trace.c | 24 ++-- scripts/tracing/draw_functrace.py | 8 +- 20 files changed, 183 insertions(+), 183 deletions(-)
Documentation/DocBook/debugobjects.tmpl +1 -1
@@ -106,7 +106,7 @@ number of errors are printk'ed including a full stack trace. </para> <para> - The statistics are available via debugfs/debug_objects/stats. + The statistics are available via /sys/kernel/debug/debug_objects/stats. They provide information about the number of warnings and the number of successful fixups along with information about the usage of the internal tracking objects and the state of the
Documentation/cdrom/packet-writing.txt +1 -1
@@ -117,7 +117,7 @@ Using the pktcdvd debugfs interface To read pktcdvd device infos in human readable form, do: - # cat /debug/pktcdvd/pktcdvd[0-7]/info + # cat /sys/kernel/debug/pktcdvd/pktcdvd[0-7]/info For a description of the debugfs interface look into the file:
Documentation/fault-injection/fault-injection.txt +35 -35
145 lines not on this page · raw message
Documentation/kprobes.txt +3 -3
@@ -507,9 +507,9 @@ http://www.linuxsymposium.org/2006/linuxsymposium_procv2.pdf (pages 101-115) Appendix A: The kprobes debugfs interface With recent kernels (> 2.6.20) the list of registered kprobes is visible -under the /debug/kprobes/ directory (assuming debugfs is mounted at /debug). +under the /sys/kernel/debug/kprobes/ directory (assuming debugfs is mounted at //sys/kernel/debug). -/debug/kprobes/list: Lists all registered probes on the system +/sys/kernel/debug/kprobes/list: Lists all registered probes on the system c015d71a k vfs_read+0x0 c011a316 j do_fork+0x0
@@ -525,7 +525,7 @@ virtual addresses that correspond to modules that've been unloaded), such probes are marked with [GONE]. If the probe is temporarily disabled, such probes are marked with [DISABLED]. -/debug/kprobes/enabled: Turn kprobes ON/OFF forcibly. +/sys/kernel/debug/kprobes/enabled: Turn kprobes ON/OFF forcibly. Provides a knob to globally and forcibly turn registered kprobes ON or OFF. By default, all kprobes are enabled. By echoing "0" to this file, all
Documentation/trace/ftrace.txt +83 -83
375 lines not on this page · raw message
Documentation/trace/mmiotrace.txt +13 -13
@@ -32,41 +32,41 @@ is no way to automatically detect if you are losing events due to CPUs racing. Usage Quick Reference --------------------- -$ mount -t debugfs debugfs /debug -$ echo mmiotrace > /debug/tracing/current_tracer -$ cat /debug/tracing/trace_pipe > mydump.txt & +$ mount -t debugfs debugfs /sys/kernel/debug +$ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer +$ cat /sys/kernel/debug/tracing/trace_pipe > mydump.txt & Start X or whatever. -$ echo "X is up" > /debug/tracing/trace_marker -$ echo nop > /debug/tracing/current_tracer +$ echo "X is up" > /sys/kernel/debug/tracing/trace_marker +$ echo nop > /sys/kernel/debug/tracing/current_tracer Check for lost events. Usage ----- -Make sure debugfs is mounted to /debug. If not, (requires root privileges) -$ mount -t debugfs debugfs /debug +Make sure debugfs is mounted to /sys/kernel/debug. If not, (requires root privileges) +$ mount -t debugfs debugfs /sys/kernel/debug Check that the driver you are about to trace is not loaded. Activate mmiotrace (requires root privileges): -$ echo mmiotrace > /debug/tracing/current_tracer +$ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer Start storing the trace: -$ cat /debug/tracing/trace_pipe > mydump.txt & +$ cat /sys/kernel/debug/tracing/trace_pipe > mydump.txt & The 'cat' process should stay running (sleeping) in the background. Load the driver you want to trace and use it. Mmiotrace will only catch MMIO accesses to areas that are ioremapped while mmiotrace is active. During tracing you can place comments (markers) into the trace by -$ echo "X is up" > /debug/tracing/trace_marker +$ echo "X is up" > /sys/kernel/debug/tracing/trace_marker This makes it easier to see which part of the (huge) trace corresponds to which action. It is recommended to place descriptive markers about what you do. Shut down mmiotrace (requires root privileges): -$ echo nop > /debug/tracing/current_tracer +$ echo nop > /sys/kernel/debug/tracing/current_tracer The 'cat' process exits. If it does not, kill it by issuing 'fg' command and pressing ctrl+c.
@@ -78,10 +78,10 @@ to view your kernel log and look for "mmiotrace has lost events" warning. If events were lost, the trace is incomplete. You should enlarge the buffers and try again. Buffers are enlarged by first seeing how large the current buffers are: -$ cat /debug/tracing/buffer_size_kb +$ cat /sys/kernel/debug/tracing/buffer_size_kb gives you a number. Approximately double this number and write it back, for instance: -$ echo 128000 > /debug/tracing/buffer_size_kb +$ echo 128000 > /sys/kernel/debug/tracing/buffer_size_kb Then start again from the top. If you are doing a trace for a driver project, e.g. Nouveau, you should also
drivers/block/pktcdvd.c +1 -1
@@ -430,7 +430,7 @@ static void pkt_sysfs_cleanup(void)/******************************************************************** entries in debugfs -/debugfs/pktcdvd[0-7]/ +/sys/kernel/debug/pktcdvd[0-7]/ info *******************************************************************/
drivers/gpu/drm/drm_debugfs.c +6 -6
@@ -105,7 +105,7 @@ int drm_debugfs_create_files(struct drm_info_list *files, int count, ent =debugfs_create_file (files[i].name,S_IFREG |S_IRUGO , root, tmp, &drm_debugfs_fops);if (!ent) { -DRM_ERROR ("Cannot create /debugfs/dri/%s/%s\n" , +DRM_ERROR ("Cannot create /sys/kernel/debug/dri/%s/%s\n" , name, files[i].name);drm_free (tmp,sizeof (struct drm_info_node ), _DRM_DRIVER);
@@ -133,9 +133,9 @@ EXPORT_SYMBOL(drm_debugfs_create_files);* \param minor device minor number * \param root DRI debugfs dir entry. * -* Create the DRI debugfs root entry "/debugfs/dri", the device debugfs root entry -* "/debugfs/dri/%minor%/", and each entry in debugfs_list as -* "/debugfs/dri/%minor%/%name%". +* Create the DRI debugfs root entry "/sys/kernel/debug/dri", the device debugfs root entry +* "/sys/kernel/debug/dri/%minor%/", and each entry in debugfs_list as +* "/sys/kernel/debug/dri/%minor%/%name%". */ int drm_debugfs_init (struct drm_minor *minor,int minor_id,struct dentry *root)
@@ -148,7 +148,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,sprintf (name,"%d" , minor_id); minor->debugfs_root =debugfs_create_dir (name, root);if (!minor->debugfs_root) { -DRM_ERROR ("Cannot create /debugfs/dri/%s\n" , name); +DRM_ERROR ("Cannot create /sys/kernel/debug/dri/%s\n" , name);return -1 ; }
@@ -165,7 +165,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, ret = dev->driver->debugfs_init (minor);if (ret) {DRM_ERROR ("DRM: Driver failed to initialize " -"/debugfs/dri.\n" ); +"/sys/kernel/debug/dri.\n" );return ret; } }
drivers/gpu/drm/drm_drv.c +1 -1
@@ -339,7 +339,7 @@ static int __init drm_core_init(void) drm_debugfs_root =debugfs_create_dir ("dri" ,NULL );if (!drm_debugfs_root) { -DRM_ERROR ("Cannot create /debugfs/dri\n" ); +DRM_ERROR ("Cannot create /sys/kernel/debug/dri\n" ); ret =-1 ; goto err_p3; }
drivers/gpu/drm/drm_stub.c +1 -1
@@ -328,7 +328,7 @@ static int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int t#if defined(CONFIG_DEBUG_FS ) ret =drm_debugfs_init (new_minor, minor_id, drm_debugfs_root);if (ret) { -DRM_ERROR ("DRM: Failed to initialize /debugfs/dri.\n" ); +DRM_ERROR ("DRM: Failed to initialize /sys/kernel/debug/dri.\n" ); goto err_g2; }#endif
drivers/net/Kconfig +2 -2
@@ -2200,7 +2200,7 @@ config SKGE_DEBUG depends on SKGE && DEBUG_FS help This option adds the ability to dump driver state for debugging. - The file debugfs/skge/ethX displays the state of the internal + The file /sys/kernel/debug/skge/ethX displays the state of the internal transmit and receive rings. If unsure, say N.
@@ -2226,7 +2226,7 @@ config SKY2_DEBUG depends on SKY2 && DEBUG_FS help This option adds the ability to dump driver state for debugging. - The file debugfs/sky2/ethX displays the state of the internal + The file /sys/kernel/debug/sky2/ethX displays the state of the internal transmit and receive rings. If unsure, say N.
drivers/net/wimax/i2400m/i2400m.h +1 -1
@@ -389,7 +389,7 @@ struct i2400m { unsigned ready:1; /* all probing steps done */ unsigned rx_reorder:1; /* RX reorder is enabled */u8 trace_msg_from_user;/* echo rx msgs to 'trace' pipe */ -/* typed u8 so debugfs/u8 can tweak */ +/* typed u8 so /sys/kernel/debug/u8 can tweak */ enum i2400m_system_state state;wait_queue_head_t state_wq;/* Woken up when on state updates */
drivers/net/wireless/ath5k/Kconfig +3 -3
@@ -27,11 +27,11 @@ config ATH5K_DEBUG Say Y, if and you will get debug options for ath5k. To use this, you need to mount debugfs: - mkdir /debug/ - mount -t debugfs debug /debug/ + mkdir /sys/kernel/debug/ + mount -t debugfs debug /sys/kernel/debug/ You will get access to files under: - /debug/ath5k/phy0/ + /sys/kernel/debug/ath5k/phy0/ To enable debug, pass the debug level to the debug module parameter. For example:
drivers/net/wireless/libertas/README +6 -6
@@ -72,7 +72,7 @@ rdrf location that is to be read. This parameter must be specified in hexadecimal (its possible to preceed preceding the number with a "0x"). - Path: /debugfs/libertas_wireless/ethX/registers/ + Path: /sys/kernel/debug/libertas_wireless/ethX/registers/ Usage: echo "0xa123" > rdmac ; cat rdmac
@@ -95,7 +95,7 @@ wrrf sleepparams This command is used to set the sleepclock configurations - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: cat sleepparams: reads the current sleepclock configuration
@@ -115,7 +115,7 @@ subscribed_events The subscribed_events directory contains the interface for the subscribed events API. - Path: /debugfs/libertas_wireless/ethX/subscribed_events/ + Path: /sys/kernel/debug/libertas_wireless/ethX/subscribed_events/ Each event is represented by a filename. Each filename consists of the following three fields:
@@ -165,7 +165,7 @@ subscribed_events extscan This command is used to do a specific scan. - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: echo "SSID" > extscan
@@ -179,7 +179,7 @@ getscantable Display the current contents of the driver scan table (ie. get the scan results). - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: cat getscantable
@@ -188,7 +188,7 @@ setuserscan Initiate a customized scan and retrieve the results - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: echo "[ARGS]" > setuserscan
drivers/scsi/lpfc/lpfc_debugfs.c +2 -2
@@ -51,8 +51,8 @@* debugfs interface * * To access this interface the user should: -* # mkdir /debug -* # mount -t debugfs none /debug +* # mkdir /sys/kernel/debug +* # mount -t debugfs none /sys/kernel/debug * * The lpfc debugfs directory hierarchy is: * lpfc/lpfcX/vportY
include/linux/kernel.h +1 -1
@@ -406,7 +406,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte)* * Use tracing_on/tracing_off when you want to quickly turn on or off * tracing. It simply enables or disables the recording of the trace events. -* This also corresponds to the user space debugfs/tracing/tracing_on +* This also corresponds to the user space /sys/kernel/debug/tracing/tracing_on * file, which gives a means for the kernel and userspace to interact. * Place a tracing_off() in the kernel where you want tracing to end. * From user space, examine the trace, and then echo 1 > tracing_on
include/linux/tracepoint.h +2 -2
@@ -197,7 +197,7 @@ static inline void tracepoint_synchronize_unregister(void)* * This is how the trace record is structured and will * * be saved into the ring buffer. These are the fields * * that will be exposed to user-space in -* * /debug/tracing/events/<*>/format. +* * /sys/kernel/debug/tracing/events/<*>/format. * * * * The declared 'local variable' is called '__entry' * *
@@ -257,7 +257,7 @@ static inline void tracepoint_synchronize_unregister(void)* tracepoint callback (this is used by programmatic plugins and * can also by used by generic instrumentation like SystemTap), and * it is also used to expose a structured trace record in -* /debug/tracing/events/. +* /sys/kernel/debug/tracing/events/. */ #define TRACE_EVENT (name, proto, args, struct, assign, print) \
kernel/trace/Kconfig +5 -5
@@ -120,7 +120,7 @@ config IRQSOFF_TRACER disabled by default and can be runtime (re-)started via: - echo 0 > /debugfs/tracing/tracing_max_latency + echo 0 > /sys/kernel/debug/tracing/tracing_max_latency (Note that kernel size and overhead increases with this option enabled. This option and the preempt-off timing option can be
@@ -141,7 +141,7 @@ config PREEMPT_TRACER disabled by default and can be runtime (re-)started via: - echo 0 > /debugfs/tracing/tracing_max_latency + echo 0 > /sys/kernel/debug/tracing/tracing_max_latency (Note that kernel size and overhead increases with this option enabled. This option and the irqs-off timing option can be
@@ -213,7 +213,7 @@ config TRACE_BRANCH_PROFILING This tracer profiles all the the likely and unlikely macros in the kernel. It will display the results in: - /debugfs/tracing/profile_annotated_branch + /sys/kernel/debug/tracing/profile_annotated_branch Note: this will add a significant overhead, only turn this on if you need to profile the system's use of these macros.
@@ -228,7 +228,7 @@ config PROFILE_ALL_BRANCHES taken in the kernel is recorded whether it hit or miss. The results will be displayed in: - /debugfs/tracing/profile_branch + /sys/kernel/debug/tracing/profile_branch This configuration, when enabled, will impose a great overhead on the system. This should only be enabled when the system
@@ -276,7 +276,7 @@ config STACK_TRACER select KALLSYMS help This special tracer records the maximum stack footprint of the - kernel and displays it in debugfs/tracing/stack_trace. + kernel and displays it in /sys/kernel/debug/tracing/stack_trace. This tracer works by hooking into every function call that the kernel executes, and keeping a maximum stack depth value and
kernel/trace/trace.c +12 -12
@@ -335,7 +335,7 @@ static raw_spinlock_t ftrace_max_lock =/* * Copy the new maximum trace into the separate maximum-trace * structure. (this way the maximum trace is permanently saved, -* for later retrieval via /debugfs/tracing/latency_trace) +* for later retrieval via /sys/kernel/debug/tracing/latency_trace) */ static void __update_max_tr (struct trace_array *tr,struct task_struct *tsk,int cpu)
@@ -2366,21 +2366,21 @@ static const struct file_operations tracing_iter_fops = {static const char readme_msg[] ="tracing mini-HOWTO:\n\n" -"# mkdir /debug\n" -"# mount -t debugfs nodev /debug\n\n" -"# cat /debug/tracing/available_tracers\n" +"# mkdir /sys/kernel/debug\n" +"# mount -t debugfs nodev /sys/kernel/debug\n\n" +"# cat /sys/kernel/debug/tracing/available_tracers\n" "wakeup preemptirqsoff preemptoff irqsoff function sched_switch nop\n\n" -"# cat /debug/tracing/current_tracer\n" +"# cat /sys/kernel/debug/tracing/current_tracer\n" "nop\n" -"# echo sched_switch > /debug/tracing/current_tracer\n" -"# cat /debug/tracing/current_tracer\n" +"# echo sched_switch > /sys/kernel/debug/tracing/current_tracer\n" +"# cat /sys/kernel/debug/tracing/current_tracer\n" "sched_switch\n" -"# cat /debug/tracing/trace_options\n" +"# cat /sys/kernel/debug/tracing/trace_options\n" "noprint-parent nosym-offset nosym-addr noverbose\n" -"# echo print-parent > /debug/tracing/trace_options\n" -"# echo 1 > /debug/tracing/tracing_enabled\n" -"# cat /debug/tracing/trace > /tmp/trace.txt\n" -"# echo 0 > /debug/tracing/tracing_enabled\n" +"# echo print-parent > /sys/kernel/debug/tracing/trace_options\n" +"# echo 1 > /sys/kernel/debug/tracing/tracing_enabled\n" +"# cat /sys/kernel/debug/tracing/trace > /tmp/trace.txt\n" +"# echo 0 > /sys/kernel/debug/tracing/tracing_enabled\n" ; static ssize_t
scripts/tracing/draw_functrace.py +4 -4
@@ -12,10 +12,10 @@ calls. Only the functions's names and the the call time are provided. Usage: Be sure that you have CONFIG_FUNCTION_TRACER - # mkdir /debugfs - # mount -t debug debug /debug - # echo function > /debug/tracing/current_tracer - $ cat /debug/tracing/trace_pipe > ~/raw_trace_func + # mkdir /sys/kernel/debug + # mount -t debug debug /sys/kernel/debug + # echo function > /sys/kernel/debug/tracing/current_tracer + $ cat /sys/kernel/debug/tracing/trace_pipe > ~/raw_trace_func Wait some times but not too much, the script is a bit slow. Break the pipe (Ctrl + Z) $ scripts/draw_functrace.py < raw_trace_func > draw_functrace
Signature · 14 lines
1.6.3.1 ----------------------------------------------- To unsubscribe from this list: send the line "unsubscribe linux-***" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ GeunSik Lim ( S A M S U N G E L E C T R O N I C S ) e-Mail :1) [email protected] 2) [email protected] , [email protected] HomePage: http://blog.naver.com/invain/ -----------------------------------------------
Steven Rostedt
maintainerDocumentation/trace/ftrace.txt well as the files to display output. · line 38
Quoted 11 lines · GeunSik Lim
Documentation/trace/ftrace.txt +1
-2@@ -35,11 +35,11 @@ well as the files to display output. To mount the debugfs system: - # mkdir /debug - # mount -t debugfs nodev /debug + # mkdir /sys/kernel/debug
If you configure debugfs into the kernel, the directory /sys/kernel/debug will automatically be created. Remember, /sys is a psuedo filesystem as well.
Documentation/trace/ftrace.txt well as the files to display output. · line 42
Quoted 5 lines
Documentation/trace/ftrace.txt +2
-1+ # mount -t debugfs nodev /sys/kernel/debug ( Note: it is more common to mount at /sys/kernel/debug, but for - simplicity this document will use /debug) + simplicity this document will use /sys/kernel/debug)
LOL!
Quoted 99 lines
Documentation/trace/ftrace.txt +22
-22That's it! (assuming that you have ftrace configured into your kernel)@@ -389,18 +389,18 @@ trace_options The trace_options file is used to control what gets printed in the trace output. To see what is available, simply cat the file: - cat /debug/tracing/trace_options + cat /sys/kernel/debug/tracing/trace_options print-parent nosym-offset nosym-addr noverbose noraw nohex nobin \ noblock nostacktrace nosched-tree nouserstacktrace nosym-userobj To disable one of the options, echo in the option prepended with "no". - echo noprint-parent > /debug/tracing/trace_options + echo noprint-parent > /sys/kernel/debug/tracing/trace_options To enable an option, leave off the "no". - echo sym-offset > /debug/tracing/trace_options + echo sym-offset > /sys/kernel/debug/tracing/trace_options Here are the available options:@@ -476,11 +476,11 @@ sched_switch This tracer simply records schedule switches. Here is an example of how to use it. - # echo sched_switch > /debug/tracing/current_tracer - # echo 1 > /debug/tracing/tracing_enabled + # echo sched_switch > /sys/kernel/debug/tracing/current_tracer + # echo 1 > /sys/kernel/debug/tracing/tracing_enabled # sleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > /sys/kernel/debug/tracing/tracing_enabled + # cat /sys/kernel/debug/tracing/trace # tracer: sched_switch #@@ -574,13 +574,13 @@ new trace is saved. To reset the maximum, echo 0 into tracing_max_latency. Here is an example: - # echo irqsoff > /debug/tracing/current_tracer - # echo 0 > /debug/tracing/tracing_max_latency - # echo 1 > /debug/tracing/tracing_enabled + # echo irqsoff > /sys/kernel/debug/tracing/current_tracer + # echo 0 > /sys/kernel/debug/tracing/tracing_max_latency + # echo 1 > /sys/kernel/debug/tracing/tracing_enabled # ls -ltr - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > /sys/kernel/debug/tracing/tracing_enabled + # cat /sys/kernel/debug/tracing/latency_trace # tracer: irqsoff # irqsoff latency trace v1.1.5 on 2.6.26@@ -681,13 +681,13 @@ Like the irqsoff tracer, it records the maximum latency for which preemption was disabled. The control of preemptoff tracer is much like the irqsoff tracer. - # echo preemptoff > /debug/tracing/current_tracer - # echo 0 > /debug/tracing/tracing_max_latency - # echo 1 > /debug/tracing/tracing_enabled + # echo preemptoff > /sys/kernel/debug/tracing/current_tracer + # echo 0 > /sys/kernel/debug/tracing/tracing_max_latency + # echo 1 > /sys/kernel/debug/tracing/tracing_enabled # ls -ltr - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > /sys/kernel/debug/tracing/tracing_enabled + # cat /sys/kernel/debug/tracing/latency_trace # tracer: preemptoff # preemptoff latency trace v1.1.5 on 2.6.26-rc8@@ -828,13 +828,13 @@ tracer. Again, using this trace is much like the irqsoff and preemptoff tracers. - # echo preemptirqsoff > /debug/tracing/current_tracer - # echo 0 > /debug/tracing/tracing_max_latency - # echo 1 > /debug/tracing/tracing_enabled + # echo preemptirqsoff > /sys/kernel/debug/tracing/current_tracer + # echo 0 > /sys/kernel/debug/tracing/tracing_max_latency + # echo 1 > /sys/kernel/debug/tracing/tracing_enabled # ls -ltr - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > /sys/kernel/debug/tracing/tracing_enabled + # cat /sys/kernel/debug/tracing/latency_trace # tracer: preemptirqsoff # preemptirqsoff latency trace v1.1.5 on 2.6.26-rc8
Documentation/trace/ftrace.txt slightly differently than we did with the previous tracers. · line 995
Quoted 9 lines
Documentation/trace/ftrace.txt +3
-3@@ -990,12 +990,12 @@ slightly differently than we did with the previous tracers. Instead of performing an 'ls', we will run 'sleep 1' under 'chrt' which changes the priority of the task. - # echo wakeup > /debug/tracing/current_tracer - # echo 0 > /debug/tracing/tracing_max_latency - # echo 1 > /debug/tracing/tracing_enabled + # echo wakeup > /sys/kernel/debug/tracing/current_tracer + # echo 0 > /sys/kernel/debug/tracing/tracing_max_latency + # echo 1 > /sys/kernel/debug/tracing/tracing_enabled
Egad! This is exactly why I hate the path name. It distracts so much from the eyes to what you want to accomplish. It seems that because it is a tradition to use this /sys/kernel/debug path, that I'm destine to fail in my discuss for it. I will ask that this document suggest the following at the beginning.
===
When debugfs is configured into the kernel (which selecting any ftrace option will do) the directory /sys/kernel/debug will be created. To mount this directory, you can add to your /etc/fstab file:
debugfs /debug debugfs defaults 0 0
Or you can mount it at run time with:
mount -t debugfs nodev /sys/kernel/debug
For quicker access to that directory you may want to make a soft link to it:
ln -s /sys/kernel/debug /debug
Any selected ftrace option will also create a directory called tracing within the debugfs. The rest of the document will assume that you are in the ftrace directory (cd /sys/kernel/debugfs) and will only concentrate on the files within that directory and not distract from the content with the extended "/sys/kernel/debug/tracing" path name.
===
And then we can change all your other changes in this file as:
s,/sys/kernel/debug/tracing,,
-- Steve
Quoted 727 lines
Documentation/trace/ftrace.txt +55
-55# chrt -f 5 sleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > /sys/kernel/debug/tracing/tracing_enabled + # cat /sys/kernel/debug/tracing/latency_trace # tracer: wakeup # wakeup latency trace v1.1.5 on 2.6.26-rc8@@ -1105,11 +1105,11 @@ can be done from the debug file system. Make sure the ftrace_enabled is set; otherwise this tracer is a nop. # sysctl kernel.ftrace_enabled=1 - # echo function > /debug/tracing/current_tracer - # echo 1 > /debug/tracing/tracing_enabled + # echo function > /sys/kernel/debug/tracing/current_tracer + # echo 1 > /sys/kernel/debug/tracing/tracing_enabled # usleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > /sys/kernel/debug/tracing/tracing_enabled + # cat /sys/kernel/debug/tracing/trace # tracer: function # # TASK-PID CPU# TIMESTAMP FUNCTION@@ -1146,7 +1146,7 @@ int trace_fd; int main(int argc, char *argv[]) { - trace_fd = open("/debug/tracing/tracing_enabled", O_WRONLY); + trace_fd = open("/sys/kernel/debug/tracing/tracing_enabled", O_WRONLY); if (condition_hit()) { write(trace_fd, "0", 1);@@ -1155,7 +1155,7 @@ int main(int argc, char *argv[]) { } Note: Here we hard coded the path name. The debugfs mount is not -guaranteed to be at /debug (and is more commonly at +guaranteed to be at /sys/kernel/debug (and is more commonly at /sys/kernel/debug). For simple one time traces, the above is sufficent. For anything else, a search through /proc/mounts may be needed to find where the debugfs file-system is mounted.@@ -1164,16 +1164,16 @@ be needed to find where the debugfs file-system is mounted. Single thread tracing --------------------- -By writing into /debug/tracing/set_ftrace_pid you can trace a +By writing into /sys/kernel/debug/tracing/set_ftrace_pid you can trace a single thread. For example: -# cat /debug/tracing/set_ftrace_pid +# cat /sys/kernel/debug/tracing/set_ftrace_pid no pid -# echo 3111 > /debug/tracing/set_ftrace_pid -# cat /debug/tracing/set_ftrace_pid +# echo 3111 > /sys/kernel/debug/tracing/set_ftrace_pid +# cat /sys/kernel/debug/tracing/set_ftrace_pid 3111 -# echo function > /debug/tracing/current_tracer -# cat /debug/tracing/trace | head +# echo function > /sys/kernel/debug/tracing/current_tracer +# cat /sys/kernel/debug/tracing/trace | head # tracer: function # # TASK-PID CPU# TIMESTAMP FUNCTION@@ -1184,8 +1184,8 @@ no pid yum-updatesd-3111 [003] 1637.254683: lock_hrtimer_base <-hrtimer_try_to_cancel yum-updatesd-3111 [003] 1637.254685: fget_light <-do_sys_poll yum-updatesd-3111 [003] 1637.254686: pipe_poll <-do_sys_poll -# echo -1 > /debug/tracing/set_ftrace_pid -# cat /debug/tracing/trace |head +# echo -1 > /sys/kernel/debug/tracing/set_ftrace_pid +# cat /sys/kernel/debug/tracing/trace |head # tracer: function # # TASK-PID CPU# TIMESTAMP FUNCTION@@ -1217,12 +1217,12 @@ int main (int argc, char **argv) char line[64]; int s; - ffd = open("/debug/tracing/current_tracer", O_WRONLY); + ffd = open("/sys/kernel/debug/tracing/current_tracer", O_WRONLY); if (ffd < 0) exit(-1); write(ffd, "nop", 3); - fd = open("/debug/tracing/set_ftrace_pid", O_WRONLY); + fd = open("/sys/kernel/debug/tracing/set_ftrace_pid", O_WRONLY); s = sprintf(line, "%d\n", getpid()); write(fd, line, s);@@ -1374,22 +1374,22 @@ want, depending on your needs. tracing_cpu_mask file) or you might sometimes see unordered function calls while cpu tracing switch. - hide: echo nofuncgraph-cpu > /debug/tracing/trace_options - show: echo funcgraph-cpu > /debug/tracing/trace_options + hide: echo nofuncgraph-cpu > /sys/kernel/debug/tracing/trace_options + show: echo funcgraph-cpu > /sys/kernel/debug/tracing/trace_options - The duration (function's time of execution) is displayed on the closing bracket line of a function or on the same line than the current function in case of a leaf one. It is default enabled. - hide: echo nofuncgraph-duration > /debug/tracing/trace_options - show: echo funcgraph-duration > /debug/tracing/trace_options + hide: echo nofuncgraph-duration > /sys/kernel/debug/tracing/trace_options + show: echo funcgraph-duration > /sys/kernel/debug/tracing/trace_options - The overhead field precedes the duration field in case of reached duration thresholds. - hide: echo nofuncgraph-overhead > /debug/tracing/trace_options - show: echo funcgraph-overhead > /debug/tracing/trace_options + hide: echo nofuncgraph-overhead > /sys/kernel/debug/tracing/trace_options + show: echo funcgraph-overhead > /sys/kernel/debug/tracing/trace_options depends on: funcgraph-duration ie:@@ -1418,8 +1418,8 @@ want, depending on your needs. - The task/pid field displays the thread cmdline and pid which executed the function. It is default disabled. - hide: echo nofuncgraph-proc > /debug/tracing/trace_options - show: echo funcgraph-proc > /debug/tracing/trace_options + hide: echo nofuncgraph-proc > /sys/kernel/debug/tracing/trace_options + show: echo funcgraph-proc > /sys/kernel/debug/tracing/trace_options ie:@@ -1442,8 +1442,8 @@ want, depending on your needs. system clock since it started. A snapshot of this time is given on each entry/exit of functions - hide: echo nofuncgraph-abstime > /debug/tracing/trace_options - show: echo funcgraph-abstime > /debug/tracing/trace_options + hide: echo nofuncgraph-abstime > /sys/kernel/debug/tracing/trace_options + show: echo funcgraph-abstime > /sys/kernel/debug/tracing/trace_options ie:@@ -1540,7 +1540,7 @@ listed in: available_filter_functions - # cat /debug/tracing/available_filter_functions + # cat /sys/kernel/debug/tracing/available_filter_functions put_prev_task_idle kmem_cache_create pick_next_task_rt@@ -1552,12 +1552,12 @@ mutex_lock If I am only interested in sys_nanosleep and hrtimer_interrupt: # echo sys_nanosleep hrtimer_interrupt \ - > /debug/tracing/set_ftrace_filter - # echo ftrace > /debug/tracing/current_tracer - # echo 1 > /debug/tracing/tracing_enabled + > /sys/kernel/debug/tracing/set_ftrace_filter + # echo ftrace > /sys/kernel/debug/tracing/current_tracer + # echo 1 > /sys/kernel/debug/tracing/tracing_enabled # usleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > /sys/kernel/debug/tracing/tracing_enabled + # cat /sys/kernel/debug/tracing/trace # tracer: ftrace # # TASK-PID CPU# TIMESTAMP FUNCTION@@ -1568,7 +1568,7 @@ If I am only interested in sys_nanosleep and hrtimer_interrupt: To see which functions are being traced, you can cat the file: - # cat /debug/tracing/set_ftrace_filter + # cat /sys/kernel/debug/tracing/set_ftrace_filter hrtimer_interrupt sys_nanosleep@@ -1588,7 +1588,7 @@ Note: It is better to use quotes to enclose the wild cards, otherwise the shell may expand the parameters into names of files in the local directory. - # echo 'hrtimer_*' > /debug/tracing/set_ftrace_filter + # echo 'hrtimer_*' > /sys/kernel/debug/tracing/set_ftrace_filter Produces:@@ -1609,7 +1609,7 @@ Produces: Notice that we lost the sys_nanosleep. - # cat /debug/tracing/set_ftrace_filter + # cat /sys/kernel/debug/tracing/set_ftrace_filter hrtimer_run_queues hrtimer_run_pending hrtimer_init@@ -1635,17 +1635,17 @@ To append to the filters, use '>>' To clear out a filter so that all functions will be recorded again: - # echo > /debug/tracing/set_ftrace_filter - # cat /debug/tracing/set_ftrace_filter + # echo > /sys/kernel/debug/tracing/set_ftrace_filter + # cat /sys/kernel/debug/tracing/set_ftrace_filter # Again, now we want to append. - # echo sys_nanosleep > /debug/tracing/set_ftrace_filter - # cat /debug/tracing/set_ftrace_filter + # echo sys_nanosleep > /sys/kernel/debug/tracing/set_ftrace_filter + # cat /sys/kernel/debug/tracing/set_ftrace_filter sys_nanosleep - # echo 'hrtimer_*' >> /debug/tracing/set_ftrace_filter - # cat /debug/tracing/set_ftrace_filter + # echo 'hrtimer_*' >> /sys/kernel/debug/tracing/set_ftrace_filter + # cat /sys/kernel/debug/tracing/set_ftrace_filter hrtimer_run_queues hrtimer_run_pending hrtimer_init@@ -1668,7 +1668,7 @@ hrtimer_init_sleeper The set_ftrace_notrace prevents those functions from being traced. - # echo '*preempt*' '*lock*' > /debug/tracing/set_ftrace_notrace + # echo '*preempt*' '*lock*' > /sys/kernel/debug/tracing/set_ftrace_notrace Produces:@@ -1758,13 +1758,13 @@ the effect on the tracing is different. Every read from trace_pipe is consumed. This means that subsequent reads will be different. The trace is live. - # echo function > /debug/tracing/current_tracer - # cat /debug/tracing/trace_pipe > /tmp/trace.out & + # echo function > /sys/kernel/debug/tracing/current_tracer + # cat /sys/kernel/debug/tracing/trace_pipe > /tmp/trace.out & [1] 4153 - # echo 1 > /debug/tracing/tracing_enabled + # echo 1 > /sys/kernel/debug/tracing/tracing_enabled # usleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > /sys/kernel/debug/tracing/tracing_enabled + # cat /sys/kernel/debug/tracing/trace # tracer: function # # TASK-PID CPU# TIMESTAMP FUNCTION@@ -1800,7 +1800,7 @@ number listed is the number of entries that can be recorded per CPU. To know the full size, multiply the number of possible CPUS with the number of entries. - # cat /debug/tracing/buffer_size_kb + # cat /sys/kernel/debug/tracing/buffer_size_kb 1408 (units kilobytes) Note, to modify this, you must have tracing completely disabled.@@ -1808,18 +1808,18 @@ To do that, echo "nop" into the current_tracer. If the current_tracer is not set to "nop", an EINVAL error will be returned. - # echo nop > /debug/tracing/current_tracer - # echo 10000 > /debug/tracing/buffer_size_kb - # cat /debug/tracing/buffer_size_kb + # echo nop > /sys/kernel/debug/tracing/current_tracer + # echo 10000 > /sys/kernel/debug/tracing/buffer_size_kb + # cat /sys/kernel/debug/tracing/buffer_size_kb 10000 (units kilobytes) The number of pages which will be allocated is limited to a percentage of available memory. Allocating too much will produce an error. - # echo 1000000000000 > /debug/tracing/buffer_size_kb + # echo 1000000000000 > /sys/kernel/debug/tracing/buffer_size_kb -bash: echo: write error: Cannot allocate memory - # cat /debug/tracing/buffer_size_kb + # cat /sys/kernel/debug/tracing/buffer_size_kb 85 -----------Documentation/trace/mmiotrace.txt +13
-13@@ -32,41 +32,41 @@ is no way to automatically detect if you are losing events due to CPUs racing. Usage Quick Reference --------------------- -$ mount -t debugfs debugfs /debug -$ echo mmiotrace > /debug/tracing/current_tracer -$ cat /debug/tracing/trace_pipe > mydump.txt & +$ mount -t debugfs debugfs /sys/kernel/debug +$ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer +$ cat /sys/kernel/debug/tracing/trace_pipe > mydump.txt & Start X or whatever. -$ echo "X is up" > /debug/tracing/trace_marker -$ echo nop > /debug/tracing/current_tracer +$ echo "X is up" > /sys/kernel/debug/tracing/trace_marker +$ echo nop > /sys/kernel/debug/tracing/current_tracer Check for lost events. Usage ----- -Make sure debugfs is mounted to /debug. If not, (requires root privileges) -$ mount -t debugfs debugfs /debug +Make sure debugfs is mounted to /sys/kernel/debug. If not, (requires root privileges) +$ mount -t debugfs debugfs /sys/kernel/debug Check that the driver you are about to trace is not loaded. Activate mmiotrace (requires root privileges): -$ echo mmiotrace > /debug/tracing/current_tracer +$ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer Start storing the trace: -$ cat /debug/tracing/trace_pipe > mydump.txt & +$ cat /sys/kernel/debug/tracing/trace_pipe > mydump.txt & The 'cat' process should stay running (sleeping) in the background. Load the driver you want to trace and use it. Mmiotrace will only catch MMIO accesses to areas that are ioremapped while mmiotrace is active. During tracing you can place comments (markers) into the trace by -$ echo "X is up" > /debug/tracing/trace_marker +$ echo "X is up" > /sys/kernel/debug/tracing/trace_marker This makes it easier to see which part of the (huge) trace corresponds to which action. It is recommended to place descriptive markers about what you do. Shut down mmiotrace (requires root privileges): -$ echo nop > /debug/tracing/current_tracer +$ echo nop > /sys/kernel/debug/tracing/current_tracer The 'cat' process exits. If it does not, kill it by issuing 'fg' command and pressing ctrl+c.@@ -78,10 +78,10 @@ to view your kernel log and look for "mmiotrace has lost events" warning. If events were lost, the trace is incomplete. You should enlarge the buffers and try again. Buffers are enlarged by first seeing how large the current buffers are: -$ cat /debug/tracing/buffer_size_kb +$ cat /sys/kernel/debug/tracing/buffer_size_kb gives you a number. Approximately double this number and write it back, for instance: -$ echo 128000 > /debug/tracing/buffer_size_kb +$ echo 128000 > /sys/kernel/debug/tracing/buffer_size_kb Then start again from the top. If you are doing a trace for a driver project, e.g. Nouveau, you should alsodrivers/block/pktcdvd.c +1
-1@@ -430,7 +430,7 @@ static void pkt_sysfs_cleanup(void)/******************************************************************** entries in debugfs -/debugfs/pktcdvd[0-7]/ +/sys/kernel/debug/pktcdvd[0-7]/ info *******************************************************************/ drivers/gpu/drm/drm_debugfs.c +6
-6@@ -105,7 +105,7 @@ int drm_debugfs_create_files(struct drm_info_list *files, int count, ent =debugfs_create_file (files[i].name,S_IFREG |S_IRUGO , root, tmp, &drm_debugfs_fops);if (!ent) { -DRM_ERROR ("Cannot create /debugfs/dri/%s/%s\n" , +DRM_ERROR ("Cannot create /sys/kernel/debug/dri/%s/%s\n" , name, files[i].name);drm_free (tmp,sizeof (struct drm_info_node ), _DRM_DRIVER);@@ -133,9 +133,9 @@ EXPORT_SYMBOL(drm_debugfs_create_files);* \param minor device minor number * \param root DRI debugfs dir entry. * -* Create the DRI debugfs root entry "/debugfs/dri", the device debugfs root entry -* "/debugfs/dri/%minor%/", and each entry in debugfs_list as -* "/debugfs/dri/%minor%/%name%". +* Create the DRI debugfs root entry "/sys/kernel/debug/dri", the device debugfs root entry +* "/sys/kernel/debug/dri/%minor%/", and each entry in debugfs_list as +* "/sys/kernel/debug/dri/%minor%/%name%". */ int drm_debugfs_init (struct drm_minor *minor,int minor_id,struct dentry *root)@@ -148,7 +148,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,sprintf (name,"%d" , minor_id); minor->debugfs_root =debugfs_create_dir (name, root);if (!minor->debugfs_root) { -DRM_ERROR ("Cannot create /debugfs/dri/%s\n" , name); +DRM_ERROR ("Cannot create /sys/kernel/debug/dri/%s\n" , name);return -1 ; }@@ -165,7 +165,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, ret = dev->driver->debugfs_init (minor);if (ret) {DRM_ERROR ("DRM: Driver failed to initialize " -"/debugfs/dri.\n" ); +"/sys/kernel/debug/dri.\n" );return ret; } }drivers/gpu/drm/drm_drv.c +1
-1@@ -339,7 +339,7 @@ static int __init drm_core_init(void) drm_debugfs_root =debugfs_create_dir ("dri" ,NULL );if (!drm_debugfs_root) { -DRM_ERROR ("Cannot create /debugfs/dri\n" ); +DRM_ERROR ("Cannot create /sys/kernel/debug/dri\n" ); ret =-1 ; goto err_p3; }drivers/gpu/drm/drm_stub.c +1
-1@@ -328,7 +328,7 @@ static int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int t#if defined(CONFIG_DEBUG_FS ) ret =drm_debugfs_init (new_minor, minor_id, drm_debugfs_root);if (ret) { -DRM_ERROR ("DRM: Failed to initialize /debugfs/dri.\n" ); +DRM_ERROR ("DRM: Failed to initialize /sys/kernel/debug/dri.\n" ); goto err_g2; }#endif drivers/net/Kconfig +2
-2@@ -2200,7 +2200,7 @@ config SKGE_DEBUG depends on SKGE && DEBUG_FS help This option adds the ability to dump driver state for debugging. - The file debugfs/skge/ethX displays the state of the internal + The file /sys/kernel/debug/skge/ethX displays the state of the internal transmit and receive rings. If unsure, say N.@@ -2226,7 +2226,7 @@ config SKY2_DEBUG depends on SKY2 && DEBUG_FS help This option adds the ability to dump driver state for debugging. - The file debugfs/sky2/ethX displays the state of the internal + The file /sys/kernel/debug/sky2/ethX displays the state of the internal transmit and receive rings. If unsure, say N.drivers/net/wimax/i2400m/i2400m.h +1
-1@@ -389,7 +389,7 @@ struct i2400m { unsigned ready:1; /* all probing steps done */ unsigned rx_reorder:1; /* RX reorder is enabled */u8 trace_msg_from_user;/* echo rx msgs to 'trace' pipe */ -/* typed u8 so debugfs/u8 can tweak */ +/* typed u8 so /sys/kernel/debug/u8 can tweak */ enum i2400m_system_state state;wait_queue_head_t state_wq;/* Woken up when on state updates */ drivers/net/wireless/ath5k/Kconfig +3
-3@@ -27,11 +27,11 @@ config ATH5K_DEBUG Say Y, if and you will get debug options for ath5k. To use this, you need to mount debugfs: - mkdir /debug/ - mount -t debugfs debug /debug/ + mkdir /sys/kernel/debug/ + mount -t debugfs debug /sys/kernel/debug/ You will get access to files under: - /debug/ath5k/phy0/ + /sys/kernel/debug/ath5k/phy0/ To enable debug, pass the debug level to the debug module parameter. For example:drivers/net/wireless/libertas/README +6
-6@@ -72,7 +72,7 @@ rdrf location that is to be read. This parameter must be specified in hexadecimal (its possible to preceed preceding the number with a "0x"). - Path: /debugfs/libertas_wireless/ethX/registers/ + Path: /sys/kernel/debug/libertas_wireless/ethX/registers/ Usage: echo "0xa123" > rdmac ; cat rdmac@@ -95,7 +95,7 @@ wrrf sleepparams This command is used to set the sleepclock configurations - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: cat sleepparams: reads the current sleepclock configuration@@ -115,7 +115,7 @@ subscribed_events The subscribed_events directory contains the interface for the subscribed events API. - Path: /debugfs/libertas_wireless/ethX/subscribed_events/ + Path: /sys/kernel/debug/libertas_wireless/ethX/subscribed_events/ Each event is represented by a filename. Each filename consists of the following three fields:@@ -165,7 +165,7 @@ subscribed_events extscan This command is used to do a specific scan. - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: echo "SSID" > extscan@@ -179,7 +179,7 @@ getscantable Display the current contents of the driver scan table (ie. get the scan results). - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: cat getscantable@@ -188,7 +188,7 @@ setuserscan Initiate a customized scan and retrieve the results - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: echo "[ARGS]" > setuserscandrivers/scsi/lpfc/lpfc_debugfs.c +2
-2@@ -51,8 +51,8 @@* debugfs interface * * To access this interface the user should: -* # mkdir /debug -* # mount -t debugfs none /debug +* # mkdir /sys/kernel/debug +* # mount -t debugfs none /sys/kernel/debug * * The lpfc debugfs directory hierarchy is: * lpfc/lpfcX/vportY include/linux/kernel.h +1
-1@@ -406,7 +406,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte)* * Use tracing_on/tracing_off when you want to quickly turn on or off * tracing. It simply enables or disables the recording of the trace events. -* This also corresponds to the user space debugfs/tracing/tracing_on +* This also corresponds to the user space /sys/kernel/debug/tracing/tracing_on * file, which gives a means for the kernel and userspace to interact. * Place a tracing_off() in the kernel where you want tracing to end. * From user space, examine the trace, and then echo 1 > tracing_on include/linux/tracepoint.h +2
-2@@ -197,7 +197,7 @@ static inline void tracepoint_synchronize_unregister(void)* * This is how the trace record is structured and will * * be saved into the ring buffer. These are the fields * * that will be exposed to user-space in -* * /debug/tracing/events/<*>/format. +* * /sys/kernel/debug/tracing/events/<*>/format. * * * * The declared 'local variable' is called '__entry' * * @@ -257,7 +257,7 @@ static inline void tracepoint_synchronize_unregister(void)* tracepoint callback (this is used by programmatic plugins and * can also by used by generic instrumentation like SystemTap), and * it is also used to expose a structured trace record in -* /debug/tracing/events/. +* /sys/kernel/debug/tracing/events/. */ #define TRACE_EVENT (name, proto, args, struct, assign, print) \kernel/trace/Kconfig +5
-5@@ -120,7 +120,7 @@ config IRQSOFF_TRACER disabled by default and can be runtime (re-)started via: - echo 0 > /debugfs/tracing/tracing_max_latency + echo 0 > /sys/kernel/debug/tracing/tracing_max_latency (Note that kernel size and overhead increases with this option enabled. This option and the preempt-off timing option can be@@ -141,7 +141,7 @@ config PREEMPT_TRACER disabled by default and can be runtime (re-)started via: - echo 0 > /debugfs/tracing/tracing_max_latency + echo 0 > /sys/kernel/debug/tracing/tracing_max_latency (Note that kernel size and overhead increases with this option enabled. This option and the irqs-off timing option can be@@ -213,7 +213,7 @@ config TRACE_BRANCH_PROFILING This tracer profiles all the the likely and unlikely macros in the kernel. It will display the results in: - /debugfs/tracing/profile_annotated_branch + /sys/kernel/debug/tracing/profile_annotated_branch Note: this will add a significant overhead, only turn this on if you need to profile the system's use of these macros.@@ -228,7 +228,7 @@ config PROFILE_ALL_BRANCHES taken in the kernel is recorded whether it hit or miss. The results will be displayed in: - /debugfs/tracing/profile_branch + /sys/kernel/debug/tracing/profile_branch This configuration, when enabled, will impose a great overhead on the system. This should only be enabled when the system@@ -276,7 +276,7 @@ config STACK_TRACER select KALLSYMS help This special tracer records the maximum stack footprint of the - kernel and displays it in debugfs/tracing/stack_trace. + kernel and displays it in /sys/kernel/debug/tracing/stack_trace. This tracer works by hooking into every function call that the kernel executes, and keeping a maximum stack depth value andkernel/trace/trace.c +12
-12@@ -335,7 +335,7 @@ static raw_spinlock_t ftrace_max_lock =/* * Copy the new maximum trace into the separate maximum-trace * structure. (this way the maximum trace is permanently saved, -* for later retrieval via /debugfs/tracing/latency_trace) +* for later retrieval via /sys/kernel/debug/tracing/latency_trace) */ static void __update_max_tr (struct trace_array *tr,struct task_struct *tsk,int cpu)@@ -2366,21 +2366,21 @@ static const struct file_operations tracing_iter_fops = {static const char readme_msg[] ="tracing mini-HOWTO:\n\n" -"# mkdir /debug\n" -"# mount -t debugfs nodev /debug\n\n" -"# cat /debug/tracing/available_tracers\n" +"# mkdir /sys/kernel/debug\n" +"# mount -t debugfs nodev /sys/kernel/debug\n\n" +"# cat /sys/kernel/debug/tracing/available_tracers\n" "wakeup preemptirqsoff preemptoff irqsoff function sched_switch nop\n\n" -"# cat /debug/tracing/current_tracer\n" +"# cat /sys/kernel/debug/tracing/current_tracer\n" "nop\n" -"# echo sched_switch > /debug/tracing/current_tracer\n" -"# cat /debug/tracing/current_tracer\n" +"# echo sched_switch > /sys/kernel/debug/tracing/current_tracer\n" +"# cat /sys/kernel/debug/tracing/current_tracer\n" "sched_switch\n" -"# cat /debug/tracing/trace_options\n" +"# cat /sys/kernel/debug/tracing/trace_options\n" "noprint-parent nosym-offset nosym-addr noverbose\n" -"# echo print-parent > /debug/tracing/trace_options\n" -"# echo 1 > /debug/tracing/tracing_enabled\n" -"# cat /debug/tracing/trace > /tmp/trace.txt\n" -"# echo 0 > /debug/tracing/tracing_enabled\n" +"# echo print-parent > /sys/kernel/debug/tracing/trace_options\n" +"# echo 1 > /sys/kernel/debug/tracing/tracing_enabled\n" +"# cat /sys/kernel/debug/tracing/trace > /tmp/trace.txt\n" +"# echo 0 > /sys/kernel/debug/tracing/tracing_enabled\n" ; static ssize_tscripts/tracing/draw_functrace.py +4
-4@@ -12,10 +12,10 @@ calls. Only the functions's names and the the call time are provided. Usage: Be sure that you have CONFIG_FUNCTION_TRACER - # mkdir /debugfs - # mount -t debug debug /debug - # echo function > /debug/tracing/current_tracer - $ cat /debug/tracing/trace_pipe > ~/raw_trace_func + # mkdir /sys/kernel/debug + # mount -t debug debug /sys/kernel/debug + # echo function > /sys/kernel/debug/tracing/current_tracer + $ cat /sys/kernel/debug/tracing/trace_pipe > ~/raw_trace_func Wait some times but not too much, the script is a bit slow. Break the pipe (Ctrl + Z) $ scripts/draw_functrace.py < raw_trace_func > draw_functraceSignature · 14 lines
1.6.3.1 ----------------------------------------------- To unsubscribe from this list: send the line "unsubscribe linux-***" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ GeunSik Lim ( S A M S U N G E L E C T R O N I C S ) e-Mail :1) [email protected] 2) [email protected] , [email protected] HomePage: http://blog.naver.com/invain/ -----------------------------------------------
Steven Rostedt
maintainerQuoted 6 lines · Steven Rostedt
===
When debugfs is configured into the kernel (which selecting any ftrace option will do) the directory/sys/kernel/debugwill be created. To mount this directory, you can add to your/etc/fstabfile:debugfs /debug debugfs defaults 0 0
s,/debug,/sys/kernel/debug,
Quoted 8 lines
Or you can mount it at run time with:
mount -t debugfs nodev
/sys/kernel/debugFor quicker access to that directory you may want to make a soft link to it:
Quoted 8 lines
ln -s
/sys/kernel/debug/debugAny selected ftrace option will also create a directory called tracing within the debugfs. The rest of the document will assume that you are in the ftrace directory (cd
/sys/kernel/debugfs) and will only concentrate on the files within that directory and not distract from the content with the extended "/sys/kernel/debug/tracing" path name.
===
-- Steve
Steven Rostedt
maintainerQuoted 11 lines · Steven Rostedt
===
When debugfs is configured into the kernel (which selecting any ftrace option will do) the directory/sys/kernel/debugwill be created. To mount this directory, you can add to your/etc/fstabfile:debugfs /debug debugfs defaults 0 0
Or you can mount it at run time with:
mount -t debugfs nodev
/sys/kernel/debug
Quoted 8 lines
For quicker access to that directory you may want to make a soft link to it:
ln -s
/sys/kernel/debug/debugAny selected ftrace option will also create a directory called tracing within the debugfs. The rest of the document will assume that you are in the ftrace directory (cd
/sys/kernel/debugfs) and will only concentrate
s,/sys/kernel/debugfs,/sys/kernel/debug/tracing,
Quoted 3 lines
on the files within that directory and not distract from the content with the extended "
/sys/kernel/debug/tracing" path name.
===
-- Steve
Steven Rostedt
maintainerQuoted 21 lines · GeunSik Lim
Dear Greg and Steen,
Thanks your advices and opinions about a confusion according to
too many mount directory names for debugfs. I made rfc v2 patch file again like belows. Can I hear your advices about below patch contents?.Regards,
GeunSik Lim.Subject: [PATCH] Fix terminology inconsistency of dir name to mount debugfs filesystem.
Many developers use "/debug/" or "/debugfs/ directory name to mount debugfs filesystem for ftrace according to
./Documentation/tracers/ftrace.txtfile.
Quoted 8 lines
And, three directory
names(ex:/debug/, /debugfs/, /sys/kernel/debug/)is existed in kernel source like ftrace, DRM, Wireless, Network[sky2]files to mount debugfs filesystem.debugfs means debug filesystem for debugging easy to use by greg kroah hartman. "
/sys/kernel/debug/" name is suitable as directory name of debugfs filesystem.
-debugfs related reference: http://lwn.net/Articles/115405/
Note, LWN has an update this week:
http://lwn.net/Articles/334546/
But it currently is subscriber only. Others would need to either buy a subscription (plug) or wait a week for it to become open.
Still for some aspects, just having "debugfs" without the leading "/" might just be self explanatory. We can assume the user already knows where debugfs is mounted.
-- Steve
Quoted 8 lines
Fix inconsistency of directory name to mount debugfs filesystem.
Signed-off-by GeunSik Lim <[email protected]>CC Greg KH <[email protected]>CC Steven Rostedt <[email protected]>CC linux-kernel <[email protected]>
Thanks your advice. I agree with your reply about this patch. I updated contents that you advised like belows.
If I mistake, Please correct me.
And, I also need your review about below 2 contents in the ftrace.txt file.
Thanks,
GeunSik Lim.
1)
@@ -1146,7 +1158,7 @@ int trace_fd;
[...]
int main(int argc, char *argv[]) {
[...]
- trace_fd = open("/debug/tracing/tracing_enabled", O_WRONLY);
+ trace_fd = open("/sys/kernel/debug/tracing/tracing_enabled", O_WRONLY);
[...]
if (condition_hit()) {
write(trace_fd, "0", 1);
@@ -1154,26 +1166,23 @@ int main(int argc, char *argv[]) {
[...]
}
@@ -1217,12 +1226,12 @@ int main (int argc, char **argv)
char line[64];
int s;- ffd = open("/debug/tracing/current_tracer", O_WRONLY);
+ ffd =
open("/sys/kernel/debug/tracing/current_tracer", O_WRONLY);
if (ffd < 0)
exit(-1);
write(ffd, "nop", 3);- fd = open("/debug/tracing/set_ftrace_pid", O_WRONLY);
+ fd = open("/sys/kernel/debug/tracing/set_ftrace_pid",
O_WRONLY);
s = sprintf(line, "%d\n", getpid());
write(fd, line, s);-Note: Here we hard coded the path name. The debugfs mount is not -guaranteed to be at /debug (and is more commonly at -/sys/kernel/debug). For simple one time traces, the above is -sufficent. For anything else, a search through /proc/mounts may +Note: Here we hard coded the path name. A search through /proc/mounts may
be needed to find where the debugfs file-system is mounted.
2)
More details can be found in the source code, in the -kernel/tracing/*.c files.
+kernel/trace/*.c files
* about ftrace.txt file
---
Documentation/trace/ftrace.txt +30 -18
@@ -7,7 +7,6 @@ Copyright 2008 Red Hat Inc. (dual licensed under the GPL v2) Reviewers: Elias Oltmanns, Randy Dunlap, Andrew Morton, John Kacur, and David Teigland. - Written for: 2.6.28-rc2 Introduction
@@ -33,13 +32,26 @@ The File System Ftrace uses the debugfs file system to hold the control files as well as the files to display output. -To mount the debugfs system: +When debugfs is configured into the kernel (which selecting any ftrace +option will do) the directory /sys/kernel/debug will be created. To mount +this directory, you can add to your /etc/fstab file: + + debugfs /sys/kernel/debug debugfs defaults 0 0 + +Or you can mount it at run time with: + + mount -t debugfs nodev /sys/kernel/debug + +For quicker access to that directory you may want to make a soft link to +it: - # mkdir /debug - # mount -t debugfs nodev /debug + ln -s /sys/kernel/debug /debug -( Note: it is more common to mount at /sys/kernel/debug, but for - simplicity this document will use /debug) +Any selected ftrace option will also create a directory called tracing +within the debugfs. The rest of the document will assume that you are in +the ftrace directory (cd /sys/kernel/debug/tracing) and will only concentrate +on the files within that directory and not distract from the content with +the extended "/sys/kernel/debug/tracing" path name. That's it! (assuming that you have ftrace configured into your kernel)
@@ -389,18 +401,18 @@ trace_options The trace_options file is used to control what gets printed in the trace output. To see what is available, simply cat the file: - cat /debug/tracing/trace_options + cat ./trace_options print-parent nosym-offset nosym-addr noverbose noraw nohex nobin \ noblock nostacktrace nosched-tree nouserstacktrace nosym-userobj To disable one of the options, echo in the option prepended with "no". - echo noprint-parent > /debug/tracing/trace_options + echo noprint-parent > ./trace_options To enable an option, leave off the "no". - echo sym-offset > /debug/tracing/trace_options + echo sym-offset > ./trace_options Here are the available options:
@@ -476,11 +488,11 @@ sched_switch This tracer simply records schedule switches. Here is an example of how to use it. - # echo sched_switch > /debug/tracing/current_tracer - # echo 1 > /debug/tracing/tracing_enabled + # echo sched_switch > ./current_tracer + # echo 1 > ./tracing_enabled # sleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > ./tracing_enabled + # cat ./trace # tracer: sched_switch #
@@ -574,13 +586,13 @@ new trace is saved. To reset the maximum, echo 0 into tracing_max_latency. Here is an example: - # echo irqsoff > /debug/tracing/current_tracer - # echo 0 > /debug/tracing/tracing_max_latency - # echo 1 > /debug/tracing/tracing_enabled + # echo irqsoff > ./current_tracer + # echo 0 > ./tracing_max_latency + # echo 1 > ./tracing_enabled # ls -ltr [...] - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > ./tracing_enabled + # cat ./latency_trace # tracer: irqsoff # irqsoff latency trace v1.1.5 on 2.6.26
@@ -681,13 +693,13 @@ Like the irqsoff tracer, it records the maximum
latency for
which preemption was disabled. The control of preemptoff tracer is much like the irqsoff tracer.
- # echo preemptoff > /debug/tracing/current_tracer
- # echo 0 > /debug/tracing/tracing_max_latency
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo preemptoff > ./current_tracer
+ # echo 0 > ./tracing_max_latency
+ # echo 1 > ./tracing_enabled
# ls -ltr [...] - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > ./tracing_enabled + # cat ./latency_trace # tracer: preemptoff # preemptoff latency trace v1.1.5 on 2.6.26-rc8 @@ -828,13 +840,13 @@ tracer. Again, using this trace is much like the irqsoff and preemptoff tracers.
- # echo preemptirqsoff > /debug/tracing/current_tracer
- # echo 0 > /debug/tracing/tracing_max_latency
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo preemptirqsoff > ./current_tracer
+ # echo 0 > ./tracing_max_latency
+ # echo 1 > ./tracing_enabled
# ls -ltr [...] - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > ./tracing_enabled + # cat ./latency_trace # tracer: preemptirqsoff # preemptirqsoff latency trace v1.1.5 on 2.6.26-rc8 @@ -990,12 +1002,12 @@ slightly differently than we did with the previous tracers. Instead of performing an 'ls', we will run 'sleep 1' under 'chrt' which changes the priority of the task.
- # echo wakeup > /debug/tracing/current_tracer
- # echo 0 > /debug/tracing/tracing_max_latency
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo wakeup > ./current_tracer
+ # echo 0 > ./tracing_max_latency
+ # echo 1 > ./tracing_enabled
# chrt -f 5 sleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > ./tracing_enabled + # cat ./latency_trace # tracer: wakeup # wakeup latency trace v1.1.5 on 2.6.26-rc8 @@ -1105,11 +1117,11 @@ can be done from the debug file system. Make sure the ftrace_enabled is set; otherwise this tracer is a nop.
# sysctl kernel.ftrace_enabled=1
- # echo function > /debug/tracing/current_tracer
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo function > ./current_tracer
+ # echo 1 > ./tracing_enabled
# usleep 1
- # echo 0 > /debug/tracing/tracing_enabled
- # cat /debug/tracing/trace
+ # echo 0 > ./tracing_enabled
+ # cat ./trace
# tracer: function
#
# TASK-PID CPU# TIMESTAMP FUNCTION
@@ -1146,7 +1158,7 @@ int trace_fd;
[...]
int main(int argc, char *argv[]) {
[...]
- trace_fd = open("/debug/tracing/tracing_enabled", O_WRONLY);
+ trace_fd = open("/sys/kernel/debug/tracing/tracing_enabled", O_WRONLY);
[...]
if (condition_hit()) {
write(trace_fd, "0", 1);
@@ -1154,26 +1166,23 @@ int main(int argc, char *argv[]) {
[...]
}-Note: Here we hard coded the path name. The debugfs mount is not -guaranteed to be at /debug (and is more commonly at -/sys/kernel/debug). For simple one time traces, the above is -sufficent. For anything else, a search through /proc/mounts may +Note: Here we hard coded the path name. A search through /proc/mounts may
be needed to find where the debugfs file-system is mounted.
Single thread tracing
---------------------
-By writing into /debug/tracing/set_ftrace_pid you can trace a +By writing into ./set_ftrace_pid you can trace a
single thread. For example:
-# cat /debug/tracing/set_ftrace_pid
+# cat ./set_ftrace_pid
no pid
-# echo 3111 > /debug/tracing/set_ftrace_pid
-# cat /debug/tracing/set_ftrace_pid
+# echo 3111 > ./set_ftrace_pid
+# cat ./set_ftrace_pid
3111
-# echo function > /debug/tracing/current_tracer
-# cat /debug/tracing/trace | head
+# echo function > ./current_tracer
+# cat ./trace | head
# tracer: function
#
# TASK-PID CPU# TIMESTAMP FUNCTION
@@ -1184,8 +1193,8 @@ no pid
yum-updatesd-3111 [003] 1637.254683: lock_hrtimer_base
<-hrtimer_try_to_cancel
yum-updatesd-3111 [003] 1637.254685: fget_light <-do_sys_poll
yum-updatesd-3111 [003] 1637.254686: pipe_poll <-do_sys_poll-# echo -1 > /debug/tracing/set_ftrace_pid
-# cat /debug/tracing/trace |head
+# echo -1 > ./set_ftrace_pid
+# cat ./trace |head
# tracer: function
#
# TASK-PID CPU# TIMESTAMP FUNCTION
@@ -1217,12 +1226,12 @@ int main (int argc, char **argv)
char line[64];
int s;- ffd = open("/debug/tracing/current_tracer", O_WRONLY);
+ ffd =
open("/sys/kernel/debug/tracing/current_tracer", O_WRONLY);
if (ffd < 0)
exit(-1);
write(ffd, "nop", 3);- fd = open("/debug/tracing/set_ftrace_pid", O_WRONLY);
+ fd = open("/sys/kernel/debug/tracing/set_ftrace_pid",
O_WRONLY);
s = sprintf(line, "%d\n", getpid());
write(fd, line, s);@@ -1374,22 +1383,22 @@ want, depending on your needs.
tracing_cpu_mask file) or you might sometimes see unordered function calls while cpu tracing switch.
- hide: echo nofuncgraph-cpu > /debug/tracing/trace_options
- show: echo funcgraph-cpu > /debug/tracing/trace_options
+ hide: echo nofuncgraph-cpu > ./trace_options
+ show: echo funcgraph-cpu > ./trace_options
- The duration (function's time of execution) is displayed on the closing bracket line of a function or on the same line than the current function in case of a leaf one. It is default enabled.
- hide: echo nofuncgraph-duration > /debug/tracing/trace_options
- show: echo funcgraph-duration > /debug/tracing/trace_options
+ hide: echo nofuncgraph-duration > ./trace_options
+ show: echo funcgraph-duration > ./trace_options
- The overhead field precedes the duration field in case of reached duration thresholds.
- hide: echo nofuncgraph-overhead > /debug/tracing/trace_options
- show: echo funcgraph-overhead > /debug/tracing/trace_options
+ hide: echo nofuncgraph-overhead > ./trace_options
+ show: echo funcgraph-overhead > ./trace_options
depends on: funcgraph-duration
ie:
@@ -1418,8 +1427,8 @@ want, depending on your needs.
- The task/pid field displays the thread cmdline and pid which executed the function. It is default disabled.
- hide: echo nofuncgraph-proc > /debug/tracing/trace_options
- show: echo funcgraph-proc > /debug/tracing/trace_options
+ hide: echo nofuncgraph-proc > ./trace_options
+ show: echo funcgraph-proc > ./trace_options
ie:
@@ -1442,8 +1451,8 @@ want, depending on your needs.
system clock since it started. A snapshot of this time is given on each entry/exit of functions
- hide: echo nofuncgraph-abstime > /debug/tracing/trace_options
- show: echo funcgraph-abstime > /debug/tracing/trace_options
+ hide: echo nofuncgraph-abstime > ./trace_options
+ show: echo funcgraph-abstime > ./trace_options
ie:
@@ -1540,7 +1549,7 @@ listed in:
available_filter_functions
- # cat /debug/tracing/available_filter_functions
+ # cat ./available_filter_functions put_prev_task_idle
kmem_cache_create
pick_next_task_rt
@@ -1552,12 +1561,12 @@ mutex_lock
If I am only interested in sys_nanosleep and hrtimer_interrupt:
# echo sys_nanosleep hrtimer_interrupt \ - > /debug/tracing/set_ftrace_filter - # echo ftrace > /debug/tracing/current_tracer - # echo 1 > /debug/tracing/tracing_enabled + > ./set_ftrace_filter + # echo ftrace > ./current_tracer + # echo 1 > ./tracing_enabled # usleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > ./tracing_enabled + # cat ./trace # tracer: ftrace # # TASK-PID CPU# TIMESTAMP FUNCTION @@ -1568,7 +1577,7 @@ If I am only interested in sys_nanosleep and hrtimer_interrupt:
To see which functions are being traced, you can cat the file:
- # cat /debug/tracing/set_ftrace_filter
+ # cat ./set_ftrace_filter
hrtimer_interrupt
sys_nanosleep
@@ -1588,7 +1597,7 @@ Note: It is better to use quotes to enclose the wild cards,
otherwise the shell may expand the parameters into names of files in the local directory.
- # echo 'hrtimer_*' > /debug/tracing/set_ftrace_filter
+ # echo 'hrtimer_*' > ./set_ftrace_filter
Produces:
@@ -1609,7 +1618,7 @@ Produces:
Notice that we lost the sys_nanosleep.
- # cat /debug/tracing/set_ftrace_filter
+ # cat ./set_ftrace_filter
hrtimer_run_queues
hrtimer_run_pending
hrtimer_init
@@ -1635,17 +1644,17 @@ To append to the filters, use '>>'
To clear out a filter so that all functions will be recorded again:
- # echo > /debug/tracing/set_ftrace_filter
- # cat /debug/tracing/set_ftrace_filter
+ # echo > ./set_ftrace_filter
+ # cat ./set_ftrace_filter
#
Again, now we want to append.
- # echo sys_nanosleep > /debug/tracing/set_ftrace_filter
- # cat /debug/tracing/set_ftrace_filter
+ # echo sys_nanosleep > ./set_ftrace_filter
+ # cat ./set_ftrace_filter
sys_nanosleep
- # echo 'hrtimer_*' >> /debug/tracing/set_ftrace_filter
- # cat /debug/tracing/set_ftrace_filter
+ # echo 'hrtimer_*' >> ./set_ftrace_filter
+ # cat ./set_ftrace_filter
hrtimer_run_queues
hrtimer_run_pending
hrtimer_init
@@ -1668,7 +1677,7 @@ hrtimer_init_sleeper
The set_ftrace_notrace prevents those functions from being traced.
- # echo '*preempt*' '*lock*' > /debug/tracing/set_ftrace_notrace
+ # echo '*preempt*' '*lock*' > ./set_ftrace_notrace
Produces:
@@ -1758,13 +1767,13 @@ the effect on the tracing is different. Every read from
trace_pipe is consumed. This means that subsequent reads will be different. The trace is live.
- # echo function > /debug/tracing/current_tracer
- # cat /debug/tracing/trace_pipe > /tmp/trace.out &
+ # echo function > ./current_tracer
+ # cat ./trace_pipe > /tmp/trace.out &
[1] 4153
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo 1 > ./tracing_enabled
# usleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > ./tracing_enabled + # cat ./trace # tracer: function # # TASK-PID CPU# TIMESTAMP FUNCTION @@ -1800,7 +1809,7 @@ number listed is the number of entries that can be recorded per CPU. To know the full size, multiply the number of possible CPUS with the number of entries.
- # cat /debug/tracing/buffer_size_kb
+ # cat ./buffer_size_kb
1408 (units kilobytes)
Note, to modify this, you must have tracing completely disabled.
@@ -1808,21 +1817,21 @@ To do that, echo "nop" into the current_tracer. If the
current_tracer is not set to "nop", an EINVAL error will be returned.
- # echo nop > /debug/tracing/current_tracer
- # echo 10000 > /debug/tracing/buffer_size_kb
- # cat /debug/tracing/buffer_size_kb
+ # echo nop > ./current_tracer
+ # echo 10000 > ./buffer_size_kb
+ # cat ./buffer_size_kb
10000 (units kilobytes)
The number of pages which will be allocated is limited to a percentage of available memory. Allocating too much will produce an error.
- # echo 1000000000000 > /debug/tracing/buffer_size_kb
+ # echo 1000000000000 > ./buffer_size_kb -bash: echo: write error: Cannot allocate memory
- # cat /debug/tracing/buffer_size_kb
+ # cat ./buffer_size_kb
85
---
Quoted 58 lines · Steven Rostedt
Quoted 21 lines · GeunSik Lim
Dear Greg and Steen,
Thanks your advices and opinions about a confusion according to
too many mount directory names for debugfs. I made rfc v2 patch file again like belows. Can I hear your advices about below patch contents?.Regards,
GeunSik Lim.Subject: [PATCH] Fix terminology inconsistency of dir name to mount debugfs filesystem.
Many developers use "/debug/" or "/debugfs/ directory name to mount debugfs filesystem for ftrace according to
./Documentation/tracers/ftrace.txtfile.Quoted 8 lines
And, three directory
names(ex:/debug/, /debugfs/, /sys/kernel/debug/)is existed in kernel source like ftrace, DRM, Wireless, Network[sky2]files to mount debugfs filesystem.debugfs means debug filesystem for debugging easy to use by greg kroah hartman. "
/sys/kernel/debug/" name is suitable as directory name of debugfs filesystem.
-debugfs related reference: http://lwn.net/Articles/115405/Note, LWN has an update this week:
http://lwn.net/Articles/334546/
But it currently is subscriber only. Others would need to either buy a subscription (plug) or wait a week for it to become open.
Still for some aspects, just having "debugfs" without the leading "/" might just be self explanatory. We can assume the user already knows where debugfs is mounted.
-- Steve
Quoted 8 lines
Fix inconsistency of directory name to mount debugfs filesystem.
Signed-off-by GeunSik Lim <[email protected]>CC Greg KH <[email protected]>CC Steven Rostedt <[email protected]>CC linux-kernel <[email protected]>
Signature · 10 lines
Regards, GeunSik Lim ( SAMSUNG ELECTRONICS) Blog : http://blog.naver.com/invain/ e-Mail: [email protected] [email protected] , [email protected] -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Steven Rostedt
maintainerQuoted 41 lines · GeunSik Lim
Thanks your advice. I agree with your reply about this patch. I updated contents that you advised like belows.
If I mistake, Please correct me.And, I also need your review about below 2 contents in the ftrace.txt file.
Thanks,
GeunSik Lim.1)
(quoted diff) +3
-3@@ -1146,7 +1158,7 @@ int trace_fd; int main(int argc, char *argv[]) { - trace_fd = open("/debug/tracing/tracing_enabled", O_WRONLY); + trace_fd = open("/sys/kernel/debug/tracing/tracing_enabled", O_WRONLY); if (condition_hit()) { write(trace_fd, "0", 1);@@ -1154,26 +1166,23 @@ int main(int argc, char *argv[]) { }@@ -1217,12 +1226,12 @@ int main (int argc, char **argv) char line[64]; int s; - ffd = open("/debug/tracing/current_tracer", O_WRONLY); + ffd = open("/sys/kernel/debug/tracing/current_tracer", O_WRONLY); if (ffd < 0) exit(-1); write(ffd, "nop", 3); - fd = open("/debug/tracing/set_ftrace_pid", O_WRONLY); + fd = open("/sys/kernel/debug/tracing/set_ftrace_pid", O_WRONLY); s = sprintf(line, "%d\n", getpid());write(fd, line, s);
Review
Quoted 6 lines
(quoted diff) +1
-4-Note: Here we hard coded the path name. The debugfs mount is not -guaranteed to be at /debug (and is more commonly at -/sys/kernel/debug). For simple one time traces, the above is -sufficent. For anything else, a search through /proc/mounts may +Note: Here we hard coded the path name. A search through /proc/mounts may be needed to find where the debugfs file-system is mounted.
Here's the function I use:
#define _STR(x) x
#define STR(x) _STR(x)
#define MAX_PATH 256
const char *find_debugfs(void)
{
static char debugfs[MAX_PATH+1];
static int debugfs_found;
char type[100];
FILE *fp;
if (debugfs_found)
return debugfs;
if ((fp = fopen("/proc/mounts","r")) == NULL) {
perror("/proc/mounts");
return NULL;
}
while (fscanf(fp, "%*s %"
STR(MAX_PATH)
"s %99s %*s %*d %*d\n",
debugfs, type) == 2) {
if (strcmp(type, "debugfs") == 0)
break;
}
fclose(fp);
if (strcmp(type, "debugfs") != 0) {
fprintf(stderr, "debugfs not mounted");
return NULL;
}
debugfs_found = 1;
return debugfs;
}This might be a good idea to show it. This is the most robust since it does not hard code the debugfs directory.
Quoted 55 lines
2)
More details can be found in the source code, in the(quoted diff) +1
-1-kernel/tracing/*.c files. +kernel/trace/*.c files* about ftrace.txt file
---Documentation/trace/ftrace.txt +18
-6@@ -7,7 +7,6 @@ Copyright 2008 Red Hat Inc. (dual licensed under the GPL v2) Reviewers: Elias Oltmanns, Randy Dunlap, Andrew Morton, John Kacur, and David Teigland. - Written for: 2.6.28-rc2 Introduction@@ -33,13 +32,26 @@ The File System Ftrace uses the debugfs file system to hold the control files as well as the files to display output. -To mount the debugfs system: +When debugfs is configured into the kernel (which selecting any ftrace +option will do) the directory /sys/kernel/debug will be created. To mount +this directory, you can add to your /etc/fstab file: + + debugfs /sys/kernel/debug debugfs defaults 0 0 + +Or you can mount it at run time with: + + mount -t debugfs nodev /sys/kernel/debug + +For quicker access to that directory you may want to make a soft link to +it: - # mkdir /debug - # mount -t debugfs nodev /debug + ln -s /sys/kernel/debug /debug -( Note: it is more common to mount at /sys/kernel/debug, but for - simplicity this document will use /debug) +Any selected ftrace option will also create a directory called tracing +within the debugfs. The rest of the document will assume that you are in +the ftrace directory (cd /sys/kernel/debug/tracing) and will only concentrate +on the files within that directory and not distract from the content with +the extended "/sys/kernel/debug/tracing" path name. That's it! (assuming that you have ftrace configured into your kernel)
Documentation/trace/ftrace.txt trace_options · line 404
Quoted 5 lines
Documentation/trace/ftrace.txt +1
-1@@ -389,18 +401,18 @@ trace_options The trace_options file is used to control what gets printed in the trace output. To see what is available, simply cat the file: - cat /debug/tracing/trace_options + cat ./trace_options
Please remove the "./", it is also distracting. We state that we "cd" to the location. "cat trace_options" is good enough.
Same for the all the others below.
Also, since I'm the most picky about this, you may want to remove the ftrace files from the patch and move it to another patch. That way the owners of the other files can ack them and get those changes in. When we have something for ftrace, I'll give my ack. But lets not hold up the other changes because of me ;-)
-- Steve
Quoted 465 lines
Documentation/trace/ftrace.txt +11
-11print-parent nosym-offset nosym-addr noverbose noraw nohex nobin \ noblock nostacktrace nosched-tree nouserstacktrace nosym-userobj To disable one of the options, echo in the option prepended with "no". - echo noprint-parent > /debug/tracing/trace_options + echo noprint-parent > ./trace_options To enable an option, leave off the "no". - echo sym-offset > /debug/tracing/trace_options + echo sym-offset > ./trace_options Here are the available options:@@ -476,11 +488,11 @@ sched_switch This tracer simply records schedule switches. Here is an example of how to use it. - # echo sched_switch > /debug/tracing/current_tracer - # echo 1 > /debug/tracing/tracing_enabled + # echo sched_switch > ./current_tracer + # echo 1 > ./tracing_enabled # sleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > ./tracing_enabled + # cat ./trace # tracer: sched_switch #@@ -574,13 +586,13 @@ new trace is saved. To reset the maximum, echo 0 into tracing_max_latency. Here is an example: - # echo irqsoff > /debug/tracing/current_tracer - # echo 0 > /debug/tracing/tracing_max_latency - # echo 1 > /debug/tracing/tracing_enabled + # echo irqsoff > ./current_tracer + # echo 0 > ./tracing_max_latency + # echo 1 > ./tracing_enabled # ls -ltr - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > ./tracing_enabled + # cat ./latency_trace # tracer: irqsoff # irqsoff latency trace v1.1.5 on 2.6.26@@ -681,13 +693,13 @@ Like the irqsoff tracer, it records the maximumlatency for
which preemption was disabled. The control of preemptoff tracer is much like the irqsoff tracer.- # echo preemptoff > /debug/tracing/current_tracer
- # echo 0 > /debug/tracing/tracing_max_latency
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo preemptoff > ./current_tracer
+ # echo 0 > ./tracing_max_latency
+ # echo 1 > ./tracing_enabled# ls -ltr [...] - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > ./tracing_enabled + # cat ./latency_trace # tracer: preemptoff # preemptoff latency trace v1.1.5 on 2.6.26-rc8Documentation/trace/ftrace.txt +5
-5@@ -828,13 +840,13 @@ tracer. Again, using this trace is much like the irqsoff and preemptoff tracers. - # echo preemptirqsoff > /debug/tracing/current_tracer - # echo 0 > /debug/tracing/tracing_max_latency - # echo 1 > /debug/tracing/tracing_enabled + # echo preemptirqsoff > ./current_tracer + # echo 0 > ./tracing_max_latency + # echo 1 > ./tracing_enabled # ls -ltr - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > ./tracing_enabled + # cat ./latency_trace # tracer: preemptirqsoff # preemptirqsoff latency trace v1.1.5 on 2.6.26-rc8@@ -990,12 +1002,12 @@ slightly differently than we did with theprevious tracers.
Instead of performing an 'ls', we will run 'sleep 1' under 'chrt' which changes the priority of the task.- # echo wakeup > /debug/tracing/current_tracer
- # echo 0 > /debug/tracing/tracing_max_latency
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo wakeup > ./current_tracer
+ # echo 0 > ./tracing_max_latency
+ # echo 1 > ./tracing_enabled# chrt -f 5 sleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > ./tracing_enabled + # cat ./latency_trace # tracer: wakeup # wakeup latency trace v1.1.5 on 2.6.26-rc8Documentation/trace/ftrace.txt +12
-15@@ -1105,11 +1117,11 @@ can be done from the debug file system. Make sure the ftrace_enabled is set; otherwise this tracer is a nop. # sysctl kernel.ftrace_enabled=1 - # echo function > /debug/tracing/current_tracer - # echo 1 > /debug/tracing/tracing_enabled + # echo function > ./current_tracer + # echo 1 > ./tracing_enabled # usleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > ./tracing_enabled + # cat ./trace # tracer: function # # TASK-PID CPU# TIMESTAMP FUNCTION@@ -1146,7 +1158,7 @@ int trace_fd; int main(int argc, char *argv[]) { - trace_fd = open("/debug/tracing/tracing_enabled", O_WRONLY); + trace_fd = open("/sys/kernel/debug/tracing/tracing_enabled", O_WRONLY); if (condition_hit()) { write(trace_fd, "0", 1);@@ -1154,26 +1166,23 @@ int main(int argc, char *argv[]) { } -Note: Here we hard coded the path name. The debugfs mount is not -guaranteed to be at /debug (and is more commonly at -/sys/kernel/debug). For simple one time traces, the above is -sufficent. For anything else, a search through /proc/mounts may +Note: Here we hard coded the path name. A search through /proc/mounts may be needed to find where the debugfs file-system is mounted. Single thread tracing --------------------- -By writing into /debug/tracing/set_ftrace_pid you can trace a +By writing into ./set_ftrace_pid you can trace a single thread. For example: -# cat /debug/tracing/set_ftrace_pid +# cat ./set_ftrace_pid no pid -# echo 3111 > /debug/tracing/set_ftrace_pid -# cat /debug/tracing/set_ftrace_pid +# echo 3111 > ./set_ftrace_pid +# cat ./set_ftrace_pid 3111 -# echo function > /debug/tracing/current_tracer -# cat /debug/tracing/trace | head +# echo function > ./current_tracer +# cat ./trace | head # tracer: function # # TASK-PID CPU# TIMESTAMP FUNCTION@@ -1184,8 +1193,8 @@ no pid yum-updatesd-3111 [003] 1637.254683: lock_hrtimer_base<-hrtimer_try_to_cancel
yum-updatesd-3111 [003] 1637.254685: fget_light <-do_sys_poll yum-updatesd-3111 [003] 1637.254686: pipe_poll <-do_sys_pollDocumentation/trace/ftrace.txt +4
-4-# echo -1 > /debug/tracing/set_ftrace_pid -# cat /debug/tracing/trace |head +# echo -1 > ./set_ftrace_pid +# cat ./trace |head # tracer: function # # TASK-PID CPU# TIMESTAMP FUNCTION@@ -1217,12 +1226,12 @@ int main (int argc, char **argv) char line[64]; int s; - ffd = open("/debug/tracing/current_tracer", O_WRONLY); + ffd = open("/sys/kernel/debug/tracing/current_tracer", O_WRONLY); if (ffd < 0) exit(-1); write(ffd, "nop", 3); - fd = open("/debug/tracing/set_ftrace_pid", O_WRONLY); + fd = open("/sys/kernel/debug/tracing/set_ftrace_pid", O_WRONLY); s = sprintf(line, "%d\n", getpid());write(fd, line, s);Documentation/trace/ftrace.txt +16
-16@@ -1374,22 +1383,22 @@ want, depending on your needs. tracing_cpu_mask file) or you might sometimes see unordered function calls while cpu tracing switch. - hide: echo nofuncgraph-cpu > /debug/tracing/trace_options - show: echo funcgraph-cpu > /debug/tracing/trace_options + hide: echo nofuncgraph-cpu > ./trace_options + show: echo funcgraph-cpu > ./trace_options - The duration (function's time of execution) is displayed on the closing bracket line of a function or on the same line than the current function in case of a leaf one. It is default enabled. - hide: echo nofuncgraph-duration > /debug/tracing/trace_options - show: echo funcgraph-duration > /debug/tracing/trace_options + hide: echo nofuncgraph-duration > ./trace_options + show: echo funcgraph-duration > ./trace_options - The overhead field precedes the duration field in case of reached duration thresholds. - hide: echo nofuncgraph-overhead > /debug/tracing/trace_options - show: echo funcgraph-overhead > /debug/tracing/trace_options + hide: echo nofuncgraph-overhead > ./trace_options + show: echo funcgraph-overhead > ./trace_options depends on: funcgraph-duration ie:@@ -1418,8 +1427,8 @@ want, depending on your needs. - The task/pid field displays the thread cmdline and pid which executed the function. It is default disabled. - hide: echo nofuncgraph-proc > /debug/tracing/trace_options - show: echo funcgraph-proc > /debug/tracing/trace_options + hide: echo nofuncgraph-proc > ./trace_options + show: echo funcgraph-proc > ./trace_options ie:@@ -1442,8 +1451,8 @@ want, depending on your needs. system clock since it started. A snapshot of this time is given on each entry/exit of functions - hide: echo nofuncgraph-abstime > /debug/tracing/trace_options - show: echo funcgraph-abstime > /debug/tracing/trace_options + hide: echo nofuncgraph-abstime > ./trace_options + show: echo funcgraph-abstime > ./trace_options ie:@@ -1540,7 +1549,7 @@ listed in: available_filter_functions - # cat /debug/tracing/available_filter_functions + # cat ./available_filter_functions put_prev_task_idle kmem_cache_create pick_next_task_rt@@ -1552,12 +1561,12 @@ mutex_lock If I am only interested in sys_nanosleep and hrtimer_interrupt: # echo sys_nanosleep hrtimer_interrupt \ - > /debug/tracing/set_ftrace_filter - # echo ftrace > /debug/tracing/current_tracer - # echo 1 > /debug/tracing/tracing_enabled + > ./set_ftrace_filter + # echo ftrace > ./current_tracer + # echo 1 > ./tracing_enabled # usleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > ./tracing_enabled + # cat ./trace # tracer: ftrace # # TASK-PID CPU# TIMESTAMP FUNCTION@@ -1568,7 +1577,7 @@ If I am only interested in sys_nanosleep and
hrtimer_interrupt:To see which functions are being traced, you can cat the file:
- # cat /debug/tracing/set_ftrace_filter
+ # cat ./set_ftrace_filter
hrtimer_interrupt
sys_nanosleepDocumentation/trace/ftrace.txt +14
-14@@ -1588,7 +1597,7 @@ Note: It is better to use quotes to enclose the wild cards, otherwise the shell may expand the parameters into names of files in the local directory. - # echo 'hrtimer_*' > /debug/tracing/set_ftrace_filter + # echo 'hrtimer_*' > ./set_ftrace_filter Produces:@@ -1609,7 +1618,7 @@ Produces: Notice that we lost the sys_nanosleep. - # cat /debug/tracing/set_ftrace_filter + # cat ./set_ftrace_filter hrtimer_run_queues hrtimer_run_pending hrtimer_init@@ -1635,17 +1644,17 @@ To append to the filters, use '>>' To clear out a filter so that all functions will be recorded again: - # echo > /debug/tracing/set_ftrace_filter - # cat /debug/tracing/set_ftrace_filter + # echo > ./set_ftrace_filter + # cat ./set_ftrace_filter # Again, now we want to append. - # echo sys_nanosleep > /debug/tracing/set_ftrace_filter - # cat /debug/tracing/set_ftrace_filter + # echo sys_nanosleep > ./set_ftrace_filter + # cat ./set_ftrace_filter sys_nanosleep - # echo 'hrtimer_*' >> /debug/tracing/set_ftrace_filter - # cat /debug/tracing/set_ftrace_filter + # echo 'hrtimer_*' >> ./set_ftrace_filter + # cat ./set_ftrace_filter hrtimer_run_queues hrtimer_run_pending hrtimer_init@@ -1668,7 +1677,7 @@ hrtimer_init_sleeper The set_ftrace_notrace prevents those functions from being traced. - # echo '*preempt*' '*lock*' > /debug/tracing/set_ftrace_notrace + # echo '*preempt*' '*lock*' > ./set_ftrace_notrace Produces:@@ -1758,13 +1767,13 @@ the effect on the tracing is different. Every read from trace_pipe is consumed. This means that subsequent reads will be different. The trace is live. - # echo function > /debug/tracing/current_tracer - # cat /debug/tracing/trace_pipe > /tmp/trace.out & + # echo function > ./current_tracer + # cat ./trace_pipe > /tmp/trace.out & [1] 4153 - # echo 1 > /debug/tracing/tracing_enabled + # echo 1 > ./tracing_enabled # usleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > ./tracing_enabled + # cat ./trace # tracer: function # # TASK-PID CPU# TIMESTAMP FUNCTION@@ -1800,7 +1809,7 @@ number listed is the number of entries that canbe recorded per
CPU. To know the full size, multiply the number of possible CPUS with the number of entries.- # cat /debug/tracing/buffer_size_kb
+ # cat ./buffer_size_kb
1408 (units kilobytes)Note, to modify this, you must have tracing completely disabled.
Documentation/trace/ftrace.txt +5
-5@@ -1808,21 +1817,21 @@ To do that, echo "nop" into the current_tracer. If the current_tracer is not set to "nop", an EINVAL error will be returned. - # echo nop > /debug/tracing/current_tracer - # echo 10000 > /debug/tracing/buffer_size_kb - # cat /debug/tracing/buffer_size_kb + # echo nop > ./current_tracer + # echo 10000 > ./buffer_size_kb + # cat ./buffer_size_kb 10000 (units kilobytes) The number of pages which will be allocated is limited to a percentage of available memory. Allocating too much will produce an error. - # echo 1000000000000 > /debug/tracing/buffer_size_kb + # echo 1000000000000 > ./buffer_size_kb -bash: echo: write error: Cannot allocate memory - # cat /debug/tracing/buffer_size_kb + # cat ./buffer_size_kb 85 ---Quoted 58 lines · Steven Rostedt
Quoted 21 lines · GeunSik Lim
Dear Greg and Steen,
Thanks your advices and opinions about a confusion according to
too many mount directory names for debugfs. I made rfc v2 patch file again like belows. Can I hear your advices about below patch contents?.Regards,
GeunSik Lim.Subject: [PATCH] Fix terminology inconsistency of dir name to mount debugfs filesystem.
Many developers use "/debug/" or "/debugfs/ directory name to mount debugfs filesystem for ftrace according to
./Documentation/tracers/ftrace.txtfile.Quoted 8 lines
And, three directory
names(ex:/debug/, /debugfs/, /sys/kernel/debug/)is existed in kernel source like ftrace, DRM, Wireless, Network[sky2]files to mount debugfs filesystem.debugfs means debug filesystem for debugging easy to use by greg kroah hartman. "
/sys/kernel/debug/" name is suitable as directory name of debugfs filesystem.
-debugfs related reference: http://lwn.net/Articles/115405/Note, LWN has an update this week:
http://lwn.net/Articles/334546/
But it currently is subscriber only. Others would need to either buy a subscription (plug) or wait a week for it to become open.
Still for some aspects, just having "debugfs" without the leading "/" might just be self explanatory. We can assume the user already knows where debugfs is mounted.
-- Steve
Quoted 8 lines
Fix inconsistency of directory name to mount debugfs filesystem.
Signed-off-by GeunSik Lim <[email protected]>CC Greg KH <[email protected]>CC Steven Rostedt <[email protected]>CC linux-kernel <[email protected]>Signature · 10 lines
Regards, GeunSik Lim ( SAMSUNG ELECTRONICS) Blog : http://blog.naver.com/invain/ e-Mail: [email protected] [email protected] , [email protected] -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Quoted 87 lines · Steven Rostedt
Quoted 46 lines · GeunSik Lim
Thanks your advice. I agree with your reply about this patch. I updated contents that you advised like belows.
If I mistake, Please correct me.And, I also need your review about below 2 contents in the ftrace.txt file.
Thanks,
GeunSik Lim.1)
(quoted diff) +0
-0@@ -1146,7 +1158,7 @@ int trace_fd;int
main(int argc, char *argv[]){
[...]
-trace_fd=open("/debug/tracing/tracing_enabled", O_WRONLY);
+trace_fd=open("/sys/kernel/debug/tracing/tracing_enabled", O_WRONLY); [...]
if (condition_hit()) {
write(trace_fd, "0", 1);(quoted diff) +0
-0@@ -1154,26 +1166,23 @@ int main(int argc, char *argv[]) {}
(quoted diff) +2
-2@@ -1217,12 +1226,12 @@ int main (int argc, char **argv) char line[64]; int s; - ffd = open("/debug/tracing/current_tracer", O_WRONLY); + ffd = open("/sys/kernel/debug/tracing/current_tracer", O_WRONLY); if (ffd < 0) exit(-1); write(ffd, "nop", 3); - fd = open("/debug/tracing/set_ftrace_pid", O_WRONLY); + fd = open("/sys/kernel/debug/tracing/set_ftrace_pid", O_WRONLY); s = sprintf(line, "%d\n", getpid());write(fd, line, s);
(quoted diff) +1
-4-Note: Here we hard coded the path name. The debugfs mount is not -guaranteed to be at /debug (and is more commonly at -/sys/kernel/debug). For simple one time traces, the above is -sufficent. For anything else, a search through /proc/mounts may +Note: Here we hard coded the path name. A search through /proc/mounts mayQuoted 1 line
be needed to find where the debugfs file-system is mounted.
Here's the function I use:
#define
_STR(x)x
#define STR(x)_STR(x)
#defineMAX_PATH256const char
*find_debugfs(void)
{
static char debugfs[MAX_PATH+1];
static intdebugfs_found;
char type[100];
FILE *fp;if (
debugfs_found)
return debugfs;if ((fp =
fopen("/proc/mounts","r")) == NULL) {perror("/proc/mounts");
return NULL;
}while (fscanf(fp, "%*s %"
STR(MAX_PATH)
"s %99s %*s %*d %*d\n",
debugfs, type) == 2) {
if (strcmp(type, "debugfs")== 0)
break;
}
fclose(fp);if (
strcmp(type, "debugfs")!= 0) {fprintf(stderr, "debugfs not mounted"); return NULL;
}
Quoted 7 lines
debugfs_found = 1;
return debugfs;
}This might be a good idea to show it. This is the most robust since it does not hard code the debugfs directory.
Yes, I think so. I have one opinion in the above find_debugfs() function. Default directory is "/sys/kernel/debug/tracing" in ftrace.txt file as you mentioned.
I will append below code for "***/tracing/" directory name.
int size;
[...]
size = MAX_PATH - strlen(debugfs);
strncat(debugfs, "/tracing/", size);
return debugfs;Quoted 59 lines
Quoted 59 lines
2)
More details can be found in the source code, in the(quoted diff) +1
-1-kernel/tracing/*.c files. +kernel/trace/*.c files* about ftrace.txt file
---Documentation/trace/ftrace.txt +0
-0@@ -7,7 +7,6 @@ Copyright 2008 Red Hat Inc. (dual licensed under the GPL v2) Reviewers: Elias Oltmanns, Randy Dunlap, Andrew Morton,John Kacur, and David Teigland.
-
Written for: 2.6.28-rc2Introduction
Documentation/trace/ftrace.txt +0
-0@@ -33,13 +32,26 @@ The File SystemFtrace uses the debugfs file system to hold the control files as well as the files to display output.
Documentation/trace/ftrace.txt +18
-5-To mount the debugfs system: +When debugfs is configured into the kernel (which selecting any ftrace +option will do) the directory /sys/kernel/debug will be created. To mount +this directory, you can add to your /etc/fstab file: + + debugfs /sys/kernel/debug debugfs defaults 0 0 + +Or you can mount it at run time with: + + mount -t debugfs nodev /sys/kernel/debug + +For quicker access to that directory you may want to make a soft link to +it: - # mkdir /debug - # mount -t debugfs nodev /debug + ln -s /sys/kernel/debug /debug -( Note: it is more common to mount at /sys/kernel/debug, but for - simplicity this document will use /debug) +Any selected ftrace option will also create a directory called tracing +within the debugfs. The rest of the document will assume that you are in +the ftrace directory (cd /sys/kernel/debug/tracing) and will only concentrate +on the files within that directory and not distract from the content with +the extended "/sys/kernel/debug/tracing" path name.That's it! (assuming that you have ftrace configured into your kernel)
Documentation/trace/ftrace.txt +0
-0@@ -389,18 +401,18 @@ trace_optionsThe
trace_optionsfile is used to control what gets printed in the trace output. To see what is available, simply cat the file:
Quoted 5 lines
Quoted 2 lines
- cat /debug/tracing/trace_options
+ cat ./trace_optionsPlease remove the "./", it is also distracting. We state that we "cd" to the location. "cat
trace_options" is good enough.
It's right. This is just my private style. I will remove "./".
Quoted 5 lines
Same for the all the others below.
Also, since I'm the most picky about this, you may want to remove the ftrace files from the patch and move it to another patch. That way the
I am not think that you are the most picky about this. I like your advice and review about my proposal for consensus.
Quoted 4 lines
owners of the other files can ack them and get those changes in. When we have something for ftrace, I'll give my ack. But lets not hold up the other changes because of me ;-)
Don't care. Hope it helps. ;-)
I will modify ftrace files from the patch according to your advice.
Quoted 467 lines
-- Steve
Quoted 465 lines
print-parent nosym-offset nosym-addr noverbose noraw nohex nobin \
noblock nostacktrace nosched-tree nouserstacktrace nosym-userobjTo disable one of the options, echo in the option prepended with "no".
- echo noprint-parent > /debug/tracing/trace_options
+ echo noprint-parent > ./trace_optionsTo enable an option, leave off the "no".
- echo sym-offset > /debug/tracing/trace_options
+ echo sym-offset > ./trace_optionsHere are the available options:
Documentation/trace/ftrace.txt +0
-0@@ -476,11 +488,11 @@ sched_switchThis tracer simply records schedule switches. Here is an example of how to use it.
- # echo
sched_switch> /debug/tracing/current_tracer
- # echo 1 > /debug/tracing/tracing_enabled
+ # echosched_switch> ./current_tracer
+ # echo 1 > ./tracing_enabled# sleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > ./tracing_enabled + # cat ./trace# tracer:
sched_switch
#Documentation/trace/ftrace.txt +0
-0@@ -574,13 +586,13 @@ new trace is saved.To reset the maximum, echo 0 into
tracing_max_latency. Here is an example:- # echo irqsoff > /debug/tracing/current_tracer
- # echo 0 > /debug/tracing/tracing_max_latency
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo irqsoff > ./current_tracer
+ # echo 0 > ./tracing_max_latency
+ # echo 1 > ./tracing_enabled# ls -ltr [...] - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > ./tracing_enabled + # cat ./latency_trace # tracer: irqsoff # irqsoff latency trace v1.1.5 on 2.6.26Documentation/trace/ftrace.txt +0
-0@@ -681,13 +693,13 @@ Like the irqsoff tracer, it records the maximumlatency for
which preemption was disabled. The control of preemptoff tracer is much like the irqsoff tracer.- # echo preemptoff > /debug/tracing/current_tracer
- # echo 0 > /debug/tracing/tracing_max_latency
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo preemptoff > ./current_tracer
+ # echo 0 > ./tracing_max_latency
+ # echo 1 > ./tracing_enabled# ls -ltr [...] - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > ./tracing_enabled + # cat ./latency_trace # tracer: preemptoff # preemptoff latency trace v1.1.5 on 2.6.26-rc8Documentation/trace/ftrace.txt +0
-0@@ -828,13 +840,13 @@ tracer.Again, using this trace is much like the irqsoff and preemptoff tracers.
- # echo preemptirqsoff > /debug/tracing/current_tracer
- # echo 0 > /debug/tracing/tracing_max_latency
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo preemptirqsoff > ./current_tracer
+ # echo 0 > ./tracing_max_latency
+ # echo 1 > ./tracing_enabled# ls -ltr [...] - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > ./tracing_enabled + # cat ./latency_trace # tracer: preemptirqsoff # preemptirqsoff latency trace v1.1.5 on 2.6.26-rc8Documentation/trace/ftrace.txt +0
-0@@ -990,12 +1002,12 @@ slightly differently than we did with theprevious tracers.
Instead of performing an 'ls', we will run 'sleep 1' under 'chrt' which changes the priority of the task.- # echo wakeup > /debug/tracing/current_tracer
- # echo 0 > /debug/tracing/tracing_max_latency
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo wakeup > ./current_tracer
+ # echo 0 > ./tracing_max_latency
+ # echo 1 > ./tracing_enabled# chrt -f 5 sleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > ./tracing_enabled + # cat ./latency_trace # tracer: wakeup # wakeup latency trace v1.1.5 on 2.6.26-rc8Documentation/trace/ftrace.txt +0
-0@@ -1105,11 +1117,11 @@ can be done from the debug file system. Make sure theftrace_enabled is set; otherwise this tracer is a nop.
# sysctl kernel.ftrace_enabled=1 - # echo function > /debug/tracing/current_tracer - # echo 1 > /debug/tracing/tracing_enabled + # echo function > ./current_tracer + # echo 1 > ./tracing_enabled # usleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > ./tracing_enabled + # cat ./trace # tracer: function # # TASK-PID CPU# TIMESTAMP FUNCTIONDocumentation/trace/ftrace.txt +0
-0@@ -1146,7 +1158,7 @@ int trace_fd;int
main(int argc, char *argv[]){
[...]
-trace_fd=open("/debug/tracing/tracing_enabled", O_WRONLY);
+trace_fd=open("/sys/kernel/debug/tracing/tracing_enabled", O_WRONLY); [...]
if (condition_hit()) {
write(trace_fd, "0", 1);Documentation/trace/ftrace.txt +0
-0@@ -1154,26 +1166,23 @@ int main(int argc, char *argv[]) {}
Documentation/trace/ftrace.txt +1
-4-Note: Here we hard coded the path name. The debugfs mount is not -guaranteed to be at /debug (and is more commonly at -/sys/kernel/debug). For simple one time traces, the above is -sufficent. For anything else, a search through /proc/mounts may +Note: Here we hard coded the path name. A search through /proc/mounts maybe needed to find where the debugfs file-system is mounted.
Single thread tracing
---------------------Documentation/trace/ftrace.txt +1
-1-By writing into /debug/tracing/set_ftrace_pid you can trace a +By writing into ./set_ftrace_pid you can trace asingle thread. For example:
Documentation/trace/ftrace.txt +1
-1-# cat /debug/tracing/set_ftrace_pid +# cat ./set_ftrace_pidno pid
Documentation/trace/ftrace.txt +2
-2-# echo 3111 > /debug/tracing/set_ftrace_pid -# cat /debug/tracing/set_ftrace_pid +# echo 3111 > ./set_ftrace_pid +# cat ./set_ftrace_pid3111
Documentation/trace/ftrace.txt +2
-2-# echo function > /debug/tracing/current_tracer -# cat /debug/tracing/trace | head +# echo function > ./current_tracer +# cat ./trace | head# tracer: function
#
# TASK-PID CPU# TIMESTAMP FUNCTIONDocumentation/trace/ftrace.txt +0
-0@@ -1184,8 +1193,8 @@ no pidyum-updatesd-3111 [003] 1637.254683:
lock_hrtimer_base<-hrtimer_try_to_cancel
yum-updatesd-3111 [003] 1637.254685:fget_light<-do_sys_poll yum-updatesd-3111 [003] 1637.254686:pipe_poll<-do_sys_pollDocumentation/trace/ftrace.txt +2
-2-# echo -1 > /debug/tracing/set_ftrace_pid -# cat /debug/tracing/trace |head +# echo -1 > ./set_ftrace_pid +# cat ./trace |head# tracer: function
#
# TASK-PID CPU# TIMESTAMP FUNCTIONDocumentation/trace/ftrace.txt +2
-2@@ -1217,12 +1226,12 @@ int main (int argc, char **argv) char line[64]; int s; - ffd = open("/debug/tracing/current_tracer", O_WRONLY); + ffd = open("/sys/kernel/debug/tracing/current_tracer", O_WRONLY); if (ffd < 0) exit(-1); write(ffd, "nop", 3); - fd = open("/debug/tracing/set_ftrace_pid", O_WRONLY); + fd = open("/sys/kernel/debug/tracing/set_ftrace_pid", O_WRONLY); s = sprintf(line, "%d\n", getpid());write(fd, line, s);
Documentation/trace/ftrace.txt +0
-0@@ -1374,22 +1383,22 @@ want, depending on your needs.tracing_cpu_mask file) or you might sometimes see unordered function calls while cpu tracing switch.
- hide: echo nofuncgraph-cpu > /debug/tracing/trace_options
- show: echo funcgraph-cpu > /debug/tracing/trace_options
+ hide: echo nofuncgraph-cpu > ./trace_options
+ show: echo funcgraph-cpu > ./trace_options- The duration (function's time of execution) is displayed on the closing bracket line of a function or on the same line than the current function in case of a leaf one. It is default enabled.
- hide: echo nofuncgraph-duration > /debug/tracing/trace_options
- show: echo funcgraph-duration > /debug/tracing/trace_options
+ hide: echo nofuncgraph-duration > ./trace_options
+ show: echo funcgraph-duration > ./trace_options- The overhead field precedes the duration field in case of reached duration thresholds.
- hide: echo nofuncgraph-overhead > /debug/tracing/trace_options
- show: echo funcgraph-overhead > /debug/tracing/trace_options
+ hide: echo nofuncgraph-overhead > ./trace_options
+ show: echo funcgraph-overhead > ./trace_options depends on: funcgraph-durationie:
Documentation/trace/ftrace.txt +0
-0@@ -1418,8 +1427,8 @@ want, depending on your needs.- The task/pid field displays the thread cmdline and pid which executed the function. It is default disabled.
- hide: echo nofuncgraph-proc > /debug/tracing/trace_options
- show: echo funcgraph-proc > /debug/tracing/trace_options
+ hide: echo nofuncgraph-proc > ./trace_options
+ show: echo funcgraph-proc > ./trace_optionsie:
Documentation/trace/ftrace.txt +0
-0@@ -1442,8 +1451,8 @@ want, depending on your needs.system clock since it started. A snapshot of this time is given on each entry/exit of functions
- hide: echo nofuncgraph-abstime > /debug/tracing/trace_options
- show: echo funcgraph-abstime > /debug/tracing/trace_options
+ hide: echo nofuncgraph-abstime > ./trace_options
+ show: echo funcgraph-abstime > ./trace_optionsie:
Documentation/trace/ftrace.txt +0
-0@@ -1540,7 +1549,7 @@ listed in:
available_filter_functions- # cat /debug/tracing/available_filter_functions
+ # cat ./available_filter_functions
put_prev_task_idle
kmem_cache_create
pick_next_task_rtDocumentation/trace/ftrace.txt +0
-0@@ -1552,12 +1561,12 @@ mutex_lockIf I am only interested in
sys_nanosleepandhrtimer_interrupt:# echo sys_nanosleep hrtimer_interrupt \ - > /debug/tracing/set_ftrace_filter - # echo ftrace > /debug/tracing/current_tracer - # echo 1 > /debug/tracing/tracing_enabled + > ./set_ftrace_filter + # echo ftrace > ./current_tracer + # echo 1 > ./tracing_enabled # usleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > ./tracing_enabled + # cat ./trace # tracer: ftrace # # TASK-PID CPU# TIMESTAMP FUNCTIONDocumentation/trace/ftrace.txt +0
-0@@ -1568,7 +1577,7 @@ If I am only interested in sys_nanosleep and
hrtimer_interrupt:To see which functions are being traced, you can cat the file:
- # cat /debug/tracing/set_ftrace_filter
+ # cat ./set_ftrace_filter
hrtimer_interrupt
sys_nanosleepDocumentation/trace/ftrace.txt +0
-0@@ -1588,7 +1597,7 @@ Note: It is better to use quotes to enclose the wild cards,otherwise the shell may expand the parameters into names of files in the local directory.
- # echo 'hrtimer_*' > /debug/tracing/set_ftrace_filter
+ # echo 'hrtimer_*' > ./set_ftrace_filterProduces:
Documentation/trace/ftrace.txt +0
-0@@ -1609,7 +1618,7 @@ Produces:Notice that we lost the
sys_nanosleep.- # cat /debug/tracing/set_ftrace_filter
+ # cat ./set_ftrace_filter
hrtimer_run_queues
hrtimer_run_pending
hrtimer_initDocumentation/trace/ftrace.txt +0
-0@@ -1635,17 +1644,17 @@ To append to the filters, use '>>'To clear out a filter so that all functions will be recorded again:
- # echo > /debug/tracing/set_ftrace_filter
- # cat /debug/tracing/set_ftrace_filter
+ # echo > ./set_ftrace_filter
+ # cat ./set_ftrace_filter
#Again, now we want to append.
- # echo
sys_nanosleep> /debug/tracing/set_ftrace_filter
- # cat /debug/tracing/set_ftrace_filter
+ # echosys_nanosleep> ./set_ftrace_filter
+ # cat ./set_ftrace_filter
sys_nanosleep
- # echo 'hrtimer_*' >> /debug/tracing/set_ftrace_filter
- # cat /debug/tracing/set_ftrace_filter
+ # echo 'hrtimer_*' >> ./set_ftrace_filter
+ # cat ./set_ftrace_filter
hrtimer_run_queues
hrtimer_run_pending
hrtimer_initDocumentation/trace/ftrace.txt +0
-0@@ -1668,7 +1677,7 @@ hrtimer_init_sleeperThe
set_ftrace_notraceprevents those functions from being traced.- # echo '*preempt*' '*lock*' > /debug/tracing/set_ftrace_notrace
+ # echo '*preempt*' '*lock*' > ./set_ftrace_notraceProduces:
Documentation/trace/ftrace.txt +0
-0@@ -1758,13 +1767,13 @@ the effect on the tracing is different. Every read fromtrace_pipe is consumed. This means that subsequent reads will be different. The trace is live.
- # echo function > /debug/tracing/current_tracer
- # cat /debug/tracing/trace_pipe >/tmp/trace.out&
+ # echo function > ./current_tracer
+ # cat ./trace_pipe >/tmp/trace.out&
[1] 4153
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo 1 > ./tracing_enabled# usleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > ./tracing_enabled + # cat ./trace # tracer: function # # TASK-PID CPU# TIMESTAMP FUNCTIONDocumentation/trace/ftrace.txt +0
-0@@ -1800,7 +1809,7 @@ number listed is the number of entries that canbe recorded per
CPU. To know the full size, multiply the number of possible CPUS with the number of entries.- # cat /debug/tracing/buffer_size_kb
+ # cat ./buffer_size_kb
1408 (units kilobytes)Note, to modify this, you must have tracing completely disabled.
Documentation/trace/ftrace.txt +0
-0@@ -1808,21 +1817,21 @@ To do that, echo "nop" into the current_tracer. If thecurrent_tracer is not set to "nop", an EINVAL error will be returned.
- # echo nop > /debug/tracing/current_tracer
- # echo 10000 > /debug/tracing/buffer_size_kb
- # cat /debug/tracing/buffer_size_kb
+ # echo nop > ./current_tracer
+ # echo 10000 > ./buffer_size_kb
+ # cat ./buffer_size_kb
10000 (units kilobytes)The number of pages which will be allocated is limited to a percentage of available memory. Allocating too much will produce an error.
- # echo 1000000000000 > /debug/tracing/buffer_size_kb
+ # echo 1000000000000 > ./buffer_size_kb -bash: echo: write error: Cannot allocate memory
- # cat /debug/tracing/buffer_size_kb
+ # cat ./buffer_size_kb
85---
Quoted 39 lines · Steven Rostedt
Quoted 21 lines · GeunSik Lim
Dear Greg and Steen,
Thanks your advices and opinions about a confusion according to
too many mount directory names for debugfs. I made rfc v2 patch file again like belows. Can I hear your advices about below patch contents?.Regards,
GeunSik Lim.Subject: [PATCH] Fix terminology inconsistency of dir name to mount debugfs filesystem.
Many developers use "/debug/" or "/debugfs/ directory name to mount debugfs filesystem for ftrace according to
./Documentation/tracers/ftrace.txtfile.Quoted 8 lines
And, three directory
names(ex:/debug/, /debugfs/, /sys/kernel/debug/)is existed in kernel source like ftrace, DRM, Wireless, Network[sky2]files to mount debugfs filesystem.debugfs means debug filesystem for debugging easy to use by greg kroah hartman. "
/sys/kernel/debug/" name is suitable as directory name of debugfs filesystem.
-debugfs related reference: http://lwn.net/Articles/115405/Note, LWN has an update this week:
Quoted 19 lines
But it currently is subscriber only. Others would need to either buy a subscription (plug) or wait a week for it to become open.
Still for some aspects, just having "debugfs" without the leading "/" might just be self explanatory. We can assume the user already knows where debugfs is mounted.
-- Steve
Quoted 8 lines
Fix inconsistency of directory name to mount debugfs filesystem.
Signed-off-by GeunSik Lim <[email protected]>CC Greg KH <[email protected]>CC Steven Rostedt <[email protected]>CC linux-kernel <[email protected]>--
Regards,
GeunSik Lim ( SAMSUNG ELECTRONICS)
Blog : http://blog.naver.com/invain/
e-Mail: [email protected]
[email protected] , [email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 10 lines
Regards, GeunSik Lim ( SAMSUNG ELECTRONICS) Blog : http://blog.naver.com/invain/ e-Mail: [email protected] [email protected] , [email protected] -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Quoted 10 lines · GeunSik Lim
Quoted 2 lines
Also, since I'm the most picky about this, you may want to remove the ftrace files from the patch and move it to another patch. That way the
I am not think that you are the most picky about this. I like your advice and review about my proposal for consensus.
Quoted 4 lines
owners of the other files can ack them and get those changes in. When we have something for ftrace, I'll give my ack. But lets not hold up the other changes because of me ;-)
Don't care. Hope it helps. ;-)
I will modify ftrace files from the patch according to your advice.
I updated ftrace related contents according to Steven's help like belows. If I misunderstood wrongly, Please correct me.
Thanks.
* About ftrace.txt file/
---
Documentation/trace/ftrace.txt +30 -18
@@ -7,7 +7,6 @@ Copyright 2008 Red Hat Inc. (dual licensed under the GPL v2) Reviewers: Elias Oltmanns, Randy Dunlap, Andrew Morton, John Kacur, and David Teigland. - Written for: 2.6.28-rc2 Introduction
@@ -33,13 +32,26 @@ The File System Ftrace uses the debugfs file system to hold the control files as well as the files to display output. -To mount the debugfs system: +When debugfs is configured into the kernel (which selecting any ftrace +option will do) the directory /sys/kernel/debug will be created. To mount +this directory, you can add to your /etc/fstab file: + + debugfs /sys/kernel/debug debugfs defaults 0 0 + +Or you can mount it at run time with: + + mount -t debugfs nodev /sys/kernel/debug + +For quicker access to that directory you may want to make a soft link to +it: - # mkdir /debug - # mount -t debugfs nodev /debug + ln -s /sys/kernel/debug /debug -( Note: it is more common to mount at /sys/kernel/debug, but for - simplicity this document will use /debug) +Any selected ftrace option will also create a directory called tracing +within the debugfs. The rest of the document will assume that you are in +the ftrace directory (cd /sys/kernel/debug/tracing) and will only concentrate +on the files within that directory and not distract from the content with +the extended "/sys/kernel/debug/tracing" path name. That's it! (assuming that you have ftrace configured into your kernel)
@@ -389,18 +401,18 @@ trace_options The trace_options file is used to control what gets printed in the trace output. To see what is available, simply cat the file: - cat /debug/tracing/trace_options + cat trace_options print-parent nosym-offset nosym-addr noverbose noraw nohex nobin \ noblock nostacktrace nosched-tree nouserstacktrace nosym-userobj To disable one of the options, echo in the option prepended with "no". - echo noprint-parent > /debug/tracing/trace_options + echo noprint-parent > trace_options To enable an option, leave off the "no". - echo sym-offset > /debug/tracing/trace_options + echo sym-offset > trace_options Here are the available options:
@@ -476,11 +488,11 @@ sched_switch This tracer simply records schedule switches. Here is an example of how to use it. - # echo sched_switch > /debug/tracing/current_tracer - # echo 1 > /debug/tracing/tracing_enabled + # echo sched_switch > current_tracer + # echo 1 > tracing_enabled # sleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > tracing_enabled + # cat trace # tracer: sched_switch #
@@ -574,13 +586,13 @@ new trace is saved. To reset the maximum, echo 0 into tracing_max_latency. Here is an example: - # echo irqsoff > /debug/tracing/current_tracer - # echo 0 > /debug/tracing/tracing_max_latency - # echo 1 > /debug/tracing/tracing_enabled + # echo irqsoff > current_tracer + # echo 0 > tracing_max_latency + # echo 1 > tracing_enabled # ls -ltr [...] - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > tracing_enabled + # cat latency_trace # tracer: irqsoff # irqsoff latency trace v1.1.5 on 2.6.26
@@ -681,13 +693,13 @@ Like the irqsoff tracer, it records the maximum
latency for
which preemption was disabled. The control of preemptoff tracer is much like the irqsoff tracer.
- # echo preemptoff > /debug/tracing/current_tracer
- # echo 0 > /debug/tracing/tracing_max_latency
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo preemptoff > current_tracer
+ # echo 0 > tracing_max_latency
+ # echo 1 > tracing_enabled
# ls -ltr [...] - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > tracing_enabled + # cat latency_trace # tracer: preemptoff # preemptoff latency trace v1.1.5 on 2.6.26-rc8 @@ -828,13 +840,13 @@ tracer. Again, using this trace is much like the irqsoff and preemptoff tracers.
- # echo preemptirqsoff > /debug/tracing/current_tracer
- # echo 0 > /debug/tracing/tracing_max_latency
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo preemptirqsoff > current_tracer
+ # echo 0 > tracing_max_latency
+ # echo 1 > tracing_enabled
# ls -ltr [...] - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > tracing_enabled + # cat latency_trace # tracer: preemptirqsoff # preemptirqsoff latency trace v1.1.5 on 2.6.26-rc8 @@ -990,12 +1002,12 @@ slightly differently than we did with the previous tracers. Instead of performing an 'ls', we will run 'sleep 1' under 'chrt' which changes the priority of the task.
- # echo wakeup > /debug/tracing/current_tracer
- # echo 0 > /debug/tracing/tracing_max_latency
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo wakeup > current_tracer
+ # echo 0 > tracing_max_latency
+ # echo 1 > tracing_enabled
# chrt -f 5 sleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > tracing_enabled + # cat latency_trace # tracer: wakeup # wakeup latency trace v1.1.5 on 2.6.26-rc8 @@ -1105,11 +1117,11 @@ can be done from the debug file system. Make sure the ftrace_enabled is set; otherwise this tracer is a nop.
# sysctl kernel.ftrace_enabled=1
- # echo function > /debug/tracing/current_tracer
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo function > current_tracer
+ # echo 1 > tracing_enabled
# usleep 1
- # echo 0 > /debug/tracing/tracing_enabled
- # cat /debug/tracing/trace
+ # echo 0 > tracing_enabled
+ # cat trace
# tracer: function
#
# TASK-PID CPU# TIMESTAMP FUNCTION
@@ -1146,7 +1158,7 @@ int trace_fd;
[...]
int main(int argc, char *argv[]) {
[...]
- trace_fd = open("/debug/tracing/tracing_enabled", O_WRONLY);
+ trace_fd = open(find_debugfs("tracing_enabled"), O_WRONLY);
[...]
if (condition_hit()) {
write(trace_fd, "0", 1);
@@ -1154,26 +1166,20 @@ int main(int argc, char *argv[]) {
[...]
}-Note: Here we hard coded the path name. The debugfs mount is not -guaranteed to be at /debug (and is more commonly at -/sys/kernel/debug). For simple one time traces, the above is -sufficent. For anything else, a search through /proc/mounts may -be needed to find where the debugfs file-system is mounted. -
Single thread tracing
---------------------
-By writing into /debug/tracing/set_ftrace_pid you can trace a +By writing into set_ftrace_pid you can trace a
single thread. For example:
-# cat /debug/tracing/set_ftrace_pid
+# cat set_ftrace_pid
no pid
-# echo 3111 > /debug/tracing/set_ftrace_pid
-# cat /debug/tracing/set_ftrace_pid
+# echo 3111 > set_ftrace_pid
+# cat set_ftrace_pid
3111
-# echo function > /debug/tracing/current_tracer
-# cat /debug/tracing/trace | head
+# echo function > current_tracer
+# cat trace | head
# tracer: function
#
# TASK-PID CPU# TIMESTAMP FUNCTION
@@ -1184,8 +1190,8 @@ no pid
yum-updatesd-3111 [003] 1637.254683: lock_hrtimer_base
<-hrtimer_try_to_cancel
yum-updatesd-3111 [003] 1637.254685: fget_light <-do_sys_poll
yum-updatesd-3111 [003] 1637.254686: pipe_poll <-do_sys_poll-# echo -1 > /debug/tracing/set_ftrace_pid
-# cat /debug/tracing/trace |head
+# echo -1 > set_ftrace_pid
+# cat trace |head
# tracer: function
#
# TASK-PID CPU# TIMESTAMP FUNCTION
@@ -1202,11 +1208,57 @@ something like this simple program:
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
+#define _STR(x) #x
+#define STR(x) _STR(x)
+#define MAX_PATH 256
+
+const char *find_debugfs(char *file_name)
+{
+ static char debugfs[MAX_PATH+1]; + static int debugfs_found; + char type[100]; + FILE *fp; + int size;
+
+ if (debugfs_found)
+ return debugfs;
+
+ if ((fp = fopen("/proc/mounts","r")) == NULL) {
+ perror("/proc/mounts");
+ return NULL;
+ }
+
+ while (fscanf(fp, "%*s %"
+ STR(MAX_PATH)
+ "s %99s %*s %*d %*d\n",
+ debugfs, type) == 2) {+ if (strcmp(type, "debugfs") == 0)
+ break;
+ }
+ fclose(fp);
+
+ if (strcmp(type, "debugfs") != 0) {
+ fprintf(stderr, "debugfs not mounted");
+ return NULL;
+ }
+
+ debugfs_found = 1;
+
+ size = MAX_PATH - strlen(debugfs);
+ strncat(debugfs, "/tracing/", size);
+
+ size = MAX_PATH - strlen(debugfs);
+ strncat(debugfs, file_name, size);
+
+ return debugfs;
+}
+
int main (int argc, char **argv)
{
if (argc < 1)
@@ -1217,12 +1269,12 @@ int main (int argc, char **argv)
char line[64];
int s;- ffd = open("/debug/tracing/current_tracer", O_WRONLY);
+ ffd = open(find_debugfs("current_tracer"), O_WRONLY);
if (ffd < 0)
exit(-1);
write(ffd, "nop", 3);- fd = open("/debug/tracing/set_ftrace_pid", O_WRONLY);
+ fd = open(find_debugfs("set_ftrace_pid"), O_WRONLY);
s = sprintf(line, "%d\n", getpid());
write(fd, line, s);@@ -1374,22 +1426,22 @@ want, depending on your needs.
tracing_cpu_mask file) or you might sometimes see unordered function calls while cpu tracing switch.
- hide: echo nofuncgraph-cpu > /debug/tracing/trace_options
- show: echo funcgraph-cpu > /debug/tracing/trace_options
+ hide: echo nofuncgraph-cpu > trace_options
+ show: echo funcgraph-cpu > trace_options
- The duration (function's time of execution) is displayed on the closing bracket line of a function or on the same line than the current function in case of a leaf one. It is default enabled.
- hide: echo nofuncgraph-duration > /debug/tracing/trace_options
- show: echo funcgraph-duration > /debug/tracing/trace_options
+ hide: echo nofuncgraph-duration > trace_options
+ show: echo funcgraph-duration > trace_options
- The overhead field precedes the duration field in case of reached duration thresholds.
- hide: echo nofuncgraph-overhead > /debug/tracing/trace_options
- show: echo funcgraph-overhead > /debug/tracing/trace_options
+ hide: echo nofuncgraph-overhead > trace_options
+ show: echo funcgraph-overhead > trace_options
depends on: funcgraph-duration
ie:
@@ -1418,8 +1470,8 @@ want, depending on your needs.
- The task/pid field displays the thread cmdline and pid which executed the function. It is default disabled.
- hide: echo nofuncgraph-proc > /debug/tracing/trace_options
- show: echo funcgraph-proc > /debug/tracing/trace_options
+ hide: echo nofuncgraph-proc > trace_options
+ show: echo funcgraph-proc > trace_options
ie:
@@ -1442,8 +1494,8 @@ want, depending on your needs.
system clock since it started. A snapshot of this time is given on each entry/exit of functions
- hide: echo nofuncgraph-abstime > /debug/tracing/trace_options
- show: echo funcgraph-abstime > /debug/tracing/trace_options
+ hide: echo nofuncgraph-abstime > trace_options
+ show: echo funcgraph-abstime > trace_options
ie:
@@ -1540,7 +1592,7 @@ listed in:
available_filter_functions
- # cat /debug/tracing/available_filter_functions
+ # cat available_filter_functions
put_prev_task_idle
kmem_cache_create
pick_next_task_rt
@@ -1552,12 +1604,12 @@ mutex_lock
If I am only interested in sys_nanosleep and hrtimer_interrupt:
# echo sys_nanosleep hrtimer_interrupt \ - > /debug/tracing/set_ftrace_filter - # echo ftrace > /debug/tracing/current_tracer - # echo 1 > /debug/tracing/tracing_enabled + > set_ftrace_filter + # echo ftrace > current_tracer + # echo 1 > tracing_enabled # usleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > tracing_enabled + # cat trace # tracer: ftrace # # TASK-PID CPU# TIMESTAMP FUNCTION @@ -1568,7 +1620,7 @@ If I am only interested in sys_nanosleep and hrtimer_interrupt:
To see which functions are being traced, you can cat the file:
- # cat /debug/tracing/set_ftrace_filter
+ # cat set_ftrace_filter
hrtimer_interrupt
sys_nanosleep
@@ -1588,7 +1640,7 @@ Note: It is better to use quotes to enclose the wild cards,
otherwise the shell may expand the parameters into names of files in the local directory.
- # echo 'hrtimer_*' > /debug/tracing/set_ftrace_filter
+ # echo 'hrtimer_*' > set_ftrace_filter
Produces:
@@ -1609,7 +1661,7 @@ Produces:
Notice that we lost the sys_nanosleep.
- # cat /debug/tracing/set_ftrace_filter
+ # cat set_ftrace_filter
hrtimer_run_queues
hrtimer_run_pending
hrtimer_init
@@ -1635,17 +1687,17 @@ To append to the filters, use '>>'
To clear out a filter so that all functions will be recorded again:
- # echo > /debug/tracing/set_ftrace_filter
- # cat /debug/tracing/set_ftrace_filter
+ # echo > set_ftrace_filter
+ # cat set_ftrace_filter
#
Again, now we want to append.
- # echo sys_nanosleep > /debug/tracing/set_ftrace_filter
- # cat /debug/tracing/set_ftrace_filter
+ # echo sys_nanosleep > set_ftrace_filter
+ # cat set_ftrace_filter
sys_nanosleep
- # echo 'hrtimer_*' >> /debug/tracing/set_ftrace_filter
- # cat /debug/tracing/set_ftrace_filter
+ # echo 'hrtimer_*' >> set_ftrace_filter
+ # cat set_ftrace_filter
hrtimer_run_queues
hrtimer_run_pending
hrtimer_init
@@ -1668,7 +1720,7 @@ hrtimer_init_sleeper
The set_ftrace_notrace prevents those functions from being traced.
- # echo '*preempt*' '*lock*' > /debug/tracing/set_ftrace_notrace
+ # echo '*preempt*' '*lock*' > set_ftrace_notrace
Produces:
@@ -1758,13 +1810,13 @@ the effect on the tracing is different. Every read from
trace_pipe is consumed. This means that subsequent reads will be different. The trace is live.
- # echo function > /debug/tracing/current_tracer
- # cat /debug/tracing/trace_pipe > /tmp/trace.out &
+ # echo function > current_tracer
+ # cat trace_pipe > /tmp/trace.out &
[1] 4153
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo 1 > tracing_enabled
# usleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > tracing_enabled + # cat trace # tracer: function # # TASK-PID CPU# TIMESTAMP FUNCTION @@ -1800,7 +1852,7 @@ number listed is the number of entries that can be recorded per CPU. To know the full size, multiply the number of possible CPUS with the number of entries.
- # cat /debug/tracing/buffer_size_kb
+ # cat buffer_size_kb
1408 (units kilobytes)
Note, to modify this, you must have tracing completely disabled.
@@ -1808,18 +1860,18 @@ To do that, echo "nop" into the current_tracer. If the
current_tracer is not set to "nop", an EINVAL error will be returned.
- # echo nop > /debug/tracing/current_tracer
- # echo 10000 > /debug/tracing/buffer_size_kb
- # cat /debug/tracing/buffer_size_kb
+ # echo nop > current_tracer
+ # echo 10000 > buffer_size_kb
+ # cat buffer_size_kb
10000 (units kilobytes)
The number of pages which will be allocated is limited to a percentage of available memory. Allocating too much will produce an error.
- # echo 1000000000000 > /debug/tracing/buffer_size_kb
+ # echo 1000000000000 > buffer_size_kb -bash: echo: write error: Cannot allocate memory
- # cat /debug/tracing/buffer_size_kb
+ # cat buffer_size_kb
85
---
Regards,
GeunSik Lim ( SAMSUNG ELECTRONICS)
Blog : http://blog.naver.com/invain/
e-Mail: [email protected]
[email protected] , [email protected]
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Steven Rostedt
maintainerQuoted 41 lines · GeunSik Lim
(quoted diff) +32
-0@@ -1202,11 +1208,57 @@ something like this simple program: #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> +#define _STR(x) #x +#define STR(x) _STR(x) +#define MAX_PATH 256 + +const char *find_debugfs(char *file_name) +{ + static char debugfs[MAX_PATH+1]; + static int debugfs_found; + char type[100]; + FILE *fp; + int size; + + if (debugfs_found) + return debugfs; + + if ((fp = fopen("/proc/mounts","r")) == NULL) { + perror("/proc/mounts"); + return NULL; + } + + while (fscanf(fp, "%*s %" + STR(MAX_PATH) + "s %99s %*s %*d %*d\n", + debugfs, type) == 2) { + if (strcmp(type, "debugfs") == 0) + break; + } + fclose(fp); + + if (strcmp(type, "debugfs") != 0) { + fprintf(stderr, "debugfs not mounted");
Review something like this simple program: · line 1257
Quoted 10 lines
(quoted diff) +10
-0+ return NULL; + } + + debugfs_found = 1; + + size = MAX_PATH - strlen(debugfs); + strncat(debugfs, "/tracing/", size); + + size = MAX_PATH - strlen(debugfs); + strncat(debugfs, file_name, size);
You need to make two functions. One to find the debugfs and one to add the file. The "debugfs_found" will make the function return just the first file_name every time. Something like this: (remove the file_name from find_debugfs).
const char *tracing_file(const char *file_name)
{
static char trace_file[MAX_PATH+1];
snprintf(trace_file, MAX_PATH, "%s/%s", find_debugfs(), file_name);
return trace_file;
}The above is not thread safe, but is OK for non threaded programs.
-- Steve
Quoted 22 lines
(quoted diff) +6
-2+ + return debugfs; +} + int main (int argc, char **argv) { if (argc < 1)@@ -1217,12 +1269,12 @@ int main (int argc, char **argv) char line[64]; int s; - ffd = open("/debug/tracing/current_tracer", O_WRONLY); + ffd = open(find_debugfs("current_tracer"), O_WRONLY); if (ffd < 0) exit(-1); write(ffd, "nop", 3); - fd = open("/debug/tracing/set_ftrace_pid", O_WRONLY); + fd = open(find_debugfs("set_ftrace_pid"), O_WRONLY); s = sprintf(line, "%d\n", getpid()); write(fd, line, s);
Quoted 9 lines · Steven Rostedt
You need to make two functions. One to find the debugfs and one to add the file. The "
debugfs_found" will make the function return just the firstfile_nameevery time. Something like this: (remove thefile_namefromfind_debugfs).const char *tracing_file(const char
*file_name)
{
static char trace_file[MAX_PATH+1];
Quoted 6 lines
snprintf(trace_file,
MAX_PATH, "%s/%s",find_debugfs(),file_name);return
trace_file;
}The above is not thread safe, but is OK for non threaded programs.
Thanks.
I modified pseudo code using tracing_file function that you sent.
* ftrace.txt info after modification.
---
Documentation/trace/ftrace.txt +30 -18
@@ -7,7 +7,6 @@ Copyright 2008 Red Hat Inc. (dual licensed under the GPL v2) Reviewers: Elias Oltmanns, Randy Dunlap, Andrew Morton, John Kacur, and David Teigland. - Written for: 2.6.28-rc2 Introduction
@@ -33,13 +32,26 @@ The File System Ftrace uses the debugfs file system to hold the control files as well as the files to display output. -To mount the debugfs system: +When debugfs is configured into the kernel (which selecting any ftrace +option will do) the directory /sys/kernel/debug will be created. To mount +this directory, you can add to your /etc/fstab file: + + debugfs /sys/kernel/debug debugfs defaults 0 0 + +Or you can mount it at run time with: + + mount -t debugfs nodev /sys/kernel/debug - # mkdir /debug - # mount -t debugfs nodev /debug +For quicker access to that directory you may want to make a soft link to +it: -( Note: it is more common to mount at /sys/kernel/debug, but for - simplicity this document will use /debug) + ln -s /sys/kernel/debug /debug + +Any selected ftrace option will also create a directory called tracing +within the debugfs. The rest of the document will assume that you are in +the ftrace directory (cd /sys/kernel/debug/tracing) and will only concentrate +on the files within that directory and not distract from the content with +the extended "/sys/kernel/debug/tracing" path name. That's it! (assuming that you have ftrace configured into your kernel)
@@ -389,18 +401,18 @@ trace_options The trace_options file is used to control what gets printed in the trace output. To see what is available, simply cat the file: - cat /debug/tracing/trace_options + cat trace_options print-parent nosym-offset nosym-addr noverbose noraw nohex nobin \ noblock nostacktrace nosched-tree nouserstacktrace nosym-userobj To disable one of the options, echo in the option prepended with "no". - echo noprint-parent > /debug/tracing/trace_options + echo noprint-parent > trace_options To enable an option, leave off the "no". - echo sym-offset > /debug/tracing/trace_options + echo sym-offset > trace_options Here are the available options:
@@ -476,11 +488,11 @@ sched_switch This tracer simply records schedule switches. Here is an example of how to use it. - # echo sched_switch > /debug/tracing/current_tracer - # echo 1 > /debug/tracing/tracing_enabled + # echo sched_switch > current_tracer + # echo 1 > tracing_enabled # sleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > tracing_enabled + # cat trace # tracer: sched_switch #
@@ -574,13 +586,13 @@ new trace is saved. To reset the maximum, echo 0 into tracing_max_latency. Here is an example: - # echo irqsoff > /debug/tracing/current_tracer - # echo 0 > /debug/tracing/tracing_max_latency - # echo 1 > /debug/tracing/tracing_enabled + # echo irqsoff > current_tracer + # echo 0 > tracing_max_latency + # echo 1 > tracing_enabled # ls -ltr [...] - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > tracing_enabled + # cat latency_trace # tracer: irqsoff # irqsoff latency trace v1.1.5 on 2.6.26
@@ -681,13 +693,13 @@ Like the irqsoff tracer, it records the maximum
latency for
which preemption was disabled. The control of preemptoff tracer is much like the irqsoff tracer.
- # echo preemptoff > /debug/tracing/current_tracer
- # echo 0 > /debug/tracing/tracing_max_latency
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo preemptoff > current_tracer
+ # echo 0 > tracing_max_latency
+ # echo 1 > tracing_enabled
# ls -ltr [...] - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > tracing_enabled + # cat latency_trace # tracer: preemptoff # preemptoff latency trace v1.1.5 on 2.6.26-rc8 @@ -828,13 +840,13 @@ tracer. Again, using this trace is much like the irqsoff and preemptoff tracers.
- # echo preemptirqsoff > /debug/tracing/current_tracer
- # echo 0 > /debug/tracing/tracing_max_latency
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo preemptirqsoff > current_tracer
+ # echo 0 > tracing_max_latency
+ # echo 1 > tracing_enabled
# ls -ltr [...] - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > tracing_enabled + # cat latency_trace # tracer: preemptirqsoff # preemptirqsoff latency trace v1.1.5 on 2.6.26-rc8 @@ -990,12 +1002,12 @@ slightly differently than we did with the previous tracers. Instead of performing an 'ls', we will run 'sleep 1' under 'chrt' which changes the priority of the task.
- # echo wakeup > /debug/tracing/current_tracer
- # echo 0 > /debug/tracing/tracing_max_latency
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo wakeup > current_tracer
+ # echo 0 > tracing_max_latency
+ # echo 1 > tracing_enabled
# chrt -f 5 sleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/latency_trace + # echo 0 > tracing_enabled + # cat latency_trace # tracer: wakeup # wakeup latency trace v1.1.5 on 2.6.26-rc8 @@ -1105,11 +1117,11 @@ can be done from the debug file system. Make sure the ftrace_enabled is set; otherwise this tracer is a nop.
# sysctl kernel.ftrace_enabled=1
- # echo function > /debug/tracing/current_tracer
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo function > current_tracer
+ # echo 1 > tracing_enabled
# usleep 1
- # echo 0 > /debug/tracing/tracing_enabled
- # cat /debug/tracing/trace
+ # echo 0 > tracing_enabled
+ # cat trace
# tracer: function
#
# TASK-PID CPU# TIMESTAMP FUNCTION
@@ -1146,7 +1158,7 @@ int trace_fd;
[...]
int main(int argc, char *argv[]) {
[...]
- trace_fd = open("/debug/tracing/tracing_enabled", O_WRONLY);
+ trace_fd = open(tracing_file("tracing_enabled"), O_WRONLY);
[...]
if (condition_hit()) {
write(trace_fd, "0", 1);
@@ -1154,26 +1166,20 @@ int main(int argc, char *argv[]) {
[...]
}-Note: Here we hard coded the path name. The debugfs mount is not -guaranteed to be at /debug (and is more commonly at -/sys/kernel/debug). For simple one time traces, the above is -sufficent. For anything else, a search through /proc/mounts may -be needed to find where the debugfs file-system is mounted. -
Single thread tracing
---------------------
-By writing into /debug/tracing/set_ftrace_pid you can trace a +By writing into set_ftrace_pid you can trace a
single thread. For example:
-# cat /debug/tracing/set_ftrace_pid
+# cat set_ftrace_pid
no pid
-# echo 3111 > /debug/tracing/set_ftrace_pid
-# cat /debug/tracing/set_ftrace_pid
+# echo 3111 > set_ftrace_pid
+# cat set_ftrace_pid
3111
-# echo function > /debug/tracing/current_tracer
-# cat /debug/tracing/trace | head
+# echo function > current_tracer
+# cat trace | head
# tracer: function
#
# TASK-PID CPU# TIMESTAMP FUNCTION
@@ -1184,8 +1190,8 @@ no pid
yum-updatesd-3111 [003] 1637.254683: lock_hrtimer_base
<-hrtimer_try_to_cancel
yum-updatesd-3111 [003] 1637.254685: fget_light <-do_sys_poll
yum-updatesd-3111 [003] 1637.254686: pipe_poll <-do_sys_poll-# echo -1 > /debug/tracing/set_ftrace_pid
-# cat /debug/tracing/trace |head
+# echo -1 > set_ftrace_pid
+# cat trace |head
# tracer: function
#
# TASK-PID CPU# TIMESTAMP FUNCTION
@@ -1207,6 +1213,51 @@ something like this simple program:
#include <fcntl.h>
#include <unistd.h>
+#define _STR(x) #x
+#define STR(x) _STR(x)
+#define MAX_PATH 256
+
+const char *find_debugfs(void)
+{
+ static char debugfs[MAX_PATH+1]; + static int debugfs_found; + char type[100]; + FILE *fp;
+
+ if (debugfs_found)
+ return debugfs;
+
+ if ((fp = fopen("/proc/mounts","r")) == NULL) {
+ perror("/proc/mounts");
+ return NULL;
+ }
+
+ while (fscanf(fp, "%*s %"
+ STR(MAX_PATH)
+ "s %99s %*s %*d %*d\n",
+ debugfs, type) == 2) {+ if (strcmp(type, "debugfs") == 0)
+ break;
+ }
+ fclose(fp);
+
+ if (strcmp(type, "debugfs") != 0) {
+ fprintf(stderr, "debugfs not mounted");
+ return NULL;
+ }
+
+ debugfs_found = 1;
+
+ return debugfs;
+}
+
+const char *tracing_file(const char *file_name)
+{
+ static char trace_file[MAX_PATH+1];
+ snprintf(trace_file, MAX_PATH, "%s/%s", find_debugfs(), file_name);
+ return trace_file;
+}
+
int main (int argc, char **argv)
{
if (argc < 1)
@@ -1217,12 +1268,12 @@ int main (int argc, char **argv)
char line[64];
int s;- ffd = open("/debug/tracing/current_tracer", O_WRONLY);
+ ffd = open(tracing_file("current_tracer"), O_WRONLY);
if (ffd < 0)
exit(-1);
write(ffd, "nop", 3);- fd = open("/debug/tracing/set_ftrace_pid", O_WRONLY);
+ fd = open(tracing_file("set_ftrace_pid"), O_WRONLY);
s = sprintf(line, "%d\n", getpid());
write(fd, line, s);@@ -1374,22 +1425,22 @@ want, depending on your needs.
tracing_cpu_mask file) or you might sometimes see unordered function calls while cpu tracing switch.
- hide: echo nofuncgraph-cpu > /debug/tracing/trace_options
- show: echo funcgraph-cpu > /debug/tracing/trace_options
+ hide: echo nofuncgraph-cpu > trace_options
+ show: echo funcgraph-cpu > trace_options
- The duration (function's time of execution) is displayed on the closing bracket line of a function or on the same line than the current function in case of a leaf one. It is default enabled.
- hide: echo nofuncgraph-duration > /debug/tracing/trace_options
- show: echo funcgraph-duration > /debug/tracing/trace_options
+ hide: echo nofuncgraph-duration > trace_options
+ show: echo funcgraph-duration > trace_options
- The overhead field precedes the duration field in case of reached duration thresholds.
- hide: echo nofuncgraph-overhead > /debug/tracing/trace_options
- show: echo funcgraph-overhead > /debug/tracing/trace_options
+ hide: echo nofuncgraph-overhead > trace_options
+ show: echo funcgraph-overhead > trace_options
depends on: funcgraph-duration
ie:
@@ -1418,8 +1469,8 @@ want, depending on your needs.
- The task/pid field displays the thread cmdline and pid which executed the function. It is default disabled.
- hide: echo nofuncgraph-proc > /debug/tracing/trace_options
- show: echo funcgraph-proc > /debug/tracing/trace_options
+ hide: echo nofuncgraph-proc > trace_options
+ show: echo funcgraph-proc > trace_options
ie:
@@ -1442,8 +1493,8 @@ want, depending on your needs.
system clock since it started. A snapshot of this time is given on each entry/exit of functions
- hide: echo nofuncgraph-abstime > /debug/tracing/trace_options
- show: echo funcgraph-abstime > /debug/tracing/trace_options
+ hide: echo nofuncgraph-abstime > trace_options
+ show: echo funcgraph-abstime > trace_options
ie:
@@ -1540,7 +1591,7 @@ listed in:
available_filter_functions
- # cat /debug/tracing/available_filter_functions
+ # cat available_filter_functions
put_prev_task_idle
kmem_cache_create
pick_next_task_rt
@@ -1552,12 +1603,12 @@ mutex_lock
If I am only interested in sys_nanosleep and hrtimer_interrupt:
# echo sys_nanosleep hrtimer_interrupt \ - > /debug/tracing/set_ftrace_filter - # echo ftrace > /debug/tracing/current_tracer - # echo 1 > /debug/tracing/tracing_enabled + > set_ftrace_filter + # echo ftrace > current_tracer + # echo 1 > tracing_enabled # usleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > tracing_enabled + # cat trace # tracer: ftrace # # TASK-PID CPU# TIMESTAMP FUNCTION @@ -1568,7 +1619,7 @@ If I am only interested in sys_nanosleep and hrtimer_interrupt:
To see which functions are being traced, you can cat the file:
- # cat /debug/tracing/set_ftrace_filter
+ # cat set_ftrace_filter
hrtimer_interrupt
sys_nanosleep
@@ -1588,7 +1639,7 @@ Note: It is better to use quotes to enclose the wild cards,
otherwise the shell may expand the parameters into names of files in the local directory.
- # echo 'hrtimer_*' > /debug/tracing/set_ftrace_filter
+ # echo 'hrtimer_*' > set_ftrace_filter
Produces:
@@ -1609,7 +1660,7 @@ Produces:
Notice that we lost the sys_nanosleep.
- # cat /debug/tracing/set_ftrace_filter
+ # cat set_ftrace_filter
hrtimer_run_queues
hrtimer_run_pending
hrtimer_init
@@ -1635,17 +1686,17 @@ To append to the filters, use '>>'
To clear out a filter so that all functions will be recorded again:
- # echo > /debug/tracing/set_ftrace_filter
- # cat /debug/tracing/set_ftrace_filter
+ # echo > set_ftrace_filter
+ # cat set_ftrace_filter
#
Again, now we want to append.
- # echo sys_nanosleep > /debug/tracing/set_ftrace_filter
- # cat /debug/tracing/set_ftrace_filter
+ # echo sys_nanosleep > set_ftrace_filter
+ # cat set_ftrace_filter
sys_nanosleep
- # echo 'hrtimer_*' >> /debug/tracing/set_ftrace_filter
- # cat /debug/tracing/set_ftrace_filter
+ # echo 'hrtimer_*' >> set_ftrace_filter
+ # cat set_ftrace_filter
hrtimer_run_queues
hrtimer_run_pending
hrtimer_init
@@ -1668,7 +1719,7 @@ hrtimer_init_sleeper
The set_ftrace_notrace prevents those functions from being traced.
- # echo '*preempt*' '*lock*' > /debug/tracing/set_ftrace_notrace
+ # echo '*preempt*' '*lock*' > set_ftrace_notrace
Produces:
@@ -1758,13 +1809,13 @@ the effect on the tracing is different. Every read from
trace_pipe is consumed. This means that subsequent reads will be different. The trace is live.
- # echo function > /debug/tracing/current_tracer
- # cat /debug/tracing/trace_pipe > /tmp/trace.out &
+ # echo function > current_tracer
+ # cat trace_pipe > /tmp/trace.out &
[1] 4153
- # echo 1 > /debug/tracing/tracing_enabled
+ # echo 1 > tracing_enabled
# usleep 1 - # echo 0 > /debug/tracing/tracing_enabled - # cat /debug/tracing/trace + # echo 0 > tracing_enabled + # cat trace # tracer: function # # TASK-PID CPU# TIMESTAMP FUNCTION @@ -1800,7 +1851,7 @@ number listed is the number of entries that can be recorded per CPU. To know the full size, multiply the number of possible CPUS with the number of entries.
- # cat /debug/tracing/buffer_size_kb
+ # cat buffer_size_kb
1408 (units kilobytes)
Note, to modify this, you must have tracing completely disabled.
@@ -1808,18 +1859,18 @@ To do that, echo "nop" into the current_tracer. If the
current_tracer is not set to "nop", an EINVAL error will be returned.
- # echo nop > /debug/tracing/current_tracer
- # echo 10000 > /debug/tracing/buffer_size_kb
- # cat /debug/tracing/buffer_size_kb
+ # echo nop > current_tracer
+ # echo 10000 > buffer_size_kb
+ # cat buffer_size_kb
10000 (units kilobytes)
The number of pages which will be allocated is limited to a percentage of available memory. Allocating too much will produce an error.
- # echo 1000000000000 > /debug/tracing/buffer_size_kb
+ # echo 1000000000000 > buffer_size_kb -bash: echo: write error: Cannot allocate memory
- # cat /debug/tracing/buffer_size_kb
+ # cat buffer_size_kb
85
---
Signature · 10 lines
Regards, GeunSik Lim ( SAMSUNG ELECTRONICS) Blog : http://blog.naver.com/invain/ e-Mail: [email protected] [email protected] , [email protected] -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Steven Rostedt
maintainerQuoted 48 lines · GeunSik Lim
Quoted 36 lines
Here's the function I use:
#define
_STR(x)x
#define STR(x)_STR(x)
#defineMAX_PATH256const char
*find_debugfs(void)
{
static char debugfs[MAX_PATH+1];
static intdebugfs_found;
char type[100];
FILE *fp;if (
debugfs_found)
return debugfs;if ((fp =
fopen("/proc/mounts","r")) == NULL) {perror("/proc/mounts");
return NULL;
}while (fscanf(fp, "%*s %"
STR(MAX_PATH)
"s %99s %*s %*d %*d\n",
debugfs, type) == 2) {
if (strcmp(type, "debugfs")== 0)
break;
}
fclose(fp);if (
strcmp(type, "debugfs")!= 0) {fprintf(stderr, "debugfs not mounted"); return NULL;
}Quoted 7 lines
debugfs_found = 1;
return debugfs;
}This might be a good idea to show it. This is the most robust since it does not hard code the debugfs directory.
Yes, I think so. I have one opinion in the above
find_debugfs()function. Default directory is "/sys/kernel/debug/tracing" in ftrace.txt file as you mentioned.
I will append below code for "***/tracing/" directory name.
Quoted 5 lines
int size;
[...]
size = MAX_PATH - strlen(debugfs);
strncat(debugfs, "/tracing/", size);
return debugfs;Heh, I usually have another function to add the /tracing part. But sure, we could do that too.
-- Steve
RFC PATCH v3 1/1 debugfs:Fix terminology inconsistency of dir name to mount debugfs filesystem.
In reply to GeunSik LimDear Greg and Steven,
Thanks your advices and opinions about a confusion according to too many mount directory names for debugfs filesystem. I made rfc v3 like belows thanks to steven and greg. Can I hear your advices and comments about below patch contents?
* LKML about rfc v2:
http://lkml.org/lkml/2009/5/29/219
* LKML about rfc v1:
http://lkml.org/lkml/2009/5/26/17
Regards,
GeunSik Lim.
Subject: [PATCH] Fix terminology inconsistency of dir name to mount debugfs filesystem.
Many developers use "/debug/" or "/debugfs/ directory name to mount debugfs filesystem for ftrace according to ./Documentation/tracers/ftrace.txt file.
And, three directory names(ex:/debug/, /debugfs/, /sys/kernel/debug/) is existed in kernel source like ftrace, DRM, Wireless, Documentation, Network[sky2]files to mount debugfs filesystem.
debugfs means debug filesystem for debugging easy to use by greg kroah hartman. "/sys/kernel/debug/" name is suitable as directory name of debugfs filesystem.
-debugfs related reference: http://lwn.net/Articles/334546/
Fix inconsistency of directory name to mount debugfs filesystem.
--- Documentation/DocBook/debugobjects.tmpl | 2 +- Documentation/cdrom/packet-writing.txt | 2 +- Documentation/fault-injection/fault-injection.txt | 70 +++--- Documentation/kprobes.txt | 6 +- Documentation/trace/ftrace.txt | 233 +++++++++++++-------- Documentation/trace/mmiotrace.txt | 26 ++-- drivers/block/pktcdvd.c | 2 +- drivers/gpu/drm/drm_debugfs.c | 12 +- drivers/gpu/drm/drm_drv.c | 2 +- drivers/gpu/drm/drm_stub.c | 2 +- drivers/net/Kconfig | 4 +- drivers/net/wimax/i2400m/i2400m.h | 2 +- drivers/net/wireless/ath5k/Kconfig | 6 +- drivers/net/wireless/libertas/README | 12 +- drivers/scsi/lpfc/lpfc_debugfs.c | 4 +- include/linux/kernel.h | 2 +- include/linux/tracepoint.h | 4 +- kernel/trace/Kconfig | 10 +- kernel/trace/trace.c | 24 +- scripts/tracing/draw_functrace.py | 8 +- 20 files changed, 242 insertions(+), 191 deletions(-)
Documentation/DocBook/debugobjects.tmpl +1 -1
@@ -106,7 +106,7 @@ number of errors are printk'ed including a full stack trace. </para> <para> - The statistics are available via debugfs/debug_objects/stats. + The statistics are available via /sys/kernel/debug/debug_objects/stats. They provide information about the number of warnings and the number of successful fixups along with information about the usage of the internal tracking objects and the state of the
Documentation/cdrom/packet-writing.txt +1 -1
@@ -117,7 +117,7 @@ Using the pktcdvd debugfs interface To read pktcdvd device infos in human readable form, do: - # cat /debug/pktcdvd/pktcdvd[0-7]/info + # cat /sys/kernel/debug/pktcdvd/pktcdvd[0-7]/info For a description of the debugfs interface look into the file:
Documentation/fault-injection/fault-injection.txt +35 -35
145 lines not on this page · raw message
Documentation/kprobes.txt +3 -3
@@ -507,9 +507,9 @@ http://www.linuxsymposium.org/2006/linuxsymposium_procv2.pdf (pages 101-115) Appendix A: The kprobes debugfs interface With recent kernels (> 2.6.20) the list of registered kprobes is visible -under the /debug/kprobes/ directory (assuming debugfs is mounted at /debug). +under the /sys/kernel/debug/kprobes/ directory (assuming debugfs is mounted at //sys/kernel/debug). -/debug/kprobes/list: Lists all registered probes on the system +/sys/kernel/debug/kprobes/list: Lists all registered probes on the system c015d71a k vfs_read+0x0 c011a316 j do_fork+0x0
@@ -525,7 +525,7 @@ virtual addresses that correspond to modules that've been unloaded), such probes are marked with [GONE]. If the probe is temporarily disabled, such probes are marked with [DISABLED]. -/debug/kprobes/enabled: Turn kprobes ON/OFF forcibly. +/sys/kernel/debug/kprobes/enabled: Turn kprobes ON/OFF forcibly. Provides a knob to globally and forcibly turn registered kprobes ON or OFF. By default, all kprobes are enabled. By echoing "0" to this file, all
Documentation/trace/ftrace.txt +142 -91
452 lines not on this page · raw message
Documentation/trace/mmiotrace.txt +13 -13
@@ -32,41 +32,41 @@ is no way to automatically detect if you are losing events due to CPUs racing. Usage Quick Reference --------------------- -$ mount -t debugfs debugfs /debug -$ echo mmiotrace > /debug/tracing/current_tracer -$ cat /debug/tracing/trace_pipe > mydump.txt & +$ mount -t debugfs debugfs /sys/kernel/debug +$ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer +$ cat /sys/kernel/debug/tracing/trace_pipe > mydump.txt & Start X or whatever. -$ echo "X is up" > /debug/tracing/trace_marker -$ echo nop > /debug/tracing/current_tracer +$ echo "X is up" > /sys/kernel/debug/tracing/trace_marker +$ echo nop > /sys/kernel/debug/tracing/current_tracer Check for lost events. Usage ----- -Make sure debugfs is mounted to /debug. If not, (requires root privileges) -$ mount -t debugfs debugfs /debug +Make sure debugfs is mounted to /sys/kernel/debug. If not, (requires root privileges) +$ mount -t debugfs debugfs /sys/kernel/debug Check that the driver you are about to trace is not loaded. Activate mmiotrace (requires root privileges): -$ echo mmiotrace > /debug/tracing/current_tracer +$ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer Start storing the trace: -$ cat /debug/tracing/trace_pipe > mydump.txt & +$ cat /sys/kernel/debug/tracing/trace_pipe > mydump.txt & The 'cat' process should stay running (sleeping) in the background. Load the driver you want to trace and use it. Mmiotrace will only catch MMIO accesses to areas that are ioremapped while mmiotrace is active. During tracing you can place comments (markers) into the trace by -$ echo "X is up" > /debug/tracing/trace_marker +$ echo "X is up" > /sys/kernel/debug/tracing/trace_marker This makes it easier to see which part of the (huge) trace corresponds to which action. It is recommended to place descriptive markers about what you do. Shut down mmiotrace (requires root privileges): -$ echo nop > /debug/tracing/current_tracer +$ echo nop > /sys/kernel/debug/tracing/current_tracer The 'cat' process exits. If it does not, kill it by issuing 'fg' command and pressing ctrl+c.
@@ -78,10 +78,10 @@ to view your kernel log and look for "mmiotrace has lost events" warning. If events were lost, the trace is incomplete. You should enlarge the buffers and try again. Buffers are enlarged by first seeing how large the current buffers are: -$ cat /debug/tracing/buffer_size_kb +$ cat /sys/kernel/debug/tracing/buffer_size_kb gives you a number. Approximately double this number and write it back, for instance: -$ echo 128000 > /debug/tracing/buffer_size_kb +$ echo 128000 > /sys/kernel/debug/tracing/buffer_size_kb Then start again from the top. If you are doing a trace for a driver project, e.g. Nouveau, you should also
drivers/block/pktcdvd.c +1 -1
@@ -430,7 +430,7 @@ static void pkt_sysfs_cleanup(void)/******************************************************************** entries in debugfs -/debugfs/pktcdvd[0-7]/ +/sys/kernel/debug/pktcdvd[0-7]/ info *******************************************************************/
drivers/gpu/drm/drm_debugfs.c +6 -6
@@ -105,7 +105,7 @@ int drm_debugfs_create_files(struct drm_info_list *files, int count, ent =debugfs_create_file (files[i].name,S_IFREG |S_IRUGO , root, tmp, &drm_debugfs_fops);if (!ent) { -DRM_ERROR ("Cannot create /debugfs/dri/%s/%s\n" , +DRM_ERROR ("Cannot create /sys/kernel/debug/dri/%s/%s\n" , name, files[i].name);drm_free (tmp,sizeof (struct drm_info_node ), _DRM_DRIVER);
@@ -133,9 +133,9 @@ EXPORT_SYMBOL(drm_debugfs_create_files);* \param minor device minor number * \param root DRI debugfs dir entry. * -* Create the DRI debugfs root entry "/debugfs/dri", the device debugfs root entry -* "/debugfs/dri/%minor%/", and each entry in debugfs_list as -* "/debugfs/dri/%minor%/%name%". +* Create the DRI debugfs root entry "/sys/kernel/debug/dri", the device debugfs root entry +* "/sys/kernel/debug/dri/%minor%/", and each entry in debugfs_list as +* "/sys/kernel/debug/dri/%minor%/%name%". */ int drm_debugfs_init (struct drm_minor *minor,int minor_id,struct dentry *root)
@@ -148,7 +148,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,sprintf (name,"%d" , minor_id); minor->debugfs_root =debugfs_create_dir (name, root);if (!minor->debugfs_root) { -DRM_ERROR ("Cannot create /debugfs/dri/%s\n" , name); +DRM_ERROR ("Cannot create /sys/kernel/debug/dri/%s\n" , name);return -1 ; }
@@ -165,7 +165,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, ret = dev->driver->debugfs_init (minor);if (ret) {DRM_ERROR ("DRM: Driver failed to initialize " -"/debugfs/dri.\n" ); +"/sys/kernel/debug/dri.\n" );return ret; } }
drivers/gpu/drm/drm_drv.c +1 -1
@@ -339,7 +339,7 @@ static int __init drm_core_init(void) drm_debugfs_root =debugfs_create_dir ("dri" ,NULL );if (!drm_debugfs_root) { -DRM_ERROR ("Cannot create /debugfs/dri\n" ); +DRM_ERROR ("Cannot create /sys/kernel/debug/dri\n" ); ret =-1 ; goto err_p3; }
drivers/gpu/drm/drm_stub.c +1 -1
@@ -328,7 +328,7 @@ static int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int t#if defined(CONFIG_DEBUG_FS ) ret =drm_debugfs_init (new_minor, minor_id, drm_debugfs_root);if (ret) { -DRM_ERROR ("DRM: Failed to initialize /debugfs/dri.\n" ); +DRM_ERROR ("DRM: Failed to initialize /sys/kernel/debug/dri.\n" ); goto err_g2; }#endif
drivers/net/Kconfig +2 -2
@@ -2200,7 +2200,7 @@ config SKGE_DEBUG depends on SKGE && DEBUG_FS help This option adds the ability to dump driver state for debugging. - The file debugfs/skge/ethX displays the state of the internal + The file /sys/kernel/debug/skge/ethX displays the state of the internal transmit and receive rings. If unsure, say N.
@@ -2226,7 +2226,7 @@ config SKY2_DEBUG depends on SKY2 && DEBUG_FS help This option adds the ability to dump driver state for debugging. - The file debugfs/sky2/ethX displays the state of the internal + The file /sys/kernel/debug/sky2/ethX displays the state of the internal transmit and receive rings. If unsure, say N.
drivers/net/wimax/i2400m/i2400m.h +1 -1
@@ -389,7 +389,7 @@ struct i2400m { unsigned ready:1; /* all probing steps done */ unsigned rx_reorder:1; /* RX reorder is enabled */u8 trace_msg_from_user;/* echo rx msgs to 'trace' pipe */ -/* typed u8 so debugfs/u8 can tweak */ +/* typed u8 so /sys/kernel/debug/u8 can tweak */ enum i2400m_system_state state;wait_queue_head_t state_wq;/* Woken up when on state updates */
drivers/net/wireless/ath5k/Kconfig +3 -3
@@ -27,11 +27,11 @@ config ATH5K_DEBUG Say Y, if and you will get debug options for ath5k. To use this, you need to mount debugfs: - mkdir /debug/ - mount -t debugfs debug /debug/ + mkdir /sys/kernel/debug/ + mount -t debugfs debug /sys/kernel/debug/ You will get access to files under: - /debug/ath5k/phy0/ + /sys/kernel/debug/ath5k/phy0/ To enable debug, pass the debug level to the debug module parameter. For example:
drivers/net/wireless/libertas/README +6 -6
@@ -72,7 +72,7 @@ rdrf location that is to be read. This parameter must be specified in hexadecimal (its possible to preceed preceding the number with a "0x"). - Path: /debugfs/libertas_wireless/ethX/registers/ + Path: /sys/kernel/debug/libertas_wireless/ethX/registers/ Usage: echo "0xa123" > rdmac ; cat rdmac
@@ -95,7 +95,7 @@ wrrf sleepparams This command is used to set the sleepclock configurations - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: cat sleepparams: reads the current sleepclock configuration
@@ -115,7 +115,7 @@ subscribed_events The subscribed_events directory contains the interface for the subscribed events API. - Path: /debugfs/libertas_wireless/ethX/subscribed_events/ + Path: /sys/kernel/debug/libertas_wireless/ethX/subscribed_events/ Each event is represented by a filename. Each filename consists of the following three fields:
@@ -165,7 +165,7 @@ subscribed_events extscan This command is used to do a specific scan. - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: echo "SSID" > extscan
@@ -179,7 +179,7 @@ getscantable Display the current contents of the driver scan table (ie. get the scan results). - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: cat getscantable
@@ -188,7 +188,7 @@ setuserscan Initiate a customized scan and retrieve the results - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: echo "[ARGS]" > setuserscan
drivers/scsi/lpfc/lpfc_debugfs.c +2 -2
@@ -51,8 +51,8 @@* debugfs interface * * To access this interface the user should: -* # mkdir /debug -* # mount -t debugfs none /debug +* # mkdir /sys/kernel/debug +* # mount -t debugfs none /sys/kernel/debug * * The lpfc debugfs directory hierarchy is: * lpfc/lpfcX/vportY
include/linux/kernel.h +1 -1
@@ -406,7 +406,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte)* * Use tracing_on/tracing_off when you want to quickly turn on or off * tracing. It simply enables or disables the recording of the trace events. -* This also corresponds to the user space debugfs/tracing/tracing_on +* This also corresponds to the user space /sys/kernel/debug/tracing/tracing_on * file, which gives a means for the kernel and userspace to interact. * Place a tracing_off() in the kernel where you want tracing to end. * From user space, examine the trace, and then echo 1 > tracing_on
include/linux/tracepoint.h +2 -2
@@ -197,7 +197,7 @@ static inline void tracepoint_synchronize_unregister(void)* * This is how the trace record is structured and will * * be saved into the ring buffer. These are the fields * * that will be exposed to user-space in -* * /debug/tracing/events/<*>/format. +* * /sys/kernel/debug/tracing/events/<*>/format. * * * * The declared 'local variable' is called '__entry' * *
@@ -257,7 +257,7 @@ static inline void tracepoint_synchronize_unregister(void)* tracepoint callback (this is used by programmatic plugins and * can also by used by generic instrumentation like SystemTap), and * it is also used to expose a structured trace record in -* /debug/tracing/events/. +* /sys/kernel/debug/tracing/events/. */ #define TRACE_EVENT (name, proto, args, struct, assign, print) \
kernel/trace/Kconfig +5 -5
@@ -120,7 +120,7 @@ config IRQSOFF_TRACER disabled by default and can be runtime (re-)started via: - echo 0 > /debugfs/tracing/tracing_max_latency + echo 0 > /sys/kernel/debug/tracing/tracing_max_latency (Note that kernel size and overhead increases with this option enabled. This option and the preempt-off timing option can be
@@ -141,7 +141,7 @@ config PREEMPT_TRACER disabled by default and can be runtime (re-)started via: - echo 0 > /debugfs/tracing/tracing_max_latency + echo 0 > /sys/kernel/debug/tracing/tracing_max_latency (Note that kernel size and overhead increases with this option enabled. This option and the irqs-off timing option can be
@@ -213,7 +213,7 @@ config TRACE_BRANCH_PROFILING This tracer profiles all the the likely and unlikely macros in the kernel. It will display the results in: - /debugfs/tracing/profile_annotated_branch + /sys/kernel/debug/tracing/profile_annotated_branch Note: this will add a significant overhead, only turn this on if you need to profile the system's use of these macros.
@@ -228,7 +228,7 @@ config PROFILE_ALL_BRANCHES taken in the kernel is recorded whether it hit or miss. The results will be displayed in: - /debugfs/tracing/profile_branch + /sys/kernel/debug/tracing/profile_branch This configuration, when enabled, will impose a great overhead on the system. This should only be enabled when the system
@@ -276,7 +276,7 @@ config STACK_TRACER select KALLSYMS help This special tracer records the maximum stack footprint of the - kernel and displays it in debugfs/tracing/stack_trace. + kernel and displays it in /sys/kernel/debug/tracing/stack_trace. This tracer works by hooking into every function call that the kernel executes, and keeping a maximum stack depth value and
kernel/trace/trace.c +12 -12
@@ -335,7 +335,7 @@ static raw_spinlock_t ftrace_max_lock =/* * Copy the new maximum trace into the separate maximum-trace * structure. (this way the maximum trace is permanently saved, -* for later retrieval via /debugfs/tracing/latency_trace) +* for later retrieval via /sys/kernel/debug/tracing/latency_trace) */ static void __update_max_tr (struct trace_array *tr,struct task_struct *tsk,int cpu)
@@ -2366,21 +2366,21 @@ static const struct file_operations tracing_iter_fops = {static const char readme_msg[] ="tracing mini-HOWTO:\n\n" -"# mkdir /debug\n" -"# mount -t debugfs nodev /debug\n\n" -"# cat /debug/tracing/available_tracers\n" +"# mkdir /sys/kernel/debug\n" +"# mount -t debugfs nodev /sys/kernel/debug\n\n" +"# cat /sys/kernel/debug/tracing/available_tracers\n" "wakeup preemptirqsoff preemptoff irqsoff function sched_switch nop\n\n" -"# cat /debug/tracing/current_tracer\n" +"# cat /sys/kernel/debug/tracing/current_tracer\n" "nop\n" -"# echo sched_switch > /debug/tracing/current_tracer\n" -"# cat /debug/tracing/current_tracer\n" +"# echo sched_switch > /sys/kernel/debug/tracing/current_tracer\n" +"# cat /sys/kernel/debug/tracing/current_tracer\n" "sched_switch\n" -"# cat /debug/tracing/trace_options\n" +"# cat /sys/kernel/debug/tracing/trace_options\n" "noprint-parent nosym-offset nosym-addr noverbose\n" -"# echo print-parent > /debug/tracing/trace_options\n" -"# echo 1 > /debug/tracing/tracing_enabled\n" -"# cat /debug/tracing/trace > /tmp/trace.txt\n" -"# echo 0 > /debug/tracing/tracing_enabled\n" +"# echo print-parent > /sys/kernel/debug/tracing/trace_options\n" +"# echo 1 > /sys/kernel/debug/tracing/tracing_enabled\n" +"# cat /sys/kernel/debug/tracing/trace > /tmp/trace.txt\n" +"# echo 0 > /sys/kernel/debug/tracing/tracing_enabled\n" ; static ssize_t
scripts/tracing/draw_functrace.py +4 -4
@@ -12,10 +12,10 @@ calls. Only the functions's names and the the call time are provided. Usage: Be sure that you have CONFIG_FUNCTION_TRACER - # mkdir /debugfs - # mount -t debug debug /debug - # echo function > /debug/tracing/current_tracer - $ cat /debug/tracing/trace_pipe > ~/raw_trace_func + # mkdir /sys/kernel/debug + # mount -t debug debug /sys/kernel/debug + # echo function > /sys/kernel/debug/tracing/current_tracer + $ cat /sys/kernel/debug/tracing/trace_pipe > ~/raw_trace_func Wait some times but not too much, the script is a bit slow. Break the pipe (Ctrl + Z) $ scripts/draw_functrace.py < raw_trace_func > draw_functrace
Signature · 16 lines
1.6.3.1 ----------------------------------------------- To unsubscribe from this list: send the line "unsubscribe linux-***" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ GeunSik Lim ( S A M S U N G E L E C T R O N I C S ) e-Mail :1) [email protected] 2) [email protected] , [email protected] HomePage: http://blog.naver.com/invain/ -----------------------------------------------
PATCH 1/1 debugfs:Fix terminology inconsistency of dir name to mount debugfs filesystem.
Dear Greg and Steven,
This is debugfs's mount directory related patch files. Please, merge my patch. Any Comment?
I read ./linux-2.6.git/MAINTAINERS file to submit debugfs related this patch file. But, I don't know a maintainer about this patch exactly.
Um... If I mistake, Please, correct me.
Thanks,
Subject: [PATCH V1] Fix terminology inconsistency of dir name to mount debugfs filesystem.
Many developers use "/debug/" or "/debugfs/" or "/sys/kernel/debug/" directory name to mount debugfs filesystem for ftrace according to ./Documentation/tracers/ftrace.txt file.
And, three directory names(ex:/debug/, /debugfs/, /sys/kernel/debug/) is existed in kernel source like ftrace, DRM, Wireless, Documentation, Network[sky2]files to mount debugfs filesystem.
debugfs means debug filesystem for debugging easy to use by greg kroah hartman. "/sys/kernel/debug/" name is suitable as directory name of debugfs filesystem.
- debugfs related reference: http://lwn.net/Articles/334546/
Fix inconsistency of directory name to mount debugfs filesystem.
* From Steven Rostedt
- find_debugfs() and tracing_files() in this patch.
--- Documentation/DocBook/debugobjects.tmpl | 2 +- Documentation/cdrom/packet-writing.txt | 2 +- Documentation/fault-injection/fault-injection.txt | 70 +++--- Documentation/kprobes.txt | 6 +- Documentation/trace/ftrace.txt | 233 +++++++++++++-------- Documentation/trace/mmiotrace.txt | 26 ++-- drivers/block/pktcdvd.c | 2 +- drivers/gpu/drm/drm_debugfs.c | 12 +- drivers/gpu/drm/drm_drv.c | 2 +- drivers/gpu/drm/drm_stub.c | 2 +- drivers/net/Kconfig | 4 +- drivers/net/wimax/i2400m/i2400m.h | 2 +- drivers/net/wireless/ath5k/Kconfig | 6 +- drivers/net/wireless/libertas/README | 12 +- drivers/scsi/lpfc/lpfc_debugfs.c | 4 +- include/linux/kernel.h | 2 +- include/linux/tracepoint.h | 4 +- kernel/trace/Kconfig | 10 +- kernel/trace/trace.c | 24 +- scripts/tracing/draw_functrace.py | 8 +- 20 files changed, 242 insertions(+), 191 deletions(-)
Documentation/DocBook/debugobjects.tmpl +1 -1
@@ -106,7 +106,7 @@ number of errors are printk'ed including a full stack trace. </para> <para> - The statistics are available via debugfs/debug_objects/stats. + The statistics are available via /sys/kernel/debug/debug_objects/stats. They provide information about the number of warnings and the number of successful fixups along with information about the usage of the internal tracking objects and the state of the
Documentation/cdrom/packet-writing.txt +1 -1
@@ -117,7 +117,7 @@ Using the pktcdvd debugfs interface To read pktcdvd device infos in human readable form, do: - # cat /debug/pktcdvd/pktcdvd[0-7]/info + # cat /sys/kernel/debug/pktcdvd/pktcdvd[0-7]/info For a description of the debugfs interface look into the file:
Documentation/fault-injection/fault-injection.txt +35 -35
145 lines not on this page · raw message
Documentation/kprobes.txt +3 -3
@@ -507,9 +507,9 @@ http://www.linuxsymposium.org/2006/linuxsymposium_procv2.pdf (pages 101-115) Appendix A: The kprobes debugfs interface With recent kernels (> 2.6.20) the list of registered kprobes is visible -under the /debug/kprobes/ directory (assuming debugfs is mounted at /debug). +under the /sys/kernel/debug/kprobes/ directory (assuming debugfs is mounted at //sys/kernel/debug). -/debug/kprobes/list: Lists all registered probes on the system +/sys/kernel/debug/kprobes/list: Lists all registered probes on the system c015d71a k vfs_read+0x0 c011a316 j do_fork+0x0
@@ -525,7 +525,7 @@ virtual addresses that correspond to modules that've been unloaded), such probes are marked with [GONE]. If the probe is temporarily disabled, such probes are marked with [DISABLED]. -/debug/kprobes/enabled: Turn kprobes ON/OFF forcibly. +/sys/kernel/debug/kprobes/enabled: Turn kprobes ON/OFF forcibly. Provides a knob to globally and forcibly turn registered kprobes ON or OFF. By default, all kprobes are enabled. By echoing "0" to this file, all
Documentation/trace/ftrace.txt +142 -91
452 lines not on this page · raw message
Documentation/trace/mmiotrace.txt +13 -13
@@ -32,41 +32,41 @@ is no way to automatically detect if you are losing events due to CPUs racing. Usage Quick Reference --------------------- -$ mount -t debugfs debugfs /debug -$ echo mmiotrace > /debug/tracing/current_tracer -$ cat /debug/tracing/trace_pipe > mydump.txt & +$ mount -t debugfs debugfs /sys/kernel/debug +$ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer +$ cat /sys/kernel/debug/tracing/trace_pipe > mydump.txt & Start X or whatever. -$ echo "X is up" > /debug/tracing/trace_marker -$ echo nop > /debug/tracing/current_tracer +$ echo "X is up" > /sys/kernel/debug/tracing/trace_marker +$ echo nop > /sys/kernel/debug/tracing/current_tracer Check for lost events. Usage ----- -Make sure debugfs is mounted to /debug. If not, (requires root privileges) -$ mount -t debugfs debugfs /debug +Make sure debugfs is mounted to /sys/kernel/debug. If not, (requires root privileges) +$ mount -t debugfs debugfs /sys/kernel/debug Check that the driver you are about to trace is not loaded. Activate mmiotrace (requires root privileges): -$ echo mmiotrace > /debug/tracing/current_tracer +$ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer Start storing the trace: -$ cat /debug/tracing/trace_pipe > mydump.txt & +$ cat /sys/kernel/debug/tracing/trace_pipe > mydump.txt & The 'cat' process should stay running (sleeping) in the background. Load the driver you want to trace and use it. Mmiotrace will only catch MMIO accesses to areas that are ioremapped while mmiotrace is active. During tracing you can place comments (markers) into the trace by -$ echo "X is up" > /debug/tracing/trace_marker +$ echo "X is up" > /sys/kernel/debug/tracing/trace_marker This makes it easier to see which part of the (huge) trace corresponds to which action. It is recommended to place descriptive markers about what you do. Shut down mmiotrace (requires root privileges): -$ echo nop > /debug/tracing/current_tracer +$ echo nop > /sys/kernel/debug/tracing/current_tracer The 'cat' process exits. If it does not, kill it by issuing 'fg' command and pressing ctrl+c.
@@ -78,10 +78,10 @@ to view your kernel log and look for "mmiotrace has lost events" warning. If events were lost, the trace is incomplete. You should enlarge the buffers and try again. Buffers are enlarged by first seeing how large the current buffers are: -$ cat /debug/tracing/buffer_size_kb +$ cat /sys/kernel/debug/tracing/buffer_size_kb gives you a number. Approximately double this number and write it back, for instance: -$ echo 128000 > /debug/tracing/buffer_size_kb +$ echo 128000 > /sys/kernel/debug/tracing/buffer_size_kb Then start again from the top. If you are doing a trace for a driver project, e.g. Nouveau, you should also
drivers/block/pktcdvd.c +1 -1
@@ -430,7 +430,7 @@ static void pkt_sysfs_cleanup(void)/******************************************************************** entries in debugfs -/debugfs/pktcdvd[0-7]/ +/sys/kernel/debug/pktcdvd[0-7]/ info *******************************************************************/
drivers/gpu/drm/drm_debugfs.c +6 -6
@@ -105,7 +105,7 @@ int drm_debugfs_create_files(struct drm_info_list *files, int count, ent =debugfs_create_file (files[i].name,S_IFREG |S_IRUGO , root, tmp, &drm_debugfs_fops);if (!ent) { -DRM_ERROR ("Cannot create /debugfs/dri/%s/%s\n" , +DRM_ERROR ("Cannot create /sys/kernel/debug/dri/%s/%s\n" , name, files[i].name);drm_free (tmp,sizeof (struct drm_info_node ), _DRM_DRIVER);
@@ -133,9 +133,9 @@ EXPORT_SYMBOL(drm_debugfs_create_files);* \param minor device minor number * \param root DRI debugfs dir entry. * -* Create the DRI debugfs root entry "/debugfs/dri", the device debugfs root entry -* "/debugfs/dri/%minor%/", and each entry in debugfs_list as -* "/debugfs/dri/%minor%/%name%". +* Create the DRI debugfs root entry "/sys/kernel/debug/dri", the device debugfs root entry +* "/sys/kernel/debug/dri/%minor%/", and each entry in debugfs_list as +* "/sys/kernel/debug/dri/%minor%/%name%". */ int drm_debugfs_init (struct drm_minor *minor,int minor_id,struct dentry *root)
@@ -148,7 +148,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,sprintf (name,"%d" , minor_id); minor->debugfs_root =debugfs_create_dir (name, root);if (!minor->debugfs_root) { -DRM_ERROR ("Cannot create /debugfs/dri/%s\n" , name); +DRM_ERROR ("Cannot create /sys/kernel/debug/dri/%s\n" , name);return -1 ; }
@@ -165,7 +165,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, ret = dev->driver->debugfs_init (minor);if (ret) {DRM_ERROR ("DRM: Driver failed to initialize " -"/debugfs/dri.\n" ); +"/sys/kernel/debug/dri.\n" );return ret; } }
drivers/gpu/drm/drm_drv.c +1 -1
@@ -339,7 +339,7 @@ static int __init drm_core_init(void) drm_debugfs_root =debugfs_create_dir ("dri" ,NULL );if (!drm_debugfs_root) { -DRM_ERROR ("Cannot create /debugfs/dri\n" ); +DRM_ERROR ("Cannot create /sys/kernel/debug/dri\n" ); ret =-1 ; goto err_p3; }
drivers/gpu/drm/drm_stub.c +1 -1
@@ -328,7 +328,7 @@ static int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int t#if defined(CONFIG_DEBUG_FS ) ret =drm_debugfs_init (new_minor, minor_id, drm_debugfs_root);if (ret) { -DRM_ERROR ("DRM: Failed to initialize /debugfs/dri.\n" ); +DRM_ERROR ("DRM: Failed to initialize /sys/kernel/debug/dri.\n" ); goto err_g2; }#endif
drivers/net/Kconfig +2 -2
@@ -2200,7 +2200,7 @@ config SKGE_DEBUG depends on SKGE && DEBUG_FS help This option adds the ability to dump driver state for debugging. - The file debugfs/skge/ethX displays the state of the internal + The file /sys/kernel/debug/skge/ethX displays the state of the internal transmit and receive rings. If unsure, say N.
@@ -2226,7 +2226,7 @@ config SKY2_DEBUG depends on SKY2 && DEBUG_FS help This option adds the ability to dump driver state for debugging. - The file debugfs/sky2/ethX displays the state of the internal + The file /sys/kernel/debug/sky2/ethX displays the state of the internal transmit and receive rings. If unsure, say N.
drivers/net/wimax/i2400m/i2400m.h +1 -1
@@ -389,7 +389,7 @@ struct i2400m { unsigned ready:1; /* all probing steps done */ unsigned rx_reorder:1; /* RX reorder is enabled */u8 trace_msg_from_user;/* echo rx msgs to 'trace' pipe */ -/* typed u8 so debugfs/u8 can tweak */ +/* typed u8 so /sys/kernel/debug/u8 can tweak */ enum i2400m_system_state state;wait_queue_head_t state_wq;/* Woken up when on state updates */
drivers/net/wireless/ath5k/Kconfig +3 -3
@@ -27,11 +27,11 @@ config ATH5K_DEBUG Say Y, if and you will get debug options for ath5k. To use this, you need to mount debugfs: - mkdir /debug/ - mount -t debugfs debug /debug/ + mkdir /sys/kernel/debug/ + mount -t debugfs debug /sys/kernel/debug/ You will get access to files under: - /debug/ath5k/phy0/ + /sys/kernel/debug/ath5k/phy0/ To enable debug, pass the debug level to the debug module parameter. For example:
drivers/net/wireless/libertas/README +6 -6
@@ -72,7 +72,7 @@ rdrf location that is to be read. This parameter must be specified in hexadecimal (its possible to preceed preceding the number with a "0x"). - Path: /debugfs/libertas_wireless/ethX/registers/ + Path: /sys/kernel/debug/libertas_wireless/ethX/registers/ Usage: echo "0xa123" > rdmac ; cat rdmac
@@ -95,7 +95,7 @@ wrrf sleepparams This command is used to set the sleepclock configurations - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: cat sleepparams: reads the current sleepclock configuration
@@ -115,7 +115,7 @@ subscribed_events The subscribed_events directory contains the interface for the subscribed events API. - Path: /debugfs/libertas_wireless/ethX/subscribed_events/ + Path: /sys/kernel/debug/libertas_wireless/ethX/subscribed_events/ Each event is represented by a filename. Each filename consists of the following three fields:
@@ -165,7 +165,7 @@ subscribed_events extscan This command is used to do a specific scan. - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: echo "SSID" > extscan
@@ -179,7 +179,7 @@ getscantable Display the current contents of the driver scan table (ie. get the scan results). - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: cat getscantable
@@ -188,7 +188,7 @@ setuserscan Initiate a customized scan and retrieve the results - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: echo "[ARGS]" > setuserscan
drivers/scsi/lpfc/lpfc_debugfs.c +2 -2
@@ -51,8 +51,8 @@* debugfs interface * * To access this interface the user should: -* # mkdir /debug -* # mount -t debugfs none /debug +* # mkdir /sys/kernel/debug +* # mount -t debugfs none /sys/kernel/debug * * The lpfc debugfs directory hierarchy is: * lpfc/lpfcX/vportY
include/linux/kernel.h +1 -1
@@ -406,7 +406,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte)* * Use tracing_on/tracing_off when you want to quickly turn on or off * tracing. It simply enables or disables the recording of the trace events. -* This also corresponds to the user space debugfs/tracing/tracing_on +* This also corresponds to the user space /sys/kernel/debug/tracing/tracing_on * file, which gives a means for the kernel and userspace to interact. * Place a tracing_off() in the kernel where you want tracing to end. * From user space, examine the trace, and then echo 1 > tracing_on
include/linux/tracepoint.h +2 -2
@@ -197,7 +197,7 @@ static inline void tracepoint_synchronize_unregister(void)* * This is how the trace record is structured and will * * be saved into the ring buffer. These are the fields * * that will be exposed to user-space in -* * /debug/tracing/events/<*>/format. +* * /sys/kernel/debug/tracing/events/<*>/format. * * * * The declared 'local variable' is called '__entry' * *
@@ -257,7 +257,7 @@ static inline void tracepoint_synchronize_unregister(void)* tracepoint callback (this is used by programmatic plugins and * can also by used by generic instrumentation like SystemTap), and * it is also used to expose a structured trace record in -* /debug/tracing/events/. +* /sys/kernel/debug/tracing/events/. */ #define TRACE_EVENT (name, proto, args, struct, assign, print) \
kernel/trace/Kconfig +5 -5
@@ -120,7 +120,7 @@ config IRQSOFF_TRACER disabled by default and can be runtime (re-)started via: - echo 0 > /debugfs/tracing/tracing_max_latency + echo 0 > /sys/kernel/debug/tracing/tracing_max_latency (Note that kernel size and overhead increases with this option enabled. This option and the preempt-off timing option can be
@@ -141,7 +141,7 @@ config PREEMPT_TRACER disabled by default and can be runtime (re-)started via: - echo 0 > /debugfs/tracing/tracing_max_latency + echo 0 > /sys/kernel/debug/tracing/tracing_max_latency (Note that kernel size and overhead increases with this option enabled. This option and the irqs-off timing option can be
@@ -213,7 +213,7 @@ config TRACE_BRANCH_PROFILING This tracer profiles all the the likely and unlikely macros in the kernel. It will display the results in: - /debugfs/tracing/profile_annotated_branch + /sys/kernel/debug/tracing/profile_annotated_branch Note: this will add a significant overhead, only turn this on if you need to profile the system's use of these macros.
@@ -228,7 +228,7 @@ config PROFILE_ALL_BRANCHES taken in the kernel is recorded whether it hit or miss. The results will be displayed in: - /debugfs/tracing/profile_branch + /sys/kernel/debug/tracing/profile_branch This configuration, when enabled, will impose a great overhead on the system. This should only be enabled when the system
@@ -276,7 +276,7 @@ config STACK_TRACER select KALLSYMS help This special tracer records the maximum stack footprint of the - kernel and displays it in debugfs/tracing/stack_trace. + kernel and displays it in /sys/kernel/debug/tracing/stack_trace. This tracer works by hooking into every function call that the kernel executes, and keeping a maximum stack depth value and
kernel/trace/trace.c +12 -12
@@ -335,7 +335,7 @@ static raw_spinlock_t ftrace_max_lock =/* * Copy the new maximum trace into the separate maximum-trace * structure. (this way the maximum trace is permanently saved, -* for later retrieval via /debugfs/tracing/latency_trace) +* for later retrieval via /sys/kernel/debug/tracing/latency_trace) */ static void __update_max_tr (struct trace_array *tr,struct task_struct *tsk,int cpu)
@@ -2366,21 +2366,21 @@ static const struct file_operations tracing_iter_fops = {static const char readme_msg[] ="tracing mini-HOWTO:\n\n" -"# mkdir /debug\n" -"# mount -t debugfs nodev /debug\n\n" -"# cat /debug/tracing/available_tracers\n" +"# mkdir /sys/kernel/debug\n" +"# mount -t debugfs nodev /sys/kernel/debug\n\n" +"# cat /sys/kernel/debug/tracing/available_tracers\n" "wakeup preemptirqsoff preemptoff irqsoff function sched_switch nop\n\n" -"# cat /debug/tracing/current_tracer\n" +"# cat /sys/kernel/debug/tracing/current_tracer\n" "nop\n" -"# echo sched_switch > /debug/tracing/current_tracer\n" -"# cat /debug/tracing/current_tracer\n" +"# echo sched_switch > /sys/kernel/debug/tracing/current_tracer\n" +"# cat /sys/kernel/debug/tracing/current_tracer\n" "sched_switch\n" -"# cat /debug/tracing/trace_options\n" +"# cat /sys/kernel/debug/tracing/trace_options\n" "noprint-parent nosym-offset nosym-addr noverbose\n" -"# echo print-parent > /debug/tracing/trace_options\n" -"# echo 1 > /debug/tracing/tracing_enabled\n" -"# cat /debug/tracing/trace > /tmp/trace.txt\n" -"# echo 0 > /debug/tracing/tracing_enabled\n" +"# echo print-parent > /sys/kernel/debug/tracing/trace_options\n" +"# echo 1 > /sys/kernel/debug/tracing/tracing_enabled\n" +"# cat /sys/kernel/debug/tracing/trace > /tmp/trace.txt\n" +"# echo 0 > /sys/kernel/debug/tracing/tracing_enabled\n" ; static ssize_t
scripts/tracing/draw_functrace.py +4 -4
@@ -12,10 +12,10 @@ calls. Only the functions's names and the the call time are provided. Usage: Be sure that you have CONFIG_FUNCTION_TRACER - # mkdir /debugfs - # mount -t debug debug /debug - # echo function > /debug/tracing/current_tracer - $ cat /debug/tracing/trace_pipe > ~/raw_trace_func + # mkdir /sys/kernel/debug + # mount -t debug debug /sys/kernel/debug + # echo function > /sys/kernel/debug/tracing/current_tracer + $ cat /sys/kernel/debug/tracing/trace_pipe > ~/raw_trace_func Wait some times but not too much, the script is a bit slow. Break the pipe (Ctrl + Z) $ scripts/draw_functrace.py < raw_trace_func > draw_functrace
Signature · 16 lines
1.6.3.1 ----------------------------------------------- To unsubscribe from this list: send the line "unsubscribe linux-***" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ GeunSik Lim ( Samsung Electronics ) e-Mail :1) [email protected] 2) [email protected] , [email protected] HomePage: http://blog.naver.com/invain/ -----------------------------------------------