aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/trace
diff options
context:
space:
mode:
authorGeunSik Lim <leemgs1@gmail.com>2009-06-02 02:01:37 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-06-16 00:30:28 -0400
commit156f5a7801195fa2ce44aeeb62d6cf8468f3332a (patch)
treedd506816ca6f14bb650189aa364eb0a2f51ad5cc /Documentation/trace
parent1b713e00500c6f03317742981674e89a21629399 (diff)
debugfs: 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. Signed-off-by: GeunSik Lim <geunsik.lim@samsung.com> Acked-by : Inaky Perez-Gonzalez <inaky@linux.intel.com> Reviewed-by : Steven Rostedt <rostedt@goodmis.org> Reviewed-by : James Smart <james.smart@emulex.com> CC: Jiri Kosina <trivial@kernel.org> CC: David Airlie <airlied@linux.ie> CC: Peter Osterlund <petero2@telia.com> CC: Ananth N Mavinakayanahalli <ananth@in.ibm.com> CC: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> CC: Masami Hiramatsu <mhiramat@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'Documentation/trace')
-rw-r--r--Documentation/trace/ftrace.txt233
-rw-r--r--Documentation/trace/mmiotrace.txt26
2 files changed, 155 insertions, 104 deletions
diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt
index 7bd27f0e2880..a39b3c749de5 100644
--- a/Documentation/trace/ftrace.txt
+++ b/Documentation/trace/ftrace.txt
@@ -7,7 +7,6 @@ Copyright 2008 Red Hat Inc.
7 (dual licensed under the GPL v2) 7 (dual licensed under the GPL v2)
8Reviewers: Elias Oltmanns, Randy Dunlap, Andrew Morton, 8Reviewers: Elias Oltmanns, Randy Dunlap, Andrew Morton,
9 John Kacur, and David Teigland. 9 John Kacur, and David Teigland.
10
11Written for: 2.6.28-rc2 10Written for: 2.6.28-rc2
12 11
13Introduction 12Introduction
@@ -33,13 +32,26 @@ The File System
33Ftrace uses the debugfs file system to hold the control files as 32Ftrace uses the debugfs file system to hold the control files as
34well as the files to display output. 33well as the files to display output.
35 34
36To mount the debugfs system: 35When debugfs is configured into the kernel (which selecting any ftrace
36option will do) the directory /sys/kernel/debug will be created. To mount
37this directory, you can add to your /etc/fstab file:
38
39 debugfs /sys/kernel/debug debugfs defaults 0 0
40
41Or you can mount it at run time with:
42
43 mount -t debugfs nodev /sys/kernel/debug
37 44
38 # mkdir /debug 45For quicker access to that directory you may want to make a soft link to
39 # mount -t debugfs nodev /debug 46it:
40 47
41( Note: it is more common to mount at /sys/kernel/debug, but for 48 ln -s /sys/kernel/debug /debug
42 simplicity this document will use /debug) 49
50Any selected ftrace option will also create a directory called tracing
51within the debugfs. The rest of the document will assume that you are in
52the ftrace directory (cd /sys/kernel/debug/tracing) and will only concentrate
53on the files within that directory and not distract from the content with
54the extended "/sys/kernel/debug/tracing" path name.
43 55
44That's it! (assuming that you have ftrace configured into your kernel) 56That's it! (assuming that you have ftrace configured into your kernel)
45 57
@@ -389,18 +401,18 @@ trace_options
389The trace_options file is used to control what gets printed in 401The trace_options file is used to control what gets printed in
390the trace output. To see what is available, simply cat the file: 402the trace output. To see what is available, simply cat the file:
391 403
392 cat /debug/tracing/trace_options 404 cat trace_options
393 print-parent nosym-offset nosym-addr noverbose noraw nohex nobin \ 405 print-parent nosym-offset nosym-addr noverbose noraw nohex nobin \
394 noblock nostacktrace nosched-tree nouserstacktrace nosym-userobj 406 noblock nostacktrace nosched-tree nouserstacktrace nosym-userobj
395 407
396To disable one of the options, echo in the option prepended with 408To disable one of the options, echo in the option prepended with
397"no". 409"no".
398 410
399 echo noprint-parent > /debug/tracing/trace_options 411 echo noprint-parent > trace_options
400 412
401To enable an option, leave off the "no". 413To enable an option, leave off the "no".
402 414
403 echo sym-offset > /debug/tracing/trace_options 415 echo sym-offset > trace_options
404 416
405Here are the available options: 417Here are the available options:
406 418
@@ -476,11 +488,11 @@ sched_switch
476This tracer simply records schedule switches. Here is an example 488This tracer simply records schedule switches. Here is an example
477of how to use it. 489of how to use it.
478 490
479 # echo sched_switch > /debug/tracing/current_tracer 491 # echo sched_switch > current_tracer
480 # echo 1 > /debug/tracing/tracing_enabled 492 # echo 1 > tracing_enabled
481 # sleep 1 493 # sleep 1
482 # echo 0 > /debug/tracing/tracing_enabled 494 # echo 0 > tracing_enabled
483 # cat /debug/tracing/trace 495 # cat trace
484 496
485# tracer: sched_switch 497# tracer: sched_switch
486# 498#
@@ -583,13 +595,13 @@ new trace is saved.
583To reset the maximum, echo 0 into tracing_max_latency. Here is 595To reset the maximum, echo 0 into tracing_max_latency. Here is
584an example: 596an example:
585 597
586 # echo irqsoff > /debug/tracing/current_tracer 598 # echo irqsoff > current_tracer
587 # echo 0 > /debug/tracing/tracing_max_latency 599 # echo 0 > tracing_max_latency
588 # echo 1 > /debug/tracing/tracing_enabled 600 # echo 1 > tracing_enabled
589 # ls -ltr 601 # ls -ltr
590 [...] 602 [...]
591 # echo 0 > /debug/tracing/tracing_enabled 603 # echo 0 > tracing_enabled
592 # cat /debug/tracing/latency_trace 604 # cat latency_trace
593# tracer: irqsoff 605# tracer: irqsoff
594# 606#
595irqsoff latency trace v1.1.5 on 2.6.26 607irqsoff latency trace v1.1.5 on 2.6.26
@@ -690,13 +702,13 @@ Like the irqsoff tracer, it records the maximum latency for
690which preemption was disabled. The control of preemptoff tracer 702which preemption was disabled. The control of preemptoff tracer
691is much like the irqsoff tracer. 703is much like the irqsoff tracer.
692 704
693 # echo preemptoff > /debug/tracing/current_tracer 705 # echo preemptoff > current_tracer
694 # echo 0 > /debug/tracing/tracing_max_latency 706 # echo 0 > tracing_max_latency
695 # echo 1 > /debug/tracing/tracing_enabled 707 # echo 1 > tracing_enabled
696 # ls -ltr 708 # ls -ltr
697 [...] 709 [...]
698 # echo 0 > /debug/tracing/tracing_enabled 710 # echo 0 > tracing_enabled
699 # cat /debug/tracing/latency_trace 711 # cat latency_trace
700# tracer: preemptoff 712# tracer: preemptoff
701# 713#
702preemptoff latency trace v1.1.5 on 2.6.26-rc8 714preemptoff latency trace v1.1.5 on 2.6.26-rc8
@@ -837,13 +849,13 @@ tracer.
837Again, using this trace is much like the irqsoff and preemptoff 849Again, using this trace is much like the irqsoff and preemptoff
838tracers. 850tracers.
839 851
840 # echo preemptirqsoff > /debug/tracing/current_tracer 852 # echo preemptirqsoff > current_tracer
841 # echo 0 > /debug/tracing/tracing_max_latency 853 # echo 0 > tracing_max_latency
842 # echo 1 > /debug/tracing/tracing_enabled 854 # echo 1 > tracing_enabled
843 # ls -ltr 855 # ls -ltr
844 [...] 856 [...]
845 # echo 0 > /debug/tracing/tracing_enabled 857 # echo 0 > tracing_enabled
846 # cat /debug/tracing/latency_trace 858 # cat latency_trace
847# tracer: preemptirqsoff 859# tracer: preemptirqsoff
848# 860#
849preemptirqsoff latency trace v1.1.5 on 2.6.26-rc8 861preemptirqsoff latency trace v1.1.5 on 2.6.26-rc8
@@ -999,12 +1011,12 @@ slightly differently than we did with the previous tracers.
999Instead of performing an 'ls', we will run 'sleep 1' under 1011Instead of performing an 'ls', we will run 'sleep 1' under
1000'chrt' which changes the priority of the task. 1012'chrt' which changes the priority of the task.
1001 1013
1002 # echo wakeup > /debug/tracing/current_tracer 1014 # echo wakeup > current_tracer
1003 # echo 0 > /debug/tracing/tracing_max_latency 1015 # echo 0 > tracing_max_latency
1004 # echo 1 > /debug/tracing/tracing_enabled 1016 # echo 1 > tracing_enabled
1005 # chrt -f 5 sleep 1 1017 # chrt -f 5 sleep 1
1006 # echo 0 > /debug/tracing/tracing_enabled 1018 # echo 0 > tracing_enabled
1007 # cat /debug/tracing/latency_trace 1019 # cat latency_trace
1008# tracer: wakeup 1020# tracer: wakeup
1009# 1021#
1010wakeup latency trace v1.1.5 on 2.6.26-rc8 1022wakeup latency trace v1.1.5 on 2.6.26-rc8
@@ -1114,11 +1126,11 @@ can be done from the debug file system. Make sure the
1114ftrace_enabled is set; otherwise this tracer is a nop. 1126ftrace_enabled is set; otherwise this tracer is a nop.
1115 1127
1116 # sysctl kernel.ftrace_enabled=1 1128 # sysctl kernel.ftrace_enabled=1
1117 # echo function > /debug/tracing/current_tracer 1129 # echo function > current_tracer
1118 # echo 1 > /debug/tracing/tracing_enabled 1130 # echo 1 > tracing_enabled
1119 # usleep 1 1131 # usleep 1
1120 # echo 0 > /debug/tracing/tracing_enabled 1132 # echo 0 > tracing_enabled
1121 # cat /debug/tracing/trace 1133 # cat trace
1122# tracer: function 1134# tracer: function
1123# 1135#
1124# TASK-PID CPU# TIMESTAMP FUNCTION 1136# TASK-PID CPU# TIMESTAMP FUNCTION
@@ -1155,7 +1167,7 @@ int trace_fd;
1155[...] 1167[...]
1156int main(int argc, char *argv[]) { 1168int main(int argc, char *argv[]) {
1157 [...] 1169 [...]
1158 trace_fd = open("/debug/tracing/tracing_enabled", O_WRONLY); 1170 trace_fd = open(tracing_file("tracing_enabled"), O_WRONLY);
1159 [...] 1171 [...]
1160 if (condition_hit()) { 1172 if (condition_hit()) {
1161 write(trace_fd, "0", 1); 1173 write(trace_fd, "0", 1);
@@ -1163,26 +1175,20 @@ int main(int argc, char *argv[]) {
1163 [...] 1175 [...]
1164} 1176}
1165 1177
1166Note: Here we hard coded the path name. The debugfs mount is not
1167guaranteed to be at /debug (and is more commonly at
1168/sys/kernel/debug). For simple one time traces, the above is
1169sufficent. For anything else, a search through /proc/mounts may
1170be needed to find where the debugfs file-system is mounted.
1171
1172 1178
1173Single thread tracing 1179Single thread tracing
1174--------------------- 1180---------------------
1175 1181
1176By writing into /debug/tracing/set_ftrace_pid you can trace a 1182By writing into set_ftrace_pid you can trace a
1177single thread. For example: 1183single thread. For example:
1178 1184
1179# cat /debug/tracing/set_ftrace_pid 1185# cat set_ftrace_pid
1180no pid 1186no pid
1181# echo 3111 > /debug/tracing/set_ftrace_pid 1187# echo 3111 > set_ftrace_pid
1182# cat /debug/tracing/set_ftrace_pid 1188# cat set_ftrace_pid
11833111 11893111
1184# echo function > /debug/tracing/current_tracer 1190# echo function > current_tracer
1185# cat /debug/tracing/trace | head 1191# cat trace | head
1186 # tracer: function 1192 # tracer: function
1187 # 1193 #
1188 # TASK-PID CPU# TIMESTAMP FUNCTION 1194 # TASK-PID CPU# TIMESTAMP FUNCTION
@@ -1193,8 +1199,8 @@ no pid
1193 yum-updatesd-3111 [003] 1637.254683: lock_hrtimer_base <-hrtimer_try_to_cancel 1199 yum-updatesd-3111 [003] 1637.254683: lock_hrtimer_base <-hrtimer_try_to_cancel
1194 yum-updatesd-3111 [003] 1637.254685: fget_light <-do_sys_poll 1200 yum-updatesd-3111 [003] 1637.254685: fget_light <-do_sys_poll
1195 yum-updatesd-3111 [003] 1637.254686: pipe_poll <-do_sys_poll 1201 yum-updatesd-3111 [003] 1637.254686: pipe_poll <-do_sys_poll
1196# echo -1 > /debug/tracing/set_ftrace_pid 1202# echo -1 > set_ftrace_pid
1197# cat /debug/tracing/trace |head 1203# cat trace |head
1198 # tracer: function 1204 # tracer: function
1199 # 1205 #
1200 # TASK-PID CPU# TIMESTAMP FUNCTION 1206 # TASK-PID CPU# TIMESTAMP FUNCTION
@@ -1216,6 +1222,51 @@ something like this simple program:
1216#include <fcntl.h> 1222#include <fcntl.h>
1217#include <unistd.h> 1223#include <unistd.h>
1218 1224
1225#define _STR(x) #x
1226#define STR(x) _STR(x)
1227#define MAX_PATH 256
1228
1229const char *find_debugfs(void)
1230{
1231 static char debugfs[MAX_PATH+1];
1232 static int debugfs_found;
1233 char type[100];
1234 FILE *fp;
1235
1236 if (debugfs_found)
1237 return debugfs;
1238
1239 if ((fp = fopen("/proc/mounts","r")) == NULL) {
1240 perror("/proc/mounts");
1241 return NULL;
1242 }
1243
1244 while (fscanf(fp, "%*s %"
1245 STR(MAX_PATH)
1246 "s %99s %*s %*d %*d\n",
1247 debugfs, type) == 2) {
1248 if (strcmp(type, "debugfs") == 0)
1249 break;
1250 }
1251 fclose(fp);
1252
1253 if (strcmp(type, "debugfs") != 0) {
1254 fprintf(stderr, "debugfs not mounted");
1255 return NULL;
1256 }
1257
1258 debugfs_found = 1;
1259
1260 return debugfs;
1261}
1262
1263const char *tracing_file(const char *file_name)
1264{
1265 static char trace_file[MAX_PATH+1];
1266 snprintf(trace_file, MAX_PATH, "%s/%s", find_debugfs(), file_name);
1267 return trace_file;
1268}
1269
1219int main (int argc, char **argv) 1270int main (int argc, char **argv)
1220{ 1271{
1221 if (argc < 1) 1272 if (argc < 1)
@@ -1226,12 +1277,12 @@ int main (int argc, char **argv)
1226 char line[64]; 1277 char line[64];
1227 int s; 1278 int s;
1228 1279
1229 ffd = open("/debug/tracing/current_tracer", O_WRONLY); 1280 ffd = open(tracing_file("current_tracer"), O_WRONLY);
1230 if (ffd < 0) 1281 if (ffd < 0)
1231 exit(-1); 1282 exit(-1);
1232 write(ffd, "nop", 3); 1283 write(ffd, "nop", 3);
1233 1284
1234 fd = open("/debug/tracing/set_ftrace_pid", O_WRONLY); 1285 fd = open(tracing_file("set_ftrace_pid"), O_WRONLY);
1235 s = sprintf(line, "%d\n", getpid()); 1286 s = sprintf(line, "%d\n", getpid());
1236 write(fd, line, s); 1287 write(fd, line, s);
1237 1288
@@ -1383,22 +1434,22 @@ want, depending on your needs.
1383 tracing_cpu_mask file) or you might sometimes see unordered 1434 tracing_cpu_mask file) or you might sometimes see unordered
1384 function calls while cpu tracing switch. 1435 function calls while cpu tracing switch.
1385 1436
1386 hide: echo nofuncgraph-cpu > /debug/tracing/trace_options 1437 hide: echo nofuncgraph-cpu > trace_options
1387 show: echo funcgraph-cpu > /debug/tracing/trace_options 1438 show: echo funcgraph-cpu > trace_options
1388 1439
1389- The duration (function's time of execution) is displayed on 1440- The duration (function's time of execution) is displayed on
1390 the closing bracket line of a function or on the same line 1441 the closing bracket line of a function or on the same line
1391 than the current function in case of a leaf one. It is default 1442 than the current function in case of a leaf one. It is default
1392 enabled. 1443 enabled.
1393 1444
1394 hide: echo nofuncgraph-duration > /debug/tracing/trace_options 1445 hide: echo nofuncgraph-duration > trace_options
1395 show: echo funcgraph-duration > /debug/tracing/trace_options 1446 show: echo funcgraph-duration > trace_options
1396 1447
1397- The overhead field precedes the duration field in case of 1448- The overhead field precedes the duration field in case of
1398 reached duration thresholds. 1449 reached duration thresholds.
1399 1450
1400 hide: echo nofuncgraph-overhead > /debug/tracing/trace_options 1451 hide: echo nofuncgraph-overhead > trace_options
1401 show: echo funcgraph-overhead > /debug/tracing/trace_options 1452 show: echo funcgraph-overhead > trace_options
1402 depends on: funcgraph-duration 1453 depends on: funcgraph-duration
1403 1454
1404 ie: 1455 ie:
@@ -1427,8 +1478,8 @@ want, depending on your needs.
1427- The task/pid field displays the thread cmdline and pid which 1478- The task/pid field displays the thread cmdline and pid which
1428 executed the function. It is default disabled. 1479 executed the function. It is default disabled.
1429 1480
1430 hide: echo nofuncgraph-proc > /debug/tracing/trace_options 1481 hide: echo nofuncgraph-proc > trace_options
1431 show: echo funcgraph-proc > /debug/tracing/trace_options 1482 show: echo funcgraph-proc > trace_options
1432 1483
1433 ie: 1484 ie:
1434 1485
@@ -1451,8 +1502,8 @@ want, depending on your needs.
1451 system clock since it started. A snapshot of this time is 1502 system clock since it started. A snapshot of this time is
1452 given on each entry/exit of functions 1503 given on each entry/exit of functions
1453 1504
1454 hide: echo nofuncgraph-abstime > /debug/tracing/trace_options 1505 hide: echo nofuncgraph-abstime > trace_options
1455 show: echo funcgraph-abstime > /debug/tracing/trace_options 1506 show: echo funcgraph-abstime > trace_options
1456 1507
1457 ie: 1508 ie:
1458 1509
@@ -1549,7 +1600,7 @@ listed in:
1549 1600
1550 available_filter_functions 1601 available_filter_functions
1551 1602
1552 # cat /debug/tracing/available_filter_functions 1603 # cat available_filter_functions
1553put_prev_task_idle 1604put_prev_task_idle
1554kmem_cache_create 1605kmem_cache_create
1555pick_next_task_rt 1606pick_next_task_rt
@@ -1561,12 +1612,12 @@ mutex_lock
1561If I am only interested in sys_nanosleep and hrtimer_interrupt: 1612If I am only interested in sys_nanosleep and hrtimer_interrupt:
1562 1613
1563 # echo sys_nanosleep hrtimer_interrupt \ 1614 # echo sys_nanosleep hrtimer_interrupt \
1564 > /debug/tracing/set_ftrace_filter 1615 > set_ftrace_filter
1565 # echo ftrace > /debug/tracing/current_tracer 1616 # echo ftrace > current_tracer
1566 # echo 1 > /debug/tracing/tracing_enabled 1617 # echo 1 > tracing_enabled
1567 # usleep 1 1618 # usleep 1
1568 # echo 0 > /debug/tracing/tracing_enabled 1619 # echo 0 > tracing_enabled
1569 # cat /debug/tracing/trace 1620 # cat trace
1570# tracer: ftrace 1621# tracer: ftrace
1571# 1622#
1572# TASK-PID CPU# TIMESTAMP FUNCTION 1623# TASK-PID CPU# TIMESTAMP FUNCTION
@@ -1577,7 +1628,7 @@ If I am only interested in sys_nanosleep and hrtimer_interrupt:
1577 1628
1578To see which functions are being traced, you can cat the file: 1629To see which functions are being traced, you can cat the file:
1579 1630
1580 # cat /debug/tracing/set_ftrace_filter 1631 # cat set_ftrace_filter
1581hrtimer_interrupt 1632hrtimer_interrupt
1582sys_nanosleep 1633sys_nanosleep
1583 1634
@@ -1597,7 +1648,7 @@ Note: It is better to use quotes to enclose the wild cards,
1597 otherwise the shell may expand the parameters into names 1648 otherwise the shell may expand the parameters into names
1598 of files in the local directory. 1649 of files in the local directory.
1599 1650
1600 # echo 'hrtimer_*' > /debug/tracing/set_ftrace_filter 1651 # echo 'hrtimer_*' > set_ftrace_filter
1601 1652
1602Produces: 1653Produces:
1603 1654
@@ -1618,7 +1669,7 @@ Produces:
1618 1669
1619Notice that we lost the sys_nanosleep. 1670Notice that we lost the sys_nanosleep.
1620 1671
1621 # cat /debug/tracing/set_ftrace_filter 1672 # cat set_ftrace_filter
1622hrtimer_run_queues 1673hrtimer_run_queues
1623hrtimer_run_pending 1674hrtimer_run_pending
1624hrtimer_init 1675hrtimer_init
@@ -1644,17 +1695,17 @@ To append to the filters, use '>>'
1644To clear out a filter so that all functions will be recorded 1695To clear out a filter so that all functions will be recorded
1645again: 1696again:
1646 1697
1647 # echo > /debug/tracing/set_ftrace_filter 1698 # echo > set_ftrace_filter
1648 # cat /debug/tracing/set_ftrace_filter 1699 # cat set_ftrace_filter
1649 # 1700 #
1650 1701
1651Again, now we want to append. 1702Again, now we want to append.
1652 1703
1653 # echo sys_nanosleep > /debug/tracing/set_ftrace_filter 1704 # echo sys_nanosleep > set_ftrace_filter
1654 # cat /debug/tracing/set_ftrace_filter 1705 # cat set_ftrace_filter
1655sys_nanosleep 1706sys_nanosleep
1656 # echo 'hrtimer_*' >> /debug/tracing/set_ftrace_filter 1707 # echo 'hrtimer_*' >> set_ftrace_filter
1657 # cat /debug/tracing/set_ftrace_filter 1708 # cat set_ftrace_filter
1658hrtimer_run_queues 1709hrtimer_run_queues
1659hrtimer_run_pending 1710hrtimer_run_pending
1660hrtimer_init 1711hrtimer_init
@@ -1677,7 +1728,7 @@ hrtimer_init_sleeper
1677The set_ftrace_notrace prevents those functions from being 1728The set_ftrace_notrace prevents those functions from being
1678traced. 1729traced.
1679 1730
1680 # echo '*preempt*' '*lock*' > /debug/tracing/set_ftrace_notrace 1731 # echo '*preempt*' '*lock*' > set_ftrace_notrace
1681 1732
1682Produces: 1733Produces:
1683 1734
@@ -1767,13 +1818,13 @@ the effect on the tracing is different. Every read from
1767trace_pipe is consumed. This means that subsequent reads will be 1818trace_pipe is consumed. This means that subsequent reads will be
1768different. The trace is live. 1819different. The trace is live.
1769 1820
1770 # echo function > /debug/tracing/current_tracer 1821 # echo function > current_tracer
1771 # cat /debug/tracing/trace_pipe > /tmp/trace.out & 1822 # cat trace_pipe > /tmp/trace.out &
1772[1] 4153 1823[1] 4153
1773 # echo 1 > /debug/tracing/tracing_enabled 1824 # echo 1 > tracing_enabled
1774 # usleep 1 1825 # usleep 1
1775 # echo 0 > /debug/tracing/tracing_enabled 1826 # echo 0 > tracing_enabled
1776 # cat /debug/tracing/trace 1827 # cat trace
1777# tracer: function 1828# tracer: function
1778# 1829#
1779# TASK-PID CPU# TIMESTAMP FUNCTION 1830# TASK-PID CPU# TIMESTAMP FUNCTION
@@ -1809,7 +1860,7 @@ number listed is the number of entries that can be recorded per
1809CPU. To know the full size, multiply the number of possible CPUS 1860CPU. To know the full size, multiply the number of possible CPUS
1810with the number of entries. 1861with the number of entries.
1811 1862
1812 # cat /debug/tracing/buffer_size_kb 1863 # cat buffer_size_kb
18131408 (units kilobytes) 18641408 (units kilobytes)
1814 1865
1815Note, to modify this, you must have tracing completely disabled. 1866Note, to modify this, you must have tracing completely disabled.
@@ -1817,18 +1868,18 @@ To do that, echo "nop" into the current_tracer. If the
1817current_tracer is not set to "nop", an EINVAL error will be 1868current_tracer is not set to "nop", an EINVAL error will be
1818returned. 1869returned.
1819 1870
1820 # echo nop > /debug/tracing/current_tracer 1871 # echo nop > current_tracer
1821 # echo 10000 > /debug/tracing/buffer_size_kb 1872 # echo 10000 > buffer_size_kb
1822 # cat /debug/tracing/buffer_size_kb 1873 # cat buffer_size_kb
182310000 (units kilobytes) 187410000 (units kilobytes)
1824 1875
1825The number of pages which will be allocated is limited to a 1876The number of pages which will be allocated is limited to a
1826percentage of available memory. Allocating too much will produce 1877percentage of available memory. Allocating too much will produce
1827an error. 1878an error.
1828 1879
1829 # echo 1000000000000 > /debug/tracing/buffer_size_kb 1880 # echo 1000000000000 > buffer_size_kb
1830-bash: echo: write error: Cannot allocate memory 1881-bash: echo: write error: Cannot allocate memory
1831 # cat /debug/tracing/buffer_size_kb 1882 # cat buffer_size_kb
183285 188385
1833 1884
1834----------- 1885-----------
diff --git a/Documentation/trace/mmiotrace.txt b/Documentation/trace/mmiotrace.txt
index 5731c67abc55..162effbfbdec 100644
--- a/Documentation/trace/mmiotrace.txt
+++ b/Documentation/trace/mmiotrace.txt
@@ -32,41 +32,41 @@ is no way to automatically detect if you are losing events due to CPUs racing.
32Usage Quick Reference 32Usage Quick Reference
33--------------------- 33---------------------
34 34
35$ mount -t debugfs debugfs /debug 35$ mount -t debugfs debugfs /sys/kernel/debug
36$ echo mmiotrace > /debug/tracing/current_tracer 36$ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer
37$ cat /debug/tracing/trace_pipe > mydump.txt & 37$ cat /sys/kernel/debug/tracing/trace_pipe > mydump.txt &
38Start X or whatever. 38Start X or whatever.
39$ echo "X is up" > /debug/tracing/trace_marker 39$ echo "X is up" > /sys/kernel/debug/tracing/trace_marker
40$ echo nop > /debug/tracing/current_tracer 40$ echo nop > /sys/kernel/debug/tracing/current_tracer
41Check for lost events. 41Check for lost events.
42 42
43 43
44Usage 44Usage
45----- 45-----
46 46
47Make sure debugfs is mounted to /debug. If not, (requires root privileges) 47Make sure debugfs is mounted to /sys/kernel/debug. If not, (requires root privileges)
48$ mount -t debugfs debugfs /debug 48$ mount -t debugfs debugfs /sys/kernel/debug
49 49
50Check that the driver you are about to trace is not loaded. 50Check that the driver you are about to trace is not loaded.
51 51
52Activate mmiotrace (requires root privileges): 52Activate mmiotrace (requires root privileges):
53$ echo mmiotrace > /debug/tracing/current_tracer 53$ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer
54 54
55Start storing the trace: 55Start storing the trace:
56$ cat /debug/tracing/trace_pipe > mydump.txt & 56$ cat /sys/kernel/debug/tracing/trace_pipe > mydump.txt &
57The 'cat' process should stay running (sleeping) in the background. 57The 'cat' process should stay running (sleeping) in the background.
58 58
59Load the driver you want to trace and use it. Mmiotrace will only catch MMIO 59Load the driver you want to trace and use it. Mmiotrace will only catch MMIO
60accesses to areas that are ioremapped while mmiotrace is active. 60accesses to areas that are ioremapped while mmiotrace is active.
61 61
62During tracing you can place comments (markers) into the trace by 62During tracing you can place comments (markers) into the trace by
63$ echo "X is up" > /debug/tracing/trace_marker 63$ echo "X is up" > /sys/kernel/debug/tracing/trace_marker
64This makes it easier to see which part of the (huge) trace corresponds to 64This makes it easier to see which part of the (huge) trace corresponds to
65which action. It is recommended to place descriptive markers about what you 65which action. It is recommended to place descriptive markers about what you
66do. 66do.
67 67
68Shut down mmiotrace (requires root privileges): 68Shut down mmiotrace (requires root privileges):
69$ echo nop > /debug/tracing/current_tracer 69$ echo nop > /sys/kernel/debug/tracing/current_tracer
70The 'cat' process exits. If it does not, kill it by issuing 'fg' command and 70The 'cat' process exits. If it does not, kill it by issuing 'fg' command and
71pressing ctrl+c. 71pressing ctrl+c.
72 72
@@ -78,10 +78,10 @@ to view your kernel log and look for "mmiotrace has lost events" warning. If
78events were lost, the trace is incomplete. You should enlarge the buffers and 78events were lost, the trace is incomplete. You should enlarge the buffers and
79try again. Buffers are enlarged by first seeing how large the current buffers 79try again. Buffers are enlarged by first seeing how large the current buffers
80are: 80are:
81$ cat /debug/tracing/buffer_size_kb 81$ cat /sys/kernel/debug/tracing/buffer_size_kb
82gives you a number. Approximately double this number and write it back, for 82gives you a number. Approximately double this number and write it back, for
83instance: 83instance:
84$ echo 128000 > /debug/tracing/buffer_size_kb 84$ echo 128000 > /sys/kernel/debug/tracing/buffer_size_kb
85Then start again from the top. 85Then start again from the top.
86 86
87If you are doing a trace for a driver project, e.g. Nouveau, you should also 87If you are doing a trace for a driver project, e.g. Nouveau, you should also