All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] softirq: weaken warning in local_bh_enable_ip()
@ 2013-06-19 16:19 Joern Engel
       [not found] ` <CA+55aFyBL9S9y=kpBte67PfO6EaB79CP3JtMP3KwMWQfo3PrFg@mail.gmail.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Joern Engel @ 2013-06-19 16:19 UTC (permalink / raw)
  To: linux-kernel, target-devel
  Cc: Joern Engel, Johannes Berg, Michael Buesch, David Ellingsworth,
	Linus Torvalds, Ingo Molnar, Nicholas A. Bellinger

This reliably triggers with the following backtrace:

local_bh_enable_ip+0x128/0x140
_raw_spin_unlock_bh+0x15/0x20
iscsit_inc_conn_usage_count+0x37/0x50 [iscsi_target_mod]
iscsit_stop_session+0x1db/0x280 [iscsi_target_mod]
lio_tpg_shutdown_session+0xb2/0xf0 [iscsi_target_mod]
core_tpg_set_initiator_node_queue_depth+0x119/0x2f0 [target_core_mod]
iscsit_tpg_set_initiator_node_queue_depth+0x12/0x20 [iscsi_target_mod]
lio_target_nacl_store_cmdsn_depth+0x110/0x1e0 [iscsi_target_mod]
target_fabric_nacl_base_attr_store+0x39/0x40 [target_core_mod]
configfs_write_file+0xbd/0x120
vfs_write+0xc6/0x180
sys_write+0x51/0x90
system_call_fastpath+0x16/0x1b

core_tpg_set_initiator_node_queue_depth() calls
lio_tpg_shutdown_session() inside a spin_lock_irqsave-protected block.
Calling spin_unlock_bh later in the call chain always triggers the
warning.

Signed-off-by: Joern Engel <joern@logfs.org>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Michael Buesch <mb@bu3sch.de>
Cc: David Ellingsworth <david@identd.dyndns.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
---
 kernel/softirq.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/softirq.c b/kernel/softirq.c
index 14d7758..d4ee1c6 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -157,7 +157,7 @@ EXPORT_SYMBOL(_local_bh_enable);
 
 static inline void _local_bh_enable_ip(unsigned long ip)
 {
-	WARN_ON_ONCE(in_irq() || irqs_disabled());
+	WARN_ON_ONCE(in_irq());
 #ifdef CONFIG_TRACE_IRQFLAGS
 	local_irq_disable();
 #endif
-- 
1.7.10.4


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

* Re: [PATCH] softirq: weaken warning in local_bh_enable_ip()
       [not found] ` <CA+55aFyBL9S9y=kpBte67PfO6EaB79CP3JtMP3KwMWQfo3PrFg@mail.gmail.com>
@ 2013-06-19 22:11   ` Jörn Engel
  0 siblings, 0 replies; 2+ messages in thread
From: Jörn Engel @ 2013-06-19 22:11 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Ingo Molnar, David Ellingsworth, Johannes Berg,
	Nicholas A. Bellinger, Michael Buesch, target-devel, linux-kernel

On Wed, 19 June 2013 12:27:37 -1000, Linus Torvalds wrote:
> 
> No the warning is correct, the SCSI target code needs to be fixed. You
> cannot call spin_unlock_bh with interrupts disabled.

That sounds like something coverity could be taught with reasonable
effort - if someone from them is listening.  Not sure if sparse has
enough context to do the same.

Just to play thick and make things ultra-clear, you say the following
pattern is never legal, correct?

spin_lock_irq(save)
...
spin_lock_bh
...
spin_unlock_bh
...
spin_unlock_irq(restore)

> So fix the code, don't weaken the warning.

Will do.

Jörn

--
The only real mistake is the one from which we learn nothing.
-- John Powell

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

end of thread, other threads:[~2013-06-19 23:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-19 16:19 [PATCH] softirq: weaken warning in local_bh_enable_ip() Joern Engel
     [not found] ` <CA+55aFyBL9S9y=kpBte67PfO6EaB79CP3JtMP3KwMWQfo3PrFg@mail.gmail.com>
2013-06-19 22:11   ` Jörn Engel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.