Re: [RFC PATCH v2] ftrace: support very early function tracing

2017-11-08 Thread Peter Zijlstra
On Wed, Nov 08, 2017 at 02:19:07PM -0500, Steven Rostedt wrote: > On Wed, 8 Nov 2017 20:07:27 +0100 > Peter Zijlstra wrote: > > > Depends on how early you need things; ideally you'd be able to use the > > Well, he starts tracing at the entry of start_kernel(), would this > handle that? You'll h

Re: [RFC PATCH v2] ftrace: support very early function tracing

2017-11-08 Thread Steven Rostedt
On Wed, 8 Nov 2017 20:07:27 +0100 Peter Zijlstra wrote: > Depends on how early you need things; ideally you'd be able to use the Well, he starts tracing at the entry of start_kernel(), would this handle that? -- Steve > stuff from here: > > > https://lkml.kernel.org/r/1504116205-355281-1-g

Re: [RFC PATCH v2] ftrace: support very early function tracing

2017-11-08 Thread Steven Rostedt
On Wed, 08 Nov 2017 18:44:39 + Abderrahmane Benbachir wrote: > I implemented the ring_buffer_set_clock solution and I have some questions. > > > void __init ftrace_early_fill_ringbuffer(void *data) > { > ... > ring_buffer_set_clock(tr->trace_buffer.buffer, early_trace_clock); >

Re: [RFC PATCH v2] ftrace: support very early function tracing

2017-11-08 Thread Peter Zijlstra
On Wed, Nov 08, 2017 at 11:07:57AM -0500, Steven Rostedt wrote: > On Wed, 8 Nov 2017 09:10:58 +0100 > Peter Zijlstra wrote: > > > On Tue, Nov 07, 2017 at 09:17:06PM -0500, Steven Rostedt wrote: > > > > +#ifdef CONFIG_X86_TSC > > > > + entry->clock = rdtsc(); > > > > +#else > > > > + e

Re: [RFC PATCH v2] ftrace: support very early function tracing

2017-11-08 Thread Abderrahmane Benbachir
I implemented the ring_buffer_set_clock solution and I have some questions. void __init ftrace_early_fill_ringbuffer(void *data) { ... ring_buffer_set_clock(tr->trace_buffer.buffer, early_trace_clock); preempt_disable_notrace(); for (i = 0; i < vearly_entries_count; i++)

Re: [RFC PATCH v2] ftrace: support very early function tracing

2017-11-08 Thread Steven Rostedt
On Wed, 8 Nov 2017 09:10:58 +0100 Peter Zijlstra wrote: > On Tue, Nov 07, 2017 at 09:17:06PM -0500, Steven Rostedt wrote: > > > +#ifdef CONFIG_X86_TSC > > > + entry->clock = rdtsc(); > > > +#else > > > + entry->clock = trace_clock_local(); > > > +#endif > > > > +#ifdef CONFIG_X86_TSC > > > + c

Re: [RFC PATCH v2] ftrace: support very early function tracing

2017-11-08 Thread Abderrahmane Benbachir
Steven Rostedt a écrit : ring_buffer_set_clock(tr->trace_buffer.buffer, early_trace_clock); Then have: static u64 early_timestamp __initdata; static __init u64 early_trace_clock(void) { return early_timestamp; } Then we can have: + p

Re: [RFC PATCH v2] ftrace: support very early function tracing

2017-11-08 Thread Peter Zijlstra
On Tue, Nov 07, 2017 at 09:17:06PM -0500, Steven Rostedt wrote: > > +#ifdef CONFIG_X86_TSC > > + entry->clock = rdtsc(); > > +#else > > + entry->clock = trace_clock_local(); > > +#endif > > +#ifdef CONFIG_X86_TSC > > + cpu_khz = native_calibrate_cpu(); > > +#endif > > +#ifdef CONFIG_X86_TSC

Re: [RFC PATCH v2] ftrace: support very early function tracing

2017-11-07 Thread Steven Rostedt
On Tue, 07 Nov 2017 18:44:05 -0500 Abderrahmane Benbachir wrote: > Hi Steve, > > I updated the patch with all the fixes except for update timestamp part. > > I used ftrace_export as you suggested, but I don't know how to hook to  > ringbuffer to update the timestamp, I used the same way as befo

[RFC PATCH v2] ftrace: support very early function tracing

2017-11-07 Thread Abderrahmane Benbachir
Hi Steve, I updated the patch with all the fixes except for update timestamp part. I used ftrace_export as you suggested, but I don't know how to hook to  ringbuffer to update the timestamp, I used the same way as before to update the time_delta in function ftrace_vearly_export_write. static u64