All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Zanussi <zanussi@kernel.org>
To: rostedt@goodmis.org
Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v7 0/6] tracing: Add and use event_command parsing func helpers
Date: Mon, 10 Jan 2022 08:04:10 -0600	[thread overview]
Message-ID: <cover.1641823001.git.zanussi@kernel.org> (raw)

With more event commands being implemented, it's been pointed out that
it would make sense to clean up the existing ones and make it easier
to implement new ones without copying a lot of boilerplate.  The main
culprit here is the event_command.func() callback - the rest of the
event_command infrastructure has default implementations that work for
most implementations.  The func() callback is a little different in
that every new command needs to customize parsing to some extent.

This patchset attempts to help clean that up and make it easier for
new users to deal with.

v7:
    Missed a fixup in patch 6/6 to a data->ops->print() in the debug
    code since I forgot to build with CONFIG_HIST_TRIGGERS_DEBUG.

    Patches 1-5 remain the same.

v6:
    Fixed warning for an uninitialized trigger_ops local in
    event_trigger_parse() pointed out by Steve and the kernel test
    robot. This was done by removing the need for the local by
    removing the redundant trigger_ops params in [PATCH v6 3/6]
    tracing: Remove ops param from event_command reg()/unreg()
    callbacks.

    Also added a follow-on patch to remove all the other instances of
    redundant trigger_ops in [PATCH v6 6/6] tracing: Remove redundant
    trigger_ops params

v5: Changed the parsing helper function example components param and
    filter to reflect only the param and filter components, and added
    param_and_filter which now appears in the functions.

    Removed the check for a NULL *param following the strsep
    separating the param from the filter in
    event_trigger_separate_filter() because it will never be true due
    to the previous check for NULL param_and_filter previously.

    Changed the param name from trigger to param and updated the
    function documentation in event_trigger_parse_num().

v4: Added two patches changing the names of event_command.func() and
    event_trigger_ops.func() to make them reflect their functions.

    Added back missing kfree(trigger_data) in event_trigger_callback().

    Changed char *param to const char *param in
    event_trigger_check_remove() and event_trigger_empty_param().

    Changed event_trigger_separate_filter() to use separate param and
    filter outparams, and changed the name of the param inparam to
    param_and_filter to better reflect its contents and avoid the
    clash with new param outparam.  Changed all parse()
    implementations to use this new scheme.

    Fixed some typos and added more extensive comments with examples
    explaining various things that were mentioned as causing confusion
    and just in general tried to clarify things with respect to the
    callbacks and parameters.

v3: broke up event_trigger_check() into smaller functions instead of
    parameterizing it, and added function documentation.

v2: removed unused event_trigger_remove(). No change in functionality.

The following changes since commit a6ed2aee54644cfa2d04ca86308767f5c3a087e8:

  tracing: Switch to kvfree_rcu() API (2021-12-06 17:53:50 -0500)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/zanussi/linux-trace.git ftrace/cleanup-hist-func-v7

Tom Zanussi (6):
  tracing: Change event_command func() to parse()
  tracing: Change event_trigger_ops func() to trigger()
  tracing: Remove ops param from event_command reg()/unreg() callbacks
  tracing: Add helper functions to simplify event_command.parse()
    callback handling
  tracing: Have existing event_command.parse() implementations use
    helpers
  tracing: Remove redundant trigger_ops params

 kernel/trace/trace.h                |  81 ++--
 kernel/trace/trace_eprobe.c         |  30 +-
 kernel/trace/trace_events_hist.c    | 147 +++----
 kernel/trace/trace_events_trigger.c | 626 +++++++++++++++++++---------
 4 files changed, 566 insertions(+), 318 deletions(-)

-- 
2.17.1


             reply	other threads:[~2022-01-10 14:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10 14:04 Tom Zanussi [this message]
2022-01-10 14:04 ` [PATCH V7 1/6] tracing: Change event_command func() to parse() Tom Zanussi
2022-01-10 14:04 ` [PATCH v7 2/6] tracing: Change event_trigger_ops func() to trigger() Tom Zanussi
2022-01-10 14:04 ` [PATCH v7 3/6] tracing: Remove ops param from event_command reg()/unreg() callbacks Tom Zanussi
2022-01-10 14:04 ` [PATCH v7 4/6] tracing: Add helper functions to simplify event_command.parse() callback handling Tom Zanussi
2022-01-10 14:04 ` [PATCH v7 5/6] tracing: Have existing event_command.parse() implementations use helpers Tom Zanussi
2022-01-10 14:04 ` [PATCH v7 6/6] tracing: Remove redundant trigger_ops params 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.1641823001.git.zanussi@kernel.org \
    --to=zanussi@kernel.org \
    --cc=linux-kernel@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.