Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'trace-v6.13-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull tracing fixes from Steven Rostedt:

- Fix a regression in the irqsoff and wakeup latency tracing

The function graph tracer infrastructure has become generic so that
fprobes and BPF can be based on it. As it use to only handle function
graph tracing, it would always calculate the time the function
entered so that it could then calculate the time it exits and give
the length of time the function executed for. But this is not needed
for the other users (fprobes and BPF) and reading the clock adds a
non-negligible overhead, so the calculation was moved into the
function graph tracer logic.

But the irqsoff and wakeup latency tracers, when the "display-graph"
option was set, would use the function graph tracer to calculate the
times of functions during the latency. The movement of the calltime
calculation made the value zero for these tracers, and the output no
longer showed the length of time of each tracer, but instead the
absolute timestamp of when the function returned (rettime - calltime
where calltime is now zero).

Have the irqsoff and wakeup latency tracers also do the calltime
calculation as the function graph tracer does and report the proper
length of the function timings.

- Update the tracing display to reflect the new preempt lazy model

When the system is configured with preempt lazy, the output of the
trace data would state "unknown" for the current preemption model.
Because the lazy preemption model was just added, make it known to
the tracing subsystem too. This is just a one line change.

- Document multiple function graph having slightly different timings

Now that function graph tracer infrastructure is separate, this also
allows the function graph tracer to run in multiple instances (it
wasn't able to do so before). If two instances ran the function graph
tracer and traced the same functions, the timings for them will be
slightly different because each does their own timings and collects
the timestamps differently. Document this to not have people be
confused by it.

* tag 'trace-v6.13-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
ftrace: Document that multiple function_graph tracing may have different times
tracing: Print lazy preemption model
tracing: Fix irqsoff and wakeup latency tracers when using function graph

+35
+6
Documentation/trace/ftrace.rst
··· 810 810 to draw a graph of function calls similar to C code 811 811 source. 812 812 813 + Note that the function graph calculates the timings of when the 814 + function starts and returns internally and for each instance. If 815 + there are two instances that run function graph tracer and traces 816 + the same functions, the length of the timings may be slightly off as 817 + each read the timestamp separately and not at the same time. 818 + 813 819 "blk" 814 820 815 821 The block tracer. The tracer used by the blktrace user
+1
kernel/trace/trace.c
··· 4122 4122 preempt_model_none() ? "server" : 4123 4123 preempt_model_voluntary() ? "desktop" : 4124 4124 preempt_model_full() ? "preempt" : 4125 + preempt_model_lazy() ? "lazy" : 4125 4126 preempt_model_rt() ? "preempt_rt" : 4126 4127 "unknown", 4127 4128 /* These are reserved for later use */
+14
kernel/trace/trace_irqsoff.c
··· 182 182 struct trace_array_cpu *data; 183 183 unsigned long flags; 184 184 unsigned int trace_ctx; 185 + u64 *calltime; 185 186 int ret; 186 187 187 188 if (ftrace_graph_ignore_func(gops, trace)) ··· 200 199 if (!func_prolog_dec(tr, &data, &flags)) 201 200 return 0; 202 201 202 + calltime = fgraph_reserve_data(gops->idx, sizeof(*calltime)); 203 + if (!calltime) 204 + return 0; 205 + 206 + *calltime = trace_clock_local(); 207 + 203 208 trace_ctx = tracing_gen_ctx_flags(flags); 204 209 ret = __trace_graph_entry(tr, trace, trace_ctx); 205 210 atomic_dec(&data->disabled); ··· 220 213 struct trace_array_cpu *data; 221 214 unsigned long flags; 222 215 unsigned int trace_ctx; 216 + u64 *calltime; 217 + int size; 223 218 224 219 ftrace_graph_addr_finish(gops, trace); 225 220 226 221 if (!func_prolog_dec(tr, &data, &flags)) 227 222 return; 223 + 224 + calltime = fgraph_retrieve_data(gops->idx, &size); 225 + if (!calltime) 226 + return; 227 + trace->calltime = *calltime; 228 228 229 229 trace_ctx = tracing_gen_ctx_flags(flags); 230 230 __trace_graph_return(tr, trace, trace_ctx);
+14
kernel/trace/trace_sched_wakeup.c
··· 118 118 struct trace_array *tr = wakeup_trace; 119 119 struct trace_array_cpu *data; 120 120 unsigned int trace_ctx; 121 + u64 *calltime; 121 122 int ret = 0; 122 123 123 124 if (ftrace_graph_ignore_func(gops, trace)) ··· 136 135 if (!func_prolog_preempt_disable(tr, &data, &trace_ctx)) 137 136 return 0; 138 137 138 + calltime = fgraph_reserve_data(gops->idx, sizeof(*calltime)); 139 + if (!calltime) 140 + return 0; 141 + 142 + *calltime = trace_clock_local(); 143 + 139 144 ret = __trace_graph_entry(tr, trace, trace_ctx); 140 145 atomic_dec(&data->disabled); 141 146 preempt_enable_notrace(); ··· 155 148 struct trace_array *tr = wakeup_trace; 156 149 struct trace_array_cpu *data; 157 150 unsigned int trace_ctx; 151 + u64 *calltime; 152 + int size; 158 153 159 154 ftrace_graph_addr_finish(gops, trace); 160 155 161 156 if (!func_prolog_preempt_disable(tr, &data, &trace_ctx)) 162 157 return; 158 + 159 + calltime = fgraph_retrieve_data(gops->idx, &size); 160 + if (!calltime) 161 + return; 162 + trace->calltime = *calltime; 163 163 164 164 __trace_graph_return(tr, trace, trace_ctx); 165 165 atomic_dec(&data->disabled);