Allow instances to independently set trace options.
Subsystems (4)
cover Allow instances to independently set trace options.
Currently, the trace options are global, and shared among all instances. This patchset allows instances to set certain trace options independently, without affecting the global instance or other instances. With this change, trace_overwrite will become an instance specific option, while others remain global options.
This is achieved in three steps
1. Replace references to the global trace_flags mask with get/set accessors. This allows global trace_flags to be replaced by instance specific flags in step 2.
2. Replace the global trace_flags mask with instance specific trace_flags from the trace_array. Divide the set of trace options into global options, and instance options (that may be set independently by instances).
3. Make trace_overwrite an instance specific option.
Bharath Ravi (3):
tracing: Replace usage of trace_flags with new accessors.
tracing: Allow instances to have independent trace flags/trace
options.
tracing: Allow instances to independently set trace_overwrite.
kernel/trace/blktrace.c | 3 +- kernel/trace/ftrace.c | 4 +- kernel/trace/trace.c | 127 +++++++++++++++++++++++++---------- kernel/trace/trace.h | 48 ++++++------- kernel/trace/trace_events.c | 2 +- kernel/trace/trace_functions_graph.c | 10 +-- kernel/trace/trace_irqsoff.c | 4 +- kernel/trace/trace_kdb.c | 6 +- kernel/trace/trace_output.c | 8 +-- kernel/trace/trace_printk.c | 8 +-- kernel/trace/trace_sched_wakeup.c | 3 +- kernel/trace/trace_syscalls.c | 2 +- 12 files changed, 143 insertions(+), 82 deletions(-)
Signature · 1 line
1.9.1.423.g4596e3a
PATCH 1/3 tracing: Replace usage of trace_flags with new accessors.
The trace_flags global variable stores various trace options that are shared across all ftrace instances. This patch adds accessors function for trace_flags - a getter and a setter - and replaces usages of trace_flags with these.
This is in preparation for replacing the global trace_flags with instance specific (local) trace_flags, allowing each instance to set trace_flags independently.
--- kernel/trace/blktrace.c | 3 +- kernel/trace/ftrace.c | 4 +-- kernel/trace/trace.c | 64 ++++++++++++++++++++++-------------- kernel/trace/trace.h | 2 ++ kernel/trace/trace_events.c | 2 +- kernel/trace/trace_functions_graph.c | 10 +++--- kernel/trace/trace_irqsoff.c | 4 +-- kernel/trace/trace_kdb.c | 6 ++-- kernel/trace/trace_output.c | 8 ++--- kernel/trace/trace_printk.c | 8 ++--- kernel/trace/trace_sched_wakeup.c | 3 +- kernel/trace/trace_syscalls.c | 2 +- 12 files changed, 68 insertions(+), 48 deletions(-)
kernel/trace/blktrace.c +2 -1
@@ -1368,7 +1368,7 @@ static enum print_line_t print_one_line(struct trace_iterator *iter, t =te_blk_io_trace (iter->ent); what = t->action & ((1 <<BLK_TC_SHIFT ) -1 ); - long_act = !!(trace_flags &TRACE_ITER_VERBOSE ); + long_act = !!(global_trace_flags () &TRACE_ITER_VERBOSE ); log_action = classic ? &blk_log_action_classic : &blk_log_action;if (t->action ==BLK_TN_MESSAGE ) {
@@ -1429,6 +1429,7 @@ static enum print_line_t blk_tracer_print_line(struct trace_iterator *iter)static int blk_tracer_set_flag (u32 old_flags,u32 bit,int set) { +unsigned long trace_flags =global_trace_flags ();/* don't output context-info for blk_classic output */ if (bit ==TRACE_BLK_OPT_CLASSIC ) {if (set)
kernel/trace/ftrace.c +2 -2
@@ -939,7 +939,7 @@ static void profile_graph_return(struct ftrace_graph_ret *trace) calltime = trace->rettime - trace->calltime; -if (!(trace_flags &TRACE_ITER_GRAPH_TIME )) { +if (!(global_trace_flags () &TRACE_ITER_GRAPH_TIME )) {int index; index = trace->depth;
@@ -4979,7 +4979,7 @@ ftrace_graph_probe_sched_switch(void *ignore,* Does the user want to count the time a function was asleep. * If so, do not update the time stamps. */ -if (trace_flags &TRACE_ITER_SLEEP_TIME ) +if (global_trace_flags () &TRACE_ITER_SLEEP_TIME )return ; timestamp =trace_clock_local ();
kernel/trace/trace.c +39 -25
229 lines not on this page · raw message
kernel/trace/trace.h +2 -0
@@ -705,6 +705,8 @@ void trace_printk_seq(struct trace_seq *s);enum print_line_t print_trace_line (struct trace_iterator *iter);extern unsigned long trace_flags; +unsigned long global_trace_flags (void ); +void set_global_trace_flags (unsigned long flags);/* Standard output formatting function used for function return traces */ #ifdef CONFIG_FUNCTION_GRAPH_TRACER
kernel/trace/trace_events.c +1 -1
@@ -320,7 +320,7 @@ static int __ftrace_event_enable_disable(struct ftrace_event_file *file,if (soft_disable)set_bit (FTRACE_EVENT_FL_SOFT_DISABLED_BIT , &file->flags); -if (trace_flags &TRACE_ITER_RECORD_CMD ) { +if (global_trace_flags () &TRACE_ITER_RECORD_CMD ) {tracing_start_cmdline_record ();set_bit (FTRACE_EVENT_FL_RECORDED_CMD_BIT , &file->flags); }
kernel/trace/trace_functions_graph.c +6 -4
@@ -675,7 +675,7 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr, addr >= (unsigned long)__irqentry_text_end)return TRACE_TYPE_UNHANDLED ; -if (trace_flags &TRACE_ITER_CONTEXT_INFO ) { +if (global_trace_flags () &TRACE_ITER_CONTEXT_INFO ) {/* Absolute time */ if (flags &TRACE_GRAPH_PRINT_ABS_TIME ) { ret =print_graph_abs_time (iter->ts, s);
@@ -775,7 +775,7 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s,int ret =-1 ;if (!(flags &TRACE_GRAPH_PRINT_DURATION ) || - !(trace_flags &TRACE_ITER_CONTEXT_INFO )) + !(global_trace_flags () &TRACE_ITER_CONTEXT_INFO ))return TRACE_TYPE_HANDLED ;/* No real adata, just filling the column with spaces */
@@ -932,6 +932,7 @@ print_graph_prologue(struct trace_iterator *iter, struct trace_seq *s,struct trace_entry *ent = iter->ent;int cpu = iter->cpu;int ret; +unsigned long trace_flags =global_trace_flags ();/* Pid */ if (verif_pid (s, ent->pid, cpu, data) ==TRACE_TYPE_PARTIAL_LINE )
@@ -1208,7 +1209,7 @@ static enum print_line_t print_graph_comment(struct trace_seq *s, struct trace_entry *ent, struct trace_iterator *iter, u32 flags) { - unsigned long sym_flags = (trace_flags & TRACE_ITER_SYM_MASK); + unsigned long sym_flags = (global_trace_flags() & TRACE_ITER_SYM_MASK);struct fgraph_data *data = iter->private;struct trace_event *event;int depth =0 ;
@@ -1371,7 +1372,7 @@ static void print_lat_header(struct seq_file *s, u32 flags)static void __print_graph_headers_flags (struct seq_file *s,u32 flags) { -int lat = trace_flags &TRACE_ITER_LATENCY_FMT ; +int lat =global_trace_flags () &TRACE_ITER_LATENCY_FMT ;if (lat)print_lat_header (s, flags);
@@ -1412,6 +1413,7 @@ void print_graph_headers(struct seq_file *s)void print_graph_headers_flags (struct seq_file *s,u32 flags) { +unsigned long trace_flags =global_trace_flags ();struct trace_iterator *iter = s->private;if (!(trace_flags &TRACE_ITER_CONTEXT_INFO ))
kernel/trace/trace_irqsoff.c +2 -2
@@ -532,7 +532,7 @@ void trace_preempt_off(unsigned long a0, unsigned long a1)static int register_irqsoff_function (int graph,int set) {int ret; - +unsigned long trace_flags =global_trace_flags ();/* 'set' is set if TRACE_ITER_FUNCTION is about to be set */ if (function_enabled || (!set && !(trace_flags &TRACE_ITER_FUNCTION )))return 0 ;
@@ -601,7 +601,7 @@ static void stop_irqsoff_tracer(struct trace_array *tr, int graph)static void __irqsoff_tracer_init (struct trace_array *tr) { - save_flags = trace_flags; + save_flags =global_trace_flags ();/* non overwrite screws up the latency tracers */ set_tracer_flag (tr,TRACE_ITER_OVERWRITE ,1 );
kernel/trace/trace_kdb.c +3 -3
@@ -29,10 +29,10 @@ static void ftrace_dump_buf(int skip_lines, long cpu_file)atomic_inc (&per_cpu_ptr (iter.trace_buffer->data, cpu)->disabled); } - old_userobj = trace_flags; + old_userobj =global_trace_flags ();/* don't look at user memory in panic mode */ - trace_flags &= ~TRACE_ITER_SYM_USEROBJ ; +set_trace_flags (global_trace_flags () & ~TRACE_ITER_SYM_USEROBJ );kdb_printf ("Dumping ftrace buffer:\n" );
@@ -80,7 +80,7 @@ static void ftrace_dump_buf(int skip_lines, long cpu_file)kdb_printf ("---------------------------------\n" ); out: - trace_flags = old_userobj; +set_trace_flags (old_userobj);for_each_tracing_cpu (cpu) {atomic_dec (&per_cpu_ptr (iter.trace_buffer->data, cpu)->disabled);
kernel/trace/trace_output.c +4 -4
@@ -534,7 +534,7 @@ seq_print_userip_objs(const struct userstack_entry *entry, struct trace_seq *s,int ret =1 ;unsigned int i; -if (trace_flags &TRACE_ITER_SYM_USEROBJ ) { +if (global_trace_flags () &TRACE_ITER_SYM_USEROBJ ) {struct task_struct *task;/* * we do the lookup on the thread group leader,
@@ -672,7 +672,7 @@ static unsigned long preempt_mark_thresh_us = 100;static int lat_print_timestamp (struct trace_iterator *iter,u64 next_ts) { -unsigned long verbose = trace_flags &TRACE_ITER_VERBOSE ; +unsigned long verbose =global_trace_flags () &TRACE_ITER_VERBOSE ;unsigned long in_ns = iter->iter_flags &TRACE_FILE_TIME_IN_NS ;unsigned long long abs_ts = iter->ts - iter->trace_buffer->time_start;unsigned long long rel_ts = next_ts - iter->ts;
@@ -725,7 +725,7 @@ int trace_print_context(struct trace_iterator *iter)if (!ret)return 0 ; -if (trace_flags &TRACE_ITER_IRQ_INFO ) { +if (global_trace_flags () &TRACE_ITER_IRQ_INFO ) { ret =trace_print_lat_fmt (s, entry);if (!ret)return 0 ;
@@ -750,7 +750,7 @@ int trace_print_lat_context(struct trace_iterator *iter)struct trace_entry *entry = iter->ent, *next_entry =trace_find_next_entry (iter,NULL , &next_ts); -unsigned long verbose = (trace_flags &TRACE_ITER_VERBOSE ); +unsigned long verbose = (global_trace_flags () &TRACE_ITER_VERBOSE );/* Restore the original ent_size */ iter->ent_size = ent_size;
kernel/trace/trace_printk.c +4 -4
@@ -194,7 +194,7 @@ int __trace_bprintk(unsigned long ip, const char *fmt, ...)if (unlikely (!fmt))return 0 ; -if (!(trace_flags &TRACE_ITER_PRINTK )) +if (!(global_trace_flags () &TRACE_ITER_PRINTK ))return 0 ;va_start (ap, fmt);
@@ -209,7 +209,7 @@ int __ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap)if (unlikely (!fmt))return 0 ; -if (!(trace_flags &TRACE_ITER_PRINTK )) +if (!(global_trace_flags () &TRACE_ITER_PRINTK ))return 0 ;return trace_vbprintk (ip, fmt, ap);
@@ -221,7 +221,7 @@ int __trace_printk(unsigned long ip, const char *fmt, ...)int ret;va_list ap; -if (!(trace_flags &TRACE_ITER_PRINTK )) +if (!(global_trace_flags () &TRACE_ITER_PRINTK ))return 0 ;va_start (ap, fmt);
@@ -233,7 +233,7 @@ EXPORT_SYMBOL_GPL(__trace_printk);int __ftrace_vprintk (unsigned long ip,const char *fmt,va_list ap) { -if (!(trace_flags &TRACE_ITER_PRINTK )) +if (!(global_trace_flags () &TRACE_ITER_PRINTK ))return 0 ;return trace_vprintk (ip, fmt, ap);
kernel/trace/trace_sched_wakeup.c +2 -1
@@ -141,6 +141,7 @@ static struct ftrace_ops trace_ops __read_mostly =static int register_wakeup_function (int graph,int set) {int ret; +int trace_flags =global_trace_flags ();/* 'set' is set if TRACE_ITER_FUNCTION is about to be set */ if (function_enabled || (!set && !(trace_flags &TRACE_ITER_FUNCTION )))
@@ -605,7 +606,7 @@ static void stop_wakeup_tracer(struct trace_array *tr)static int __wakeup_tracer_init (struct trace_array *tr) { - save_flags = trace_flags; + save_flags =global_trace_flags ();/* non overwrite screws up the latency tracers */ set_tracer_flag (tr,TRACE_ITER_OVERWRITE ,1 );
kernel/trace/trace_syscalls.c +1 -1
@@ -134,7 +134,7 @@ print_syscall_enter(struct trace_iterator *iter, int flags,for (i =0 ; i < entry->nb_args; i++) {/* parameter types */ -if (trace_flags &TRACE_ITER_VERBOSE ) { +if (global_trace_flags () &TRACE_ITER_VERBOSE ) { ret =trace_seq_printf (s,"%s " , entry->types[i]);if (!ret)return TRACE_TYPE_PARTIAL_LINE ;
Signature · 1 line
1.9.1.423.g4596e3a
Steven Rostedt
maintainerRe: [PATCH 1/3] tracing: Replace usage of trace_flags with new accessors.
Quoted 30 lines · On Mon, 24 Mar 2014 11:13:44 -0700 Bharath Ravi <[email protected]> wrote:
The
trace_flagsglobal variable stores various trace options that are shared across all ftrace instances. This patch adds accessors function fortrace_flags- a getter and a setter - and replaces usages oftrace_flagswith these.This is in preparation for replacing the global
trace_flagswith instance specific (local)trace_flags, allowing each instance to settrace_flagsindependently.Signed-off-by Bharath Ravi <[email protected]>--- kernel/trace/blktrace.c | 3 +- kernel/trace/ftrace.c | 4 +-- kernel/trace/trace.c | 64 ++++++++++++++++++++++-------------- kernel/trace/trace.h | 2 ++ kernel/trace/trace_events.c | 2 +- kernel/trace/trace_functions_graph.c | 10 +++--- kernel/trace/trace_irqsoff.c | 4 +-- kernel/trace/trace_kdb.c | 6 ++-- kernel/trace/trace_output.c | 8 ++--- kernel/trace/trace_printk.c | 8 ++--- kernel/trace/trace_sched_wakeup.c | 3 +- kernel/trace/trace_syscalls.c | 2 +- 12 files changed, 68 insertions(+), 48 deletions(-)kernel/trace/blktrace.c +0
-0
kernel/trace/blktrace.c static enum print_line_t print_one_line(struct trace_iterator *iter, · line 1371
Quoted 5 lines
kernel/trace/blktrace.c +1
-1@@ -1368,7 +1368,7 @@ static enum print_line_t print_one_line(struct trace_iterator *iter, t =te_blk_io_trace (iter->ent); what = t->action & ((1 <<BLK_TC_SHIFT ) -1 ); - long_act = !!(trace_flags &TRACE_ITER_VERBOSE ); + long_act = !!(global_trace_flags () &TRACE_ITER_VERBOSE );
Instead of having a global_trace_flags() function, use the trace_array that each tracer has. For here:
tr->trace_flags;
As if you look at my for-next branch, several tracers can now be called by instance not just by the top directory.
-- Steve
Quoted 11 lines
kernel/trace/blktrace.c +1
-0log_action = classic ? &blk_log_action_classic : &blk_log_action;if (t->action ==BLK_TN_MESSAGE ) {@@ -1429,6 +1429,7 @@ static enum print_line_t blk_tracer_print_line(struct trace_iterator *iter)static int blk_tracer_set_flag (u32 old_flags,u32 bit,int set) { +unsigned long trace_flags =global_trace_flags ();/* don't output context-info for blk_classic output */ if (bit ==TRACE_BLK_OPT_CLASSIC ) {if (set)
PATCH 2/3 tracing: Allow instances to have independent trace flags/trace options.
In reply to Bharath RaviCurrently, the trace options are global, and shared among all instances. This change divides the set of trace options into global options and instance specific options. This division is done by using a "global_flags_start" offset in the list of available trace options, that marks the first global trace option, and is preceded by options that are instance specific.
Instance specific options may be set independently by an instance without affecting either the global tracer or other instances. Global options are viewable and modifiable only from the global tracer, preventing instances from modifying shared flags.
Currently, there are no instance specific options (global_flags_start is set to 0). This patch only adds the infrastructure for allowing instance specific trace options. Subsequently, options may be made instance specific by changing global_flags_start and moving the option to a position less than global_flags_start in the trace_options list.
--- kernel/trace/trace.c | 73 ++++++++++++++++++++++++++++++++++++++++------------ kernel/trace/trace.h | 2 +- 2 files changed, 57 insertions(+), 18 deletions(-)
kernel/trace/trace.c +56 -17
@@ -406,20 +406,24 @@ static inline void trace_access_lock_init(void)#endif -/* trace_flags holds trace_options default values */ -unsigned long trace_flags =TRACE_ITER_PRINT_PARENT |TRACE_ITER_PRINTK | -TRACE_ITER_ANNOTATE |TRACE_ITER_CONTEXT_INFO |TRACE_ITER_SLEEP_TIME | -TRACE_ITER_GRAPH_TIME |TRACE_ITER_RECORD_CMD |TRACE_ITER_OVERWRITE | -TRACE_ITER_IRQ_INFO |TRACE_ITER_MARKERS |TRACE_ITER_FUNCTION ; +/* Sets default values for a tracer's trace_options */ +static inline void init_trace_flags (unsigned long *trace_flags) +{ + *trace_flags =TRACE_ITER_PRINT_PARENT |TRACE_ITER_PRINTK | +TRACE_ITER_ANNOTATE |TRACE_ITER_CONTEXT_INFO | +TRACE_ITER_SLEEP_TIME |TRACE_ITER_GRAPH_TIME | +TRACE_ITER_RECORD_CMD |TRACE_ITER_OVERWRITE | +TRACE_ITER_IRQ_INFO |TRACE_ITER_MARKERS |TRACE_ITER_FUNCTION ; +}unsigned long global_trace_flags (void ) { -return trace_flags; +return global_trace.trace_flags; }void set_global_trace_flags (unsigned long flags) { - trace_flags = flags; + global_trace.trace_flags = flags; }static void tracer_tracing_on (struct trace_array *tr)
@@ -799,6 +803,13 @@ static const char *trace_options[] = {NULL }; +/* +* The index of the first global flag in trace_options. Indices higher than or +* equal to this are global flags, while indices smaller than this are +* per-instance flags. +*/ +static const int global_flags_start; + static struct { u64 (*func)(void); const char *name;
@@ -3333,13 +3344,23 @@ static int tracing_trace_options_show(struct seq_file *m, void *v) tracer_flags = tr->current_trace->flags->val; trace_opts = tr->current_trace->flags->opts; -for (i =0 ; trace_options[i]; i++) { -if (global_trace_flags () & (1 << i)) +for (i =0 ; i < global_flags_start; i++) { +if (tr->trace_flags & (1 << i))seq_printf (m,"%s\n" , trace_options[i]);else seq_printf (m,"no%s\n" , trace_options[i]); } +/* For the global trace, also display global options*/ +if (tr->flags &TRACE_ARRAY_FL_GLOBAL ) { +for (i = global_flags_start; trace_options[i]; i++) { +if (global_trace_flags () & (1 << i)) +seq_printf (m,"%s\n" , trace_options[i]); +else +seq_printf (m,"no%s\n" , trace_options[i]); + } + } +for (i =0 ; trace_opts[i].name; i++) {if (tracer_flags & trace_opts[i].bit)seq_printf (m,"%s\n" , trace_opts[i].name);
@@ -3397,9 +3418,14 @@ int trace_keep_overwrite(struct tracer *tracer, u32 mask, int set)int set_tracer_flag (struct trace_array *tr,unsigned int mask,int enabled) { -unsigned long trace_flags =global_trace_flags (); +/* If this is a global flag, disallow instances from modifying it. */ +if (mask >= (1 << global_flags_start) && + !(tr->flags &TRACE_ARRAY_FL_GLOBAL )) +return -EINVAL ; + +/* do nothing if flag is already set */ -if (!!(trace_flags & mask) == !!enabled) +if (!!(tr->trace_flags & mask) == !!enabled)return 0 ;/* Give the tracer a chance to approve the change */
@@ -3408,9 +3434,9 @@ int set_tracer_flag(struct trace_array *tr, unsigned int mask, int enabled)return -EINVAL ;if (enabled) - trace_flags |= mask; + tr->trace_flags |= mask;else - trace_flags &= ~mask; + tr->trace_flags &= ~mask;if (mask ==TRACE_ITER_RECORD_CMD )trace_event_enable_cmd_record (enabled);
@@ -3434,6 +3460,7 @@ static int trace_set_options(struct trace_array *tr, char *option)int neg =0 ;int ret = -ENODEV ;int i; +bool option_found = false; cmp =strstrip (option);
@@ -3444,15 +3471,26 @@ static int trace_set_options(struct trace_array *tr, char *option)mutex_lock (&trace_types_lock); -for (i =0 ; trace_options[i]; i++) { +for (i =0 ; i < global_flags_start; i++) {if (strcmp (cmp, trace_options[i]) ==0 ) { ret =set_tracer_flag (tr,1 << i, !neg);break ; } } +if (i < global_flags_start) { + option_found = true; + }else if (tr->flags &TRACE_ARRAY_FL_GLOBAL ) { +/* If this is the global trace, try the global options */ +for (i = global_flags_start; trace_options[i]; i++) { + ret =set_tracer_flag (tr,1 << i, !neg); +break ; + } + option_found = trace_options[i]; + } +/* If no option could be set, test the specific tracer options */ -if (!trace_options[i]) +if (!option_found) ret =set_tracer_option (tr->current_trace, cmp, neg);mutex_unlock (&trace_types_lock);
@@ -5967,9 +6005,8 @@ static int allocate_trace_buffer(struct trace_array *tr, struct trace_buffer *buf, int size) { enum ring_buffer_flags rb_flags; -unsigned long trace_flags =global_trace_flags (); - rb_flags = trace_flags &TRACE_ITER_OVERWRITE ?RB_FL_OVERWRITE :0 ; + rb_flags = tr->trace_flags &TRACE_ITER_OVERWRITE ?RB_FL_OVERWRITE :0 ; buf->tr = tr;
@@ -6045,6 +6082,7 @@ static int new_instance_create(const char *name)cpumask_copy (tr->tracing_cpumask, cpu_all_mask);raw_spin_lock_init (&tr->start_lock); +init_trace_flags (&(tr->trace_flags)); tr->current_trace = &nop_trace;
@@ -6507,6 +6545,7 @@ __init static int tracer_alloc_buffers(void)cpumask_copy (global_trace.tracing_cpumask, cpu_all_mask);raw_spin_lock_init (&global_trace.start_lock); +init_trace_flags (&global_trace.trace_flags);/* TODO: make the number of buffers hot pluggable with CPUS */ if (allocate_trace_buffers (&global_trace, ring_buf_size) <0 ) {
kernel/trace/trace.h +1 -1
@@ -201,6 +201,7 @@ struct trace_array {int clock_id;struct tracer *current_trace;unsigned int flags; +unsigned long trace_flags;raw_spinlock_t start_lock;struct dentry *dir;struct dentry *options;
@@ -704,7 +705,6 @@ int trace_array_printk_buf(struct ring_buffer *buffer,void trace_printk_seq (struct trace_seq *s);enum print_line_t print_trace_line (struct trace_iterator *iter); -extern unsigned long trace_flags;unsigned long global_trace_flags (void );void set_global_trace_flags (unsigned long flags);
Signature · 1 line
1.9.1.423.g4596e3a
PATCH 3/3 tracing: Allow instances to independently set trace_overwrite.
In reply to Bharath RaviThis patch makes "trace_overwrite" an instance specific flag, so that instances may independently control whether their buffers are in overwrite mode or not.
To do this, the global_flags_start offset is set to 1, and the trace_overwrite flag is moved to position 0 in the trace_options array.
--- kernel/trace/trace.c | 6 ++++-- kernel/trace/trace.h | 44 +++++++++++++++++++-------------------- kernel/trace/trace_irqsoff.c | 2 +- kernel/trace/trace_sched_wakeup.c | 2 +- 4 files changed, 28 insertions(+), 26 deletions(-)
kernel/trace/trace.c +4 -2
@@ -774,6 +774,9 @@ unsigned long nsecs_to_usecs(unsigned long nsecs)/* These must match the bit postions in trace_iterator_flags */ static const char *trace_options[] = { +/* Instance specific flags */ +"overwrite" , +/* Global flags */ "print-parent" ,"sym-offset" ,"sym-addr" ,
@@ -795,7 +798,6 @@ static const char *trace_options[] = {"sleep-time" ,"graph-time" ,"record-cmd" , -"overwrite" ,"disable_on_free" ,"irq-info" , "markers",
@@ -808,7 +810,7 @@ static const char *trace_options[] = {* equal to this are global flags, while indices smaller than this are * per-instance flags. */ -static const int global_flags_start; +static const int global_flags_start =1 ; static struct { u64 (*func)(void);
kernel/trace/trace.h +22 -22
50 lines not on this page · raw message
kernel/trace/trace_irqsoff.c +1 -1
@@ -601,7 +601,7 @@ static void stop_irqsoff_tracer(struct trace_array *tr, int graph)static void __irqsoff_tracer_init (struct trace_array *tr) { - save_flags =global_trace_flags (); + save_flags = tr->trace_flags;/* non overwrite screws up the latency tracers */ set_tracer_flag (tr,TRACE_ITER_OVERWRITE ,1 );
kernel/trace/trace_sched_wakeup.c +1 -1
@@ -606,7 +606,7 @@ static void stop_wakeup_tracer(struct trace_array *tr)static int __wakeup_tracer_init (struct trace_array *tr) { - save_flags =global_trace_flags (); + save_flags = tr->trace_flags;/* non overwrite screws up the latency tracers */ set_tracer_flag (tr,TRACE_ITER_OVERWRITE ,1 );
Signature · 1 line
1.9.1.423.g4596e3a