From: Stephen Boyd <sboyd@codeaurora.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tracing: Don't account for cpu idle time with irqsoff tracers
Date: Tue, 27 May 2014 12:26:49 -0700 [thread overview]
Message-ID: <5384E6F9.6060806@codeaurora.org> (raw)
In-Reply-To: <20140527151341.4411f910@gandalf.local.home>
On 05/27/14 12:13, Steven Rostedt wrote:
> Hey! I was able to get to this.
Great!
>
> On Mon, 19 May 2014 12:30:47 -0700
> Stephen Boyd <sboyd@codeaurora.org> wrote:
>
>> + if (!tracer_enabled || !tracing_is_enabled() ||
>> + per_cpu(timings_stopped, cpu))
>> + return;
> Micro optimization. As this gets called even when not tracing, the
> tracer_enabled is what determines if tracing is enabled or not. Can you
> keep the first condition the same, and just add your check to the one
> below:
>
> if (per_cpu(timings_stop, cpu) || per_cpu(tracing_cpu, cpu))
> return;
Ok.
>
>> +
>> if (per_cpu(tracing_cpu, cpu))
>> return;
>>
>> @@ -418,7 +421,8 @@ stop_critical_timing(unsigned long ip, unsigned long parent_ip)
>> else
>> return;
>>
>> - if (!tracer_enabled || !tracing_is_enabled())
>> + if (!tracer_enabled || !tracing_is_enabled() ||
>> + per_cpu(timings_stopped, cpu))
>> return;
>>
>> data = per_cpu_ptr(tr->trace_buffer.data, cpu);
>> @@ -439,15 +443,19 @@ stop_critical_timing(unsigned long ip, unsigned long parent_ip)
>> /* start and stop critical timings used to for stoppage (in idle) */
>> void start_critical_timings(void)
>> {
>> - if (preempt_trace() || irq_trace())
>> + if (preempt_trace() || irq_trace()) {
>> + per_cpu(timings_stopped, raw_smp_processor_id()) = false;
>> start_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
>> + }
>> }
>> EXPORT_SYMBOL_GPL(start_critical_timings);
>>
>> void stop_critical_timings(void)
>> {
>> - if (preempt_trace() || irq_trace())
>> + if (preempt_trace() || irq_trace()) {
>> stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
>> + per_cpu(timings_stopped, raw_smp_processor_id()) = true;
>> + }
> Hmm, I think this is racy. If we enter idle with tracing enabled it
> will set timings_stopped to true for this cpu. But if we disable
> tracing while in idle, it will not turn it off.
>
> Well, this isn't really true, because once we enable tracing the
> trace_type that is used to check preempt_trace() and irq_trace() stays
> set even when tracing isn't enabled. But this may change soon and that
> can make this a problem.
>
> I don't see any reason the setting of timings_stopped can't be set
> unconditionally in these functions.
I don't see any problem either. I'll send an update.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
prev parent reply other threads:[~2014-05-27 19:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-19 19:30 Stephen Boyd
2014-05-27 18:05 ` Stephen Boyd
2014-05-27 18:23 ` Steven Rostedt
2014-05-27 19:13 ` Steven Rostedt
2014-05-27 19:26 ` Stephen Boyd [this message]
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=5384E6F9.6060806@codeaurora.org \
--to=sboyd@codeaurora.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.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
Powered by JetHome