From: Steven Rostedt <rostedt@goodmis.org>
To: Joel Fernandes <joelaf@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Michael Sartain <mikesart@gmail.com>,
kernel-team@android.com, Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH v4 1/3] tracing: Add support for recording tgid of tasks
Date: Mon, 26 Jun 2017 15:12:52 -0400 [thread overview]
Message-ID: <20170626151252.30e5f2bd@gandalf.local.home> (raw)
In-Reply-To: <CAJWu+ooqOTem6yKFOYkC7xn3WZiFMHA1hkvxtV6=R3bN-fjF6g@mail.gmail.com>
On Mon, 26 Jun 2017 12:02:12 -0700
Joel Fernandes <joelaf@google.com> wrote:
> >> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> >> index e7973e10398c..240c6df95ea6 100644
> >> --- a/kernel/trace/trace_events.c
> >> +++ b/kernel/trace/trace_events.c
> >> @@ -343,6 +343,28 @@ void trace_event_enable_cmd_record(bool enable)
> >> mutex_unlock(&event_mutex);
> >> }
> >>
> >> +void trace_event_enable_tgid_record(bool enable)
> >
> > This should return a value.
> >
> >> +{
> >> + struct trace_event_file *file;
> >> + struct trace_array *tr;
> >> +
> >> + mutex_lock(&event_mutex);
> >> + do_for_each_event_file(tr, file) {
> >> + if (!(file->flags & EVENT_FILE_FL_ENABLED))
> >> + continue;
> >> +
> >> + if (enable) {
> >> + tracing_start_tgid_record();
> >
> > If we fail to start, the bit should not be set, and we should return
> > failure. Note, it can only fail on the first try, as once it is
> > allocated, you don't need to worry about it failing. Thus, if it fails,
> > break out of the loop now and return failure.
> >
>
> That seems Ok with me to do, I think a valid point.
>
> I think that I should do it in the second call to
> tracing_start_tgid_record too then (__ftrace_event_enable_disable) to
> error out if the allocation fails.
>
> While going this code I again, I noticed another potential issue in
> __ftrace_event_enable_disable
Thinking about this more. Just allocate the array as soon as the option
is enabled, regardless if an trace event is set. That will make it a
lot simpler. If it fails to allocate, you can simply bail out with
-ENOMEM, and the setting of the option will return that. Then we can
even remove the WARN_ONCE() at allocation failure, as the user will
know what happened.
-- Steve
next prev parent reply other threads:[~2017-06-26 19:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-26 5:38 [PATCH v4 0/3] " Joel Fernandes
2017-06-26 5:38 ` [PATCH v4 1/3] " Joel Fernandes
2017-06-26 16:52 ` Steven Rostedt
2017-06-26 19:02 ` Joel Fernandes
2017-06-26 19:09 ` Steven Rostedt
2017-06-26 19:10 ` Joel Fernandes
2017-06-26 19:28 ` Steven Rostedt
2017-06-26 19:12 ` Steven Rostedt [this message]
2017-06-26 19:15 ` Joel Fernandes
2017-06-26 5:38 ` [PATCH v4 2/3] tracing: Add support for display of tgid in trace output Joel Fernandes
2017-06-26 5:38 ` [PATCH v4 3/3] tracing/ftrace: Add support to record and display tgid Joel Fernandes
2017-06-27 3:16 ` Joel Fernandes
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=20170626151252.30e5f2bd@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=joelaf@google.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mikesart@gmail.com \
--cc=mingo@redhat.com \
/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
all inboxes | Powered by JetHome®