mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tom Zanussi <zanussi@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>,
	Daniel Bristot de Oliveira <bristot@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [for-next][PATCH 05/31] tracing: Have existing event_command.parse() implementations use helpers
Date: Thu, 13 Jan 2022 15:58:36 -0600	[thread overview]
Message-ID: <6cd817c8de439d62741aef3cb2c0914801f0f962.camel@kernel.org> (raw)
In-Reply-To: <20220113162058.04731caf@gandalf.local.home>

Hi Steve,

On Thu, 2022-01-13 at 16:20 -0500, Steven Rostedt wrote:
> On Thu, 13 Jan 2022 18:03:07 +0100
> Daniel Bristot de Oliveira <bristot@kernel.org> wrote:
> 
> > I did some debug, and found that the histogram is working. The
> > problem is that,
> > to read the histogram I pause it to have consistent data:
> > 
> > in tools/tracing/rtla/osnoise_hist.c:
> > osnoise_read_trace_hist() {
> >  [...]
> >         tracefs_hist_pause(tool->trace.inst, data->trace_hist);
> > 
> >         content = tracefs_event_file_read(tool->trace.inst,
> > "osnoise",
> >                                           "sample_threshold",
> >                                           "hist", NULL);
> >  [...]
> > }
> > 
> > and, as far as I got, after this patch, pausing the histogram makes
> > it to clear
> > up. If I comment the "tracefs_hist_pause" line, "rtla osnoise hist"
> > start
> > working back again.
> > 
> > Thoughts?
> 
> This is all messed up. I'm removing this patch completely.
> 
> Tom, can you fix this. The issue is that it's putting too much policy
> into
> the helper functions, which is big no no.
> 
> Specifically, we have:
> 
> int event_trigger_register(struct event_command *cmd_ops,
> 			   struct trace_event_file *file,
> 			   char *glob,
> 			   char *cmd,
> 			   char *param,
> 			   struct event_trigger_data *trigger_data,
> 			   int *n_registered)
> {
> 	int ret;
> 
> 	if (n_registered)
> 		*n_registered = 0;
> 
> 	ret = cmd_ops->reg(glob, trigger_data, file);
> 	/*
> 	 * The above returns on success the # of functions enabled,
> 	 * but if it didn't find any functions it returns zero.
> 	 * Consider no functions a failure too.
> 	 */
> 	if (!ret) {
> 		cmd_ops->unreg(glob, trigger_data, file);
> 		ret = -ENOENT;
> 	} else if (ret > 0) {
> 		if (n_registered)
> 			*n_registered = ret;
> 		/* Just return zero, not the number of enabled
> functions */
> 		ret = 0;
> 	}
> 
> 	return ret;
> }
> 
> 
> And in the case of pause, this *will* have ret = 0 on return. And
> what
> happens is that it removes the trigger completely.
> 
> Look at the code in the histogram on the return:
> 
> 	ret = event_trigger_register(cmd_ops, file, glob, cmd, param,
> trigger_data, &n_registered);
> 	if (ret < 0)
> 		goto out_free;
> 	if ((ret == 0) && (n_registered == 0)) {
> 		if (!(attrs->pause || attrs->cont || attrs->clear))
> 			ret = -ENOENT;
> 		goto out_free;
> 	}
> 
> It checks for 0 and 0 and only errors if it's not pause, cont, or
> clear.
> Hence, all three are now broken due to this patch.
> 
> I will not be adding this to this merge window.

Yes, you're right, event_trigger_register() is trying to do a little
too much, and shouldn't be doing the unreg().

Thanks for finding and figuring that out.  I'll fix this and send a new
version after the merge window.

Tom

> 
> -- Steve


  parent reply	other threads:[~2022-01-13 21:58 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11 17:30 [for-next][PATCH 00/31] tracing: Final updates for 5.17 Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 01/31] tracing: Change event_command func() to parse() Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 02/31] tracing: Change event_trigger_ops func() to trigger() Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 03/31] tracing: Remove ops param from event_command reg()/unreg() callbacks Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 04/31] tracing: Add helper functions to simplify event_command.parse() callback handling Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 05/31] tracing: Have existing event_command.parse() implementations use helpers Steven Rostedt
2022-01-13 17:03   ` Daniel Bristot de Oliveira
2022-01-13 21:20     ` Steven Rostedt
2022-01-13 21:27       ` Steven Rostedt
2022-01-13 21:58       ` Tom Zanussi [this message]
2022-01-11 17:30 ` [for-next][PATCH 06/31] tracing: Remove redundant trigger_ops params Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 07/31] tracing: Account bottom half disabled sections Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 08/31] tracing/uprobes: Check the return value of kstrdup() for tu->filename Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 09/31] tracing/probes: check the return value of kstrndup() for pbuf Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 10/31] scripts: ftrace - move the sort-processing in ftrace_init Steven Rostedt
2022-01-15 20:36   ` Nathan Chancellor
2022-01-16  3:59     ` Steven Rostedt
2022-01-16  4:10       ` Nathan Chancellor
2022-01-17  6:23       ` [PATCH 0/1] fix initialization problems Yinan Liu
2022-01-17  6:23         ` [PATCH 1/1] script/sorttable: fix some " Yinan Liu
2022-01-17 22:56           ` Nathan Chancellor
2022-01-18  6:52       ` [PATCH v2] " Yinan Liu
2022-01-11 17:30 ` [for-next][PATCH 11/31] ftrace: Add test to make sure compiled time sorts work Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 12/31] tracing: Fix mismatched comment in __string_len Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 13/31] tracing: Have syscall trace events use trace_event_buffer_lock_reserve() Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 14/31] tracing: Add test for user space strings when filtering on string pointers Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 15/31] tracing/kprobes: nmissed not showed correctly for kretprobe Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 16/31] rtla: Real-Time Linux Analysis tool Steven Rostedt
2022-01-12 11:15   ` Daniel Bristot de Oliveira
2022-01-12 16:21     ` Steven Rostedt
2022-01-12 16:30       ` Steven Rostedt
2022-01-12 16:32         ` Daniel Bristot de Oliveira
2022-01-12 17:14         ` Steven Rostedt
2022-01-12 17:16           ` Steven Rostedt
2022-01-12 17:21             ` Daniel Bristot de Oliveira
2022-01-11 17:30 ` [for-next][PATCH 17/31] rtla: Helper functions for rtla Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 18/31] rtla: Add osnoise tool Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 19/31] rtla/osnoise: Add osnoise top mode Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 20/31] rtla/osnoise: Add the hist mode Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 21/31] rtla: Add timerlat tool and timelart top mode Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 22/31] rtla/timerlat: Add timerlat hist mode Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 23/31] rtla: Add Documentation Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 24/31] rtla: Add rtla osnoise man page Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 25/31] rtla: Add rtla osnoise top documentation Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 26/31] rtla: Add rtla osnoise hist documentation Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 27/31] rtla: Add rtla timerlat documentation Steven Rostedt
2022-01-11 17:30 ` [for-next][PATCH 28/31] rtla: Add rtla timerlat top documentation Steven Rostedt
2022-01-11 17:31 ` [for-next][PATCH 29/31] rtla: Add rtla timerlat hist documentation Steven Rostedt
2022-01-11 17:31 ` [for-next][PATCH 30/31] tracing: Remove duplicate warnings when calling trace_create_file() Steven Rostedt
2022-01-11 17:31 ` [for-next][PATCH 31/31] tracing/osnoise: Properly unhook events if start_per_cpu_kthreads() fails 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=6cd817c8de439d62741aef3cb2c0914801f0f962.camel@kernel.org \
    --to=zanussi@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=bristot@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome