[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <874kkx7k1f.fsf@nanos.tec.linutronix.de>
Date: Mon, 07 Dec 2020 15:44:28 +0100
From: Thomas Gleixner <tglx@...utronix.de>
To: Frederic Weisbecker <frederic@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Paul McKenney <paulmck@...nel.org>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Subject: Re: [patch V2 2/9] irqtime: Make accounting correct on RT
On Mon, Dec 07 2020 at 14:27, Frederic Weisbecker wrote:
> On Fri, Dec 04, 2020 at 06:01:53PM +0100, Thomas Gleixner wrote:
>> vtime_account_irq and irqtime_account_irq() base checks on preempt_count()
>> which fails on RT because preempt_count() does not contain the softirq
>> accounting which is seperate on RT.
>>
>> These checks do not need the full preempt count as they only operate on the
>> hard and softirq sections.
>>
>> Use irq_count() instead which provides the correct value on both RT and non
>> RT kernels. The compiler is clever enough to fold the masking for !RT:
>>
>> 99b: 65 8b 05 00 00 00 00 mov %gs:0x0(%rip),%eax
>> - 9a2: 25 ff ff ff 7f and $0x7fffffff,%eax
>> + 9a2: 25 00 ff ff 00 and $0xffff00,%eax
>>
>> Reported-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
>> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
>
> Reviewed-by: Frederic Weisbecker <frederic@...nel.org>
>
> Also I'm seeing a few other explicit SOFTIRQ_MASK checks on top
> of preempt_count(), especially on RCU:
>
> $ git grep SOFTIRQ_MASK
> arch/sh/kernel/irq.c: (irqctx->tinfo.preempt_count & ~SOFTIRQ_MASK) |
> arch/sh/kernel/irq.c: (curctx->tinfo.preempt_count & SOFTIRQ_MASK);
> kernel/rcu/rcutorture.c: if (preempt_count() & (SOFTIRQ_MASK | HARDIRQ_MASK))
> kernel/rcu/tree_exp.h: if (!(preempt_count() & (PREEMPT_MASK | SOFTIRQ_MASK)) ||
> kernel/rcu/tree_plugin.h: !!(preempt_count() & (PREEMPT_MASK | SOFTIRQ_MASK));
> kernel/rcu/tree_plugin.h: (preempt_count() &
> (PREEMPT_MASK | SOFTIRQ_MASK))) {
>
> I guess some RT RCU config take care of that?
I ignored sh so far and RCU has some quirks for RT vs. softirqs.
> Also tracing:
>
> kernel/trace/ring_buffer.c: if (!(pc & (NMI_MASK | HARDIRQ_MASK | SOFTIRQ_OFFSET)))
> kernel/trace/trace.c: ((pc & SOFTIRQ_OFFSET) ? TRACE_FLAG_SOFTIRQ : 0)
Bah, I somehow lost the cure for that while rebasing.
Thanks,
tglx
Powered by blists - more mailing lists