Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752691Ab2JIT4u (ORCPT ); Tue, 9 Oct 2012 15:56:50 -0400 Received: from co1ehsobe004.messaging.microsoft.com ([216.32.180.187]:58537 "EHLO co1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751275Ab2JIT4s convert rfc822-to-8bit (ORCPT ); Tue, 9 Oct 2012 15:56:48 -0400 X-Forefront-Antispam-Report: CIP:198.70.193.61;KIP:(null);UIP:(null);IPV:NLI;H:avexcashub1.qlogic.com;RD:avexcashub1.qlogic.com;EFVD:NLI X-SpamScore: -2 X-BigFish: VPS-2(zz98dI1432Izz1202h1d1ah1d2ahzzz2fh2a8h668h839h944hf0ah107ah1288h12a5h12a9h12bdh137ah13b6h1441h1155h) Date: Tue, 9 Oct 2012 12:56:06 -0700 From: Arun Easi X-X-Sender: aeasi@mvluser04.mv.qlogic.com To: "Nicholas A. Bellinger" CC: Jiri Kosina , "James E.J. Bottomley" , Dept-Eng Linux Driver , Andrew Vasquez , "linux-scsi@vger.kernel.org" , linux-kernel , "Srivatsa S. Bhat" , Saurav Kashyap , target-devel , Roland Dreier Subject: Re: [PATCH] [RESEND] qla2xxx: fix potential deadlock on ha->hardware_lock In-Reply-To: <1349808467.3776.48.camel@haakon2.linux-iscsi.org> Message-ID: References: <506D80C2.5040405@linux.vnet.ibm.com> <1349808467.3776.48.camel@haakon2.linux-iscsi.org> User-Agent: Alpine 2.00 (LRH 1167 2008-08-23) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII"; format=flowed Content-Transfer-Encoding: 8BIT X-OriginatorOrg: qlogic.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3550 Lines: 100 Hi Nick, On Tue, 9 Oct 2012, 11:47am -0700, Nicholas A. Bellinger wrote: > Hi Jiri, Andrew, Arun & Co, > --8<-- snipped -- > > Also please have a look below for a few more related items I noticed > while reviewing this patch.. > >> drivers/scsi/qla2xxx/qla_init.c | 5 +++-- >> 1 files changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c >> index 799a58b..48fca47 100644 >> --- a/drivers/scsi/qla2xxx/qla_init.c >> +++ b/drivers/scsi/qla2xxx/qla_init.c >> @@ -2080,6 +2080,7 @@ qla2x00_configure_hba(scsi_qla_host_t *vha) >> uint8_t domain; >> char connect_type[22]; >> struct qla_hw_data *ha = vha->hw; >> + unsigned long flags; >> >> /* Get host addresses. */ >> rval = qla2x00_get_adapter_id(vha, >> @@ -2154,9 +2155,9 @@ qla2x00_configure_hba(scsi_qla_host_t *vha) >> vha->d_id.b.area = area; >> vha->d_id.b.al_pa = al_pa; >> >> - spin_lock(&ha->vport_slock); >> + spin_lock_irqsave(&ha->vport_slock, flags); >> qlt_update_vp_map(vha, SET_AL_PA); >> - spin_unlock(&ha->vport_slock); >> + spin_unlock_irqrestore(&ha->vport_slock, flags); >> >> if (!vha->flags.init_done) >> ql_log(ql_log_info, vha, 0x2010, >> > > So while looking at other ->vport_slock + qlt_update_vp_map() usage, two > more items caught my eye: > > In qla_mid.c:qla24xx_disable_vp() code: > > ret = qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL); > atomic_set(&vha->loop_state, LOOP_DOWN); > atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); > > /* Remove port id from vp target map */ > qlt_update_vp_map(vha, RESET_AL_PA); > > qla2x00_mark_vp_devices_dead(vha); > atomic_set(&vha->vp_state, VP_FAILED); > > AFAICT all callers of qlt_update_vp_map() into qla_target.c code should > be holding ->vport_slock. I'll send out a separate patch for this > shortly. Makes sense. > > And in qla_init.c:qla2x00_init_rings() code: > > for (que = 0; que < ha->max_rsp_queues; que++) { > rsp = ha->rsp_q_map[que]; > if (!rsp) > continue; > /* Initialize response queue entries */ > qla2x00_init_response_q_entries(rsp); > } > > spin_lock(&ha->vport_slock); > > spin_unlock(&ha->vport_slock); > > ha->tgt.atio_ring_ptr = ha->tgt.atio_ring; > ha->tgt.atio_ring_index = 0; > /* Initialize ATIO queue entries */ > qlt_init_atio_q_entries(vha); > > The usage of ->vport_slock seems to be now either unnecessary, or a > result of some bad merge outside of qla2xxx target mode. > > Qlogic folks, can this (leftover..?) usage of ->vport_slock now be > safety removed..? > Yes, this is a left over of code removal and can be safely removed. We already have a patch queued internally for this. --Arun This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/