From: Steven Rostedt <rostedt@goodmis.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Joel Fernandes <joelaf@google.com>,
LKML <linux-kernel@vger.kernel.org>,
kernel-team@android.com
Subject: Re: [PATCH v6 2/2] tracing: Add support for preempt and irq enable/disable events
Date: Mon, 25 Sep 2017 06:15:28 -0400 [thread overview]
Message-ID: <20170925061528.09082957@vmware.local.home> (raw)
In-Reply-To: <20170925083432.jvaewlsrb46wjmjj@hirez.programming.kicks-ass.net>
On Mon, 25 Sep 2017 10:34:32 +0200
Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > grep-1041 [002] d..1 80.363455: preempt_disable:
> > caller=_raw_spin_lock_irqsave+0x1d/0x40
> > parent=add_wait_queue+0x15/0x50
>
> I suppose that sort-of makes sense for the preempt-tracer, but its a
> weird thing for a generic tracepoint.
I still find it very useful, even as a tracepoint.
>
> > >> void start_critical_timings(void)
> > >> {
> > >> + if (this_cpu_read(tracing_preempt_cpu))
> > >> + trace_preempt_enable_rcuidle(CALLER_ADDR0, CALLER_ADDR1);
> > >> +
> > >> + if (this_cpu_read(tracing_irq_cpu))
> > >> + trace_irq_enable_rcuidle(CALLER_ADDR0, CALLER_ADDR1);
> > >> +
> > >> start_critical_timings_tracer();
> > >> }
> > >> EXPORT_SYMBOL_GPL(start_critical_timings);
> > >>
> > >> void stop_critical_timings(void)
> > >> {
> > >> + if (this_cpu_read(tracing_preempt_cpu))
> > >> + trace_preempt_disable_rcuidle(CALLER_ADDR0, CALLER_ADDR1);
> > >> +
> > >> + if (this_cpu_read(tracing_irq_cpu))
> > >> + trace_irq_disable_rcuidle(CALLER_ADDR0, CALLER_ADDR1);
> > >> +
> > >> stop_critical_timings_tracer();
> > >> }
> > >> EXPORT_SYMBOL_GPL(stop_critical_timings);
> > >
> > > And I feel these yield somewhat odd semantics, does that need explaining
> > > somewhere?
> >
> > Maybe I can add a comment here, if you prefer that. When you meant
> > semantics, do you mean 'critical' vs 'atomic' thing or do you mean the
> > semantics/context of how this function is supposed to be used?
>
> I would add the comment to the tracepoint definition.
>
> On semantics, the whole stop/start excludes a fair bunch of walltime
> from our measurement, I feel that needs to be called out and enumerated
> (when time goes missing and why).
>
> Given that the idle thread runs with preempt-off I understand its
> purpose from the POV from the preempt-tracer, but its 'weird' behaviour
> if you're looking at it from a pure tracepoint pov.
You mean you want to trace all calls to preempt and irq off even if
preempt and irqs are already off?
>
> > >> void trace_preempt_off(unsigned long a0, unsigned long a1)
> > >> {
> > >> + if (this_cpu_read(tracing_preempt_cpu))
> > >> + return;
> > >> +
> > >> + this_cpu_write(tracing_preempt_cpu, 1);
> > >> +
> > >> + trace_preempt_disable_rcuidle(a0, a1);
> > >> tracer_preempt_off(a0, a1);
> > >> }
> > >> #endif
> > >
> > > And here you assume things like double on / double off don't happen,
> > > which might well be so, but does seem somewhat fragile.
> > >
> >
> > We are handling the cases where these functions might be called twice,
> > but we are only interested in the first time they're called. I caught
> > a dead lock happen when I didn't add such protection to
> > trace_hardirqs_off so I added to these to the trace_hardirqs* and
> > trace_preempt* ones as well to just to be extra safe and keep it
> > consistent. Hope I understood your concern correctly, if not please
> > let me know, thanks.
>
> Under what conditions where they called twice? That seems like something
> that should not happen to begin with. Esp the one I left quoted above,
> disabling when its already disabled sounds like fail. So please provide
> more details on the scenario you're working around.
I'm a little confused by this too.
-- Steve
next prev parent reply other threads:[~2017-09-25 10:15 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-22 1:50 [PATCH v6 0/2] tracing: Add trace events for preemption and irq disable/enable Joel Fernandes
2017-09-22 1:50 ` [PATCH v6 1/2] tracing: Prepare to add preempt and irq trace events Joel Fernandes
2017-09-22 1:50 ` [PATCH v6 2/2] tracing: Add support for preempt and irq enable/disable events Joel Fernandes
2017-09-22 9:02 ` Peter Zijlstra
2017-09-22 18:28 ` Joel Fernandes
2017-09-25 8:34 ` Peter Zijlstra
2017-09-25 10:15 ` Steven Rostedt [this message]
2017-09-25 10:32 ` Peter Zijlstra
2017-09-25 10:52 ` Steven Rostedt
2017-09-25 22:57 ` Joel Fernandes
2017-09-26 2:47 ` Steven Rostedt
2017-09-29 2:15 ` Joel Fernandes
2017-09-26 0:23 ` Joel Fernandes
2017-09-30 9:08 ` Steven Rostedt
2017-10-02 19:23 ` Joel Fernandes
2017-10-02 19:33 ` Joel Fernandes
2017-10-02 19:37 ` Steven Rostedt
2017-10-02 21:31 ` Joel Fernandes
2017-09-22 3:11 ` [PATCH v6 0/2] tracing: Add trace events for preemption and irq disable/enable 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=20170925061528.09082957@vmware.local.home \
--to=rostedt@goodmis.org \
--cc=joelaf@google.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.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