From: Tom Zanussi <tom.zanussi@linux.intel.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: masami.hiramatsu.pt@hitachi.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 02/10] tracing: Add basic event trigger framework
Date: Fri, 06 Sep 2013 09:25:31 -0500 [thread overview]
Message-ID: <1378477531.7570.17.camel@empanada> (raw)
In-Reply-To: <20130905132153.550819bf@gandalf.local.home>
On Thu, 2013-09-05 at 13:21 -0400, Steven Rostedt wrote:
> On Mon, 2 Sep 2013 22:52:18 -0500
> Tom Zanussi <tom.zanussi@linux.intel.com> wrote:
>
[...]
> > +{
> > + struct event_trigger_data *data;
> > +
> > + if (list_empty(&file->triggers))
> > + return;
> > +
> > + preempt_disable_notrace();
>
> What's the reason for preempt_disable()? This should be called with
> rcu_read_lock held, right?
>
You're right, it is called under rcu_read_lock() and the
preempt_disable() is completely pointless - I'll remove these.
> > + list_for_each_entry_rcu(data, &file->triggers, list)
> > + data->ops->func(data);
> > + preempt_enable_notrace();
> > +}
> > +EXPORT_SYMBOL_GPL(event_triggers_call);
> > +
> > +static void *trigger_next(struct seq_file *m, void *t, loff_t *pos)
> > +{
> > + struct ftrace_event_file *event_file = event_file_data(m->private);
> > +
> > + return seq_list_next(t, &event_file->triggers, pos);
> > +}
> > +
> > +static void *trigger_start(struct seq_file *m, loff_t *pos)
> > +{
> > + struct ftrace_event_file *event_file;
> > +
> > + /* ->stop() is called even if ->start() fails */
> > + mutex_lock(&event_mutex);
> > + event_file = event_file_data(m->private);
> > + if (unlikely(!event_file))
> > + return ERR_PTR(-ENODEV);
> > +
> > + return seq_list_start(&event_file->triggers, *pos);
> > +}
> > +
> > +static void trigger_stop(struct seq_file *m, void *t)
> > +{
> > + mutex_unlock(&event_mutex);
> > +}
> > +
> > +static int trigger_show(struct seq_file *m, void *v)
> > +{
> > + struct event_trigger_data *data;
> > +
> > + data = list_entry(v, struct event_trigger_data, list);
> > + data->ops->print(m, data->ops, data);
> > +
> > + return 0;
> > +}
> > +
> > +static const struct seq_operations event_triggers_seq_ops = {
> > + .start = trigger_start,
> > + .next = trigger_next,
> > + .stop = trigger_stop,
> > + .show = trigger_show,
> > +};
> > +
> > +static int event_trigger_regex_open(struct inode *inode, struct file *file)
> > +{
> > + int ret = 0;
> > +
> > + mutex_lock(&event_mutex);
> > +
> > + if (unlikely(!event_file_data(file))) {
> > + mutex_unlock(&event_mutex);
> > + return -ENODEV;
> > + }
> > +
> > + if (file->f_mode & FMODE_READ) {
> > + ret = seq_open(file, &event_triggers_seq_ops);
> > + if (!ret) {
> > + struct seq_file *m = file->private_data;
> > + m->private = file;
> > + }
> > + }
> > +
> > + mutex_unlock(&event_mutex);
> > +
> > + return ret;
> > +}
> > +
> > +static int trigger_process_regex(struct ftrace_event_file *file,
> > + char *buff, int enable)
> > +{
> > + char *command, *next = buff;
> > + struct event_command *p;
> > + int ret = -EINVAL;
> > +
> > + command = strsep(&next, ": \t");
> > + command = (command[0] != '!') ? command : command + 1;
> > +
> > + mutex_lock(&trigger_cmd_mutex);
>
> What exactly is trigger_cmd_mutex protecting? It is only called here,
> and the event_mutex() is already held by its only caller, so this mutex
> is basically doing nothing.
>
trigger_cmd_mutex is also passed into and used by
register/unregister_event_command() (as *cmd_list_mutex) and protects
writers setting trigger commands against changes in the command list.
The next question would be why pass the mutex and command list in to the
register/unregister command instead of having those functions use them
directly? It's because these functions were originally meant to manage
multiple command lists, for both ftrace and event commands, but since it
now handles only event commands, I'll remove those extra params and just
use them directly.
Thanks,
Tom
next prev parent reply other threads:[~2013-09-06 14:25 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-03 3:52 [PATCH v8 00/10] tracing: trace event triggers Tom Zanussi
2013-09-03 3:52 ` [PATCH v8 01/10] tracing: Add support for SOFT_DISABLE to syscall events Tom Zanussi
[not found] ` <20130905120111.4900aa60@gandalf.local.home>
2013-09-06 12:22 ` Masami Hiramatsu
2013-09-06 12:41 ` Steven Rostedt
2013-09-03 3:52 ` [PATCH v8 02/10] tracing: Add basic event trigger framework Tom Zanussi
2013-09-05 17:21 ` Steven Rostedt
2013-09-06 14:25 ` Tom Zanussi [this message]
2013-09-03 3:52 ` [PATCH v8 03/10] tracing: Add 'traceon' and 'traceoff' event trigger commands Tom Zanussi
[not found] ` <20130905164621.40f92270@gandalf.local.home>
2013-09-06 12:37 ` Masami Hiramatsu
2013-09-06 12:42 ` Steven Rostedt
2013-09-03 3:52 ` [PATCH v8 04/10] tracing: Add 'snapshot' event trigger command Tom Zanussi
2013-09-03 3:52 ` [PATCH v8 05/10] tracing: Add 'stacktrace' " Tom Zanussi
2013-09-03 3:52 ` [PATCH v8 06/10] tracing: Add 'enable_event' and 'disable_event' event trigger commands Tom Zanussi
2013-09-03 3:52 ` [PATCH v8 07/10] tracing: Add and use generic set_trigger_filter() implementation Tom Zanussi
2013-09-03 3:52 ` [PATCH v8 08/10] tracing: Update event filters for multibuffer Tom Zanussi
2013-09-03 3:52 ` [PATCH v8 09/10] tracing: Add documentation for trace event triggers Tom Zanussi
2013-09-03 3:52 ` [PATCH v8 10/10] tracing: Make register/unregister_ftrace_command __init 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=1378477531.7570.17.camel@empanada \
--to=tom.zanussi@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--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