Skip to content

Commit 84e53ff

Browse files
author
Ingo Molnar
committed
Merge branch 'tip/perf/core-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace into perf/core
Pull tracing updates from Steven Rostedt. Signed-off-by: Ingo Molnar <[email protected]>
2 parents ccf59d8 + 7bcfaf5 commit 84e53ff

24 files changed

+365
-343
lines changed

Documentation/kernel-parameters.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2859,6 +2859,22 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
28592859
to facilitate early boot debugging.
28602860
See also Documentation/trace/events.txt
28612861

2862+
trace_options=[option-list]
2863+
[FTRACE] Enable or disable tracer options at boot.
2864+
The option-list is a comma delimited list of options
2865+
that can be enabled or disabled just as if you were
2866+
to echo the option name into
2867+
2868+
/sys/kernel/debug/tracing/trace_options
2869+
2870+
For example, to enable stacktrace option (to dump the
2871+
stack trace of each event), add to the command line:
2872+
2873+
trace_options=stacktrace
2874+
2875+
See also Documentation/trace/ftrace.txt "trace options"
2876+
section.
2877+
28622878
transparent_hugepage=
28632879
[KNL]
28642880
Format: [always|madvise|never]

include/linux/ftrace_event.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@ trace_current_buffer_lock_reserve(struct ring_buffer **current_buffer,
127127
void trace_current_buffer_unlock_commit(struct ring_buffer *buffer,
128128
struct ring_buffer_event *event,
129129
unsigned long flags, int pc);
130-
void trace_nowake_buffer_unlock_commit(struct ring_buffer *buffer,
131-
struct ring_buffer_event *event,
132-
unsigned long flags, int pc);
133-
void trace_nowake_buffer_unlock_commit_regs(struct ring_buffer *buffer,
134-
struct ring_buffer_event *event,
135-
unsigned long flags, int pc,
136-
struct pt_regs *regs);
130+
void trace_buffer_unlock_commit(struct ring_buffer *buffer,
131+
struct ring_buffer_event *event,
132+
unsigned long flags, int pc);
133+
void trace_buffer_unlock_commit_regs(struct ring_buffer *buffer,
134+
struct ring_buffer_event *event,
135+
unsigned long flags, int pc,
136+
struct pt_regs *regs);
137137
void trace_current_buffer_discard_commit(struct ring_buffer *buffer,
138138
struct ring_buffer_event *event);
139139

include/linux/kernel.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -527,9 +527,6 @@ __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
527527

528528
extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode);
529529
#else
530-
static inline __printf(1, 2)
531-
int trace_printk(const char *fmt, ...);
532-
533530
static inline void tracing_start(void) { }
534531
static inline void tracing_stop(void) { }
535532
static inline void ftrace_off_permanent(void) { }
@@ -539,8 +536,8 @@ static inline void tracing_on(void) { }
539536
static inline void tracing_off(void) { }
540537
static inline int tracing_is_on(void) { return 0; }
541538

542-
static inline int
543-
trace_printk(const char *fmt, ...)
539+
static inline __printf(1, 2)
540+
int trace_printk(const char *fmt, ...)
544541
{
545542
return 0;
546543
}

include/linux/ring_buffer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,14 @@ int ring_buffer_record_is_on(struct ring_buffer *buffer);
159159
void ring_buffer_record_disable_cpu(struct ring_buffer *buffer, int cpu);
160160
void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu);
161161

162-
unsigned long ring_buffer_oldest_event_ts(struct ring_buffer *buffer, int cpu);
162+
u64 ring_buffer_oldest_event_ts(struct ring_buffer *buffer, int cpu);
163163
unsigned long ring_buffer_bytes_cpu(struct ring_buffer *buffer, int cpu);
164164
unsigned long ring_buffer_entries(struct ring_buffer *buffer);
165165
unsigned long ring_buffer_overruns(struct ring_buffer *buffer);
166166
unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu);
167167
unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu);
168168
unsigned long ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu);
169+
unsigned long ring_buffer_dropped_events_cpu(struct ring_buffer *buffer, int cpu);
169170

170171
u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu);
171172
void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer,

include/trace/ftrace.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,8 +545,7 @@ ftrace_raw_event_##call(void *__data, proto) \
545545
{ assign; } \
546546
\
547547
if (!filter_current_check_discard(buffer, event_call, entry, event)) \
548-
trace_nowake_buffer_unlock_commit(buffer, \
549-
event, irq_flags, pc); \
548+
trace_buffer_unlock_commit(buffer, event, irq_flags, pc); \
550549
}
551550
/*
552551
* The ftrace_test_probe is compiled out, it is only here as a build time check

include/trace/syscall.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,4 @@ struct syscall_metadata {
3131
struct ftrace_event_call *exit_event;
3232
};
3333

34-
#ifdef CONFIG_FTRACE_SYSCALLS
35-
extern unsigned long arch_syscall_addr(int nr);
36-
extern int init_syscall_trace(struct ftrace_event_call *call);
37-
38-
extern int reg_event_syscall_enter(struct ftrace_event_call *call);
39-
extern void unreg_event_syscall_enter(struct ftrace_event_call *call);
40-
extern int reg_event_syscall_exit(struct ftrace_event_call *call);
41-
extern void unreg_event_syscall_exit(struct ftrace_event_call *call);
42-
extern int
43-
ftrace_format_syscall(struct ftrace_event_call *call, struct trace_seq *s);
44-
enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags,
45-
struct trace_event *event);
46-
enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags,
47-
struct trace_event *event);
48-
#endif
49-
50-
#ifdef CONFIG_PERF_EVENTS
51-
int perf_sysenter_enable(struct ftrace_event_call *call);
52-
void perf_sysenter_disable(struct ftrace_event_call *call);
53-
int perf_sysexit_enable(struct ftrace_event_call *call);
54-
void perf_sysexit_disable(struct ftrace_event_call *call);
55-
#endif
56-
5734
#endif /* _TRACE_SYSCALL_H */

kernel/trace/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ config TRACING
119119
select BINARY_PRINTF
120120
select EVENT_TRACING
121121
select TRACE_CLOCK
122+
select IRQ_WORK
122123

123124
config GENERIC_TRACER
124125
bool

kernel/trace/ftrace.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2868,7 +2868,7 @@ static int __init ftrace_mod_cmd_init(void)
28682868
{
28692869
return register_ftrace_command(&ftrace_mod_cmd);
28702870
}
2871-
device_initcall(ftrace_mod_cmd_init);
2871+
core_initcall(ftrace_mod_cmd_init);
28722872

28732873
static void function_trace_probe_call(unsigned long ip, unsigned long parent_ip,
28742874
struct ftrace_ops *op, struct pt_regs *pt_regs)
@@ -4055,7 +4055,7 @@ static int __init ftrace_nodyn_init(void)
40554055
ftrace_enabled = 1;
40564056
return 0;
40574057
}
4058-
device_initcall(ftrace_nodyn_init);
4058+
core_initcall(ftrace_nodyn_init);
40594059

40604060
static inline int ftrace_init_dyn_debugfs(struct dentry *d_tracer) { return 0; }
40614061
static inline void ftrace_startup_enable(int command) { }
@@ -4381,7 +4381,7 @@ ftrace_pid_write(struct file *filp, const char __user *ubuf,
43814381
if (strlen(tmp) == 0)
43824382
return 1;
43834383

4384-
ret = strict_strtol(tmp, 10, &val);
4384+
ret = kstrtol(tmp, 10, &val);
43854385
if (ret < 0)
43864386
return ret;
43874387

kernel/trace/ring_buffer.c

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,10 @@ struct ring_buffer_per_cpu {
460460
unsigned long lost_events;
461461
unsigned long last_overrun;
462462
local_t entries_bytes;
463-
local_t commit_overrun;
464-
local_t overrun;
465463
local_t entries;
464+
local_t overrun;
465+
local_t commit_overrun;
466+
local_t dropped_events;
466467
local_t committing;
467468
local_t commits;
468469
unsigned long read;
@@ -1820,7 +1821,7 @@ rb_add_time_stamp(struct ring_buffer_event *event, u64 delta)
18201821
}
18211822

18221823
/**
1823-
* ring_buffer_update_event - update event type and data
1824+
* rb_update_event - update event type and data
18241825
* @event: the even to update
18251826
* @type: the type of event
18261827
* @length: the size of the event field in the ring buffer
@@ -2155,8 +2156,10 @@ rb_move_tail(struct ring_buffer_per_cpu *cpu_buffer,
21552156
* If we are not in overwrite mode,
21562157
* this is easy, just stop here.
21572158
*/
2158-
if (!(buffer->flags & RB_FL_OVERWRITE))
2159+
if (!(buffer->flags & RB_FL_OVERWRITE)) {
2160+
local_inc(&cpu_buffer->dropped_events);
21592161
goto out_reset;
2162+
}
21602163

21612164
ret = rb_handle_head_page(cpu_buffer,
21622165
tail_page,
@@ -2720,8 +2723,8 @@ EXPORT_SYMBOL_GPL(ring_buffer_discard_commit);
27202723
* and not the length of the event which would hold the header.
27212724
*/
27222725
int ring_buffer_write(struct ring_buffer *buffer,
2723-
unsigned long length,
2724-
void *data)
2726+
unsigned long length,
2727+
void *data)
27252728
{
27262729
struct ring_buffer_per_cpu *cpu_buffer;
27272730
struct ring_buffer_event *event;
@@ -2929,12 +2932,12 @@ rb_num_of_entries(struct ring_buffer_per_cpu *cpu_buffer)
29292932
* @buffer: The ring buffer
29302933
* @cpu: The per CPU buffer to read from.
29312934
*/
2932-
unsigned long ring_buffer_oldest_event_ts(struct ring_buffer *buffer, int cpu)
2935+
u64 ring_buffer_oldest_event_ts(struct ring_buffer *buffer, int cpu)
29332936
{
29342937
unsigned long flags;
29352938
struct ring_buffer_per_cpu *cpu_buffer;
29362939
struct buffer_page *bpage;
2937-
unsigned long ret;
2940+
u64 ret;
29382941

29392942
if (!cpumask_test_cpu(cpu, buffer->cpumask))
29402943
return 0;
@@ -2995,7 +2998,8 @@ unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu)
29952998
EXPORT_SYMBOL_GPL(ring_buffer_entries_cpu);
29962999

29973000
/**
2998-
* ring_buffer_overrun_cpu - get the number of overruns in a cpu_buffer
3001+
* ring_buffer_overrun_cpu - get the number of overruns caused by the ring
3002+
* buffer wrapping around (only if RB_FL_OVERWRITE is on).
29993003
* @buffer: The ring buffer
30003004
* @cpu: The per CPU buffer to get the number of overruns from
30013005
*/
@@ -3015,7 +3019,9 @@ unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu)
30153019
EXPORT_SYMBOL_GPL(ring_buffer_overrun_cpu);
30163020

30173021
/**
3018-
* ring_buffer_commit_overrun_cpu - get the number of overruns caused by commits
3022+
* ring_buffer_commit_overrun_cpu - get the number of overruns caused by
3023+
* commits failing due to the buffer wrapping around while there are uncommitted
3024+
* events, such as during an interrupt storm.
30193025
* @buffer: The ring buffer
30203026
* @cpu: The per CPU buffer to get the number of overruns from
30213027
*/
@@ -3035,6 +3041,28 @@ ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu)
30353041
}
30363042
EXPORT_SYMBOL_GPL(ring_buffer_commit_overrun_cpu);
30373043

3044+
/**
3045+
* ring_buffer_dropped_events_cpu - get the number of dropped events caused by
3046+
* the ring buffer filling up (only if RB_FL_OVERWRITE is off).
3047+
* @buffer: The ring buffer
3048+
* @cpu: The per CPU buffer to get the number of overruns from
3049+
*/
3050+
unsigned long
3051+
ring_buffer_dropped_events_cpu(struct ring_buffer *buffer, int cpu)
3052+
{
3053+
struct ring_buffer_per_cpu *cpu_buffer;
3054+
unsigned long ret;
3055+
3056+
if (!cpumask_test_cpu(cpu, buffer->cpumask))
3057+
return 0;
3058+
3059+
cpu_buffer = buffer->buffers[cpu];
3060+
ret = local_read(&cpu_buffer->dropped_events);
3061+
3062+
return ret;
3063+
}
3064+
EXPORT_SYMBOL_GPL(ring_buffer_dropped_events_cpu);
3065+
30383066
/**
30393067
* ring_buffer_entries - get the number of entries in a buffer
30403068
* @buffer: The ring buffer
@@ -3864,9 +3892,10 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer)
38643892
local_set(&cpu_buffer->reader_page->page->commit, 0);
38653893
cpu_buffer->reader_page->read = 0;
38663894

3867-
local_set(&cpu_buffer->commit_overrun, 0);
38683895
local_set(&cpu_buffer->entries_bytes, 0);
38693896
local_set(&cpu_buffer->overrun, 0);
3897+
local_set(&cpu_buffer->commit_overrun, 0);
3898+
local_set(&cpu_buffer->dropped_events, 0);
38703899
local_set(&cpu_buffer->entries, 0);
38713900
local_set(&cpu_buffer->committing, 0);
38723901
local_set(&cpu_buffer->commits, 0);

0 commit comments

Comments
 (0)