mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] trace/irq: fix WARNING in check_flags while CONFIG_TRACE_IRQFLAGS opened
@ 2016-02-22 10:06 Wang Yufen
  2016-02-22 12:26 ` Peter Zijlstra
  0 siblings, 1 reply; 2+ messages in thread
From: Wang Yufen @ 2016-02-22 10:06 UTC (permalink / raw)
  To: linux-kernel, mingo, peterz; +Cc: guohanjun, dingtianhong, Wang Yufen, Ma Jun

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@huawei.com>
Signed-off-by: Ma Jun <majun258@huawei.com>
---
 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] trace/irq: fix WARNING in check_flags while CONFIG_TRACE_IRQFLAGS opened
  2016-02-22 10:06 [PATCH] trace/irq: fix WARNING in check_flags while CONFIG_TRACE_IRQFLAGS opened Wang Yufen
@ 2016-02-22 12:26 ` Peter Zijlstra
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2016-02-22 12:26 UTC (permalink / raw)
  To: Wang Yufen; +Cc: linux-kernel, mingo, guohanjun, dingtianhong, Ma Jun

On Mon, Feb 22, 2016 at 06:06:45PM +0800, Wang Yufen wrote:
> 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()

I'm not entirely sure how to open a CONFIG_ symbol, but when I have it
enabled, I do not get this warning.

So your report is missing some critical information.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-22 12:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-22 10:06 [PATCH] trace/irq: fix WARNING in check_flags while CONFIG_TRACE_IRQFLAGS opened Wang Yufen
2016-02-22 12:26 ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome