[PATCH] trace/irq: fix WARNING in check_flags while CONFIG_TRACE_IRQFLAGS opened
From: Wang Yufen
Date: Mon Feb 22 2016 - 05:08:20 EST
if CONFIG_TRACE_IRQFLAGS opened, we got that warning:
[ 214.078880] ------------[ cut here ]------------
[ 214.083521] WARNING: CPU: 4 PID: 1 at kernel/locking/lockdep.c:3557
check_flags.part.40+0x1c0/0x1d0()
[ 214.092778] DEBUG_LOCKS_WARN_ON(current->hardirqs_enabled)
[ 214.098110] Modules linked in:
[ 214.101373] CPU: 4 PID: 1 Comm: systemd Tainted: G W
4.1.15+ #15
[ 214.108537] Hardware name: Hisilicon Hi1610 16core Pangea
Board (DT)
[ 214.114916] Call trace:
[ 214.117373] [<ffffffc00008af10>] dump_backtrace+0x0/0x1a0
[ 214.122794] [<ffffffc00008b0d0>] show_stack+0x20/0x30
[ 214.127867] [<ffffffc000b53454>] dump_stack+0x8c/0xb8
[ 214.132939] [<ffffffc0000c2308>]
warn_slowpath_common+0xa8/0xe0
[ 214.138882] [<ffffffc0000c23b4>] warn_slowpath_fmt+0x74/0xa0
[ 214.144563] [<ffffffc000121c20>]
check_flags.part.40+0x1c0/0x1d0
[ 214.150594] [<ffffffc000122760>] lock_is_held+0x80/0xa0
[ 214.155839] [<ffffffc00015125c>]
rcu_note_context_switch+0x3dc/0x410
[ 214.162219] [<ffffffc000b57dcc>] __schedule+0x5c/0xb00
[ 214.167377] [<ffffffc000b588b0>] schedule+0x40/0xa0
[ 214.172272] ---[ end trace 2d1dc460f8460cd7 ]---
[ 214.176906] possible reason: unannotated irqs-off.
It's because irqflags is not the same as current->hardirqs_enabled,
I think maybe use local_irq_XXX to instead raw_local_irq_XXX can fix
that warning
Signed-off-by: Wang Yufen <wangyufen@xxxxxxxxxx>
Signed-off-by: Ma Jun <majun258@xxxxxxxxxx>
---
kernel/locking/lockdep.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 716547f..1ed8b35 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -3620,13 +3620,13 @@ int lock_is_held(struct lockdep_map *lock)
if (unlikely(current->lockdep_recursion))
return 1; /* avoid false negative lockdep_assert_held() */
- raw_local_irq_save(flags);
+ local_irq_save(flags);
check_flags(flags);
current->lockdep_recursion = 1;
ret = __lock_is_held(lock);
current->lockdep_recursion = 0;
- raw_local_irq_restore(flags);
+ local_irq_restore(flags);
return ret;
}
--
1.7.1