Skip to content

Commit

Permalink
lockdep: Fix preemption WARN for spurious IRQ-enable
Browse files Browse the repository at this point in the history
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.

Fixes: 4d00409 ("lockdep: Fix lockdep recursion")
Reported-by: syzbot+53f8ce8bbc07924b6417@syzkaller.appspotmail.com
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
  • Loading branch information
Peter Zijlstra committed Oct 22, 2020
1 parent ed3e453 commit f8e48a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/locking/lockdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -4057,7 +4057,7 @@ void lockdep_hardirqs_on_prepare(unsigned long ip)
if (unlikely(in_nmi()))
return;

if (unlikely(__this_cpu_read(lockdep_recursion)))
if (unlikely(this_cpu_read(lockdep_recursion)))
return;

if (unlikely(lockdep_hardirqs_enabled())) {
Expand Down Expand Up @@ -4126,7 +4126,7 @@ void noinstr lockdep_hardirqs_on(unsigned long ip)
goto skip_checks;
}

if (unlikely(__this_cpu_read(lockdep_recursion)))
if (unlikely(this_cpu_read(lockdep_recursion)))
return;

if (lockdep_hardirqs_enabled()) {
Expand Down

0 comments on commit f8e48a3

Please sign in to comment.