From 140854cb72525246745b67300d35101ad2875a39 Mon Sep 17 00:00:00 2001 From: Nicholas Bellinger Date: Wed, 31 Aug 2011 12:34:39 -0700 Subject: target: Convert session_lock to irqsave This patch converts the remaining struct se_portal_group->session_lock usage to use irqsave+irqrestore to address the following warnings for hardware target mode interrupt context usage. This change generate other warnings for current iscsi-target mode still using ->session_lock with spin_lock_bh, which will need to be converted in a seperate patch. [ 492.480728] [ INFO: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected ] [ 492.488194] 3.0.0+ #23 [ 492.490820] ------------------------------------------------------ [ 492.497704] sh/7162 [HC0[0]:SC0[2]:HE0:SE0] is trying to acquire: [ 492.504493] (&(&se_tpg->session_lock)->rlock){+.....}, at: [] transport_deregister_session+0x2d/0x163 [target_core_mod] 492.518390] [ 492.518390] and this task is already holding: [ 492.524897] (&(&ha->hardware_lock)->rlock){-.-...}, at: [] qla_tgt_stop_phase1+0x5e/0x27e [qla2xxx] [ 492.536856] which would create a new lock dependency: [ 492.542481] (&(&ha->hardware_lock)->rlock){-.-...} -> (&(&se_tpg->session_lock)->rlock){+.....} [ 492.552321] [ 492.552321] but this new dependency connects a HARDIRQ-irq-safe lock: [ 492.561149] (&(&ha->hardware_lock)->rlock){-.-...} [ 492.566400] ... which became HARDIRQ-irq-safe at: [ 492.571841] [] __lock_acquire+0x68f/0x921 [ 492.578247] [] lock_acquire+0xe0/0x10d [ 492.584367] [] _raw_spin_lock_irqsave+0x44/0x56 [ 492.591358] [] qla24xx_msix_default+0x5c/0x2aa [qla2xxx] [ 492.599227] [] handle_irq_event_percpu+0x5a/0x197 [ 492.606413] [] handle_irq_event+0x3c/0x5c [ 492.612822] [] handle_edge_irq+0xcc/0xf1 [ 492.619138] [] handle_irq+0x83/0x8e [ 492.624971] [] do_IRQ+0x48/0xaf [ 492.630413] [] ret_from_intr+0x0/0x1a [ 492.636437] [] cpu_idle+0x5b/0x8d [ 492.642073] [] rest_init+0xad/0xb4 [ 492.647809] [] start_kernel+0x366/0x371 [ 492.654030] [] x86_64_start_reservations+0xb8/0xbc [ 492.661311] [] x86_64_start_kernel+0x101/0x110 [ 492.668204] [ 492.668205] to a HARDIRQ-irq-unsafe lock: [ 492.674324] (&(&se_tpg->session_lock)->rlock){+.....} [ 492.679862] ... which became HARDIRQ-irq-unsafe at: [ 492.685497] ... [] __lock_acquire+0x709/0x921 [ 492.692209] [] lock_acquire+0xe0/0x10d [ 492.698330] [] _raw_spin_lock_bh+0x31/0x40 [ 492.704836] [] core_tpg_del_initiator_node_acl+0x89/0x336 [target_core_mod] [ 492.714546] [] tcm_qla2xxx_drop_nodeacl+0x20/0x2d [tcm_qla2xxx] [ 492.723087] [] target_fabric_nacl_base_release+0x22/0x24 [target_core_mod] [ 492.732698] [] config_item_release+0x7d/0xa3 [configfs] [ 492.740465] [] kref_put+0x43/0x4d [ 492.746101] [] config_item_put+0x19/0x1b [configfs] [ 492.753481] [] configfs_rmdir+0x1eb/0x258 [configfs] [ 492.760957] [] vfs_rmdir+0x79/0xd0 [ 492.766690] [] do_rmdir+0xc2/0x111 [ 492.772423] [] sys_rmdir+0x11/0x13 [ 492.778156] [] system_call_fastpath+0x16/0x1b [ 492.784953] Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_transport.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'drivers/target/target_core_transport.c') diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 3533ad644286..d931edf11c2b 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -252,7 +252,7 @@ struct se_session *transport_init_session(void) EXPORT_SYMBOL(transport_init_session); /* - * Called with spin_lock_bh(&struct se_portal_group->session_lock called. + * Called with spin_lock_irqsave(&struct se_portal_group->session_lock called. */ void __transport_register_session( struct se_portal_group *se_tpg, @@ -305,9 +305,11 @@ void transport_register_session( struct se_session *se_sess, void *fabric_sess_ptr) { - spin_lock_bh(&se_tpg->session_lock); + unsigned long flags; + + spin_lock_irqsave(&se_tpg->session_lock, flags); __transport_register_session(se_tpg, se_nacl, se_sess, fabric_sess_ptr); - spin_unlock_bh(&se_tpg->session_lock); + spin_unlock_irqrestore(&se_tpg->session_lock, flags); } EXPORT_SYMBOL(transport_register_session); -- cgit v1.2.1