tracing: Snapshot command line and branch tracer fix
Subsystems (2)
Steven Rostedt
maintainercover tracing: Snapshot command line and branch tracer fix
Two more patches to my queue. I added alloc_snapshot to the kernel command line parameter to alloc allocation of the snapshot buffer when the main tracing buffer is allocated, allowing the use of tracing_snapshot() without the fear of it not being allocated.
Also Fengguang Wu's tests discovered that my changes broke the branch tracer. I guess I should add that to my test suite ;-)
Steven Rostedt (Red Hat) (2):
tracing: Add alloc_snapshot kernel command line parameter
tracing: Fix the branch tracer that broke with buffer change
----
Documentation/kernel-parameters.txt | 7 +++ kernel/trace/trace.c | 81 +++++++++++++++++++++-------------- kernel/trace/trace.h | 2 +- kernel/trace/trace_branch.c | 4 +- kernel/trace/trace_events.c | 4 +- 5 files changed, 60 insertions(+), 38 deletions(-)
Steven Rostedt
maintainerPATCH 1/2 tracing: Add alloc_snapshot kernel command line parameter
From: "Steven Rostedt (Red Hat)" <[email protected]>
If debugging the kernel, and the developer wants to use tracing_snapshot() in places where tracing_snapshot_alloc() may be difficult (or more likely, the developer is lazy and doesn't want to bother with tracing_snapshot_alloc() at all), then adding
alloc_snapshot
to the kernel command line parameter will tell ftrace to allocate the snapshot buffer (if configured) when it allocates the main tracing buffer.
I also noticed that ring_buffer_expanded and tracing_selftest_disabled had inconsistent use of boolean "true" and "false" with "0" and "1". I cleaned that up too.
--- Documentation/kernel-parameters.txt | 7 +++ kernel/trace/trace.c | 81 +++++++++++++++++++++-------------- kernel/trace/trace.h | 2 +- kernel/trace/trace_events.c | 4 +- 4 files changed, 58 insertions(+), 36 deletions(-)
Documentation/kernel-parameters.txt +7 -0
@@ -320,6 +320,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted. on: enable for both 32- and 64-bit processes off: disable for both 32- and 64-bit processes + alloc_snapshot [FTRACE] + Allocate the ftrace snapshot buffer on boot up when the + main buffer is allocated. This is handy if debugging + and you need to use tracing_snapshot() on boot up, and + do not want to use tracing_snapshot_alloc() as it needs + to be done where GFP_KERNEL allocations are allowed. + amd_iommu= [HW,X86-64] Pass parameters to the AMD IOMMU driver in the system. Possible values are:
kernel/trace/trace.c +48 -33
140 lines not on this page · raw message
kernel/trace/trace.h +1 -1
@@ -656,7 +656,7 @@ extern int DYN_FTRACE_TEST_NAME(void);#define DYN_FTRACE_TEST_NAME2 trace_selftest_dynamic_test_func2extern int DYN_FTRACE_TEST_NAME2 (void ); -extern int ring_buffer_expanded; +extern bool ring_buffer_expanded;extern bool tracing_selftest_disabled;DECLARE_PER_CPU (int, ftrace_cpu_disabled);
kernel/trace/trace_events.c +2 -2
@@ -1844,8 +1844,8 @@ static char bootup_event_buf[COMMAND_LINE_SIZE] __initdata;static __init int setup_trace_event (char *str) {strlcpy (bootup_event_buf, str,COMMAND_LINE_SIZE ); - ring_buffer_expanded =1 ; - tracing_selftest_disabled =1 ; + ring_buffer_expanded = true; + tracing_selftest_disabled = true;return 1 ; }
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 2/2 tracing: Fix the branch tracer that broke with buffer change
In reply to Steven RostedtFrom: "Steven Rostedt (Red Hat)" <[email protected]>
The changce to add the trace_buffer struct to have the trace array have both the main buffer and max buffer broke the branch tracer because the change did not update that code. As the branch tracer adds a significant amount of overhead, and must be selected via a selection (not a allyesconfig) it was missed in testing.
--- kernel/trace/trace_branch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace_branch.c +2 -2
@@ -52,12 +52,12 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)local_irq_save (flags); cpu =raw_smp_processor_id (); - data =per_cpu_ptr (tr->data, cpu); + data =per_cpu_ptr (tr->trace_buffer.data, cpu);if (atomic_inc_return (&data->disabled) !=1 ) goto out; pc =preempt_count (); - buffer = tr->buffer; + buffer = tr->trace_buffer.buffer; event =trace_buffer_lock_reserve (buffer,TRACE_BRANCH ,sizeof (*entry), flags, pc);if (!event)
Signature · 1 line
1.7.10.4