Re: BUG: using __this_cpu_read() in preemptible code in trace_hardirqs_on
From: Peter Zijlstra
Date: Fri Oct 23 2020 - 04:19:01 EST
On Thu, Oct 22, 2020 at 04:32:47PM -0400, Steven Rostedt wrote:
> On Thu, 22 Oct 2020 12:30:28 +0200
> Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> > Subject: lockdep: Fix preemption WARN for spurious IRQ-enable
> > From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> > Date: Thu Oct 22 12:23:02 CEST 2020
> >
> > It is valid (albeit uncommon) to call local_irq_enable() without first
> > having called local_irq_disable(). In this case we enter
> > lockdep_hardirqs_on*() with IRQs enabled and trip a preemption warning
> > for using __this_cpu_read().
> >
> > Use this_cpu_read() instead to avoid the warning.
>
> I was wondering why you were using __this_cpu_read() in the first place.
Well, because all other sites are actually with IRQs disabled :/ It's
just this spurious enable thing that's an exception.
> Reviewed-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
Thanks!