lkml.org 
[lkml]   [2020]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.9 040/391] lockdep: Fix preemption WARN for spurious IRQ-enable
    Date
    From: Peter Zijlstra <peterz@infradead.org>

    [ Upstream commit f8e48a3dca060e80f672d398d181db1298fbc86c ]

    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: 4d004099a6 ("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>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    kernel/locking/lockdep.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
    index 85d15f0362dc5..3eb35ad1b5241 100644
    --- a/kernel/locking/lockdep.c
    +++ b/kernel/locking/lockdep.c
    @@ -3681,7 +3681,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())) {
    @@ -3750,7 +3750,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()) {
    --
    2.27.0


    \
     
     \ /
      Last update: 2020-11-03 21:39    [W:4.350 / U:0.840 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site