From: Vincent Donnefort <vdonnefort@google.com>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: rostedt@goodmis.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org,
mathieu.desnoyers@efficios.com, kernel-team@android.com
Subject: Re: [PATCH v12 3/6] tracing: Add snapshot refcount
Date: Thu, 25 Jan 2024 14:53:40 +0000 [thread overview]
Message-ID: <ZbJ19CF2Zv4d0R_Z@google.com> (raw)
In-Reply-To: <20240125001149.364c0b08237e8b7f0a69bd56@kernel.org>
Hi Masami,
Thanks for taking the time to look at those changes.
On Thu, Jan 25, 2024 at 12:11:49AM +0900, Masami Hiramatsu wrote:
> On Tue, 23 Jan 2024 11:07:54 +0000
> Vincent Donnefort <vdonnefort@google.com> wrote:
>
> [...]
> > @@ -6592,8 +6641,11 @@ int tracing_set_tracer(struct trace_array *tr, const char *buf)
> >
> > if (t->init) {
> > ret = tracer_init(t, tr);
> > - if (ret)
> > + if (ret) {
> > + if (t->use_max_tr)
> > + tracing_disarm_snapshot_locked(tr);
>
> This part is out of CONFIG_TRACER_MAX_TRACE, so it may cause a compile error
> if CONFIG_TRACER_MAX_TRACE is not set.
Duh, yes it must depends on TRACER_MAX_TRACE :-\
>
> > goto out;
> > + }
> > }
> >
> > tr->current_trace = t;
> [...]
> > diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
> > index 46439e3bcec4..d41bf64741e2 100644
> > --- a/kernel/trace/trace_events_trigger.c
> > +++ b/kernel/trace/trace_events_trigger.c
> > @@ -597,20 +597,9 @@ static int register_trigger(char *glob,
> > return ret;
> > }
> >
> > -/**
> > - * unregister_trigger - Generic event_command @unreg implementation
> > - * @glob: The raw string used to register the trigger
> > - * @test: Trigger-specific data used to find the trigger to remove
> > - * @file: The trace_event_file associated with the event
> > - *
> > - * Common implementation for event trigger unregistration.
> > - *
> > - * Usually used directly as the @unreg method in event command
> > - * implementations.
> > - */
> > -static void unregister_trigger(char *glob,
> > - struct event_trigger_data *test,
> > - struct trace_event_file *file)
>
> OK, so __unregister_trigger returns true if data exists, but
> unregister_trigger() ignores results. (I want some comment here)
Will add something for the __unregister_trigger flavour.
>
> > +static bool __unregister_trigger(char *glob,
> > + struct event_trigger_data *test,
> > + struct trace_event_file *file)
> > {
> > struct event_trigger_data *data = NULL, *iter;
> >
> > @@ -626,8 +615,32 @@ static void unregister_trigger(char *glob,
> > }
> > }
> >
> > - if (data && data->ops->free)
> > - data->ops->free(data);
> > + if (data) {
> > + if (data->ops->free)
> > + data->ops->free(data);
> > +
> > + return true;
> > + }
> > +
> > + return false;
> > +}
> > +
> > +/**
> > + * unregister_trigger - Generic event_command @unreg implementation
> > + * @glob: The raw string used to register the trigger
> > + * @test: Trigger-specific data used to find the trigger to remove
> > + * @file: The trace_event_file associated with the event
> > + *
> > + * Common implementation for event trigger unregistration.
> > + *
> > + * Usually used directly as the @unreg method in event command
> > + * implementations.
> > + */
> > +static void unregister_trigger(char *glob,
> > + struct event_trigger_data *test,
> > + struct trace_event_file *file)
> > +{
> > + __unregister_trigger(glob, test, file);
> > }
> >
> > /*
> > @@ -1470,12 +1483,20 @@ register_snapshot_trigger(char *glob,
> > struct event_trigger_data *data,
> > struct trace_event_file *file)
> > {
> > - if (tracing_alloc_snapshot_instance(file->tr) != 0)
> > + if (tracing_arm_snapshot(file->tr))
> > return 0;
>
> BTW, is this return value correct? It seems that the register_*_trigger()
> will return error code when it fails.
It should indeed be
ret = tracing_arm_snapshot()
if (ret)
return ret;
>
> Thanks,
>
> >
> > return register_trigger(glob, data, file);
> > }
> >
> > +static void unregister_snapshot_trigger(char *glob,
> > + struct event_trigger_data *data,
> > + struct trace_event_file *file)
> > +{
> > + if (__unregister_trigger(glob, data, file))
> > + tracing_disarm_snapshot(file->tr);
> > +}
> > +
> > static int
> > snapshot_trigger_print(struct seq_file *m, struct event_trigger_data *data)
> > {
> > @@ -1508,7 +1529,7 @@ static struct event_command trigger_snapshot_cmd = {
> > .trigger_type = ETT_SNAPSHOT,
> > .parse = event_trigger_parse,
> > .reg = register_snapshot_trigger,
> > - .unreg = unregister_trigger,
> > + .unreg = unregister_snapshot_trigger,
> > .get_trigger_ops = snapshot_get_trigger_ops,
> > .set_filter = set_trigger_filter,
> > };
> > --
> > 2.43.0.429.g432eaa2c6b-goog
> >
>
>
> --
> Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2024-01-25 14:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-23 11:07 [PATCH v12 0/6] Introducing trace buffer mapping by user-space Vincent Donnefort
2024-01-23 11:07 ` [PATCH v12 1/6] ring-buffer: Zero ring-buffer sub-buffers Vincent Donnefort
2024-01-23 11:07 ` [PATCH v12 2/6] ring-buffer: Introducing ring-buffer mapping functions Vincent Donnefort
2024-01-23 15:51 ` Steven Rostedt
2024-01-23 17:48 ` Vincent Donnefort
2024-01-23 18:02 ` Steven Rostedt
2024-01-23 11:07 ` [PATCH v12 3/6] tracing: Add snapshot refcount Vincent Donnefort
2024-01-24 15:11 ` Masami Hiramatsu
2024-01-25 14:53 ` Vincent Donnefort [this message]
2024-01-26 0:32 ` Masami Hiramatsu
2024-01-26 0:42 ` [PATCH] tracing/trigger: Fix to return error if failed to alloc snapshot Masami Hiramatsu (Google)
2024-01-26 16:58 ` Steven Rostedt
2024-01-26 2:01 ` [PATCH v12 3/6] tracing: Add snapshot refcount kernel test robot
2024-01-26 2:21 ` kernel test robot
2024-01-23 11:07 ` [PATCH v12 4/6] tracing: Allow user-space mapping of the ring-buffer Vincent Donnefort
2024-01-23 11:07 ` [PATCH v12 5/6] Documentation: tracing: Add ring-buffer mapping Vincent Donnefort
2024-01-23 11:07 ` [PATCH v12 6/6] ring-buffer/selftest: Add ring-buffer mapping test Vincent Donnefort
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=ZbJ19CF2Zv4d0R_Z@google.com \
--to=vdonnefort@google.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--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.