Skip to content

Commit 9b1f61d

Browse files
committed
Merge tag 'trace-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing updates from Steven Rostedt: "New feature: - A new "func-no-repeats" option in tracefs/options directory. When set the function tracer will detect if the current function being traced is the same as the previous one, and instead of recording it, it will keep track of the number of times that the function is repeated in a row. And when another function is recorded, it will write a new event that shows the function that repeated, the number of times it repeated and the time stamp of when the last repeated function occurred. Enhancements: - In order to implement the above "func-no-repeats" option, the ring buffer timestamp can now give the accurate timestamp of the event as it is being recorded, instead of having to record an absolute timestamp for all events. This helps the histogram code which no longer needs to waste ring buffer space. - New validation logic to make sure all trace events that access dereferenced pointers do so in a safe way, and will warn otherwise. Fixes: - No longer limit the PIDs of tasks that are recorded for "saved_cmdlines" to PID_MAX_DEFAULT (32768), as systemd now allows for a much larger range. This caused the mapping of PIDs to the task names to be dropped for all tasks with a PID greater than 32768. - Change trace_clock_global() to never block. This caused a deadlock. Clean ups: - Typos, prototype fixes, and removing of duplicate or unused code. - Better management of ftrace_page allocations" * tag 'trace-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (32 commits) tracing: Restructure trace_clock_global() to never block tracing: Map all PIDs to command lines ftrace: Reuse the output of the function tracer for func_repeats tracing: Add "func_no_repeats" option for function tracing tracing: Unify the logic for function tracing options tracing: Add method for recording "func_repeats" events tracing: Add "last_func_repeats" to struct trace_array tracing: Define new ftrace event "func_repeats" tracing: Define static void trace_print_time() ftrace: Simplify the calculation of page number for ftrace_page->records some more ftrace: Store the order of pages allocated in ftrace_page tracing: Remove unused argument from "ring_buffer_time_stamp() tracing: Remove duplicate struct declaration in trace_events.h tracing: Update create_system_filter() kernel-doc comment tracing: A minor cleanup for create_system_filter() kernel: trace: Mundane typo fixes in the file trace_events_filter.c tracing: Fix various typos in comments scripts/recordmcount.pl: Make vim and emacs indent the same scripts/recordmcount.pl: Make indent spacing consistent tracing: Add a verifier to check string pointers for trace events ...
2 parents 6f8ee8d + aafe104 commit 9b1f61d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1187
-297
lines changed

arch/microblaze/include/asm/ftrace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ extern void ftrace_call_graph(void);
1313
#endif
1414

1515
#ifdef CONFIG_DYNAMIC_FTRACE
16-
/* reloction of mcount call site is the same as the address */
16+
/* relocation of mcount call site is the same as the address */
1717
static inline unsigned long ftrace_call_adjust(unsigned long addr)
1818
{
1919
return addr;

arch/nds32/kernel/ftrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ void __naked return_to_handler(void)
236236
"bal ftrace_return_to_handler\n\t"
237237
"move $lp, $r0 \n\t"
238238

239-
/* restore state nedded by the ABI */
239+
/* restore state needed by the ABI */
240240
"lmw.bim $r0,[$sp],$r1,#0x0 \n\t");
241241
}
242242

arch/powerpc/include/asm/ftrace.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#ifdef __ASSEMBLY__
1414

15-
/* Based off of objdump optput from glibc */
15+
/* Based off of objdump output from glibc */
1616

1717
#define MCOUNT_SAVE_FRAME \
1818
stwu r1,-48(r1); \
@@ -52,7 +52,7 @@ extern void _mcount(void);
5252

5353
static inline unsigned long ftrace_call_adjust(unsigned long addr)
5454
{
55-
/* reloction of mcount call site is the same as the address */
55+
/* relocation of mcount call site is the same as the address */
5656
return addr;
5757
}
5858

arch/sh/kernel/ftrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
6767
* Modifying code must take extra care. On an SMP machine, if
6868
* the code being modified is also being executed on another CPU
6969
* that CPU will have undefined results and possibly take a GPF.
70-
* We use kstop_machine to stop other CPUS from exectuing code.
70+
* We use kstop_machine to stop other CPUS from executing code.
7171
* But this does not stop NMIs from happening. We still need
7272
* to protect against that. We separate out the modification of
7373
* the code to take care of this.

arch/sparc/include/asm/ftrace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ void _mcount(void);
1717
#endif
1818

