Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp433679pxu; Fri, 4 Dec 2020 06:54:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0EVyQtsJNdPycHL6pHuicgxMBdbrPfXfOOJd6prhljg+RLECyK+3VL0SKZuox4pp4CNyw X-Received: by 2002:a17:906:22c7:: with SMTP id q7mr7449297eja.486.1607093671188; Fri, 04 Dec 2020 06:54:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607093671; cv=none; d=google.com; s=arc-20160816; b=QZ7DtqRAyN4OkdKJ7RkNILQXrhWq0X62TQuMyRqBLY5ueiPy4s6qyCQ4r+Qek0+TyI +kItrXrFIqaC6lAAZftcVbA1iBjLTGWEefGVnvJOJd50dz/i+cIgJ1r/f9JxdBtVpHna Vp/IVgM0rZJDA+kkR+9y+T5LP3X1JljSbut4Utusw14xHPPG1oy3aWw4e6WjEr7sWIzW hOIL8xD61XoDvBw2zBnR0Hqcs0lQSZ84IOlD6FJmtBggyPH9Lno4uHVGHtnZeeJoc1D3 xmUu7Z5aZis7clEdWXHAxwKLuSPcK4d3O2f0nN9CksuWqQPyEsr6sJfzy6tX1rXoDnbc 73bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=Ai6L4sa0RgQ9M3WKqdb91X2AvRLvdJvZHP9oZzdHkKU=; b=Ifpa3hPjq+MUzx051TULakt3MoN4dtVyF4C2hyd8L63CSb66e2/6uzI/My0wLkguYj PKpCrjxys0ToG2YIzt/jAcimLClEvOzpSfnJGheDfOrfm/d4bbX3/ohDqfXSvGT5SBEH S/OqebzfTrbZUWPFrL2ntor7xpl0RHRHUbywvp4gM+wL6Mbqn9/9TbjC7kvGe2AHAvB/ AEAd3lr/75FuDMQmc16a4MdaM+QtzCkDoZ3MYahc3rfcEmDp7E0OzpEjvf7EWrKQbIH1 WvcKQZ+UZ1Audhyuj3M0G9U5yjs/dAB2Pc2Kd53mOXHMAauj0r6hv25vUW50KF5qpIin SXQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=BVY6HWM8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c20si1699946ejr.339.2020.12.04.06.54.08; Fri, 04 Dec 2020 06:54:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=BVY6HWM8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730276AbgLDOwa (ORCPT + 99 others); Fri, 4 Dec 2020 09:52:30 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:5760 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727620AbgLDOwa (ORCPT ); Fri, 4 Dec 2020 09:52:30 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0B4EpAtC131585; Fri, 4 Dec 2020 09:51:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=Ai6L4sa0RgQ9M3WKqdb91X2AvRLvdJvZHP9oZzdHkKU=; b=BVY6HWM8bpj9i21VQwmOSnoyxFcyHkd6WPnTqvr3yDdJ3tZjPW+2b8lPNXqmOMDRJrv6 EsbcZg53CIY79VE3Ve5xyYl9+IArsWhExi9Z32XLbxehkWEM3Ty0y3Vbj4ld5BC0TguI +QiLCh4VpuKmB0q2YJ38IYetEBkrBLVFlon4LGZKfnD4g9Bcsdiuyu8wVm0GUSGH/2pM j8nc5EAQ4Rm/8UYBq3BjOjr7keQDipRbJ114na0PzAc1Q9U8Xbmrl+VTJBt1b0iUTd7Q kanJR2c/v0Lzx2t7JJ/shbwwBMslFMTldey0+OvWT4F+JJvRao2TYmECB8VJrxfdND4Y /w== Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0b-001b2d01.pphosted.com with ESMTP id 357pt9rwxp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Dec 2020 09:51:43 -0500 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0B4EojeM028563; Fri, 4 Dec 2020 14:51:41 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma01wdc.us.ibm.com with ESMTP id 355vrgb7yq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Dec 2020 14:51:41 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0B4Epds019530226 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 4 Dec 2020 14:51:40 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CB55A78064; Fri, 4 Dec 2020 14:51:39 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5BAE37805C; Fri, 4 Dec 2020 14:51:39 +0000 (GMT) Received: from oc6034535106.ibm.com (unknown [9.163.73.174]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 4 Dec 2020 14:51:39 +0000 (GMT) Subject: Re: [PATCH v3 06/18] ibmvfc: add handlers to drain and complete Sub-CRQ responses To: Tyrel Datwyler , james.bottomley@hansenpartnership.com Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, brking@linux.ibm.com References: <20201203020806.14747-1-tyreld@linux.ibm.com> <20201203020806.14747-7-tyreld@linux.ibm.com> From: Brian King Message-ID: <3fe8683a-47f6-8713-762a-02c57c2e4ec2@linux.vnet.ibm.com> Date: Fri, 4 Dec 2020 08:51:38 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201203020806.14747-7-tyreld@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-12-04_04:2020-12-04,2020-12-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=2 bulkscore=0 malwarescore=0 phishscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 mlxlogscore=999 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012040080 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/2/20 8:07 PM, Tyrel Datwyler wrote: > The logic for iterating over the Sub-CRQ responses is similiar to that > of the primary CRQ. Add the necessary handlers for processing those > responses. > > Signed-off-by: Tyrel Datwyler > --- > drivers/scsi/ibmvscsi/ibmvfc.c | 80 ++++++++++++++++++++++++++++++++++ > 1 file changed, 80 insertions(+) > > diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c > index e082935f56cf..b61ae1df21e5 100644 > --- a/drivers/scsi/ibmvscsi/ibmvfc.c > +++ b/drivers/scsi/ibmvscsi/ibmvfc.c > @@ -3381,6 +3381,86 @@ static int ibmvfc_toggle_scrq_irq(struct ibmvfc_sub_queue *scrq, int enable) > return rc; > } > > +static void ibmvfc_handle_scrq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost) > +{ > + struct ibmvfc_event *evt = (struct ibmvfc_event *)be64_to_cpu(crq->ioba); > + unsigned long flags; > + > + switch (crq->valid) { > + case IBMVFC_CRQ_CMD_RSP: > + break; > + case IBMVFC_CRQ_XPORT_EVENT: > + return; > + default: > + dev_err(vhost->dev, "Got and invalid message type 0x%02x\n", crq->valid); > + return; > + } > + > + /* The only kind of payload CRQs we should get are responses to > + * things we send. Make sure this response is to something we > + * actually sent > + */ > + if (unlikely(!ibmvfc_valid_event(&vhost->pool, evt))) { > + dev_err(vhost->dev, "Returned correlation_token 0x%08llx is invalid!\n", > + crq->ioba); > + return; > + } > + > + if (unlikely(atomic_read(&evt->free))) { > + dev_err(vhost->dev, "Received duplicate correlation_token 0x%08llx!\n", > + crq->ioba); > + return; > + } > + > + del_timer(&evt->timer); > + list_del(&evt->queue); > + ibmvfc_trc_end(evt);> + spin_unlock_irqrestore(vhost->host->host_lock, flags); You can't do this here... You are grabbing the host lock in ibmvfc_drain_sub_crq and saving the irqflags to a local in that function, then doing a spin_unlock_irqrestore and restoring irqflags using an uninitialized local in this function... I'm assuming this will get sorted out with the locking changes we've been discussing off-list... > + evt->done(evt); > + spin_lock_irqsave(vhost->host->host_lock, flags); > +} > + > +static struct ibmvfc_crq *ibmvfc_next_scrq(struct ibmvfc_sub_queue *scrq) > +{ > + struct ibmvfc_crq *crq; > + > + crq = &scrq->msgs[scrq->cur].crq; > + if (crq->valid & 0x80) { > + if (++scrq->cur == scrq->size) > + scrq->cur = 0; > + rmb(); > + } else > + crq = NULL; > + > + return crq; > +} > + > +static void ibmvfc_drain_sub_crq(struct ibmvfc_sub_queue *scrq) > +{ > + struct ibmvfc_crq *crq; > + unsigned long flags; > + int done = 0; > + > + spin_lock_irqsave(scrq->vhost->host->host_lock, flags); > + while (!done) { > + while ((crq = ibmvfc_next_scrq(scrq)) != NULL) { > + ibmvfc_handle_scrq(crq, scrq->vhost); > + crq->valid = 0; > + wmb(); > + } > + > + ibmvfc_toggle_scrq_irq(scrq, 1); > + if ((crq = ibmvfc_next_scrq(scrq)) != NULL) { > + ibmvfc_toggle_scrq_irq(scrq, 0); > + ibmvfc_handle_scrq(crq, scrq->vhost); > + crq->valid = 0; > + wmb(); > + } else > + done = 1; > + } > + spin_unlock_irqrestore(scrq->vhost->host->host_lock, flags); > +} > + > /** > * ibmvfc_init_tgt - Set the next init job step for the target > * @tgt: ibmvfc target struct > -- Brian King Power Linux I/O IBM Linux Technology Center