[PATCH v8 00/10] tracing: trace event triggers
Hi, This is v8 of the trace event triggers patchset. This version addresses the comments and feedback from Steve Rostedt on v7. v8: - changed rcu_dereference_raw() to rcu_dereference() and moved synchronize_sched() out from under the syscall_trace_lock mutex. - got rid of the various void ** usages in the basic framework and individual trigger patches. Since triggers always expect an event_trigger_data instance, there's not even any reason to make it a void *, so those along with the void * usages were changed to use event_trigger_data * directly. To allow for trigger-specific data, a new void * field named private_data was added to event_trigger_data; this is made use of by the enable/disable_event triggers. - fixed various style nitpicks. - added a new TRIGGER_COND flag to ftrace_file - this flag basically tracks whether or not an event has any triggers that have a condition associated with them that requires looking at the data being logged (or that would be in the case of soft-disable) for the current event. If TRIGGER_COND is not set, then the triggers can be invoked immediately without forcing the ineffeciency of actually generating the log event when not necessary. - patch 8 removed the obsolete filter_current_check_discard() and replaced it with filter_check_discard() but accidentally made the new function static inline, which is obviously not what was intended. That and the new call_filter_check_discard() functions are now normal functions as filter_current_check_discard() was. - isolated all the ugly 'if (USE_CALL_FILTER) else' usages in patch 8 which significantly cleaned up that patch as a result. v7: - moved find_event_file() extern declartion to patch 06. - moved helper functions from patch 02 to 03, where they're first used. - removed copies of cmd_ops fields from trigger_data and changed to use cmd_ops diretly instead. - renamed trigger_mode to trigger_type to avoid confusion with the FTRACE_EVENT_FL_TRIGGER_MODE_BIT bitflag, and fixed up usage/documentation, etc. v6: - fixed up the conflicts in trace_events.c related to the actual creation of the per-event 'trigger' files. v5: - got rid of the trigger_iterator, a vestige of the first patchset, which attempted to abstract the ftrace_iterator for triggers, and cleaned up related code simplified as a result. - replaced the void *cmd_data everywhere with ftrace_event_file *, another vestige of the initial patchset. - updated the patchset to use event_file_data() to grab the i_private ftrace_event_files where appropriate (this was a separate patch in the previous patchset, but was merged into the basic framework patch as suggested by Masami. The only interesting part about this is that it moved event_file_data() from kernel/trace/trace_events.c to kernel/trace/trace.h so it can be used in e.g. trace_events_trigger.c as well.) - add missing grab of event_mutex in event_trigger_regex_write(). - realized when making the above changes that the trigger filters weren't being freed when the trigger was freed, so added a trigger_data_free() to do that. It also ensures that trigger_data won't be freed until nothing is using it. - added clear_event_triggers(), which clears all triggers in a trace array (and soft-disable associated with event_enable/disable events). - added a comment to ftrace_syscall_enter/exit to document the use of rcu_dereference_raw() there. v4: - made some changes to the soft-disable for syscall patch, according to Masami's suggestions. Actually, since there's now an array of ftrace_files for syscalls that can serve the same purpose, the enabled_enter/exit_syscalls bit arrays became redundant and were removed. - moved all the remaining common functions out of the traceon/traceoff patch and into the basic trigger framework patch and added comments to all the common functions. - extensively commented the event_trigger_ops and event_command ops. - made the register/unregister_command functions __init. Since that code was originally inspired by similar ftrace code, a new patch was added to do the same thing for the register/unregister of the ftrace commands (patch 10/11). - fixed the event_trigger_regex_open i_private problem noted by Masami that's currently being addressed by Oleg Nesterov's fixes for this. Note that that patchset also affects patch 8/11 (update filters for multi-buffer, since it touches event filters as well). Patch 11/11 depends on that patchset and also moves event_file_data() to trace.h.b v3: - added a new patch to the series (patch 8/9 - update event filters for multibuffer) to bring the event filters up-to-date wrt the multibuffer changes - without this patch, the same filter is applied to all buffers regardless of which instance sets it; this patch allows you to set per-instance filters as you'd expect.
[PATCH v8 00/10] tracing: trace event triggers
Hi, This is v8 of the trace event triggers patchset. This version addresses the comments and feedback from Steve Rostedt on v7. v8: - changed rcu_dereference_raw() to rcu_dereference() and moved synchronize_sched() out from under the syscall_trace_lock mutex. - got rid of the various void ** usages in the basic framework and individual trigger patches. Since triggers always expect an event_trigger_data instance, there's not even any reason to make it a void *, so those along with the void * usages were changed to use event_trigger_data * directly. To allow for trigger-specific data, a new void * field named private_data was added to event_trigger_data; this is made use of by the enable/disable_event triggers. - fixed various style nitpicks. - added a new TRIGGER_COND flag to ftrace_file - this flag basically tracks whether or not an event has any triggers that have a condition associated with them that requires looking at the data being logged (or that would be in the case of soft-disable) for the current event. If TRIGGER_COND is not set, then the triggers can be invoked immediately without forcing the ineffeciency of actually generating the log event when not necessary. - patch 8 removed the obsolete filter_current_check_discard() and replaced it with filter_check_discard() but accidentally made the new function static inline, which is obviously not what was intended. That and the new call_filter_check_discard() functions are now normal functions as filter_current_check_discard() was. - isolated all the ugly 'if (USE_CALL_FILTER) else' usages in patch 8 which significantly cleaned up that patch as a result. v7: - moved find_event_file() extern declartion to patch 06. - moved helper functions from patch 02 to 03, where they're first used. - removed copies of cmd_ops fields from trigger_data and changed to use cmd_ops diretly instead. - renamed trigger_mode to trigger_type to avoid confusion with the FTRACE_EVENT_FL_TRIGGER_MODE_BIT bitflag, and fixed up usage/documentation, etc. v6: - fixed up the conflicts in trace_events.c related to the actual creation of the per-event 'trigger' files. v5: - got rid of the trigger_iterator, a vestige of the first patchset, which attempted to abstract the ftrace_iterator for triggers, and cleaned up related code simplified as a result. - replaced the void *cmd_data everywhere with ftrace_event_file *, another vestige of the initial patchset. - updated the patchset to use event_file_data() to grab the i_private ftrace_event_files where appropriate (this was a separate patch in the previous patchset, but was merged into the basic framework patch as suggested by Masami. The only interesting part about this is that it moved event_file_data() from kernel/trace/trace_events.c to kernel/trace/trace.h so it can be used in e.g. trace_events_trigger.c as well.) - add missing grab of event_mutex in event_trigger_regex_write(). - realized when making the above changes that the trigger filters weren't being freed when the trigger was freed, so added a trigger_data_free() to do that. It also ensures that trigger_data won't be freed until nothing is using it. - added clear_event_triggers(), which clears all triggers in a trace array (and soft-disable associated with event_enable/disable events). - added a comment to ftrace_syscall_enter/exit to document the use of rcu_dereference_raw() there. v4: - made some changes to the soft-disable for syscall patch, according to Masami's suggestions. Actually, since there's now an array of ftrace_files for syscalls that can serve the same purpose, the enabled_enter/exit_syscalls bit arrays became redundant and were removed. - moved all the remaining common functions out of the traceon/traceoff patch and into the basic trigger framework patch and added comments to all the common functions. - extensively commented the event_trigger_ops and event_command ops. - made the register/unregister_command functions __init. Since that code was originally inspired by similar ftrace code, a new patch was added to do the same thing for the register/unregister of the ftrace commands (patch 10/11). - fixed the event_trigger_regex_open i_private problem noted by Masami that's currently being addressed by Oleg Nesterov's fixes for this. Note that that patchset also affects patch 8/11 (update filters for multi-buffer, since it touches event filters as well). Patch 11/11 depends on that patchset and also moves event_file_data() to trace.h.b v3: - added a new patch to the series (patch 8/9 - update event filters for multibuffer) to bring the event filters up-to-date wrt the multibuffer changes - without this patch, the same filter is applied to all buffers regardless of which instance sets it; this patch allows you to set per-instance filters as you'd expect.