License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
ftrace: function tracer
This is a simple trace that uses the ftrace infrastructure. It is
designed to be fast and small, and easy to use. It is useful to
record things that happen over a very short period of time, and
not to analyze the system in general.
Updates:
available_tracers
"function" is added to this file.
current_tracer
To enable the function tracer:
echo function > /debugfs/tracing/current_tracer
To disable the tracer:
echo disable > /debugfs/tracing/current_tracer
The output of the function_trace file is as follows
"echo noverbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
_------=> CPU#
/ _-----=> irqs-off
| / _----=> need-resched
|| / _---=> hardirq/softirq
||| / _--=> preempt-depth
|||| /
||||| delay
cmd pid ||||| time | caller
\ / ||||| \ | /
swapper-0 0d.h. 1595128us+: set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper-0 0d.h. 1595131us+: _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
Or with verbose turned on:
"echo verbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
swapper 0 0 9 00000000 00000000 [f3675f41] 1595.128ms (+0.003ms): set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper 0 0 9 00000000 00000001 [f3675f45] 1595.131ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
swapper 0 0 9 00000000 00000002 [f3675f48] 1595.135ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
The "trace" file is not affected by the verbose mode, but is by the symonly.
echo "nosymonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479967] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <ffffffff80337a4d> <-- _spin_unlock_irqrestore+0xe/0x5a <ffffffff8048cc8f>
[ 81.479967] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <ffffffff8048ccbf> <-- sub_preempt_count+0xc/0x7a <ffffffff80233d7b>
[ 81.479968] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <ffffffff80233d9f> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
[ 81.479968] CPU 0: bash:3154 vfs_write+0x11d/0x155 <ffffffff8029a043> <-- dnotify_parent+0x12/0x78 <ffffffff802d54fb>
[ 81.479968] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <ffffffff802d5516> <-- _spin_lock+0xe/0x70 <ffffffff8048c910>
[ 81.479969] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <ffffffff8048c91d> <-- add_preempt_count+0xe/0x77 <ffffffff80233df7>
[ 81.479969] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <ffffffff80233e27> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
echo "symonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479913] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <-- _spin_unlock_irqrestore+0xe/0x5a
[ 81.479913] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <-- sub_preempt_count+0xc/0x7a
[ 81.479913] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <-- in_lock_functions+0x9/0x24
[ 81.479914] CPU 0: bash:3154 vfs_write+0x11d/0x155 <-- dnotify_parent+0x12/0x78
[ 81.479914] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <-- _spin_lock+0xe/0x70
[ 81.479914] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <-- add_preempt_count+0xe/0x77
[ 81.479914] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <-- in_lock_functions+0x9/0x24
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-05-13 03:20:42 +08:00
|
|
|
/*
|
|
|
|
* ring buffer based function tracer
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com>
|
|
|
|
* Copyright (C) 2008 Ingo Molnar <mingo@redhat.com>
|
|
|
|
*
|
|
|
|
* Based on code from the latency_tracer, that is:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004-2006 Ingo Molnar
|
2012-12-06 17:39:54 +08:00
|
|
|
* Copyright (C) 2004 Nadia Yvette Chambers
|
ftrace: function tracer
This is a simple trace that uses the ftrace infrastructure. It is
designed to be fast and small, and easy to use. It is useful to
record things that happen over a very short period of time, and
not to analyze the system in general.
Updates:
available_tracers
"function" is added to this file.
current_tracer
To enable the function tracer:
echo function > /debugfs/tracing/current_tracer
To disable the tracer:
echo disable > /debugfs/tracing/current_tracer
The output of the function_trace file is as follows
"echo noverbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
_------=> CPU#
/ _-----=> irqs-off
| / _----=> need-resched
|| / _---=> hardirq/softirq
||| / _--=> preempt-depth
|||| /
||||| delay
cmd pid ||||| time | caller
\ / ||||| \ | /
swapper-0 0d.h. 1595128us+: set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper-0 0d.h. 1595131us+: _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
Or with verbose turned on:
"echo verbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
swapper 0 0 9 00000000 00000000 [f3675f41] 1595.128ms (+0.003ms): set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper 0 0 9 00000000 00000001 [f3675f45] 1595.131ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
swapper 0 0 9 00000000 00000002 [f3675f48] 1595.135ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
The "trace" file is not affected by the verbose mode, but is by the symonly.
echo "nosymonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479967] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <ffffffff80337a4d> <-- _spin_unlock_irqrestore+0xe/0x5a <ffffffff8048cc8f>
[ 81.479967] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <ffffffff8048ccbf> <-- sub_preempt_count+0xc/0x7a <ffffffff80233d7b>
[ 81.479968] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <ffffffff80233d9f> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
[ 81.479968] CPU 0: bash:3154 vfs_write+0x11d/0x155 <ffffffff8029a043> <-- dnotify_parent+0x12/0x78 <ffffffff802d54fb>
[ 81.479968] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <ffffffff802d5516> <-- _spin_lock+0xe/0x70 <ffffffff8048c910>
[ 81.479969] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <ffffffff8048c91d> <-- add_preempt_count+0xe/0x77 <ffffffff80233df7>
[ 81.479969] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <ffffffff80233e27> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
echo "symonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479913] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <-- _spin_unlock_irqrestore+0xe/0x5a
[ 81.479913] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <-- sub_preempt_count+0xc/0x7a
[ 81.479913] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <-- in_lock_functions+0x9/0x24
[ 81.479914] CPU 0: bash:3154 vfs_write+0x11d/0x155 <-- dnotify_parent+0x12/0x78
[ 81.479914] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <-- _spin_lock+0xe/0x70
[ 81.479914] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <-- add_preempt_count+0xe/0x77
[ 81.479914] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <-- in_lock_functions+0x9/0x24
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-05-13 03:20:42 +08:00
|
|
|
*/
|
2009-02-15 08:04:24 +08:00
|
|
|
#include <linux/ring_buffer.h>
|
ftrace: function tracer
This is a simple trace that uses the ftrace infrastructure. It is
designed to be fast and small, and easy to use. It is useful to
record things that happen over a very short period of time, and
not to analyze the system in general.
Updates:
available_tracers
"function" is added to this file.
current_tracer
To enable the function tracer:
echo function > /debugfs/tracing/current_tracer
To disable the tracer:
echo disable > /debugfs/tracing/current_tracer
The output of the function_trace file is as follows
"echo noverbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
_------=> CPU#
/ _-----=> irqs-off
| / _----=> need-resched
|| / _---=> hardirq/softirq
||| / _--=> preempt-depth
|||| /
||||| delay
cmd pid ||||| time | caller
\ / ||||| \ | /
swapper-0 0d.h. 1595128us+: set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper-0 0d.h. 1595131us+: _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
Or with verbose turned on:
"echo verbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
swapper 0 0 9 00000000 00000000 [f3675f41] 1595.128ms (+0.003ms): set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper 0 0 9 00000000 00000001 [f3675f45] 1595.131ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
swapper 0 0 9 00000000 00000002 [f3675f48] 1595.135ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
The "trace" file is not affected by the verbose mode, but is by the symonly.
echo "nosymonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479967] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <ffffffff80337a4d> <-- _spin_unlock_irqrestore+0xe/0x5a <ffffffff8048cc8f>
[ 81.479967] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <ffffffff8048ccbf> <-- sub_preempt_count+0xc/0x7a <ffffffff80233d7b>
[ 81.479968] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <ffffffff80233d9f> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
[ 81.479968] CPU 0: bash:3154 vfs_write+0x11d/0x155 <ffffffff8029a043> <-- dnotify_parent+0x12/0x78 <ffffffff802d54fb>
[ 81.479968] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <ffffffff802d5516> <-- _spin_lock+0xe/0x70 <ffffffff8048c910>
[ 81.479969] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <ffffffff8048c91d> <-- add_preempt_count+0xe/0x77 <ffffffff80233df7>
[ 81.479969] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <ffffffff80233e27> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
echo "symonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479913] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <-- _spin_unlock_irqrestore+0xe/0x5a
[ 81.479913] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <-- sub_preempt_count+0xc/0x7a
[ 81.479913] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <-- in_lock_functions+0x9/0x24
[ 81.479914] CPU 0: bash:3154 vfs_write+0x11d/0x155 <-- dnotify_parent+0x12/0x78
[ 81.479914] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <-- _spin_lock+0xe/0x70
[ 81.479914] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <-- add_preempt_count+0xe/0x77
[ 81.479914] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <-- in_lock_functions+0x9/0x24
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-05-13 03:20:42 +08:00
|
|
|
#include <linux/debugfs.h>
|
|
|
|
#include <linux/uaccess.h>
|
|
|
|
#include <linux/ftrace.h>
|
2013-11-08 09:08:58 +08:00
|
|
|
#include <linux/slab.h>
|
2008-05-13 03:20:49 +08:00
|
|
|
#include <linux/fs.h>
|
ftrace: function tracer
This is a simple trace that uses the ftrace infrastructure. It is
designed to be fast and small, and easy to use. It is useful to
record things that happen over a very short period of time, and
not to analyze the system in general.
Updates:
available_tracers
"function" is added to this file.
current_tracer
To enable the function tracer:
echo function > /debugfs/tracing/current_tracer
To disable the tracer:
echo disable > /debugfs/tracing/current_tracer
The output of the function_trace file is as follows
"echo noverbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
_------=> CPU#
/ _-----=> irqs-off
| / _----=> need-resched
|| / _---=> hardirq/softirq
||| / _--=> preempt-depth
|||| /
||||| delay
cmd pid ||||| time | caller
\ / ||||| \ | /
swapper-0 0d.h. 1595128us+: set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper-0 0d.h. 1595131us+: _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
Or with verbose turned on:
"echo verbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
swapper 0 0 9 00000000 00000000 [f3675f41] 1595.128ms (+0.003ms): set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper 0 0 9 00000000 00000001 [f3675f45] 1595.131ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
swapper 0 0 9 00000000 00000002 [f3675f48] 1595.135ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
The "trace" file is not affected by the verbose mode, but is by the symonly.
echo "nosymonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479967] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <ffffffff80337a4d> <-- _spin_unlock_irqrestore+0xe/0x5a <ffffffff8048cc8f>
[ 81.479967] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <ffffffff8048ccbf> <-- sub_preempt_count+0xc/0x7a <ffffffff80233d7b>
[ 81.479968] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <ffffffff80233d9f> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
[ 81.479968] CPU 0: bash:3154 vfs_write+0x11d/0x155 <ffffffff8029a043> <-- dnotify_parent+0x12/0x78 <ffffffff802d54fb>
[ 81.479968] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <ffffffff802d5516> <-- _spin_lock+0xe/0x70 <ffffffff8048c910>
[ 81.479969] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <ffffffff8048c91d> <-- add_preempt_count+0xe/0x77 <ffffffff80233df7>
[ 81.479969] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <ffffffff80233e27> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
echo "symonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479913] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <-- _spin_unlock_irqrestore+0xe/0x5a
[ 81.479913] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <-- sub_preempt_count+0xc/0x7a
[ 81.479913] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <-- in_lock_functions+0x9/0x24
[ 81.479914] CPU 0: bash:3154 vfs_write+0x11d/0x155 <-- dnotify_parent+0x12/0x78
[ 81.479914] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <-- _spin_lock+0xe/0x70
[ 81.479914] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <-- add_preempt_count+0xe/0x77
[ 81.479914] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <-- in_lock_functions+0x9/0x24
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-05-13 03:20:42 +08:00
|
|
|
|
|
|
|
#include "trace.h"
|
|
|
|
|
2013-11-08 09:08:58 +08:00
|
|
|
static void tracing_start_function_trace(struct trace_array *tr);
|
|
|
|
static void tracing_stop_function_trace(struct trace_array *tr);
|
|
|
|
static void
|
|
|
|
function_trace_call(unsigned long ip, unsigned long parent_ip,
|
2020-10-29 05:42:17 +08:00
|
|
|
struct ftrace_ops *op, struct ftrace_regs *fregs);
|
2013-11-08 09:08:58 +08:00
|
|
|
static void
|
|
|
|
function_stack_trace_call(unsigned long ip, unsigned long parent_ip,
|
2020-10-29 05:42:17 +08:00
|
|
|
struct ftrace_ops *op, struct ftrace_regs *fregs);
|
2021-04-16 02:18:54 +08:00
|
|
|
static void
|
|
|
|
function_no_repeats_trace_call(unsigned long ip, unsigned long parent_ip,
|
|
|
|
struct ftrace_ops *op, struct ftrace_regs *fregs);
|
|
|
|
static void
|
|
|
|
function_stack_no_repeats_trace_call(unsigned long ip, unsigned long parent_ip,
|
|
|
|
struct ftrace_ops *op,
|
|
|
|
struct ftrace_regs *fregs);
|
2013-11-08 09:08:58 +08:00
|
|
|
static struct tracer_flags func_flags;
|
|
|
|
|
|
|
|
/* Our option */
|
|
|
|
enum {
|
2021-04-16 02:18:54 +08:00
|
|
|
|
|
|
|
TRACE_FUNC_NO_OPTS = 0x0, /* No flags set. */
|
|
|
|
TRACE_FUNC_OPT_STACK = 0x1,
|
|
|
|
TRACE_FUNC_OPT_NO_REPEATS = 0x2,
|
|
|
|
|
|
|
|
/* Update this to next highest bit. */
|
|
|
|
TRACE_FUNC_OPT_HIGHEST_BIT = 0x4
|
2013-11-08 09:08:58 +08:00
|
|
|
};
|
|
|
|
|
2021-04-16 02:18:54 +08:00
|
|
|
#define TRACE_FUNC_OPT_MASK (TRACE_FUNC_OPT_HIGHEST_BIT - 1)
|
2021-04-16 02:18:53 +08:00
|
|
|
|
2020-09-10 20:39:07 +08:00
|
|
|
int ftrace_allocate_ftrace_ops(struct trace_array *tr)
|
2013-11-08 09:08:58 +08:00
|
|
|
{
|
|
|
|
struct ftrace_ops *ops;
|
2009-01-16 12:06:03 +08:00
|
|
|
|
2020-09-10 20:39:07 +08:00
|
|
|
/* The top level array uses the "global_ops" */
|
|
|
|
if (tr->flags & TRACE_ARRAY_FL_GLOBAL)
|
|
|
|
return 0;
|
|
|
|
|
2013-11-08 09:08:58 +08:00
|
|
|
ops = kzalloc(sizeof(*ops), GFP_KERNEL);
|
|
|
|
if (!ops)
|
|
|
|
return -ENOMEM;
|
2009-01-16 08:12:40 +08:00
|
|
|
|
2020-06-10 11:32:51 +08:00
|
|
|
/* Currently only the non stack version is supported */
|
2013-11-08 09:08:58 +08:00
|
|
|
ops->func = function_trace_call;
|
2020-11-06 10:32:45 +08:00
|
|
|
ops->flags = FTRACE_OPS_FL_PID;
|
2013-11-08 09:08:58 +08:00
|
|
|
|
|
|
|
tr->ops = ops;
|
|
|
|
ops->private = tr;
|
2020-09-10 20:39:07 +08:00
|
|
|
|
2013-11-08 09:08:58 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2009-01-16 12:06:03 +08:00
|
|
|
|
2020-09-10 20:39:07 +08:00
|
|
|
void ftrace_free_ftrace_ops(struct trace_array *tr)
|
|
|
|
{
|
|
|
|
kfree(tr->ops);
|
|
|
|
tr->ops = NULL;
|
|
|
|
}
|
2014-01-11 05:17:45 +08:00
|
|
|
|
|
|
|
int ftrace_create_function_files(struct trace_array *tr,
|
|
|
|
struct dentry *parent)
|
|
|
|
{
|
2014-04-17 07:21:53 +08:00
|
|
|
/*
|
|
|
|
* The top level array uses the "global_ops", and the files are
|
|
|
|
* created on boot up.
|
|
|
|
*/
|
|
|
|
if (tr->flags & TRACE_ARRAY_FL_GLOBAL)
|
|
|
|
return 0;
|
|
|
|
|
2020-09-10 20:39:07 +08:00
|
|
|
if (!tr->ops)
|
|
|
|
return -EINVAL;
|
2014-01-11 05:17:45 +08:00
|
|
|
|
|
|
|
ftrace_create_filter_files(tr->ops, parent);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ftrace_destroy_function_files(struct trace_array *tr)
|
|
|
|
{
|
|
|
|
ftrace_destroy_filter_files(tr->ops);
|
2020-09-10 20:39:07 +08:00
|
|
|
ftrace_free_ftrace_ops(tr);
|
2014-01-11 05:17:45 +08:00
|
|
|
}
|
|
|
|
|
2021-04-16 02:18:53 +08:00
|
|
|
static ftrace_func_t select_trace_function(u32 flags_val)
|
|
|
|
{
|
|
|
|
switch (flags_val & TRACE_FUNC_OPT_MASK) {
|
|
|
|
case TRACE_FUNC_NO_OPTS:
|
|
|
|
return function_trace_call;
|
|
|
|
case TRACE_FUNC_OPT_STACK:
|
|
|
|
return function_stack_trace_call;
|
2021-04-16 02:18:54 +08:00
|
|
|
case TRACE_FUNC_OPT_NO_REPEATS:
|
|
|
|
return function_no_repeats_trace_call;
|
|
|
|
case TRACE_FUNC_OPT_STACK | TRACE_FUNC_OPT_NO_REPEATS:
|
|
|
|
return function_stack_no_repeats_trace_call;
|
2021-04-16 02:18:53 +08:00
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-16 02:18:54 +08:00
|
|
|
static bool handle_func_repeats(struct trace_array *tr, u32 flags_val)
|
|
|
|
{
|
|
|
|
if (!tr->last_func_repeats &&
|
|
|
|
(flags_val & TRACE_FUNC_OPT_NO_REPEATS)) {
|
|
|
|
tr->last_func_repeats = alloc_percpu(struct trace_func_repeats);
|
|
|
|
if (!tr->last_func_repeats)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-02-06 04:02:00 +08:00
|
|
|
static int function_trace_init(struct trace_array *tr)
|
ftrace: function tracer
This is a simple trace that uses the ftrace infrastructure. It is
designed to be fast and small, and easy to use. It is useful to
record things that happen over a very short period of time, and
not to analyze the system in general.
Updates:
available_tracers
"function" is added to this file.
current_tracer
To enable the function tracer:
echo function > /debugfs/tracing/current_tracer
To disable the tracer:
echo disable > /debugfs/tracing/current_tracer
The output of the function_trace file is as follows
"echo noverbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
_------=> CPU#
/ _-----=> irqs-off
| / _----=> need-resched
|| / _---=> hardirq/softirq
||| / _--=> preempt-depth
|||| /
||||| delay
cmd pid ||||| time | caller
\ / ||||| \ | /
swapper-0 0d.h. 1595128us+: set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper-0 0d.h. 1595131us+: _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
Or with verbose turned on:
"echo verbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
swapper 0 0 9 00000000 00000000 [f3675f41] 1595.128ms (+0.003ms): set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper 0 0 9 00000000 00000001 [f3675f45] 1595.131ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
swapper 0 0 9 00000000 00000002 [f3675f48] 1595.135ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
The "trace" file is not affected by the verbose mode, but is by the symonly.
echo "nosymonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479967] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <ffffffff80337a4d> <-- _spin_unlock_irqrestore+0xe/0x5a <ffffffff8048cc8f>
[ 81.479967] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <ffffffff8048ccbf> <-- sub_preempt_count+0xc/0x7a <ffffffff80233d7b>
[ 81.479968] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <ffffffff80233d9f> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
[ 81.479968] CPU 0: bash:3154 vfs_write+0x11d/0x155 <ffffffff8029a043> <-- dnotify_parent+0x12/0x78 <ffffffff802d54fb>
[ 81.479968] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <ffffffff802d5516> <-- _spin_lock+0xe/0x70 <ffffffff8048c910>
[ 81.479969] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <ffffffff8048c91d> <-- add_preempt_count+0xe/0x77 <ffffffff80233df7>
[ 81.479969] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <ffffffff80233e27> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
echo "symonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479913] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <-- _spin_unlock_irqrestore+0xe/0x5a
[ 81.479913] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <-- sub_preempt_count+0xc/0x7a
[ 81.479913] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <-- in_lock_functions+0x9/0x24
[ 81.479914] CPU 0: bash:3154 vfs_write+0x11d/0x155 <-- dnotify_parent+0x12/0x78
[ 81.479914] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <-- _spin_lock+0xe/0x70
[ 81.479914] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <-- add_preempt_count+0xe/0x77
[ 81.479914] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <-- in_lock_functions+0x9/0x24
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-05-13 03:20:42 +08:00
|
|
|
{
|
2014-01-11 06:01:58 +08:00
|
|
|
ftrace_func_t func;
|
|
|
|
/*
|
|
|
|
* Instance trace_arrays get their ops allocated
|
|
|
|
* at instance creation. Unless it failed
|
|
|
|
* the allocation.
|
|
|
|
*/
|
|
|
|
if (!tr->ops)
|
2014-01-11 05:17:45 +08:00
|
|
|
return -ENOMEM;
|
2014-01-11 06:01:58 +08:00
|
|
|
|
2021-04-16 02:18:53 +08:00
|
|
|
func = select_trace_function(func_flags.val);
|
|
|
|
if (!func)
|
|
|
|
return -EINVAL;
|
2014-01-11 06:01:58 +08:00
|
|
|
|
2021-04-16 02:18:54 +08:00
|
|
|
if (!handle_func_repeats(tr, func_flags.val))
|
|
|
|
return -ENOMEM;
|
|
|
|
|
2014-01-11 06:01:58 +08:00
|
|
|
ftrace_init_array_ops(tr, func);
|
2013-11-08 09:08:58 +08:00
|
|
|
|
2020-12-30 22:05:21 +08:00
|
|
|
tr->array_buffer.cpu = raw_smp_processor_id();
|
2008-07-11 08:58:14 +08:00
|
|
|
|
2008-05-22 23:49:22 +08:00
|
|
|
tracing_start_cmdline_record();
|
2013-11-08 09:08:58 +08:00
|
|
|
tracing_start_function_trace(tr);
|
2008-11-16 12:57:26 +08:00
|
|
|
return 0;
|
ftrace: function tracer
This is a simple trace that uses the ftrace infrastructure. It is
designed to be fast and small, and easy to use. It is useful to
record things that happen over a very short period of time, and
not to analyze the system in general.
Updates:
available_tracers
"function" is added to this file.
current_tracer
To enable the function tracer:
echo function > /debugfs/tracing/current_tracer
To disable the tracer:
echo disable > /debugfs/tracing/current_tracer
The output of the function_trace file is as follows
"echo noverbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
_------=> CPU#
/ _-----=> irqs-off
| / _----=> need-resched
|| / _---=> hardirq/softirq
||| / _--=> preempt-depth
|||| /
||||| delay
cmd pid ||||| time | caller
\ / ||||| \ | /
swapper-0 0d.h. 1595128us+: set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper-0 0d.h. 1595131us+: _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
Or with verbose turned on:
"echo verbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
swapper 0 0 9 00000000 00000000 [f3675f41] 1595.128ms (+0.003ms): set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper 0 0 9 00000000 00000001 [f3675f45] 1595.131ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
swapper 0 0 9 00000000 00000002 [f3675f48] 1595.135ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
The "trace" file is not affected by the verbose mode, but is by the symonly.
echo "nosymonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479967] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <ffffffff80337a4d> <-- _spin_unlock_irqrestore+0xe/0x5a <ffffffff8048cc8f>
[ 81.479967] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <ffffffff8048ccbf> <-- sub_preempt_count+0xc/0x7a <ffffffff80233d7b>
[ 81.479968] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <ffffffff80233d9f> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
[ 81.479968] CPU 0: bash:3154 vfs_write+0x11d/0x155 <ffffffff8029a043> <-- dnotify_parent+0x12/0x78 <ffffffff802d54fb>
[ 81.479968] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <ffffffff802d5516> <-- _spin_lock+0xe/0x70 <ffffffff8048c910>
[ 81.479969] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <ffffffff8048c91d> <-- add_preempt_count+0xe/0x77 <ffffffff80233df7>
[ 81.479969] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <ffffffff80233e27> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
echo "symonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479913] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <-- _spin_unlock_irqrestore+0xe/0x5a
[ 81.479913] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <-- sub_preempt_count+0xc/0x7a
[ 81.479913] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <-- in_lock_functions+0x9/0x24
[ 81.479914] CPU 0: bash:3154 vfs_write+0x11d/0x155 <-- dnotify_parent+0x12/0x78
[ 81.479914] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <-- _spin_lock+0xe/0x70
[ 81.479914] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <-- add_preempt_count+0xe/0x77
[ 81.479914] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <-- in_lock_functions+0x9/0x24
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-05-13 03:20:42 +08:00
|
|
|
}
|
|
|
|
|
2008-05-13 03:20:51 +08:00
|
|
|
static void function_trace_reset(struct trace_array *tr)
|
ftrace: function tracer
This is a simple trace that uses the ftrace infrastructure. It is
designed to be fast and small, and easy to use. It is useful to
record things that happen over a very short period of time, and
not to analyze the system in general.
Updates:
available_tracers
"function" is added to this file.
current_tracer
To enable the function tracer:
echo function > /debugfs/tracing/current_tracer
To disable the tracer:
echo disable > /debugfs/tracing/current_tracer
The output of the function_trace file is as follows
"echo noverbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
_------=> CPU#
/ _-----=> irqs-off
| / _----=> need-resched
|| / _---=> hardirq/softirq
||| / _--=> preempt-depth
|||| /
||||| delay
cmd pid ||||| time | caller
\ / ||||| \ | /
swapper-0 0d.h. 1595128us+: set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper-0 0d.h. 1595131us+: _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
Or with verbose turned on:
"echo verbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
swapper 0 0 9 00000000 00000000 [f3675f41] 1595.128ms (+0.003ms): set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper 0 0 9 00000000 00000001 [f3675f45] 1595.131ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
swapper 0 0 9 00000000 00000002 [f3675f48] 1595.135ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
The "trace" file is not affected by the verbose mode, but is by the symonly.
echo "nosymonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479967] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <ffffffff80337a4d> <-- _spin_unlock_irqrestore+0xe/0x5a <ffffffff8048cc8f>
[ 81.479967] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <ffffffff8048ccbf> <-- sub_preempt_count+0xc/0x7a <ffffffff80233d7b>
[ 81.479968] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <ffffffff80233d9f> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
[ 81.479968] CPU 0: bash:3154 vfs_write+0x11d/0x155 <ffffffff8029a043> <-- dnotify_parent+0x12/0x78 <ffffffff802d54fb>
[ 81.479968] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <ffffffff802d5516> <-- _spin_lock+0xe/0x70 <ffffffff8048c910>
[ 81.479969] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <ffffffff8048c91d> <-- add_preempt_count+0xe/0x77 <ffffffff80233df7>
[ 81.479969] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <ffffffff80233e27> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
echo "symonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479913] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <-- _spin_unlock_irqrestore+0xe/0x5a
[ 81.479913] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <-- sub_preempt_count+0xc/0x7a
[ 81.479913] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <-- in_lock_functions+0x9/0x24
[ 81.479914] CPU 0: bash:3154 vfs_write+0x11d/0x155 <-- dnotify_parent+0x12/0x78
[ 81.479914] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <-- _spin_lock+0xe/0x70
[ 81.479914] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <-- add_preempt_count+0xe/0x77
[ 81.479914] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <-- in_lock_functions+0x9/0x24
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-05-13 03:20:42 +08:00
|
|
|
{
|
2013-11-08 09:08:58 +08:00
|
|
|
tracing_stop_function_trace(tr);
|
2009-02-06 04:02:00 +08:00
|
|
|
tracing_stop_cmdline_record();
|
2014-01-11 06:01:58 +08:00
|
|
|
ftrace_reset_array_ops(tr);
|
ftrace: function tracer
This is a simple trace that uses the ftrace infrastructure. It is
designed to be fast and small, and easy to use. It is useful to
record things that happen over a very short period of time, and
not to analyze the system in general.
Updates:
available_tracers
"function" is added to this file.
current_tracer
To enable the function tracer:
echo function > /debugfs/tracing/current_tracer
To disable the tracer:
echo disable > /debugfs/tracing/current_tracer
The output of the function_trace file is as follows
"echo noverbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
_------=> CPU#
/ _-----=> irqs-off
| / _----=> need-resched
|| / _---=> hardirq/softirq
||| / _--=> preempt-depth
|||| /
||||| delay
cmd pid ||||| time | caller
\ / ||||| \ | /
swapper-0 0d.h. 1595128us+: set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper-0 0d.h. 1595131us+: _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
Or with verbose turned on:
"echo verbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
swapper 0 0 9 00000000 00000000 [f3675f41] 1595.128ms (+0.003ms): set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper 0 0 9 00000000 00000001 [f3675f45] 1595.131ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
swapper 0 0 9 00000000 00000002 [f3675f48] 1595.135ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
The "trace" file is not affected by the verbose mode, but is by the symonly.
echo "nosymonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479967] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <ffffffff80337a4d> <-- _spin_unlock_irqrestore+0xe/0x5a <ffffffff8048cc8f>
[ 81.479967] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <ffffffff8048ccbf> <-- sub_preempt_count+0xc/0x7a <ffffffff80233d7b>
[ 81.479968] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <ffffffff80233d9f> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
[ 81.479968] CPU 0: bash:3154 vfs_write+0x11d/0x155 <ffffffff8029a043> <-- dnotify_parent+0x12/0x78 <ffffffff802d54fb>
[ 81.479968] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <ffffffff802d5516> <-- _spin_lock+0xe/0x70 <ffffffff8048c910>
[ 81.479969] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <ffffffff8048c91d> <-- add_preempt_count+0xe/0x77 <ffffffff80233df7>
[ 81.479969] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <ffffffff80233e27> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
echo "symonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479913] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <-- _spin_unlock_irqrestore+0xe/0x5a
[ 81.479913] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <-- sub_preempt_count+0xc/0x7a
[ 81.479913] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <-- in_lock_functions+0x9/0x24
[ 81.479914] CPU 0: bash:3154 vfs_write+0x11d/0x155 <-- dnotify_parent+0x12/0x78
[ 81.479914] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <-- _spin_lock+0xe/0x70
[ 81.479914] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <-- add_preempt_count+0xe/0x77
[ 81.479914] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <-- in_lock_functions+0x9/0x24
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-05-13 03:20:42 +08:00
|
|
|
}
|
|
|
|
|
ftrace: restructure tracing start/stop infrastructure
Impact: change where tracing is started up and stopped
Currently, when a new tracer is selected via echo'ing a tracer name into
the current_tracer file, the startup is only done if tracing_enabled is
set to one. If tracing_enabled is changed to zero (by echo'ing 0 into
the tracing_enabled file) a full shutdown is performed.
The full startup and shutdown of a tracer can be expensive and the
user can lose out traces when echo'ing in 0 to the tracing_enabled file,
because the process takes too long. There can also be places that
the user would like to start and stop the tracer several times and
doing the full startup and shutdown of a tracer might be too expensive.
This patch performs the full startup and shutdown when a tracer is
selected. It also adds a way to do a quick start or stop of a tracer.
The quick version is just a flag that prevents the tracing from
taking place, but the overhead of the code is still there.
For example, the startup of a tracer may enable tracepoints, or enable
the function tracer. The stop and start will just set a flag to
have the tracer ignore the calls when the tracepoint or function trace
is called. The overhead of the tracer may still be present when
the tracer is stopped, but no tracing will occur. Setting the tracer
to the 'nop' tracer (or any other tracer) will perform the shutdown
of the tracer which will disable the tracepoint or disable the
function tracer.
The tracing_enabled file will simply start or stop tracing.
This change is all internal. The end result for the user should be the same
as before. If tracing_enabled is not set, no trace will happen.
If tracing_enabled is set, then the trace will happen. The tracing_enabled
variable is static between tracers. Enabling tracing_enabled and
going to another tracer will keep tracing_enabled enabled. Same
is true with disabling tracing_enabled.
This patch will now provide a fast start/stop method to the users
for enabling or disabling tracing.
Note: There were two methods to the struct tracer that were never
used: The methods start and stop. These were to be used as a hook
to the reading of the trace output, but ended up not being
necessary. These two methods are now used to enable the start
and stop of each tracer, in case the tracer needs to do more than
just not write into the buffer. For example, the irqsoff tracer
must stop recording max latencies when tracing is stopped.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-11-06 05:05:44 +08:00
|
|
|
static void function_trace_start(struct trace_array *tr)
|
|
|
|
{
|
2020-01-10 07:53:48 +08:00
|
|
|
tracing_reset_online_cpus(&tr->array_buffer);
|
ftrace: restructure tracing start/stop infrastructure
Impact: change where tracing is started up and stopped
Currently, when a new tracer is selected via echo'ing a tracer name into
the current_tracer file, the startup is only done if tracing_enabled is
set to one. If tracing_enabled is changed to zero (by echo'ing 0 into
the tracing_enabled file) a full shutdown is performed.
The full startup and shutdown of a tracer can be expensive and the
user can lose out traces when echo'ing in 0 to the tracing_enabled file,
because the process takes too long. There can also be places that
the user would like to start and stop the tracer several times and
doing the full startup and shutdown of a tracer might be too expensive.
This patch performs the full startup and shutdown when a tracer is
selected. It also adds a way to do a quick start or stop of a tracer.
The quick version is just a flag that prevents the tracing from
taking place, but the overhead of the code is still there.
For example, the startup of a tracer may enable tracepoints, or enable
the function tracer. The stop and start will just set a flag to
have the tracer ignore the calls when the tracepoint or function trace
is called. The overhead of the tracer may still be present when
the tracer is stopped, but no tracing will occur. Setting the tracer
to the 'nop' tracer (or any other tracer) will perform the shutdown
of the tracer which will disable the tracepoint or disable the
function tracer.
The tracing_enabled file will simply start or stop tracing.
This change is all internal. The end result for the user should be the same
as before. If tracing_enabled is not set, no trace will happen.
If tracing_enabled is set, then the trace will happen. The tracing_enabled
variable is static between tracers. Enabling tracing_enabled and
going to another tracer will keep tracing_enabled enabled. Same
is true with disabling tracing_enabled.
This patch will now provide a fast start/stop method to the users
for enabling or disabling tracing.
Note: There were two methods to the struct tracer that were never
used: The methods start and stop. These were to be used as a hook
to the reading of the trace output, but ended up not being
necessary. These two methods are now used to enable the start
and stop of each tracer, in case the tracer needs to do more than
just not write into the buffer. For example, the irqsoff tracer
must stop recording max latencies when tracing is stopped.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-11-06 05:05:44 +08:00
|
|
|
}
|
|
|
|
|
2009-01-16 09:40:23 +08:00
|
|
|
static void
|
2011-08-09 04:57:47 +08:00
|
|
|
function_trace_call(unsigned long ip, unsigned long parent_ip,
|
2020-10-29 05:42:17 +08:00
|
|
|
struct ftrace_ops *op, struct ftrace_regs *fregs)
|
2009-01-16 09:40:23 +08:00
|
|
|
{
|
2013-11-08 09:08:58 +08:00
|
|
|
struct trace_array *tr = op->private;
|
2009-01-16 09:40:23 +08:00
|
|
|
struct trace_array_cpu *data;
|
2021-01-26 03:45:08 +08:00
|
|
|
unsigned int trace_ctx;
|
2013-01-24 20:52:34 +08:00
|
|
|
int bit;
|
2009-01-16 09:40:23 +08:00
|
|
|
int cpu;
|
|
|
|
|
2013-11-08 09:08:58 +08:00
|
|
|
if (unlikely(!tr->function_enabled))
|
2009-01-16 09:40:23 +08:00
|
|
|
return;
|
|
|
|
|
2020-11-06 10:32:46 +08:00
|
|
|
bit = ftrace_test_recursion_trylock(ip, parent_ip);
|
2020-11-06 10:32:37 +08:00
|
|
|
if (bit < 0)
|
|
|
|
return;
|
|
|
|
|
2021-01-26 03:45:08 +08:00
|
|
|
trace_ctx = tracing_gen_ctx();
|
2012-11-03 05:52:35 +08:00
|
|
|
preempt_disable_notrace();
|
2009-01-16 09:40:23 +08:00
|
|
|
|
2012-11-03 05:52:35 +08:00
|
|
|
cpu = smp_processor_id();
|
2020-01-10 07:53:48 +08:00
|
|
|
data = per_cpu_ptr(tr->array_buffer.data, cpu);
|
2021-01-26 03:45:08 +08:00
|
|
|
if (!atomic_read(&data->disabled))
|
|
|
|
trace_function(tr, ip, parent_ip, trace_ctx);
|
|
|
|
|
2020-11-06 10:32:37 +08:00
|
|
|
ftrace_test_recursion_unlock(bit);
|
2012-11-03 05:52:35 +08:00
|
|
|
preempt_enable_notrace();
|
2009-01-16 09:40:23 +08:00
|
|
|
}
|
|
|
|
|
2018-01-24 02:25:04 +08:00
|
|
|
#ifdef CONFIG_UNWINDER_ORC
|
|
|
|
/*
|
|
|
|
* Skip 2:
|
|
|
|
*
|
|
|
|
* function_stack_trace_call()
|
|
|
|
* ftrace_call()
|
|
|
|
*/
|
|
|
|
#define STACK_SKIP 2
|
|
|
|
#else
|
|
|
|
/*
|
|
|
|
* Skip 3:
|
|
|
|
* __trace_stack()
|
|
|
|
* function_stack_trace_call()
|
|
|
|
* ftrace_call()
|
|
|
|
*/
|
|
|
|
#define STACK_SKIP 3
|
|
|
|
#endif
|
|
|
|
|
2009-01-16 08:12:40 +08:00
|
|
|
static void
|
2011-08-09 04:57:47 +08:00
|
|
|
function_stack_trace_call(unsigned long ip, unsigned long parent_ip,
|
2020-10-29 05:42:17 +08:00
|
|
|
struct ftrace_ops *op, struct ftrace_regs *fregs)
|
2009-01-16 08:12:40 +08:00
|
|
|
{
|
2013-11-08 09:08:58 +08:00
|
|
|
struct trace_array *tr = op->private;
|
2009-01-16 08:12:40 +08:00
|
|
|
struct trace_array_cpu *data;
|
|
|
|
unsigned long flags;
|
|
|
|
long disabled;
|
|
|
|
int cpu;
|
2021-01-26 03:45:08 +08:00
|
|
|
unsigned int trace_ctx;
|
2009-01-16 08:12:40 +08:00
|
|
|
|
2013-11-08 09:08:58 +08:00
|
|
|
if (unlikely(!tr->function_enabled))
|
2009-01-16 08:12:40 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Need to use raw, since this must be called before the
|
|
|
|
* recursive protection is performed.
|
|
|
|
*/
|
|
|
|
local_irq_save(flags);
|
|
|
|
cpu = raw_smp_processor_id();
|
2020-01-10 07:53:48 +08:00
|
|
|
data = per_cpu_ptr(tr->array_buffer.data, cpu);
|
2009-01-16 08:12:40 +08:00
|
|
|
disabled = atomic_inc_return(&data->disabled);
|
|
|
|
|
|
|
|
if (likely(disabled == 1)) {
|
2021-01-26 03:45:08 +08:00
|
|
|
trace_ctx = tracing_gen_ctx_flags(flags);
|
|
|
|
trace_function(tr, ip, parent_ip, trace_ctx);
|
|
|
|
__trace_stack(tr, trace_ctx, STACK_SKIP);
|
2009-01-16 08:12:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
atomic_dec(&data->disabled);
|
|
|
|
local_irq_restore(flags);
|
|
|
|
}
|
|
|
|
|
2021-04-16 02:18:54 +08:00
|
|
|
static inline bool is_repeat_check(struct trace_array *tr,
|
|
|
|
struct trace_func_repeats *last_info,
|
|
|
|
unsigned long ip, unsigned long parent_ip)
|
|
|
|
{
|
|
|
|
if (last_info->ip == ip &&
|
|
|
|
last_info->parent_ip == parent_ip &&
|
|
|
|
last_info->count < U16_MAX) {
|
|
|
|
last_info->ts_last_call =
|
|
|
|
ring_buffer_time_stamp(tr->array_buffer.buffer);
|
|
|
|
last_info->count++;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void process_repeats(struct trace_array *tr,
|
|
|
|
unsigned long ip, unsigned long parent_ip,
|
|
|
|
struct trace_func_repeats *last_info,
|
|
|
|
unsigned int trace_ctx)
|
|
|
|
{
|
|
|
|
if (last_info->count) {
|
|
|
|
trace_last_func_repeats(tr, last_info, trace_ctx);
|
|
|
|
last_info->count = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
last_info->ip = ip;
|
|
|
|
last_info->parent_ip = parent_ip;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
function_no_repeats_trace_call(unsigned long ip, unsigned long parent_ip,
|
|
|
|
struct ftrace_ops *op,
|
|
|
|
struct ftrace_regs *fregs)
|
|
|
|
{
|
|
|
|
struct trace_func_repeats *last_info;
|
|
|
|
struct trace_array *tr = op->private;
|
|
|
|
struct trace_array_cpu *data;
|
|
|
|
unsigned int trace_ctx;
|
|
|
|
unsigned long flags;
|
|
|
|
int bit;
|
|
|
|
int cpu;
|
|
|
|
|
|
|
|
if (unlikely(!tr->function_enabled))
|
|
|
|
return;
|
|
|
|
|
|
|
|
bit = ftrace_test_recursion_trylock(ip, parent_ip);
|
|
|
|
if (bit < 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
preempt_disable_notrace();
|
|
|
|
|
|
|
|
cpu = smp_processor_id();
|
|
|
|
data = per_cpu_ptr(tr->array_buffer.data, cpu);
|
|
|
|
if (atomic_read(&data->disabled))
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* An interrupt may happen at any place here. But as far as I can see,
|
|
|
|
* the only damage that this can cause is to mess up the repetition
|
|
|
|
* counter without valuable data being lost.
|
|
|
|
* TODO: think about a solution that is better than just hoping to be
|
|
|
|
* lucky.
|
|
|
|
*/
|
|
|
|
last_info = per_cpu_ptr(tr->last_func_repeats, cpu);
|
|
|
|
if (is_repeat_check(tr, last_info, ip, parent_ip))
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
local_save_flags(flags);
|
|
|
|
trace_ctx = tracing_gen_ctx_flags(flags);
|
|
|
|
process_repeats(tr, ip, parent_ip, last_info, trace_ctx);
|
|
|
|
|
|
|
|
trace_function(tr, ip, parent_ip, trace_ctx);
|
|
|
|
|
|
|
|
out:
|
|
|
|
ftrace_test_recursion_unlock(bit);
|
|
|
|
preempt_enable_notrace();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
function_stack_no_repeats_trace_call(unsigned long ip, unsigned long parent_ip,
|
|
|
|
struct ftrace_ops *op,
|
|
|
|
struct ftrace_regs *fregs)
|
|
|
|
{
|
|
|
|
struct trace_func_repeats *last_info;
|
|
|
|
struct trace_array *tr = op->private;
|
|
|
|
struct trace_array_cpu *data;
|
|
|
|
unsigned long flags;
|
|
|
|
long disabled;
|
|
|
|
int cpu;
|
|
|
|
unsigned int trace_ctx;
|
|
|
|
|
|
|
|
if (unlikely(!tr->function_enabled))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Need to use raw, since this must be called before the
|
|
|
|
* recursive protection is performed.
|
|
|
|
*/
|
|
|
|
local_irq_save(flags);
|
|
|
|
cpu = raw_smp_processor_id();
|
|
|
|
data = per_cpu_ptr(tr->array_buffer.data, cpu);
|
|
|
|
disabled = atomic_inc_return(&data->disabled);
|
|
|
|
|
|
|
|
if (likely(disabled == 1)) {
|
|
|
|
last_info = per_cpu_ptr(tr->last_func_repeats, cpu);
|
|
|
|
if (is_repeat_check(tr, last_info, ip, parent_ip))
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
trace_ctx = tracing_gen_ctx_flags(flags);
|
|
|
|
process_repeats(tr, ip, parent_ip, last_info, trace_ctx);
|
|
|
|
|
|
|
|
trace_function(tr, ip, parent_ip, trace_ctx);
|
|
|
|
__trace_stack(tr, trace_ctx, STACK_SKIP);
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
atomic_dec(&data->disabled);
|
|
|
|
local_irq_restore(flags);
|
|
|
|
}
|
|
|
|
|
2009-01-16 08:12:40 +08:00
|
|
|
static struct tracer_opt func_opts[] = {
|
|
|
|
#ifdef CONFIG_STACKTRACE
|
|
|
|
{ TRACER_OPT(func_stack_trace, TRACE_FUNC_OPT_STACK) },
|
|
|
|
#endif
|
2021-04-16 02:18:54 +08:00
|
|
|
{ TRACER_OPT(func-no-repeats, TRACE_FUNC_OPT_NO_REPEATS) },
|
2009-01-16 08:12:40 +08:00
|
|
|
{ } /* Always set a last empty entry */
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct tracer_flags func_flags = {
|
2021-04-16 02:18:53 +08:00
|
|
|
.val = TRACE_FUNC_NO_OPTS, /* By default: all flags disabled */
|
2009-01-16 08:12:40 +08:00
|
|
|
.opts = func_opts
|
|
|
|
};
|
|
|
|
|
2013-11-08 09:08:58 +08:00
|
|
|
static void tracing_start_function_trace(struct trace_array *tr)
|
2009-01-16 11:21:43 +08:00
|
|
|
{
|
2013-11-08 09:08:58 +08:00
|
|
|
tr->function_enabled = 0;
|
|
|
|
register_ftrace_function(tr->ops);
|
|
|
|
tr->function_enabled = 1;
|
2009-01-16 11:21:43 +08:00
|
|
|
}
|
|
|
|
|
2013-11-08 09:08:58 +08:00
|
|
|
static void tracing_stop_function_trace(struct trace_array *tr)
|
2009-01-16 11:21:43 +08:00
|
|
|
{
|
2013-11-08 09:08:58 +08:00
|
|
|
tr->function_enabled = 0;
|
|
|
|
unregister_ftrace_function(tr->ops);
|
2009-01-16 11:21:43 +08:00
|
|
|
}
|
|
|
|
|
2016-03-08 21:37:01 +08:00
|
|
|
static struct tracer function_trace;
|
|
|
|
|
2014-01-11 00:13:54 +08:00
|
|
|
static int
|
|
|
|
func_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
|
2009-01-16 08:12:40 +08:00
|
|
|
{
|
2021-04-16 02:18:53 +08:00
|
|
|
ftrace_func_t func;
|
|
|
|
u32 new_flags;
|
2016-03-08 21:37:01 +08:00
|
|
|
|
2021-04-16 02:18:53 +08:00
|
|
|
/* Do nothing if already set. */
|
|
|
|
if (!!set == !!(func_flags.val & bit))
|
|
|
|
return 0;
|
2013-11-08 09:08:58 +08:00
|
|
|
|
2021-04-16 02:18:53 +08:00
|
|
|
/* We can change this flag only when not running. */
|
|
|
|
if (tr->current_trace != &function_trace)
|
|
|
|
return 0;
|
2009-01-16 08:12:40 +08:00
|
|
|
|
2021-04-16 02:18:53 +08:00
|
|
|
new_flags = (func_flags.val & ~bit) | (set ? bit : 0);
|
|
|
|
func = select_trace_function(new_flags);
|
|
|
|
if (!func)
|
2012-07-10 08:10:46 +08:00
|
|
|
return -EINVAL;
|
2021-04-16 02:18:53 +08:00
|
|
|
|
|
|
|
/* Check if there's anything to change. */
|
|
|
|
if (tr->ops->func == func)
|
|
|
|
return 0;
|
|
|
|
|
2021-04-16 02:18:54 +08:00
|
|
|
if (!handle_func_repeats(tr, new_flags))
|
|
|
|
return -ENOMEM;
|
|
|
|
|
2021-04-16 02:18:53 +08:00
|
|
|
unregister_ftrace_function(tr->ops);
|
|
|
|
tr->ops->func = func;
|
|
|
|
register_ftrace_function(tr->ops);
|
2009-01-16 08:12:40 +08:00
|
|
|
|
2012-07-10 08:10:46 +08:00
|
|
|
return 0;
|
2009-01-16 08:12:40 +08:00
|
|
|
}
|
|
|
|
|
2013-07-19 02:41:51 +08:00
|
|
|
static struct tracer function_trace __tracer_data =
|
ftrace: function tracer
This is a simple trace that uses the ftrace infrastructure. It is
designed to be fast and small, and easy to use. It is useful to
record things that happen over a very short period of time, and
not to analyze the system in general.
Updates:
available_tracers
"function" is added to this file.
current_tracer
To enable the function tracer:
echo function > /debugfs/tracing/current_tracer
To disable the tracer:
echo disable > /debugfs/tracing/current_tracer
The output of the function_trace file is as follows
"echo noverbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
_------=> CPU#
/ _-----=> irqs-off
| / _----=> need-resched
|| / _---=> hardirq/softirq
||| / _--=> preempt-depth
|||| /
||||| delay
cmd pid ||||| time | caller
\ / ||||| \ | /
swapper-0 0d.h. 1595128us+: set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper-0 0d.h. 1595131us+: _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
Or with verbose turned on:
"echo verbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
swapper 0 0 9 00000000 00000000 [f3675f41] 1595.128ms (+0.003ms): set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper 0 0 9 00000000 00000001 [f3675f45] 1595.131ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
swapper 0 0 9 00000000 00000002 [f3675f48] 1595.135ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
The "trace" file is not affected by the verbose mode, but is by the symonly.
echo "nosymonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479967] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <ffffffff80337a4d> <-- _spin_unlock_irqrestore+0xe/0x5a <ffffffff8048cc8f>
[ 81.479967] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <ffffffff8048ccbf> <-- sub_preempt_count+0xc/0x7a <ffffffff80233d7b>
[ 81.479968] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <ffffffff80233d9f> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
[ 81.479968] CPU 0: bash:3154 vfs_write+0x11d/0x155 <ffffffff8029a043> <-- dnotify_parent+0x12/0x78 <ffffffff802d54fb>
[ 81.479968] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <ffffffff802d5516> <-- _spin_lock+0xe/0x70 <ffffffff8048c910>
[ 81.479969] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <ffffffff8048c91d> <-- add_preempt_count+0xe/0x77 <ffffffff80233df7>
[ 81.479969] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <ffffffff80233e27> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
echo "symonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479913] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <-- _spin_unlock_irqrestore+0xe/0x5a
[ 81.479913] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <-- sub_preempt_count+0xc/0x7a
[ 81.479913] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <-- in_lock_functions+0x9/0x24
[ 81.479914] CPU 0: bash:3154 vfs_write+0x11d/0x155 <-- dnotify_parent+0x12/0x78
[ 81.479914] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <-- _spin_lock+0xe/0x70
[ 81.479914] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <-- add_preempt_count+0xe/0x77
[ 81.479914] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <-- in_lock_functions+0x9/0x24
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-05-13 03:20:42 +08:00
|
|
|
{
|
2009-01-16 11:21:43 +08:00
|
|
|
.name = "function",
|
|
|
|
.init = function_trace_init,
|
|
|
|
.reset = function_trace_reset,
|
|
|
|
.start = function_trace_start,
|
2009-01-16 08:12:40 +08:00
|
|
|
.flags = &func_flags,
|
|
|
|
.set_flag = func_set_flag,
|
2013-11-08 09:08:58 +08:00
|
|
|
.allow_instances = true,
|
2008-05-13 03:20:44 +08:00
|
|
|
#ifdef CONFIG_FTRACE_SELFTEST
|
2009-01-16 11:21:43 +08:00
|
|
|
.selftest = trace_selftest_startup_function,
|
2008-05-13 03:20:44 +08:00
|
|
|
#endif
|
ftrace: function tracer
This is a simple trace that uses the ftrace infrastructure. It is
designed to be fast and small, and easy to use. It is useful to
record things that happen over a very short period of time, and
not to analyze the system in general.
Updates:
available_tracers
"function" is added to this file.
current_tracer
To enable the function tracer:
echo function > /debugfs/tracing/current_tracer
To disable the tracer:
echo disable > /debugfs/tracing/current_tracer
The output of the function_trace file is as follows
"echo noverbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
_------=> CPU#
/ _-----=> irqs-off
| / _----=> need-resched
|| / _---=> hardirq/softirq
||| / _--=> preempt-depth
|||| /
||||| delay
cmd pid ||||| time | caller
\ / ||||| \ | /
swapper-0 0d.h. 1595128us+: set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper-0 0d.h. 1595131us+: _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
Or with verbose turned on:
"echo verbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
swapper 0 0 9 00000000 00000000 [f3675f41] 1595.128ms (+0.003ms): set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper 0 0 9 00000000 00000001 [f3675f45] 1595.131ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
swapper 0 0 9 00000000 00000002 [f3675f48] 1595.135ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
The "trace" file is not affected by the verbose mode, but is by the symonly.
echo "nosymonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479967] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <ffffffff80337a4d> <-- _spin_unlock_irqrestore+0xe/0x5a <ffffffff8048cc8f>
[ 81.479967] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <ffffffff8048ccbf> <-- sub_preempt_count+0xc/0x7a <ffffffff80233d7b>
[ 81.479968] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <ffffffff80233d9f> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
[ 81.479968] CPU 0: bash:3154 vfs_write+0x11d/0x155 <ffffffff8029a043> <-- dnotify_parent+0x12/0x78 <ffffffff802d54fb>
[ 81.479968] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <ffffffff802d5516> <-- _spin_lock+0xe/0x70 <ffffffff8048c910>
[ 81.479969] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <ffffffff8048c91d> <-- add_preempt_count+0xe/0x77 <ffffffff80233df7>
[ 81.479969] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <ffffffff80233e27> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
echo "symonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479913] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <-- _spin_unlock_irqrestore+0xe/0x5a
[ 81.479913] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <-- sub_preempt_count+0xc/0x7a
[ 81.479913] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <-- in_lock_functions+0x9/0x24
[ 81.479914] CPU 0: bash:3154 vfs_write+0x11d/0x155 <-- dnotify_parent+0x12/0x78
[ 81.479914] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <-- _spin_lock+0xe/0x70
[ 81.479914] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <-- add_preempt_count+0xe/0x77
[ 81.479914] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <-- in_lock_functions+0x9/0x24
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-05-13 03:20:42 +08:00
|
|
|
};
|
|
|
|
|
2009-02-15 08:04:24 +08:00
|
|
|
#ifdef CONFIG_DYNAMIC_FTRACE
|
2017-04-04 11:22:41 +08:00
|
|
|
static void update_traceon_count(struct ftrace_probe_ops *ops,
|
2017-04-20 23:46:03 +08:00
|
|
|
unsigned long ip,
|
|
|
|
struct trace_array *tr, bool on,
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
void *data)
|
2009-02-15 08:04:24 +08:00
|
|
|
{
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
struct ftrace_func_mapper *mapper = data;
|
2017-04-04 11:22:41 +08:00
|
|
|
long *count;
|
|
|
|
long old_count;
|
2009-02-15 08:04:24 +08:00
|
|
|
|
2014-11-18 12:08:24 +08:00
|
|
|
/*
|
|
|
|
* Tracing gets disabled (or enabled) once per count.
|
2014-11-20 23:05:36 +08:00
|
|
|
* This function can be called at the same time on multiple CPUs.
|
2014-11-18 12:08:24 +08:00
|
|
|
* It is fine if both disable (or enable) tracing, as disabling
|
|
|
|
* (or enabling) the second time doesn't do anything as the
|
|
|
|
* state of the tracer is already disabled (or enabled).
|
|
|
|
* What needs to be synchronized in this case is that the count
|
|
|
|
* only gets decremented once, even if the tracer is disabled
|
|
|
|
* (or enabled) twice, as the second one is really a nop.
|
|
|
|
*
|
|
|
|
* The memory barriers guarantee that we only decrement the
|
|
|
|
* counter once. First the count is read to a local variable
|
|
|
|
* and a read barrier is used to make sure that it is loaded
|
|
|
|
* before checking if the tracer is in the state we want.
|
|
|
|
* If the tracer is not in the state we want, then the count
|
|
|
|
* is guaranteed to be the old count.
|
|
|
|
*
|
|
|
|
* Next the tracer is set to the state we want (disabled or enabled)
|
|
|
|
* then a write memory barrier is used to make sure that
|
|
|
|
* the new state is visible before changing the counter by
|
|
|
|
* one minus the old counter. This guarantees that another CPU
|
|
|
|
* executing this code will see the new state before seeing
|
2014-11-20 23:05:36 +08:00
|
|
|
* the new counter value, and would not do anything if the new
|
2014-11-18 12:08:24 +08:00
|
|
|
* counter is seen.
|
|
|
|
*
|
|
|
|
* Note, there is no synchronization between this and a user
|
|
|
|
* setting the tracing_on file. But we currently don't care
|
|
|
|
* about that.
|
|
|
|
*/
|
2017-04-04 11:22:41 +08:00
|
|
|
count = (long *)ftrace_func_mapper_find_ip(mapper, ip);
|
|
|
|
old_count = *count;
|
|
|
|
|
|
|
|
if (old_count <= 0)
|
2014-11-18 12:08:24 +08:00
|
|
|
return;
|
2009-02-15 08:04:24 +08:00
|
|
|
|
2014-11-18 12:08:24 +08:00
|
|
|
/* Make sure we see count before checking tracing state */
|
|
|
|
smp_rmb();
|
2009-02-15 08:04:24 +08:00
|
|
|
|
2017-04-20 23:46:03 +08:00
|
|
|
if (on == !!tracer_tracing_is_on(tr))
|
2014-11-18 12:08:24 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (on)
|
2017-04-20 23:46:03 +08:00
|
|
|
tracer_tracing_on(tr);
|
2014-11-18 12:08:24 +08:00
|
|
|
else
|
2017-04-20 23:46:03 +08:00
|
|
|
tracer_tracing_off(tr);
|
2014-11-18 12:08:24 +08:00
|
|
|
|
|
|
|
/* Make sure tracing state is visible before updating count */
|
|
|
|
smp_wmb();
|
|
|
|
|
|
|
|
*count = old_count - 1;
|
2009-02-15 08:04:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-04-04 06:18:47 +08:00
|
|
|
ftrace_traceon_count(unsigned long ip, unsigned long parent_ip,
|
2017-04-11 10:30:05 +08:00
|
|
|
struct trace_array *tr, struct ftrace_probe_ops *ops,
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
void *data)
|
2009-02-15 08:04:24 +08:00
|
|
|
{
|
2017-04-20 23:46:03 +08:00
|
|
|
update_traceon_count(ops, ip, tr, 1, data);
|
2013-03-09 21:36:53 +08:00
|
|
|
}
|
2009-02-15 08:04:24 +08:00
|
|
|
|
2013-03-09 21:36:53 +08:00
|
|
|
static void
|
2017-04-04 06:18:47 +08:00
|
|
|
ftrace_traceoff_count(unsigned long ip, unsigned long parent_ip,
|
2017-04-11 10:30:05 +08:00
|
|
|
struct trace_array *tr, struct ftrace_probe_ops *ops,
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
void *data)
|
2013-03-09 21:36:53 +08:00
|
|
|
{
|
2017-04-20 23:46:03 +08:00
|
|
|
update_traceon_count(ops, ip, tr, 0, data);
|
2009-02-15 08:04:24 +08:00
|
|
|
}
|
|
|
|
|
2013-03-09 21:56:43 +08:00
|
|
|
static void
|
2017-04-04 06:18:47 +08:00
|
|
|
ftrace_traceon(unsigned long ip, unsigned long parent_ip,
|
2017-04-11 10:30:05 +08:00
|
|
|
struct trace_array *tr, struct ftrace_probe_ops *ops,
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
void *data)
|
2013-03-09 21:56:43 +08:00
|
|
|
{
|
2017-04-20 23:46:03 +08:00
|
|
|
if (tracer_tracing_is_on(tr))
|
2013-03-09 21:56:43 +08:00
|
|
|
return;
|
|
|
|
|
2017-04-20 23:46:03 +08:00
|
|
|
tracer_tracing_on(tr);
|
2013-03-09 21:56:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-04-04 06:18:47 +08:00
|
|
|
ftrace_traceoff(unsigned long ip, unsigned long parent_ip,
|
2017-04-11 10:30:05 +08:00
|
|
|
struct trace_array *tr, struct ftrace_probe_ops *ops,
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
void *data)
|
2013-03-09 21:56:43 +08:00
|
|
|
{
|
2017-04-20 23:46:03 +08:00
|
|
|
if (!tracer_tracing_is_on(tr))
|
2013-03-09 21:56:43 +08:00
|
|
|
return;
|
|
|
|
|
2017-04-20 23:46:03 +08:00
|
|
|
tracer_tracing_off(tr);
|
2013-03-09 21:56:43 +08:00
|
|
|
}
|
|
|
|
|
2018-01-24 02:25:04 +08:00
|
|
|
#ifdef CONFIG_UNWINDER_ORC
|
|
|
|
/*
|
|
|
|
* Skip 3:
|
|
|
|
*
|
|
|
|
* function_trace_probe_call()
|
|
|
|
* ftrace_ops_assist_func()
|
|
|
|
* ftrace_call()
|
|
|
|
*/
|
|
|
|
#define FTRACE_STACK_SKIP 3
|
|
|
|
#else
|
2013-03-13 22:17:50 +08:00
|
|
|
/*
|
2018-01-24 02:25:04 +08:00
|
|
|
* Skip 5:
|
|
|
|
*
|
|
|
|
* __trace_stack()
|
2013-03-13 22:17:50 +08:00
|
|
|
* ftrace_stacktrace()
|
|
|
|
* function_trace_probe_call()
|
2018-01-24 02:25:04 +08:00
|
|
|
* ftrace_ops_assist_func()
|
2013-03-13 22:17:50 +08:00
|
|
|
* ftrace_call()
|
|
|
|
*/
|
2018-01-24 02:25:04 +08:00
|
|
|
#define FTRACE_STACK_SKIP 5
|
|
|
|
#endif
|
2013-03-13 22:17:50 +08:00
|
|
|
|
2017-04-20 23:59:18 +08:00
|
|
|
static __always_inline void trace_stack(struct trace_array *tr)
|
|
|
|
{
|
2021-01-26 03:45:08 +08:00
|
|
|
unsigned int trace_ctx;
|
2017-04-20 23:59:18 +08:00
|
|
|
|
2021-01-26 03:45:08 +08:00
|
|
|
trace_ctx = tracing_gen_ctx();
|
2017-04-20 23:59:18 +08:00
|
|
|
|
2021-01-26 03:45:08 +08:00
|
|
|
__trace_stack(tr, trace_ctx, FTRACE_STACK_SKIP);
|
2017-04-20 23:59:18 +08:00
|
|
|
}
|
|
|
|
|
2013-03-13 22:17:50 +08:00
|
|
|
static void
|
2017-04-04 06:18:47 +08:00
|
|
|
ftrace_stacktrace(unsigned long ip, unsigned long parent_ip,
|
2017-04-11 10:30:05 +08:00
|
|
|
struct trace_array *tr, struct ftrace_probe_ops *ops,
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
void *data)
|
2013-03-13 22:17:50 +08:00
|
|
|
{
|
2017-04-20 23:59:18 +08:00
|
|
|
trace_stack(tr);
|
2013-03-13 22:17:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-04-04 06:18:47 +08:00
|
|
|
ftrace_stacktrace_count(unsigned long ip, unsigned long parent_ip,
|
2017-04-11 10:30:05 +08:00
|
|
|
struct trace_array *tr, struct ftrace_probe_ops *ops,
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
void *data)
|
2013-03-13 22:17:50 +08:00
|
|
|
{
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
struct ftrace_func_mapper *mapper = data;
|
2017-04-04 11:22:41 +08:00
|
|
|
long *count;
|
2014-11-18 12:08:24 +08:00
|
|
|
long old_count;
|
|
|
|
long new_count;
|
|
|
|
|
2017-04-04 11:22:41 +08:00
|
|
|
if (!tracing_is_on())
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* unlimited? */
|
|
|
|
if (!mapper) {
|
2017-04-20 23:59:18 +08:00
|
|
|
trace_stack(tr);
|
2017-04-04 11:22:41 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
count = (long *)ftrace_func_mapper_find_ip(mapper, ip);
|
|
|
|
|
2014-11-18 12:08:24 +08:00
|
|
|
/*
|
|
|
|
* Stack traces should only execute the number of times the
|
|
|
|
* user specified in the counter.
|
|
|
|
*/
|
|
|
|
do {
|
|
|
|
old_count = *count;
|
|
|
|
|
|
|
|
if (!old_count)
|
|
|
|
return;
|
|
|
|
|
|
|
|
new_count = old_count - 1;
|
|
|
|
new_count = cmpxchg(count, old_count, new_count);
|
|
|
|
if (new_count == old_count)
|
2017-04-20 23:59:18 +08:00
|
|
|
trace_stack(tr);
|
2014-11-18 12:08:24 +08:00
|
|
|
|
2017-04-04 11:22:41 +08:00
|
|
|
if (!tracing_is_on())
|
|
|
|
return;
|
|
|
|
|
2014-11-18 12:08:24 +08:00
|
|
|
} while (new_count != old_count);
|
|
|
|
}
|
|
|
|
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
static int update_count(struct ftrace_probe_ops *ops, unsigned long ip,
|
|
|
|
void *data)
|
2014-11-18 12:08:24 +08:00
|
|
|
{
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
struct ftrace_func_mapper *mapper = data;
|
2017-04-04 11:22:41 +08:00
|
|
|
long *count = NULL;
|
2014-11-18 12:08:24 +08:00
|
|
|
|
2017-04-04 11:22:41 +08:00
|
|
|
if (mapper)
|
|
|
|
count = (long *)ftrace_func_mapper_find_ip(mapper, ip);
|
2014-11-18 12:08:24 +08:00
|
|
|
|
2017-04-04 11:22:41 +08:00
|
|
|
if (count) {
|
|
|
|
if (*count <= 0)
|
|
|
|
return 0;
|
2014-11-18 12:08:24 +08:00
|
|
|
(*count)--;
|
2017-04-04 11:22:41 +08:00
|
|
|
}
|
2014-11-18 12:08:24 +08:00
|
|
|
|
|
|
|
return 1;
|
2013-03-13 22:17:50 +08:00
|
|
|
}
|
|
|
|
|
2013-05-01 03:46:14 +08:00
|
|
|
static void
|
2017-04-04 06:18:47 +08:00
|
|
|
ftrace_dump_probe(unsigned long ip, unsigned long parent_ip,
|
2017-04-11 10:30:05 +08:00
|
|
|
struct trace_array *tr, struct ftrace_probe_ops *ops,
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
void *data)
|
2013-05-01 03:46:14 +08:00
|
|
|
{
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
if (update_count(ops, ip, data))
|
2013-05-01 03:46:14 +08:00
|
|
|
ftrace_dump(DUMP_ALL);
|
|
|
|
}
|
|
|
|
|
2013-05-01 07:00:46 +08:00
|
|
|
/* Only dump the current CPU buffer. */
|
|
|
|
static void
|
2017-04-04 06:18:47 +08:00
|
|
|
ftrace_cpudump_probe(unsigned long ip, unsigned long parent_ip,
|
2017-04-11 10:30:05 +08:00
|
|
|
struct trace_array *tr, struct ftrace_probe_ops *ops,
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
void *data)
|
2013-05-01 07:00:46 +08:00
|
|
|
{
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
if (update_count(ops, ip, data))
|
2013-05-01 07:00:46 +08:00
|
|
|
ftrace_dump(DUMP_ORIG);
|
|
|
|
}
|
|
|
|
|
2009-02-17 12:38:13 +08:00
|
|
|
static int
|
2013-03-13 22:17:50 +08:00
|
|
|
ftrace_probe_print(const char *name, struct seq_file *m,
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
unsigned long ip, struct ftrace_probe_ops *ops,
|
|
|
|
void *data)
|
2013-03-13 22:17:50 +08:00
|
|
|
{
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
struct ftrace_func_mapper *mapper = data;
|
2017-04-04 11:22:41 +08:00
|
|
|
long *count = NULL;
|
2013-03-13 22:17:50 +08:00
|
|
|
|
|
|
|
seq_printf(m, "%ps:%s", (void *)ip, name);
|
|
|
|
|
2017-04-04 11:22:41 +08:00
|
|
|
if (mapper)
|
|
|
|
count = (long *)ftrace_func_mapper_find_ip(mapper, ip);
|
|
|
|
|
|
|
|
if (count)
|
|
|
|
seq_printf(m, ":count=%ld\n", *count);
|
2013-03-13 22:17:50 +08:00
|
|
|
else
|
2017-04-04 11:22:41 +08:00
|
|
|
seq_puts(m, ":unlimited\n");
|
2013-03-13 22:17:50 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ftrace_traceon_print(struct seq_file *m, unsigned long ip,
|
2017-04-11 10:30:05 +08:00
|
|
|
struct ftrace_probe_ops *ops,
|
|
|
|
void *data)
|
2013-03-13 22:17:50 +08:00
|
|
|
{
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
return ftrace_probe_print("traceon", m, ip, ops, data);
|
2013-03-13 22:17:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ftrace_traceoff_print(struct seq_file *m, unsigned long ip,
|
|
|
|
struct ftrace_probe_ops *ops, void *data)
|
|
|
|
{
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
return ftrace_probe_print("traceoff", m, ip, ops, data);
|
2013-03-13 22:17:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ftrace_stacktrace_print(struct seq_file *m, unsigned long ip,
|
|
|
|
struct ftrace_probe_ops *ops, void *data)
|
|
|
|
{
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
return ftrace_probe_print("stacktrace", m, ip, ops, data);
|
2013-03-13 22:17:50 +08:00
|
|
|
}
|
2009-02-17 12:38:13 +08:00
|
|
|
|
2013-05-01 03:46:14 +08:00
|
|
|
static int
|
|
|
|
ftrace_dump_print(struct seq_file *m, unsigned long ip,
|
|
|
|
struct ftrace_probe_ops *ops, void *data)
|
|
|
|
{
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
return ftrace_probe_print("dump", m, ip, ops, data);
|
2013-05-01 03:46:14 +08:00
|
|
|
}
|
|
|
|
|
2013-05-01 07:00:46 +08:00
|
|
|
static int
|
|
|
|
ftrace_cpudump_print(struct seq_file *m, unsigned long ip,
|
|
|
|
struct ftrace_probe_ops *ops, void *data)
|
|
|
|
{
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
return ftrace_probe_print("cpudump", m, ip, ops, data);
|
2017-04-04 11:22:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2017-04-11 10:30:05 +08:00
|
|
|
ftrace_count_init(struct ftrace_probe_ops *ops, struct trace_array *tr,
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
unsigned long ip, void *init_data, void **data)
|
2017-04-04 11:22:41 +08:00
|
|
|
{
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
struct ftrace_func_mapper *mapper = *data;
|
|
|
|
|
|
|
|
if (!mapper) {
|
|
|
|
mapper = allocate_ftrace_func_mapper();
|
|
|
|
if (!mapper)
|
|
|
|
return -ENOMEM;
|
|
|
|
*data = mapper;
|
|
|
|
}
|
2017-04-04 11:22:41 +08:00
|
|
|
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
return ftrace_func_mapper_add_ip(mapper, ip, init_data);
|
2017-04-04 11:22:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-04-11 10:30:05 +08:00
|
|
|
ftrace_count_free(struct ftrace_probe_ops *ops, struct trace_array *tr,
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
unsigned long ip, void *data)
|
2017-04-04 11:22:41 +08:00
|
|
|
{
|
tracing/ftrace: Add a better way to pass data via the probe functions
With the redesign of the registration and execution of the function probes
(triggers), data can now be passed from the setup of the probe to the probe
callers that are specific to the trace_array it is on. Although, all probes
still only affect the toplevel trace array, this change will allow for
instances to have their own probes separated from other instances and the
top array.
That is, something like the stacktrace probe can be set to trace only in an
instance and not the toplevel trace array. This isn't implement yet, but
this change sets the ground work for the change.
When a probe callback is triggered (someone writes the probe format into
set_ftrace_filter), it calls register_ftrace_function_probe() passing in
init_data that will be used to initialize the probe. Then for every matching
function, register_ftrace_function_probe() will call the probe_ops->init()
function with the init data that was passed to it, as well as an address to
a place holder that is associated with the probe and the instance. The first
occurrence will have a NULL in the pointer. The init() function will then
initialize it. If other probes are added, or more functions are part of the
probe, the place holder will be passed to the init() function with the place
holder data that it was initialized to the last time.
Then this place_holder is passed to each of the other probe_ops functions,
where it can be used in the function callback. When the probe_ops free()
function is called, it can be called either with the rip of the function
that is being removed from the probe, or zero, indicating that there are no
more functions attached to the probe, and the place holder is about to be
freed. This gives the probe_ops a way to free the data it assigned to the
place holder if it was allocade during the first init call.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-20 10:39:44 +08:00
|
|
|
struct ftrace_func_mapper *mapper = data;
|
|
|
|
|
|
|
|
if (!ip) {
|
|
|
|
free_ftrace_func_mapper(mapper, NULL);
|
|
|
|
return;
|
|
|
|
}
|
2017-04-04 11:22:41 +08:00
|
|
|
|
|
|
|
ftrace_func_mapper_remove_ip(mapper, ip);
|
2013-05-01 07:00:46 +08:00
|
|
|
}
|
|
|
|
|
2013-03-09 21:56:43 +08:00
|
|
|
static struct ftrace_probe_ops traceon_count_probe_ops = {
|
|
|
|
.func = ftrace_traceon_count,
|
2013-03-13 22:17:50 +08:00
|
|
|
.print = ftrace_traceon_print,
|
2017-04-04 11:22:41 +08:00
|
|
|
.init = ftrace_count_init,
|
|
|
|
.free = ftrace_count_free,
|
2013-03-09 21:56:43 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct ftrace_probe_ops traceoff_count_probe_ops = {
|
|
|
|
.func = ftrace_traceoff_count,
|
2013-03-13 22:17:50 +08:00
|
|
|
.print = ftrace_traceoff_print,
|
2017-04-04 11:22:41 +08:00
|
|
|
.init = ftrace_count_init,
|
|
|
|
.free = ftrace_count_free,
|
2013-03-13 22:17:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct ftrace_probe_ops stacktrace_count_probe_ops = {
|
|
|
|
.func = ftrace_stacktrace_count,
|
|
|
|
.print = ftrace_stacktrace_print,
|
2017-04-04 11:22:41 +08:00
|
|
|
.init = ftrace_count_init,
|
|
|
|
.free = ftrace_count_free,
|
2013-03-09 21:56:43 +08:00
|
|
|
};
|
|
|
|
|
2013-05-01 03:46:14 +08:00
|
|
|
static struct ftrace_probe_ops dump_probe_ops = {
|
|
|
|
.func = ftrace_dump_probe,
|
|
|
|
.print = ftrace_dump_print,
|
2017-04-04 11:22:41 +08:00
|
|
|
.init = ftrace_count_init,
|
|
|
|
.free = ftrace_count_free,
|
2013-05-01 03:46:14 +08:00
|
|
|
};
|
|
|
|
|
2013-05-01 07:00:46 +08:00
|
|
|
static struct ftrace_probe_ops cpudump_probe_ops = {
|
|
|
|
.func = ftrace_cpudump_probe,
|
|
|
|
.print = ftrace_cpudump_print,
|
|
|
|
};
|
|
|
|
|
2009-02-18 01:32:04 +08:00
|
|
|
static struct ftrace_probe_ops traceon_probe_ops = {
|
2009-02-15 08:04:24 +08:00
|
|
|
.func = ftrace_traceon,
|
2013-03-13 22:17:50 +08:00
|
|
|
.print = ftrace_traceon_print,
|
2009-02-15 08:04:24 +08:00
|
|
|
};
|
|
|
|
|
2009-02-18 01:32:04 +08:00
|
|
|
static struct ftrace_probe_ops traceoff_probe_ops = {
|
2009-02-15 08:04:24 +08:00
|
|
|
.func = ftrace_traceoff,
|
2013-03-13 22:17:50 +08:00
|
|
|
.print = ftrace_traceoff_print,
|
2009-02-15 08:04:24 +08:00
|
|
|
};
|
|
|
|
|
2013-03-13 22:17:50 +08:00
|
|
|
static struct ftrace_probe_ops stacktrace_probe_ops = {
|
|
|
|
.func = ftrace_stacktrace,
|
|
|
|
.print = ftrace_stacktrace_print,
|
|
|
|
};
|
2009-02-17 12:38:13 +08:00
|
|
|
|
2009-02-15 08:04:24 +08:00
|
|
|
static int
|
2017-04-06 01:12:55 +08:00
|
|
|
ftrace_trace_probe_callback(struct trace_array *tr,
|
|
|
|
struct ftrace_probe_ops *ops,
|
2013-03-13 22:17:50 +08:00
|
|
|
struct ftrace_hash *hash, char *glob,
|
|
|
|
char *cmd, char *param, int enable)
|
2009-02-15 08:04:24 +08:00
|
|
|
{
|
|
|
|
void *count = (void *)-1;
|
|
|
|
char *number;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* hash funcs only work with set_ftrace_filter */
|
|
|
|
if (!enable)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2017-04-05 04:44:43 +08:00
|
|
|
if (glob[0] == '!')
|
2017-04-19 02:50:39 +08:00
|
|
|
return unregister_ftrace_function_probe_func(glob+1, tr, ops);
|
2013-03-12 21:25:00 +08:00
|
|
|
|
2009-02-15 08:04:24 +08:00
|
|
|
if (!param)
|
|
|
|
goto out_reg;
|
|
|
|
|
|
|
|
number = strsep(¶m, ":");
|
|
|
|
|
|
|
|
if (!strlen(number))
|
|
|
|
goto out_reg;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We use the callback data field (which is a pointer)
|
|
|
|
* as our counter.
|
|
|
|
*/
|
2012-09-27 04:08:38 +08:00
|
|
|
ret = kstrtoul(number, 0, (unsigned long *)&count);
|
2009-02-15 08:04:24 +08:00
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
out_reg:
|
2017-04-06 01:12:55 +08:00
|
|
|
ret = register_ftrace_function_probe(glob, tr, ops, count);
|
2009-02-15 08:04:24 +08:00
|
|
|
|
2009-07-15 12:29:06 +08:00
|
|
|
return ret < 0 ? ret : 0;
|
2009-02-15 08:04:24 +08:00
|
|
|
}
|
|
|
|
|
2013-03-13 22:17:50 +08:00
|
|
|
static int
|
2017-04-06 01:12:55 +08:00
|
|
|
ftrace_trace_onoff_callback(struct trace_array *tr, struct ftrace_hash *hash,
|
2013-03-13 22:17:50 +08:00
|
|
|
char *glob, char *cmd, char *param, int enable)
|
|
|
|
{
|
|
|
|
struct ftrace_probe_ops *ops;
|
|
|
|
|
2017-06-29 22:05:45 +08:00
|
|
|
if (!tr)
|
|
|
|
return -ENODEV;
|
|
|
|
|
2013-03-13 22:17:50 +08:00
|
|
|
/* we register both traceon and traceoff to this callback */
|
|
|
|
if (strcmp(cmd, "traceon") == 0)
|
|
|
|
ops = param ? &traceon_count_probe_ops : &traceon_probe_ops;
|
|
|
|
else
|
|
|
|
ops = param ? &traceoff_count_probe_ops : &traceoff_probe_ops;
|
|
|
|
|
2017-04-06 01:12:55 +08:00
|
|
|
return ftrace_trace_probe_callback(tr, ops, hash, glob, cmd,
|
2013-03-13 22:17:50 +08:00
|
|
|
param, enable);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2017-04-06 01:12:55 +08:00
|
|
|
ftrace_stacktrace_callback(struct trace_array *tr, struct ftrace_hash *hash,
|
2013-03-13 22:17:50 +08:00
|
|
|
char *glob, char *cmd, char *param, int enable)
|
|
|
|
{
|
|
|
|
struct ftrace_probe_ops *ops;
|
|
|
|
|
2017-06-29 22:05:45 +08:00
|
|
|
if (!tr)
|
|
|
|
return -ENODEV;
|
|
|
|
|
2013-03-13 22:17:50 +08:00
|
|
|
ops = param ? &stacktrace_count_probe_ops : &stacktrace_probe_ops;
|
|
|
|
|
2017-04-06 01:12:55 +08:00
|
|
|
return ftrace_trace_probe_callback(tr, ops, hash, glob, cmd,
|
2013-03-13 22:17:50 +08:00
|
|
|
param, enable);
|
|
|
|
}
|
|
|
|
|
2013-05-01 03:46:14 +08:00
|
|
|
static int
|
2017-04-06 01:12:55 +08:00
|
|
|
ftrace_dump_callback(struct trace_array *tr, struct ftrace_hash *hash,
|
2013-05-01 03:46:14 +08:00
|
|
|
char *glob, char *cmd, char *param, int enable)
|
|
|
|
{
|
|
|
|
struct ftrace_probe_ops *ops;
|
|
|
|
|
2017-06-29 22:05:45 +08:00
|
|
|
if (!tr)
|
|
|
|
return -ENODEV;
|
|
|
|
|
2013-05-01 03:46:14 +08:00
|
|
|
ops = &dump_probe_ops;
|
|
|
|
|
|
|
|
/* Only dump once. */
|
2017-04-06 01:12:55 +08:00
|
|
|
return ftrace_trace_probe_callback(tr, ops, hash, glob, cmd,
|
2013-05-01 03:46:14 +08:00
|
|
|
"1", enable);
|
|
|
|
}
|
|
|
|
|
2013-05-01 07:00:46 +08:00
|
|
|
static int
|
2017-04-06 01:12:55 +08:00
|
|
|
ftrace_cpudump_callback(struct trace_array *tr, struct ftrace_hash *hash,
|
2013-05-01 07:00:46 +08:00
|
|
|
char *glob, char *cmd, char *param, int enable)
|
|
|
|
{
|
|
|
|
struct ftrace_probe_ops *ops;
|
|
|
|
|
2017-06-29 22:05:45 +08:00
|
|
|
if (!tr)
|
|
|
|
return -ENODEV;
|
|
|
|
|
2013-05-01 07:00:46 +08:00
|
|
|
ops = &cpudump_probe_ops;
|
|
|
|
|
|
|
|
/* Only dump once. */
|
2017-04-06 01:12:55 +08:00
|
|
|
return ftrace_trace_probe_callback(tr, ops, hash, glob, cmd,
|
2013-05-01 07:00:46 +08:00
|
|
|
"1", enable);
|
|
|
|
}
|
|
|
|
|
2009-02-15 08:04:24 +08:00
|
|
|
static struct ftrace_func_command ftrace_traceon_cmd = {
|
|
|
|
.name = "traceon",
|
|
|
|
.func = ftrace_trace_onoff_callback,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct ftrace_func_command ftrace_traceoff_cmd = {
|
|
|
|
.name = "traceoff",
|
|
|
|
.func = ftrace_trace_onoff_callback,
|
|
|
|
};
|
|
|
|
|
2013-03-13 22:17:50 +08:00
|
|
|
static struct ftrace_func_command ftrace_stacktrace_cmd = {
|
|
|
|
.name = "stacktrace",
|
|
|
|
.func = ftrace_stacktrace_callback,
|
|
|
|
};
|
|
|
|
|
2013-05-01 03:46:14 +08:00
|
|
|
static struct ftrace_func_command ftrace_dump_cmd = {
|
|
|
|
.name = "dump",
|
|
|
|
.func = ftrace_dump_callback,
|
|
|
|
};
|
|
|
|
|
2013-05-01 07:00:46 +08:00
|
|
|
static struct ftrace_func_command ftrace_cpudump_cmd = {
|
|
|
|
.name = "cpudump",
|
|
|
|
.func = ftrace_cpudump_callback,
|
|
|
|
};
|
|
|
|
|
2009-02-15 08:04:24 +08:00
|
|
|
static int __init init_func_cmd_traceon(void)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = register_ftrace_command(&ftrace_traceoff_cmd);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = register_ftrace_command(&ftrace_traceon_cmd);
|
|
|
|
if (ret)
|
2013-05-01 03:46:14 +08:00
|
|
|
goto out_free_traceoff;
|
2013-03-13 22:17:50 +08:00
|
|
|
|
|
|
|
ret = register_ftrace_command(&ftrace_stacktrace_cmd);
|
2013-05-01 03:46:14 +08:00
|
|
|
if (ret)
|
|
|
|
goto out_free_traceon;
|
|
|
|
|
|
|
|
ret = register_ftrace_command(&ftrace_dump_cmd);
|
|
|
|
if (ret)
|
|
|
|
goto out_free_stacktrace;
|
|
|
|
|
2013-05-01 07:00:46 +08:00
|
|
|
ret = register_ftrace_command(&ftrace_cpudump_cmd);
|
|
|
|
if (ret)
|
|
|
|
goto out_free_dump;
|
|
|
|
|
2013-05-01 03:46:14 +08:00
|
|
|
return 0;
|
|
|
|
|
2013-05-01 07:00:46 +08:00
|
|
|
out_free_dump:
|
|
|
|
unregister_ftrace_command(&ftrace_dump_cmd);
|
2013-05-01 03:46:14 +08:00
|
|
|
out_free_stacktrace:
|
|
|
|
unregister_ftrace_command(&ftrace_stacktrace_cmd);
|
|
|
|
out_free_traceon:
|
|
|
|
unregister_ftrace_command(&ftrace_traceon_cmd);
|
|
|
|
out_free_traceoff:
|
|
|
|
unregister_ftrace_command(&ftrace_traceoff_cmd);
|
|
|
|
|
2009-02-15 08:04:24 +08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static inline int init_func_cmd_traceon(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_DYNAMIC_FTRACE */
|
|
|
|
|
2017-03-04 02:48:42 +08:00
|
|
|
__init int init_function_trace(void)
|
ftrace: function tracer
This is a simple trace that uses the ftrace infrastructure. It is
designed to be fast and small, and easy to use. It is useful to
record things that happen over a very short period of time, and
not to analyze the system in general.
Updates:
available_tracers
"function" is added to this file.
current_tracer
To enable the function tracer:
echo function > /debugfs/tracing/current_tracer
To disable the tracer:
echo disable > /debugfs/tracing/current_tracer
The output of the function_trace file is as follows
"echo noverbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
_------=> CPU#
/ _-----=> irqs-off
| / _----=> need-resched
|| / _---=> hardirq/softirq
||| / _--=> preempt-depth
|||| /
||||| delay
cmd pid ||||| time | caller
\ / ||||| \ | /
swapper-0 0d.h. 1595128us+: set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper-0 0d.h. 1595131us+: _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
Or with verbose turned on:
"echo verbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
swapper 0 0 9 00000000 00000000 [f3675f41] 1595.128ms (+0.003ms): set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper 0 0 9 00000000 00000001 [f3675f45] 1595.131ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
swapper 0 0 9 00000000 00000002 [f3675f48] 1595.135ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
The "trace" file is not affected by the verbose mode, but is by the symonly.
echo "nosymonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479967] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <ffffffff80337a4d> <-- _spin_unlock_irqrestore+0xe/0x5a <ffffffff8048cc8f>
[ 81.479967] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <ffffffff8048ccbf> <-- sub_preempt_count+0xc/0x7a <ffffffff80233d7b>
[ 81.479968] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <ffffffff80233d9f> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
[ 81.479968] CPU 0: bash:3154 vfs_write+0x11d/0x155 <ffffffff8029a043> <-- dnotify_parent+0x12/0x78 <ffffffff802d54fb>
[ 81.479968] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <ffffffff802d5516> <-- _spin_lock+0xe/0x70 <ffffffff8048c910>
[ 81.479969] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <ffffffff8048c91d> <-- add_preempt_count+0xe/0x77 <ffffffff80233df7>
[ 81.479969] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <ffffffff80233e27> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
echo "symonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479913] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <-- _spin_unlock_irqrestore+0xe/0x5a
[ 81.479913] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <-- sub_preempt_count+0xc/0x7a
[ 81.479913] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <-- in_lock_functions+0x9/0x24
[ 81.479914] CPU 0: bash:3154 vfs_write+0x11d/0x155 <-- dnotify_parent+0x12/0x78
[ 81.479914] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <-- _spin_lock+0xe/0x70
[ 81.479914] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <-- add_preempt_count+0xe/0x77
[ 81.479914] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <-- in_lock_functions+0x9/0x24
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-05-13 03:20:42 +08:00
|
|
|
{
|
2009-02-15 08:04:24 +08:00
|
|
|
init_func_cmd_traceon();
|
ftrace: function tracer
This is a simple trace that uses the ftrace infrastructure. It is
designed to be fast and small, and easy to use. It is useful to
record things that happen over a very short period of time, and
not to analyze the system in general.
Updates:
available_tracers
"function" is added to this file.
current_tracer
To enable the function tracer:
echo function > /debugfs/tracing/current_tracer
To disable the tracer:
echo disable > /debugfs/tracing/current_tracer
The output of the function_trace file is as follows
"echo noverbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
_------=> CPU#
/ _-----=> irqs-off
| / _----=> need-resched
|| / _---=> hardirq/softirq
||| / _--=> preempt-depth
|||| /
||||| delay
cmd pid ||||| time | caller
\ / ||||| \ | /
swapper-0 0d.h. 1595128us+: set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper-0 0d.h. 1595131us+: _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
Or with verbose turned on:
"echo verbose > /debugfs/tracing/iter_ctrl"
preemption latency trace v1.1.5 on 2.6.24-rc7-tst
--------------------------------------------------------------------
latency: 0 us, #419428/4361791, CPU#1 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
-----------------
| task: -0 (uid:0 nice:0 policy:0 rt_prio:0)
-----------------
swapper 0 0 9 00000000 00000000 [f3675f41] 1595.128ms (+0.003ms): set_normalized_timespec+0x8/0x2d <c043841d> (ktime_get_ts+0x4a/0x4e <c04499d4>)
swapper 0 0 9 00000000 00000001 [f3675f45] 1595.131ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
swapper 0 0 9 00000000 00000002 [f3675f48] 1595.135ms (+0.003ms): _spin_lock+0x8/0x18 <c0630690> (hrtimer_interrupt+0x6e/0x1b0 <c0449c56>)
The "trace" file is not affected by the verbose mode, but is by the symonly.
echo "nosymonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479967] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <ffffffff80337a4d> <-- _spin_unlock_irqrestore+0xe/0x5a <ffffffff8048cc8f>
[ 81.479967] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <ffffffff8048ccbf> <-- sub_preempt_count+0xc/0x7a <ffffffff80233d7b>
[ 81.479968] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <ffffffff80233d9f> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
[ 81.479968] CPU 0: bash:3154 vfs_write+0x11d/0x155 <ffffffff8029a043> <-- dnotify_parent+0x12/0x78 <ffffffff802d54fb>
[ 81.479968] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <ffffffff802d5516> <-- _spin_lock+0xe/0x70 <ffffffff8048c910>
[ 81.479969] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <ffffffff8048c91d> <-- add_preempt_count+0xe/0x77 <ffffffff80233df7>
[ 81.479969] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <ffffffff80233e27> <-- in_lock_functions+0x9/0x24 <ffffffff8025a75d>
echo "symonly" > /debugfs/tracing/iter_ctrl
tracer:
[ 81.479913] CPU 0: bash:3154 register_ftrace_function+0x5f/0x66 <-- _spin_unlock_irqrestore+0xe/0x5a
[ 81.479913] CPU 0: bash:3154 _spin_unlock_irqrestore+0x3e/0x5a <-- sub_preempt_count+0xc/0x7a
[ 81.479913] CPU 0: bash:3154 sub_preempt_count+0x30/0x7a <-- in_lock_functions+0x9/0x24
[ 81.479914] CPU 0: bash:3154 vfs_write+0x11d/0x155 <-- dnotify_parent+0x12/0x78
[ 81.479914] CPU 0: bash:3154 dnotify_parent+0x2d/0x78 <-- _spin_lock+0xe/0x70
[ 81.479914] CPU 0: bash:3154 _spin_lock+0x1b/0x70 <-- add_preempt_count+0xe/0x77
[ 81.479914] CPU 0: bash:3154 add_preempt_count+0x3e/0x77 <-- in_lock_functions+0x9/0x24
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-05-13 03:20:42 +08:00
|
|
|
return register_tracer(&function_trace);
|
|
|
|
}
|