linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Zanussi <zanussi@kernel.org>
To: Steven Rostedt <rostedt@kernel.org>,
	linux-kernel@vger.kernel.org,
	 linux-trace-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 2/2] tracing: Merge struct event_trigger_ops into struct event_command
Date: Tue, 25 Nov 2025 07:01:43 -0600	[thread overview]
Message-ID: <cfa03e4c70ff706b5373bf5314f453930019e1a1.camel@kernel.org> (raw)
In-Reply-To: <20251119031603.658997916@kernel.org>

Hi Steve,

On Tue, 2025-11-18 at 22:10 -0500, Steven Rostedt wrote:
> From: Steven Rostedt <rostedt@goodmis.org>
> 
> Now that there's pretty much a one to one mapping between the struct
> event_trigger_ops and struct event_command, there's no reason to have two
> different structures. Merge the function pointers of event_trigger_ops
> into event_command.
> 
> There's one exception in trace_events_hist.c for the
> event_hist_trigger_named_ops. This has special logic for the init and free
> function pointers for "named histograms". In this case, allocate the
> cmd_ops of the event_trigger_data and set it to the proper init and free
> functions, which are used to initialize and free the event_trigger_data
> respectively. Have the free function and the init function (on failure)
> free the cmd_ops of the data element.
> 
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Very nice as well, just one tiny note below..

Reviewed-by: Tom Zanussi <zanussi@kernel.org>


> ---
>  kernel/trace/trace.h                | 126 +++++++++++-----------------
>  kernel/trace/trace_eprobe.c         |  13 +--
>  kernel/trace/trace_events_hist.c    |  93 ++++++++++----------
>  kernel/trace/trace_events_trigger.c | 121 +++++++++++---------------
>  4 files changed, 152 insertions(+), 201 deletions(-)
> 

[...]

> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index f9cc8d6a215b..1e03398b9e91 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -5694,7 +5694,7 @@ static void hist_trigger_show(struct seq_file *m,
>  		seq_puts(m, "\n\n");
>  
>  	seq_puts(m, "# event histogram\n#\n# trigger info: ");
> -	data->ops->print(m, data);
> +	data->cmd_ops->print(m, data);
>  	seq_puts(m, "#\n\n");
>  
>  	hist_data = data->private_data;
> @@ -6016,7 +6016,7 @@ static void hist_trigger_debug_show(struct seq_file *m,
>  		seq_puts(m, "\n\n");
>  
>  	seq_puts(m, "# event histogram\n#\n# trigger info: ");
> -	data->ops->print(m, data);
> +	data->cmd_ops->print(m, data);
>  	seq_puts(m, "#\n\n");
>  
>  	hist_data = data->private_data;
> @@ -6326,20 +6326,23 @@ static void event_hist_trigger_free(struct event_trigger_data *data)
>  	free_hist_pad();
>  }
>  
> -static const struct event_trigger_ops event_hist_trigger_ops = {
> -	.trigger		= event_hist_trigger,
> -	.print			= event_hist_trigger_print,
> -	.init			= event_hist_trigger_init,
> -	.free			= event_hist_trigger_free,
> -};
> +static struct event_command trigger_hist_cmd;
>  

I don't think this is needed, since the same declaration already
appears just above the event_hist_trigger_parse() declaration.

Thanks,

Tom



  reply	other threads:[~2025-11-25 13:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-19  3:10 [PATCH 0/2] tracing: Clean up trigger code my merging structures Steven Rostedt
2025-11-19  3:10 ` [PATCH 1/2] tracing: Remove get_trigger_ops() and add count_func() from trigger ops Steven Rostedt
2025-11-25 12:54   ` Tom Zanussi
2025-11-19  3:10 ` [PATCH 2/2] tracing: Merge struct event_trigger_ops into struct event_command Steven Rostedt
2025-11-25 13:01   ` Tom Zanussi [this message]
2025-11-25 20:05     ` Steven Rostedt

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=cfa03e4c70ff706b5373bf5314f453930019e1a1.camel@kernel.org \
    --to=zanussi@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).