From: Joel Fernandes <joel@joelfernandes.org>
To: Daniel Bristot de Oliveira <bristot@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org, williams@redhat.com,
daniel@bristot.me,
"Steven Rostedt (VMware)" <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Matthias Kaehlcke <mka@chromium.org>,
Frederic Weisbecker <frederic@kernel.org>,
Yangtao Li <tiny.windzz@gmail.com>,
Tommaso Cucinotta <tommaso.cucinotta@santannapisa.it>
Subject: Re: [RFC 2/3] preempt_tracer: Disable IRQ while starting/stopping due to a preempt_counter change
Date: Fri, 31 May 2019 03:47:29 -0400 [thread overview]
Message-ID: <20190531074729.GA153831@google.com> (raw)
In-Reply-To: <b47631c3-d65a-4506-098a-355c8cf50601@redhat.com>
On Wed, May 29, 2019 at 11:40:34AM +0200, Daniel Bristot de Oliveira wrote:
> On 29/05/2019 10:33, Peter Zijlstra wrote:
> > On Tue, May 28, 2019 at 05:16:23PM +0200, Daniel Bristot de Oliveira wrote:
> >> The preempt_disable/enable tracepoint only traces in the disable <-> enable
> >> case, which is correct. But think about this case:
> >>
> >> ---------------------------- %< ------------------------------
> >> THREAD IRQ
> >> | |
> >> preempt_disable() {
> >> __preempt_count_add(1)
> >> -------> smp_apic_timer_interrupt() {
> >> preempt_disable()
> >> do not trace (preempt count >= 1)
> >> ....
> >> preempt_enable()
> >> do not trace (preempt count >= 1)
> >> }
> >> trace_preempt_disable();
> >> }
> >> ---------------------------- >% ------------------------------
> >>
> >> The tracepoint will be skipped.
> >
> > .... for the IRQ. But IRQs are not preemptible anyway, so what the
> > problem?
>
>
> right, they are.
>
> exposing my problem in a more specific way:
>
> To show in a model that an event always takes place with preemption disabled,
> but not necessarily with IRQs disabled, it is worth having the preemption
> disable events separated from IRQ disable ones.
>
> The main reason is that, although IRQs disabled postpone the execution of the
> scheduler, it is more pessimistic, as it also delays IRQs. So the more precise
> the model is, the less pessimistic the analysis will be.
>
> But there are other use-cases, for instance:
>
> (Steve, correct me if I am wrong)
>
> The preempt_tracer will not notice a "preempt disabled" section in an IRQ
> handler if the problem above happens.
>
> (Yeah, I know these problems are very specific... but...)
I agree with the problem. I think Daniel does not want to miss the preemption
disabled event caused by the IRQ disabling.
> >> To avoid skipping the trace, the change in the counter should be "atomic"
> >> with the start/stop, w.r.t the interrupts.
> >>
> >> Disable interrupts while the adding/starting stopping/subtracting.
> >
> >> +static inline void preempt_add_start_latency(int val)
> >> +{
> >> + unsigned long flags;
> >> +
> >> + raw_local_irq_save(flags);
> >> + __preempt_count_add(val);
> >> + preempt_latency_start(val);
> >> + raw_local_irq_restore(flags);
> >> +}
> >
> >> +static inline void preempt_sub_stop_latency(int val)
> >> +{
> >> + unsigned long flags;
> >> +
> >> + raw_local_irq_save(flags);
> >> + preempt_latency_stop(val);
> >> + __preempt_count_sub(val);
> >> + raw_local_irq_restore(flags);
> >> +}
> >
> > That is hideously expensive :/
>
> Yeah... :-( Is there another way to provide such "atomicity"?
>
> Can I use the argument "if one has these tracepoints enabled, they are not
> considering it as a hot-path?"
The only addition here seems to the raw_local_irq_{save,restore} around the
calls to increment the preempt counter and start the latency tracking.
Is there any performance data with the tracepoint enabled and with/without
this patch? Like with hackbench?
Thanks.
next prev parent reply other threads:[~2019-05-31 7:47 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-28 15:16 [RFC 0/3] preempt_tracer: Fix preempt_disable tracepoint Daniel Bristot de Oliveira
2019-05-28 15:16 ` [RFC 1/3] softirq: Use preempt_latency_stop/start to trace preemption Daniel Bristot de Oliveira
2019-05-29 8:29 ` Peter Zijlstra
2019-05-29 9:30 ` Joel Fernandes
2019-05-29 12:22 ` Steven Rostedt
2019-06-04 10:39 ` Daniel Bristot de Oliveira
2019-06-04 12:01 ` Steven Rostedt
2019-05-28 15:16 ` [RFC 2/3] preempt_tracer: Disable IRQ while starting/stopping due to a preempt_counter change Daniel Bristot de Oliveira
2019-05-29 8:33 ` Peter Zijlstra
2019-05-29 9:40 ` Daniel Bristot de Oliveira
2019-05-29 10:20 ` Peter Zijlstra
2019-05-29 12:39 ` Steven Rostedt
2019-05-29 13:19 ` Peter Zijlstra
2019-05-29 13:29 ` Peter Zijlstra
2019-05-29 13:42 ` Steven Rostedt
2019-05-29 13:49 ` Peter Zijlstra
2019-05-29 13:58 ` Steven Rostedt
2019-05-29 13:51 ` Daniel Bristot de Oliveira
2019-05-29 18:21 ` Peter Zijlstra
2019-06-04 10:20 ` Daniel Bristot de Oliveira
2019-05-31 7:47 ` Joel Fernandes [this message]
2019-06-04 10:12 ` Daniel Bristot de Oliveira
2019-06-04 15:01 ` Steven Rostedt
2019-06-05 15:16 ` Joel Fernandes
2019-05-28 15:16 ` [RFC 3/3] preempt_tracer: Use a percpu variable to control traceble calls Daniel Bristot de Oliveira
2019-05-29 8:41 ` Peter Zijlstra
2019-05-29 9:48 ` Daniel Bristot de Oliveira
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=20190531074729.GA153831@google.com \
--to=joel@joelfernandes.org \
--cc=bristot@redhat.com \
--cc=daniel@bristot.me \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mka@chromium.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=tiny.windzz@gmail.com \
--cc=tommaso.cucinotta@santannapisa.it \
--cc=williams@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