From: Tom Zanussi <zanussi@kernel.org> To: rostedt@goodmis.org Cc: artem.bityutskiy@linux.intel.com, mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org Subject: [PATCH v2 00/12] tracing: Add support for in-kernel dynamic event API Date: Fri, 10 Jan 2020 14:35:06 -0600 Message-ID: <cover.1578688120.git.zanussi@kernel.org> (raw) Hi, This is v2 of the previous 'tracing: Add support for in-kernel synthetic event API', and is largely a rewrite based on suggestions from Masami to expand the scope to include other types of dynamic events such as kprobe events, in addition to the original sythetic event focus. The functionality of the original API remains available, though it's in a slightly different form due to the use of the new dynevent_cmd API it's now based on. The dynevent_cmd API provides a common dynamic event command generation capability that both the synthetic event API and the kprobe event API are now based on, and there are now test modules demonstrating both the synthetic event and kprobes APIs. A couple of the patches are snippets from Masami's 'tracing: bootconfig: Boot-time tracing and Extra boot config' series, and the patch implementing the dynevent_cmd API includes some of the spnprintf() generating code from that patchset. Because I used Masami's gen_*_cmd() naming suggestion for generating the commands, the previous patchset's generate_*() functions were renamed to trace_*() to avoid confusion, and probably is better naming anyway. An overview of the user-visible changes in comparison to v1: - create_synth_event() using an array of synth_desc_fields remains unchanged and works the same way as previously - gen_synth_cmd() takes a variable-length number of args which represent 'type field;' pairs. Using this with no field args basically replaces the previous 'create_empty_synth_event()' - The 'add_synth_field()' and 'add_synth_fields()' function from v1 are essentially the same except that they now take a dynevent_cmd instead of a synth_event pointer - The finalize_synth_event() from v1 is replaced by create_dynevent() in the new version. - The new v2 API includes some additional functions to initialize the dynevent_cmd - synth_dynevent_cmd() is used to do that. While it's an extra step, it makes it easier to do error handling. - There's a new trace_synth_event() function that traces a synthetic event using a variable-arg list of values. - The original generate_synth_event() using an array of values is now called trace_synth_event_array(). - For piecewise event tracing, the original generate_synth_event_start() and generate_synth_event_end() have now been renamed to trace_synth_event_end(). - add_next_synth_val() and add_synth_val() remain the same. - A similar API and test module demonstrating the API has been added for kprobe events - Both the synthetic events and kprobe events API is based on the dynevent_cmd API, newly added - The Documentation for all of the above has been updated Text from the orginal v1 posting: I've recently had several requests and suggestions from users to add support for the creation and generation of synthetic events from kernel code such as modules, and not just from the available command line commands. This patchset adds support for that. The first three patches add some minor preliminary setup, followed by the two main patches that add the ability to create and generate synthetic events from the kernel. The next patch adds a test module that demonstrates actual use of the API and verifies that it works as intended, followed by Documentation. Special thanks to Artem Bityutskiy, who worked with me over several iterations of the API, and who had many great suggestions on the details of the interface, and pointed out several problems with the code itself. The following changes since commit d783b3c08c14fccbc4d5ef33a38288ec9b264df7: tracing: Have the histogram compare functions convert to u64 first (2019-12-11 15:47:14 -0500) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/zanussi/linux-trace.git ftrace/synth-event-gen-v2 Masami Hiramatsu (2): tracing: Add synth_event_run_command() tracing: Add trace_kprobe_run_command() Tom Zanussi (10): tracing: Add trace_array_find() to find instance trace arrays tracing: Add get/put_event_file() tracing: Add delete_synth_event() tracing: Add dynamic event command creation interface tracing: Add synthetic event command generation functions tracing: Add trace_synth_event() and related functions tracing: Add synth event generation test module tracing: Add kprobe event command generation functions tracing: Add kprobe event command generation test module tracing: Documentation for in-kernel synthetic event API Documentation/trace/events.rst | 488 ++++++++++++++++++++ include/linux/trace_events.h | 134 ++++++ kernel/trace/Kconfig | 25 ++ kernel/trace/Makefile | 2 + kernel/trace/kprobe_event_gen_test.c | 223 ++++++++++ kernel/trace/synth_event_gen_test.c | 519 +++++++++++++++++++++ kernel/trace/trace.c | 30 +- kernel/trace/trace.h | 1 + kernel/trace/trace_events.c | 304 +++++++++++++ kernel/trace/trace_events_hist.c | 842 ++++++++++++++++++++++++++++++++++- kernel/trace/trace_kprobe.c | 162 +++++++ 11 files changed, 2704 insertions(+), 26 deletions(-) create mode 100644 kernel/trace/kprobe_event_gen_test.c create mode 100644 kernel/trace/synth_event_gen_test.c -- 2.14.1
next reply index Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-10 20:35 Tom Zanussi [this message] 2020-01-10 20:35 ` [PATCH v2 01/12] tracing: Add trace_array_find() to find instance trace arrays Tom Zanussi 2020-01-10 20:35 ` [PATCH v2 02/12] tracing: Add get/put_event_file() Tom Zanussi 2020-01-13 13:15 ` Masami Hiramatsu 2020-01-13 15:15 ` Tom Zanussi 2020-01-10 20:35 ` [PATCH v2 03/12] tracing: Add delete_synth_event() Tom Zanussi 2020-01-10 20:35 ` [PATCH v2 04/12] tracing: Add dynamic event command creation interface Tom Zanussi 2020-01-14 12:14 ` Masami Hiramatsu 2020-01-14 15:19 ` Tom Zanussi 2020-01-10 20:35 ` [PATCH v2 05/12] tracing: Add synth_event_run_command() Tom Zanussi 2020-01-21 16:53 ` Steven Rostedt 2020-01-10 20:35 ` [PATCH v2 06/12] tracing: Add synthetic event command generation functions Tom Zanussi 2020-01-21 16:57 ` Steven Rostedt 2020-01-21 19:20 ` Tom Zanussi 2020-01-10 20:35 ` [PATCH v2 07/12] tracing: Add trace_synth_event() and related functions Tom Zanussi 2020-01-21 17:03 ` Steven Rostedt 2020-01-21 19:22 ` Tom Zanussi 2020-01-10 20:35 ` [PATCH v2 08/12] tracing: Add synth event generation test module Tom Zanussi 2020-01-10 20:35 ` [PATCH v2 09/12] tracing: Add trace_kprobe_run_command() Tom Zanussi 2020-01-10 20:35 ` [PATCH v2 10/12] tracing: Add kprobe event command generation functions Tom Zanussi 2020-01-10 20:35 ` [PATCH v2 11/12] tracing: Add kprobe event command generation test module Tom Zanussi 2020-01-10 20:35 ` [PATCH v2 12/12] tracing: Documentation for in-kernel synthetic event API Tom Zanussi
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=cover.1578688120.git.zanussi@kernel.org \ --to=zanussi@kernel.org \ --cc=artem.bityutskiy@linux.intel.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-rt-users@vger.kernel.org \ --cc=mhiramat@kernel.org \ --cc=rostedt@goodmis.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Linux-rt-users Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/linux-rt-users/0 linux-rt-users/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 linux-rt-users linux-rt-users/ https://lore.kernel.org/linux-rt-users \ linux-rt-users@vger.kernel.org public-inbox-index linux-rt-users Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rt-users AGPL code for this site: git clone https://public-inbox.org/public-inbox.git