1919
#ifdef CONFIG_DYNAMIC_FTRACE
20-
/* reloction of mcount call site is the same as the address */
20+
/* relocation of mcount call site is the same as the address */
2121
static inline unsigned long ftrace_call_adjust(unsigned long addr)
2222
{
2323
return addr;

fs/tracefs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ struct dentry *tracefs_create_dir(const char *name, struct dentry *parent)
477477
*
478478
* The instances directory is special as it allows for mkdir and rmdir to
479479
* to be done by userspace. When a mkdir or rmdir is performed, the inode
480-
* locks are released and the methhods passed in (@mkdir and @rmdir) are
480+
* locks are released and the methods passed in (@mkdir and @rmdir) are
481481
* called without locks and with the name of the directory being created
482482
* within the instances directory.
483483
*

include/linux/ftrace.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
/*
3434
* If the arch's mcount caller does not support all of ftrace's
3535
* features, then it must call an indirect function that
36-
* does. Or at least does enough to prevent any unwelcomed side effects.
36+
* does. Or at least does enough to prevent any unwelcome side effects.
3737
*/
3838
#if !ARCH_SUPPORTS_FTRACE_OPS
3939
# define FTRACE_FORCE_LIST_FUNC 1
@@ -389,7 +389,7 @@ DECLARE_PER_CPU(int, disable_stack_tracer);
389389
*/
390390
static inline void stack_tracer_disable(void)
391391
{
392-
/* Preemption or interupts must be disabled */
392+
/* Preemption or interrupts must be disabled */
393393
if (IS_ENABLED(CONFIG_DEBUG_PREEMPT))
394394
WARN_ON_ONCE(!preempt_count() || !irqs_disabled());
395395
this_cpu_inc(disable_stack_tracer);

include/linux/ring_buffer.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ enum ring_buffer_type {
6161

6262
unsigned ring_buffer_event_length(struct ring_buffer_event *event);
6363
void *ring_buffer_event_data(struct ring_buffer_event *event);
64-
u64 ring_buffer_event_time_stamp(struct ring_buffer_event *event);
64+
u64 ring_buffer_event_time_stamp(struct trace_buffer *buffer,
65+
struct ring_buffer_event *event);
6566

6667
/*
6768
* ring_buffer_discard_commit will remove an event that has not
@@ -180,7 +181,7 @@ unsigned long ring_buffer_commit_overrun_cpu(struct trace_buffer *buffer, int cp
180181
unsigned long ring_buffer_dropped_events_cpu(struct trace_buffer *buffer, int cpu);
181182
unsigned long ring_buffer_read_events_cpu(struct trace_buffer *buffer, int cpu);
182183

183-
u64 ring_buffer_time_stamp(struct trace_buffer *buffer, int cpu);
184+
u64 ring_buffer_time_stamp(struct trace_buffer *buffer);
184185
void ring_buffer_normalize_time_stamp(struct trace_buffer *buffer,
185186
int cpu, u64 *ts);
186187
void ring_buffer_set_clock(struct trace_buffer *buffer,

include/linux/seq_buf.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,31 @@ static inline unsigned int seq_buf_used(struct seq_buf *s)
7171
return min(s->len, s->size);
7272
}
7373

74+
/**
75+
* seq_buf_terminate - Make sure buffer is nul terminated
76+
* @s: the seq_buf descriptor to terminate.
77+
*
78+
* This makes sure that the buffer in @s is nul terminated and
79+
* safe to read as a string.
80+
*
81+
* Note, if this is called when the buffer has overflowed, then
82+
* the last byte of the buffer is zeroed, and the len will still
83+
* point passed it.
84+
*
85+
* After this function is called, s->buffer is safe to use
86+
* in string operations.
87+
*/
88+
static inline void seq_buf_terminate(struct seq_buf *s)
89+
{
90+
if (WARN_ON(s->size == 0))
91+
return;
92+
93+
if (seq_buf_buffer_left(s))
94+
s->buffer[s->len] = 0;
95+
else
96+
s->buffer[s->size - 1] = 0;
97+
}
98+
7499
/**
75100
* seq_buf_get_buf - get buffer to write arbitrary data to
76101
* @s: the seq_buf handle

include/linux/trace_events.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static inline unsigned int tracing_gen_ctx_dec(void)
206206

207207
trace_ctx = tracing_gen_ctx();
208208
/*
209-
* Subtract one from the preeption counter if preemption is enabled,
209+
* Subtract one from the preemption counter if preemption is enabled,
210210
* see trace_event_buffer_reserve()for details.
211211
*/
212212
if (IS_ENABLED(CONFIG_PREEMPTION))
@@ -404,7 +404,6 @@ trace_get_fields(struct trace_event_call *event_call)
404404
return event_call->class->get_fields(event_call);
405405
}
406406

407-
struct trace_array;
408407
struct trace_subsystem_dir;
409408

410409
enum {
@@ -640,7 +639,8 @@ enum event_trigger_type {
640639
extern int filter_match_preds(struct event_filter *filter, void *rec);
641640

642641
extern enum event_trigger_type
643-
event_triggers_call(struct trace_event_file *file, void *rec,
642+
event_triggers_call(struct trace_event_file *file,
643+
struct trace_buffer *buffer, void *rec,
644644
struct ring_buffer_event *event);
645645
extern void
646646
event_triggers_post_call(struct trace_event_file *file,
@@ -664,7 +664,7 @@ trace_trigger_soft_disabled(struct trace_event_file *file)
664664

665665
if (!(eflags & EVENT_FILE_FL_TRIGGER_COND)) {
666666
if (eflags & EVENT_FILE_FL_TRIGGER_MODE)
667-
event_triggers_call(file, NULL, NULL);
667+
event_triggers_call(file, NULL, NULL, NULL);
668668
if (eflags & EVENT_FILE_FL_SOFT_DISABLED)
669669
return true;
670670
if (eflags & EVENT_FILE_FL_PID_FILTER)

0 commit comments

Comments
 (0)