[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190529083357.GF2623@hirez.programming.kicks-ass.net>
Date: Wed, 29 May 2019 10:33:57 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Daniel Bristot de Oliveira <bristot@...hat.com>
Cc: linux-kernel@...r.kernel.org, williams@...hat.com,
daniel@...stot.me, "Steven Rostedt (VMware)" <rostedt@...dmis.org>,
Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Matthias Kaehlcke <mka@...omium.org>,
"Joel Fernandes (Google)" <joel@...lfernandes.org>,
Frederic Weisbecker <frederic@...nel.org>,
Yangtao Li <tiny.windzz@...il.com>,
Tommaso Cucinotta <tommaso.cucinotta@...tannapisa.it>
Subject: Re: [RFC 2/3] preempt_tracer: Disable IRQ while starting/stopping
due to a preempt_counter change
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?
> 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 :/
Powered by blists - more mailing lists