Re: [RFC PATCH v3 4/4] trace: Trace log handler for logging into STM blocks
On Tue, 7 Jul 2015 18:10:43 +0800 Chunyan Zhang wrote: > Add the function 'trace_event_stm_output_##call' for printing events > trace log into STM blocks. > > This patch also adds a function call at where the events have been > committed to ring buffer to export the trace event information to > STM blocks. > > Signed-off-by: Chunyan Zhang > --- > include/linux/trace_events.h | 8 > include/trace/perf.h | 3 +++ > include/trace/trace_events.h | 44 > > 3 files changed, 55 insertions(+) > > diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h > index 28dcdff..705bd4e 100644 > --- a/include/linux/trace_events.h > +++ b/include/linux/trace_events.h > @@ -418,6 +418,14 @@ enum event_trigger_type { > > #ifdef CONFIG_STM_TRACE_EVENT > extern void stm_trace_event_write(const char *buf, unsigned len); > +extern void trace_event_stm_log(struct trace_event_buffer *buffer); > +extern void trace_event_buf_vprintf(struct trace_buffer_stm *tb, > + const char *fmt, ...) __attribute__ ((weak)); > +#else > +static inline void trace_event_stm_log(struct trace_event_buffer *buffer) {} > +static inline void trace_event_buf_vprintf(struct trace_buffer_stm *tb, > + const char *fmt, ...) {} > + > #endif > > extern int filter_match_preds(struct event_filter *filter, void *rec); > diff --git a/include/trace/perf.h b/include/trace/perf.h > index 1b5443c..79906de 100644 > --- a/include/trace/perf.h > +++ b/include/trace/perf.h > @@ -175,6 +175,7 @@ trace_event_raw_event_##call(void *__data, proto) > \ > { assign; } \ > \ > trace_event_buffer_commit(&fbuffer);\ > + trace_event_stm_log(&fbuffer); \ This could be moved into trace_event_buffer_commit(). > } > /* > * The ftrace_test_probe is compiled out, it is only here as a build time > check > @@ -234,6 +235,7 @@ static struct trace_event_call __used event_##call = { > \ > .event.funcs= &trace_event_type_funcs_##template, \ > .print_fmt = print_fmt_##template, \ > .flags = TRACE_EVENT_FL_TRACEPOINT,\ > + .output_stm = trace_event_stm_output_##template,\ > }; \ > static struct trace_event_call __used > \ > __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call > @@ -251,6 +253,7 @@ static struct trace_event_call __used event_##call = { > \ > .event.funcs= &trace_event_type_funcs_##call, \ > .print_fmt = print_fmt_##call, \ > .flags = TRACE_EVENT_FL_TRACEPOINT,\ > + .output_stm = trace_event_stm_output_##call,\ > }; \ > static struct trace_event_call __used > \ > __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call > diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h > index 43be3b0..db4d8a7 100644 > --- a/include/trace/trace_events.h > +++ b/include/trace/trace_events.h > @@ -303,6 +303,50 @@ TRACE_MAKE_SYSTEM_STR(); > > #undef DECLARE_EVENT_CLASS > #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) > \ > +static notrace void \ > +trace_event_stm_output_##call(struct trace_seq *tmp_seq, \ > + void *entry, \ > + struct trace_buffer_stm *trace_buf)\ > +{\ > + struct trace_event_raw_##call *field = entry; \ > + struct trace_seq *p = tmp_seq; \ > + \ > + trace_seq_init(p); \ > + \ > + trace_event_buf_vprintf(trace_buf, print); \ > + \ > + return; \ > +} > + > +#undef DEFINE_EVENT_PRINT > +#define DEFINE_EVENT_PRINT(template, call, proto, args, print) > \ > +static notrace void \ > +trace_event_stm_output_##call(struct trace_seq *tmp_seq, \ > + void *entry
Re: [RFC PATCH v3 4/4] trace: Trace log handler for logging into STM blocks
On Wed, Jul 8, 2015 at 9:19 PM, Steven Rostedt wrote: > On Wed, 8 Jul 2015 14:31:48 +0200 > Peter Zijlstra wrote: > >> On Tue, Jul 07, 2015 at 06:10:43PM +0800, Chunyan Zhang wrote: >> > Add the function 'trace_event_stm_output_##call' for printing events >> > trace log into STM blocks. >> > >> > This patch also adds a function call at where the events have been >> > committed to ring buffer to export the trace event information to >> > STM blocks. >> >> So then you have two copies of the data, why that? Would a scheme were >> data either goes to the STM or the regular buffer not make much more >> sense? >> >> > +++ b/include/trace/perf.h >> > @@ -175,6 +175,7 @@ trace_event_raw_event_##call(void *__data, proto) >> > \ >> > { assign; } \ >> > \ >> > trace_event_buffer_commit(&fbuffer);\ >> > + trace_event_stm_log(&fbuffer); \ >> >> This makes every trace event slower. > > Of course this could use a jump label. > > But I agree, I think a switch to which buffer it should be sent to is > better. I could come up with a way to make the buffer more generic, and > have it switch between where the event is recorded. > Hello Steve, Please excuse my disturbing you again. May I get more details of how you want the code (including Trace Event and STM subsystem) will be reworked? I know you are very busy, maybe I can more or less help with something. I'm eager to do that, but the problem for now is I think I'm not in the same level for the understanding of next work we need to do. Do you have an exact solution already? or some ideas you want me to try? Looking forward to your reply, thank you! Chunyan > -- Steve > >> >> > } >> > /* >> > * The ftrace_test_probe is compiled out, it is only here as a build time >> > check > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH v3 4/4] trace: Trace log handler for logging into STM blocks
On Wed, Jul 8, 2015 at 9:19 PM, Steven Rostedt wrote: > On Wed, 8 Jul 2015 14:31:48 +0200 > Peter Zijlstra wrote: > >> On Tue, Jul 07, 2015 at 06:10:43PM +0800, Chunyan Zhang wrote: >> > Add the function 'trace_event_stm_output_##call' for printing events >> > trace log into STM blocks. >> > >> > This patch also adds a function call at where the events have been >> > committed to ring buffer to export the trace event information to >> > STM blocks. >> >> So then you have two copies of the data, why that? Would a scheme were >> data either goes to the STM or the regular buffer not make much more >> sense? >> >> > +++ b/include/trace/perf.h >> > @@ -175,6 +175,7 @@ trace_event_raw_event_##call(void *__data, proto) >> > \ >> > { assign; } \ >> > \ >> > trace_event_buffer_commit(&fbuffer);\ >> > + trace_event_stm_log(&fbuffer); \ >> >> This makes every trace event slower. > > Of course this could use a jump label. > > But I agree, I think a switch to which buffer it should be sent to is > better. I could come up with a way to make the buffer more generic, and > have it switch between where the event is recorded. Thanks, Steve. It cannot be better if there will be a way to meet the requirements both of Trace event and STM. I also don't want to slow down the trace original speed after enable this feature. But I didn't find any way to achieve this ideal effect. This is just why I sent out this RFCs. And I'd also like to explain a fact about STM, which would likely need only a string of trace messages directly when the trace events happened because of its architecture. Anyway, everything is possible, let's brainstorm! If you have any question about STM, please let me know. Many thanks, Chunyan > > -- Steve > >> >> > } >> > /* >> > * The ftrace_test_probe is compiled out, it is only here as a build time >> > check > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH v3 4/4] trace: Trace log handler for logging into STM blocks
* Chunyan Zhang wrote: > >> +++ b/include/trace/perf.h > >> @@ -175,6 +175,7 @@ trace_event_raw_event_##call(void *__data, proto) > >>\ > >> { assign; } \ > >> \ > >> trace_event_buffer_commit(&fbuffer);\ > >> + trace_event_stm_log(&fbuffer); \ > > > > This makes every trace event slower. > > It doesn't actually, you may decide if enable this feature, the trace event > will > not be slowed if STM_TRACE_EVENT is not selected. It slows down everyone if a distro enables this feature - that's not acceptable. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH v3 4/4] trace: Trace log handler for logging into STM blocks
On Wed, 8 Jul 2015 14:31:48 +0200 Peter Zijlstra wrote: > On Tue, Jul 07, 2015 at 06:10:43PM +0800, Chunyan Zhang wrote: > > Add the function 'trace_event_stm_output_##call' for printing events > > trace log into STM blocks. > > > > This patch also adds a function call at where the events have been > > committed to ring buffer to export the trace event information to > > STM blocks. > > So then you have two copies of the data, why that? Would a scheme were > data either goes to the STM or the regular buffer not make much more > sense? > > > +++ b/include/trace/perf.h > > @@ -175,6 +175,7 @@ trace_event_raw_event_##call(void *__data, proto) > > \ > > { assign; } \ > > \ > > trace_event_buffer_commit(&fbuffer);\ > > + trace_event_stm_log(&fbuffer); \ > > This makes every trace event slower. Of course this could use a jump label. But I agree, I think a switch to which buffer it should be sent to is better. I could come up with a way to make the buffer more generic, and have it switch between where the event is recorded. -- Steve > > > } > > /* > > * The ftrace_test_probe is compiled out, it is only here as a build time > > check -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH v3 4/4] trace: Trace log handler for logging into STM blocks
On Wed, Jul 8, 2015 at 8:31 PM, Peter Zijlstra wrote: > On Tue, Jul 07, 2015 at 06:10:43PM +0800, Chunyan Zhang wrote: >> Add the function 'trace_event_stm_output_##call' for printing events >> trace log into STM blocks. >> >> This patch also adds a function call at where the events have been >> committed to ring buffer to export the trace event information to >> STM blocks. > > So then you have two copies of the data, why that? Would a scheme were > data either goes to the STM or the regular buffer not make much more > sense? We don't have two copies when we export the trace logs to STM, because the event trace logs what we can see by catting the Ftrace files haven't been generated at that moment. > >> +++ b/include/trace/perf.h >> @@ -175,6 +175,7 @@ trace_event_raw_event_##call(void *__data, proto) >> \ >> { assign; } \ >> \ >> trace_event_buffer_commit(&fbuffer);\ >> + trace_event_stm_log(&fbuffer); \ > > This makes every trace event slower. It doesn't actually, you may decide if enable this feature, the trace event will not be slowed if STM_TRACE_EVENT is not selected. But if this feature enabled, it will indeed take more time than without this feature. Best regards, Chunyan > >> } >> /* >> * The ftrace_test_probe is compiled out, it is only here as a build time >> check -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH v3 4/4] trace: Trace log handler for logging into STM blocks
On Tue, Jul 07, 2015 at 06:10:43PM +0800, Chunyan Zhang wrote: > Add the function 'trace_event_stm_output_##call' for printing events > trace log into STM blocks. > > This patch also adds a function call at where the events have been > committed to ring buffer to export the trace event information to > STM blocks. So then you have two copies of the data, why that? Would a scheme were data either goes to the STM or the regular buffer not make much more sense? > +++ b/include/trace/perf.h > @@ -175,6 +175,7 @@ trace_event_raw_event_##call(void *__data, proto) > \ > { assign; } \ > \ > trace_event_buffer_commit(&fbuffer);\ > + trace_event_stm_log(&fbuffer); \ This makes every trace event slower. > } > /* > * The ftrace_test_probe is compiled out, it is only here as a build time > check -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC PATCH v3 4/4] trace: Trace log handler for logging into STM blocks
Add the function 'trace_event_stm_output_##call' for printing events trace log into STM blocks. This patch also adds a function call at where the events have been committed to ring buffer to export the trace event information to STM blocks. Signed-off-by: Chunyan Zhang --- include/linux/trace_events.h | 8 include/trace/perf.h | 3 +++ include/trace/trace_events.h | 44 3 files changed, 55 insertions(+) diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h index 28dcdff..705bd4e 100644 --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -418,6 +418,14 @@ enum event_trigger_type { #ifdef CONFIG_STM_TRACE_EVENT extern void stm_trace_event_write(const char *buf, unsigned len); +extern void trace_event_stm_log(struct trace_event_buffer *buffer); +extern void trace_event_buf_vprintf(struct trace_buffer_stm *tb, + const char *fmt, ...) __attribute__ ((weak)); +#else +static inline void trace_event_stm_log(struct trace_event_buffer *buffer) {} +static inline void trace_event_buf_vprintf(struct trace_buffer_stm *tb, + const char *fmt, ...) {} + #endif extern int filter_match_preds(struct event_filter *filter, void *rec); diff --git a/include/trace/perf.h b/include/trace/perf.h index 1b5443c..79906de 100644 --- a/include/trace/perf.h +++ b/include/trace/perf.h @@ -175,6 +175,7 @@ trace_event_raw_event_##call(void *__data, proto) \ { assign; } \ \ trace_event_buffer_commit(&fbuffer);\ + trace_event_stm_log(&fbuffer); \ } /* * The ftrace_test_probe is compiled out, it is only here as a build time check @@ -234,6 +235,7 @@ static struct trace_event_call __used event_##call = { \ .event.funcs= &trace_event_type_funcs_##template, \ .print_fmt = print_fmt_##template, \ .flags = TRACE_EVENT_FL_TRACEPOINT,\ + .output_stm = trace_event_stm_output_##template,\ }; \ static struct trace_event_call __used \ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call @@ -251,6 +253,7 @@ static struct trace_event_call __used event_##call = { \ .event.funcs= &trace_event_type_funcs_##call, \ .print_fmt = print_fmt_##call, \ .flags = TRACE_EVENT_FL_TRACEPOINT,\ + .output_stm = trace_event_stm_output_##call,\ }; \ static struct trace_event_call __used \ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h index 43be3b0..db4d8a7 100644 --- a/include/trace/trace_events.h +++ b/include/trace/trace_events.h @@ -303,6 +303,50 @@ TRACE_MAKE_SYSTEM_STR(); #undef DECLARE_EVENT_CLASS #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ +static notrace void\ +trace_event_stm_output_##call(struct trace_seq *tmp_seq, \ +void *entry, \ +struct trace_buffer_stm *trace_buf)\ +{ \ + struct trace_event_raw_##call *field = entry; \ + struct trace_seq *p = tmp_seq; \ + \ + trace_seq_init(p); \ + \ + trace_event_buf_vprintf(trace_buf, print); \ + \ + return; \ +} + +#undef DEFINE_EVENT_PRINT +#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ +static notrace void\ +trace_event_stm_output_##call(struct trace_seq *tmp_seq, \ +void *entry, \ +struct trace_buffer_stm *trace_buf)\ +{ \ + struct trace_seq *p = tmp_seq; \ + st