From: Steven Rostedt <rostedt@goodmis.org>
To: Tom Zanussi <tom.zanussi@linux.intel.com>
Cc: masami.hiramatsu.pt@hitachi.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] tracing/triggers: A couple minor variable name changes
Date: Mon, 6 Jan 2014 20:50:34 -0500 [thread overview]
Message-ID: <20140106205034.53c219cc@gandalf.local.home> (raw)
In-Reply-To: <1389055673.3040.83.camel@empanada>
On Mon, 06 Jan 2014 18:47:53 -0600
> > diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
> > index 03d2db2..ccda66f 100644
> > --- a/include/linux/ftrace_event.h
> > +++ b/include/linux/ftrace_event.h
> > @@ -370,6 +370,75 @@ extern enum event_trigger_type event_triggers_call(struct ftrace_event_file *fil
> > extern void event_triggers_post_call(struct ftrace_event_file *file,
> > enum event_trigger_type tt);
> >
> > +static inline int
> > +ftrace_trigger_call_disabled(struct ftrace_event_file *file)
> > +{
> > + unsigned long eflags = file->flags;
> > +
> > + if (!(eflags & FTRACE_EVENT_FL_TRIGGER_COND)) {
> > + if (eflags & FTRACE_EVENT_FL_TRIGGER_MODE)
> > + event_triggers_call(file, NULL);
> > + if (eflags & FTRACE_EVENT_FL_SOFT_DISABLED)
> > + return 1;
> > + }
> > + return 0;
> > +}
> > +
>
> ftrace_trigger_call_disabled() as a name is OK, but it makes it sound
> like the trigger calls are disabled if it returns 1, when it actually
> can invoke the triggers when it returns 1, in cases where there's no
> reason to delay them. ftrace_call_triggers_check_soft_disabled() is
> more accurate but too unwieldy, so I'm not coming up with anything
> better. Maybe ftrace_trigger_soft_disabled() reads better, or not.
> Punting...
Honestly, I just whipped those names up out of the blue. Yeah,
ftrace_trigger_soft_disabled() sounds better. Will switch.
>
> > +static inline int
> > +__event_trigger_test_discard(struct ftrace_event_file *file,
> > + struct ring_buffer *buffer,
> > + struct ring_buffer_event *event,
> > + void *entry,
> > + enum event_trigger_type *tt)
> > +{
> > + unsigned long eflags = file->flags;
> > +
> > + if (eflags & FTRACE_EVENT_FL_TRIGGER_COND)
> > + *tt = event_triggers_call(file, entry);
> > +
> > + if (test_bit(FTRACE_EVENT_FL_SOFT_DISABLED_BIT, &file->flags))
> > + ring_buffer_discard_commit(buffer, event);
> > + else if (!filter_check_discard(file, entry, buffer, event))
> > + return 1;
>
> If the function is called ..._discard() then shouldn't it return 0 if it
> didn't discard?
Hmm, this was a ugly helper function (hence the "__" ;-) I really
couldn't think of a good name. Actually, it's called "test_discard"
which means it's just a test to know if it should discard or not.
How about if I switch it to ".._discard_test" and just comment what it
returns? I was going to add comments regardless.
>
> > +
> > + return 0;
> > +}
> > +
> > +static inline void
> > +event_trigger_unlock_commit(struct ftrace_event_file *file,
> > + struct ring_buffer *buffer,
> > + struct ring_buffer_event *event,
> > + void *entry, unsigned long irq_flags, int pc)
> > +{
> > + unsigned long eflags = file->flags;
>
> eflags isn't used in this function...
Hah, thanks. It originally was before I created the
__event_trigger_test_discard() helper function. My extensive tests would
have caught that too, but thanks. That saved me from having to fix it
before running the tests again.
>
> > + enum event_trigger_type tt = ETT_NONE;
> > +
> > + if (__event_trigger_test_discard(file, buffer, event, entry, &tt))
> > + trace_buffer_unlock_commit(buffer, event, irq_flags, pc);
>
> The logic is correct overall, but the way it reads is the opposite of
> what it used to i.e. it should read 'if you don't discard the event,
> then do the trace_buffer_unlock_commit' - it works as written because it
> returns 1 if it didn't discard, which is confusing.
Hmm, OK, I think you may have convinced me. I'll swap the return values.
I need to write up some trigger tests to make sure they work the same
before and after this patch.
>
> > +
> > + if (tt)
> > + event_triggers_post_call(file, tt);
> > +}
> > +
> > +
> > +static inline void
> > +event_trigger_unlock_commit_regs(struct ftrace_event_file *file,
> > + struct ring_buffer *buffer,
> > + struct ring_buffer_event *event,
> > + void *entry, unsigned long irq_flags, int pc,
> > + struct pt_regs *regs)
> > +{
> > + unsigned long eflags = file->flags;
>
> Ditto here on the unused eflags.
This one was cut and pasted added.
Thanks!
-- Steve
next prev parent reply other threads:[~2014-01-07 1:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-06 19:44 Tom Zanussi
2014-01-06 19:44 ` [PATCH 1/2 v2] tracing/kprobes: Add trace event trigger invocations Tom Zanussi
2014-01-06 21:56 ` Masami Hiramatsu
2014-01-06 19:44 ` [PATCH 2/2] tracing: Remove double-underscore naming in syscall " Tom Zanussi
2014-01-06 21:13 ` [PATCH 0/2] tracing/triggers: A couple minor variable name changes Steven Rostedt
2014-01-07 0:47 ` Tom Zanussi
2014-01-07 1:50 ` Steven Rostedt [this message]
2014-01-07 2:51 ` Tom Zanussi
2014-01-07 3:27 ` Steven Rostedt
2014-01-07 17:29 ` Tom Zanussi
2014-01-07 17:56 ` Steven Rostedt
2014-01-07 3:31 ` Steven Rostedt
2014-01-07 17:30 ` 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=20140106205034.53c219cc@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=tom.zanussi@linux.intel.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®