diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-08-31 15:34:39 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-03-10 16:59:03 -0500 |
commit | 140854cb72525246745b67300d35101ad2875a39 (patch) | |
tree | 0bf6ee374f97781b6f7f00d3b89f2e901dae2255 /drivers/target | |
parent | 5e58b0299794fc4acf6e19995a2159e0535a008c (diff) |
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: [<ffffffffa022364d>] 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: [<ffffffffa00b9146>] 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] [<ffffffff81064720>] __lock_acquire+0x68f/0x921
[ 492.578247] [<ffffffff81064eff>] lock_acquire+0xe0/0x10d
[ 492.584367] [<ffffffff813a74c6>] _raw_spin_lock_irqsave+0x44/0x56
[ 492.591358] [<ffffffffa009b1be>] qla24xx_msix_default+0x5c/0x2aa [qla2xxx]
[ 492.599227] [<ffffffff81088582>] handle_irq_event_percpu+0x5a/0x197
[ 492.606413] [<ffffffff810886fb>] handle_irq_event+0x3c/0x5c
[ 492.612822] [<ffffffff8108a6dc>] handle_edge_irq+0xcc/0xf1
[ 492.619138] [<ffffffff810039b9>] handle_irq+0x83/0x8e
[ 492.624971] [<ffffffff8100333e>] do_IRQ+0x48/0xaf
[ 492.630413] [<ffffffff813a7cd3>] ret_from_intr+0x0/0x1a
[ 492.636437] [<ffffffff81001dc1>] cpu_idle+0x5b/0x8d
[ 492.642073] [<ffffffff81392709>] rest_init+0xad/0xb4
[ 492.647809] [<ffffffff81a1cbbc>] start_kernel+0x366/0x371
[ 492.654030] [<ffffffff81a1c2b1>] x86_64_start_reservations+0xb8/0xbc
[ 492.661311] [<ffffffff81a1c3b6>] 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] ... [<ffffffff8106479a>] __lock_acquire+0x709/0x921
[ 492.692209] [<ffffffff81064eff>] lock_acquire+0xe0/0x10d
[ 492.698330] [<ffffffff813a75ed>] _raw_spin_lock_bh+0x31/0x40
[ 492.704836] [<ffffffffa021c208>] core_tpg_del_initiator_node_acl+0x89/0x336 [target_core_mod]
[ 492.714546] [<ffffffffa02fb075>] tcm_qla2xxx_drop_nodeacl+0x20/0x2d [tcm_qla2xxx]
[ 492.723087] [<ffffffffa02108d9>] target_fabric_nacl_base_release+0x22/0x24 [target_core_mod]
[ 492.732698] [<ffffffffa01661c8>] config_item_release+0x7d/0xa3 [configfs]
[ 492.740465] [<ffffffff811d48fe>] kref_put+0x43/0x4d
[ 492.746101] [<ffffffffa0166149>] config_item_put+0x19/0x1b [configfs]
[ 492.753481] [<ffffffffa0164987>] configfs_rmdir+0x1eb/0x258 [configfs]
[ 492.760957] [<ffffffff810ecc54>] vfs_rmdir+0x79/0xd0
[ 492.766690] [<ffffffff810eec4a>] do_rmdir+0xc2/0x111
[ 492.772423] [<ffffffff810eecd0>] sys_rmdir+0x11/0x13
[ 492.778156] [<ffffffff813ae4d2>] system_call_fastpath+0x16/0x1b
[ 492.784953]
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_tpg.c | 18 | ||||
-rw-r--r-- | drivers/target/target_core_transport.c | 8 |
2 files changed, 15 insertions, 11 deletions
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index 06336ecd872d..32153404da14 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c | |||
@@ -449,6 +449,7 @@ int core_tpg_del_initiator_node_acl( | |||
449 | int force) | 449 | int force) |
450 | { | 450 | { |
451 | struct se_session *sess, *sess_tmp; | 451 | struct se_session *sess, *sess_tmp; |
452 | unsigned long flags; | ||
452 | int dynamic_acl = 0; | 453 | int dynamic_acl = 0; |
453 | 454 | ||
454 | spin_lock_irq(&tpg->acl_node_lock); | 455 | spin_lock_irq(&tpg->acl_node_lock); |
@@ -460,7 +461,7 @@ int core_tpg_del_initiator_node_acl( | |||
460 | tpg->num_node_acls--; | 461 | tpg->num_node_acls--; |
461 | spin_unlock_irq(&tpg->acl_node_lock); | 462 | spin_unlock_irq(&tpg->acl_node_lock); |
462 | 463 | ||
463 | spin_lock_bh(&tpg->session_lock); | 464 | spin_lock_irqsave(&tpg->session_lock, flags); |
464 | list_for_each_entry_safe(sess, sess_tmp, | 465 | list_for_each_entry_safe(sess, sess_tmp, |
465 | &tpg->tpg_sess_list, sess_list) { | 466 | &tpg->tpg_sess_list, sess_list) { |
466 | if (sess->se_node_acl != acl) | 467 | if (sess->se_node_acl != acl) |
@@ -471,16 +472,16 @@ int core_tpg_del_initiator_node_acl( | |||
471 | if (!tpg->se_tpg_tfo->shutdown_session(sess)) | 472 | if (!tpg->se_tpg_tfo->shutdown_session(sess)) |
472 | continue; | 473 | continue; |
473 | 474 | ||
474 | spin_unlock_bh(&tpg->session_lock); | 475 | spin_unlock_irqrestore(&tpg->session_lock, flags); |
475 | /* | 476 | /* |
476 | * If the $FABRIC_MOD session for the Initiator Node ACL exists, | 477 | * If the $FABRIC_MOD session for the Initiator Node ACL exists, |
477 | * forcefully shutdown the $FABRIC_MOD session/nexus. | 478 | * forcefully shutdown the $FABRIC_MOD session/nexus. |
478 | */ | 479 | */ |
479 | tpg->se_tpg_tfo->close_session(sess); | 480 | tpg->se_tpg_tfo->close_session(sess); |
480 | 481 | ||
481 | spin_lock_bh(&tpg->session_lock); | 482 | spin_lock_irqsave(&tpg->session_lock, flags); |
482 | } | 483 | } |
483 | spin_unlock_bh(&tpg->session_lock); | 484 | spin_unlock_irqrestore(&tpg->session_lock, flags); |
484 | 485 | ||
485 | core_tpg_wait_for_nacl_pr_ref(acl); | 486 | core_tpg_wait_for_nacl_pr_ref(acl); |
486 | core_clear_initiator_node_from_tpg(acl, tpg); | 487 | core_clear_initiator_node_from_tpg(acl, tpg); |
@@ -507,6 +508,7 @@ int core_tpg_set_initiator_node_queue_depth( | |||
507 | { | 508 | { |
508 | struct se_session *sess, *init_sess = NULL; | 509 | struct se_session *sess, *init_sess = NULL; |
509 | struct se_node_acl *acl; | 510 | struct se_node_acl *acl; |
511 | unsigned long flags; | ||
510 | int dynamic_acl = 0; | 512 | int dynamic_acl = 0; |
511 | 513 | ||
512 | spin_lock_irq(&tpg->acl_node_lock); | 514 | spin_lock_irq(&tpg->acl_node_lock); |
@@ -525,7 +527,7 @@ int core_tpg_set_initiator_node_queue_depth( | |||
525 | } | 527 | } |
526 | spin_unlock_irq(&tpg->acl_node_lock); | 528 | spin_unlock_irq(&tpg->acl_node_lock); |
527 | 529 | ||
528 | spin_lock_bh(&tpg->session_lock); | 530 | spin_lock_irqsave(&tpg->session_lock, flags); |
529 | list_for_each_entry(sess, &tpg->tpg_sess_list, sess_list) { | 531 | list_for_each_entry(sess, &tpg->tpg_sess_list, sess_list) { |
530 | if (sess->se_node_acl != acl) | 532 | if (sess->se_node_acl != acl) |
531 | continue; | 533 | continue; |
@@ -537,7 +539,7 @@ int core_tpg_set_initiator_node_queue_depth( | |||
537 | " depth and force session reinstatement" | 539 | " depth and force session reinstatement" |
538 | " use the \"force=1\" parameter.\n", | 540 | " use the \"force=1\" parameter.\n", |
539 | tpg->se_tpg_tfo->get_fabric_name(), initiatorname); | 541 | tpg->se_tpg_tfo->get_fabric_name(), initiatorname); |
540 | spin_unlock_bh(&tpg->session_lock); | 542 | spin_unlock_irqrestore(&tpg->session_lock, flags); |
541 | 543 | ||
542 | spin_lock_irq(&tpg->acl_node_lock); | 544 | spin_lock_irq(&tpg->acl_node_lock); |
543 | if (dynamic_acl) | 545 | if (dynamic_acl) |
@@ -567,7 +569,7 @@ int core_tpg_set_initiator_node_queue_depth( | |||
567 | acl->queue_depth = queue_depth; | 569 | acl->queue_depth = queue_depth; |
568 | 570 | ||
569 | if (core_set_queue_depth_for_node(tpg, acl) < 0) { | 571 | if (core_set_queue_depth_for_node(tpg, acl) < 0) { |
570 | spin_unlock_bh(&tpg->session_lock); | 572 | spin_unlock_irqrestore(&tpg->session_lock, flags); |
571 | /* | 573 | /* |
572 | * Force session reinstatement if | 574 | * Force session reinstatement if |
573 | * core_set_queue_depth_for_node() failed, because we assume | 575 | * core_set_queue_depth_for_node() failed, because we assume |
@@ -583,7 +585,7 @@ int core_tpg_set_initiator_node_queue_depth( | |||
583 | spin_unlock_irq(&tpg->acl_node_lock); | 585 | spin_unlock_irq(&tpg->acl_node_lock); |
584 | return -EINVAL; | 586 | return -EINVAL; |
585 | } | 587 | } |
586 | spin_unlock_bh(&tpg->session_lock); | 588 | spin_unlock_irqrestore(&tpg->session_lock, flags); |
587 | /* | 589 | /* |
588 | * If the $FABRIC_MOD session for the Initiator Node ACL exists, | 590 | * If the $FABRIC_MOD session for the Initiator Node ACL exists, |
589 | * forcefully shutdown the $FABRIC_MOD session/nexus. | 591 | * forcefully shutdown the $FABRIC_MOD session/nexus. |
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) | |||
252 | EXPORT_SYMBOL(transport_init_session); | 252 | EXPORT_SYMBOL(transport_init_session); |
253 | 253 | ||
254 | /* | 254 | /* |
255 | * Called with spin_lock_bh(&struct se_portal_group->session_lock called. | 255 | * Called with spin_lock_irqsave(&struct se_portal_group->session_lock called. |
256 | */ | 256 | */ |
257 | void __transport_register_session( | 257 | void __transport_register_session( |
258 | struct se_portal_group *se_tpg, | 258 | struct se_portal_group *se_tpg, |
@@ -305,9 +305,11 @@ void transport_register_session( | |||
305 | struct se_session *se_sess, | 305 | struct se_session *se_sess, |
306 | void *fabric_sess_ptr) | 306 | void *fabric_sess_ptr) |
307 | { | 307 | { |
308 | spin_lock_bh(&se_tpg->session_lock); | 308 | unsigned long flags; |
309 | |||
310 | spin_lock_irqsave(&se_tpg->session_lock, flags); | ||
309 | __transport_register_session(se_tpg, se_nacl, se_sess, fabric_sess_ptr); | 311 | __transport_register_session(se_tpg, se_nacl, se_sess, fabric_sess_ptr); |
310 | spin_unlock_bh(&se_tpg->session_lock); | 312 | spin_unlock_irqrestore(&se_tpg->session_lock, flags); |
311 | } | 313 | } |
312 | EXPORT_SYMBOL(transport_register_session); | 314 | EXPORT_SYMBOL(transport_register_session); |
313 | 315 | ||