Message ID | 20221213154437.15480-8-akrowiak@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp200413wrn; Tue, 13 Dec 2022 07:51:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf6RMa8+tgN8GcCMhtlnjJyJusLBQ7I1nh2yNakCH068CrjTbDW6YaE6nVVnnDoPXsK/8r5b X-Received: by 2002:a17:90a:b38b:b0:219:8e19:6ebf with SMTP id e11-20020a17090ab38b00b002198e196ebfmr21987802pjr.0.1670946664731; Tue, 13 Dec 2022 07:51:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670946664; cv=none; d=google.com; s=arc-20160816; b=wM/au8oto3/zayolSGgc74ydnxZkEXLXCCKFTRm9dTd2hUgBit+gG9oTKbcG5GTHJF 2qzz96vJAmKC1Jb2R8Z5eVrUsLIoNJynTeMz3rZZITuCJihNb4opb3nQz66E9uU3wJ8j YHSmHC+j5+xUdrKX7XgjnzHnTWqIqjVhkjZlQi588vEUcPisUaI6CitLllwg2UCbbaDK kOJvc1Prau7CPG513XA2Aa04PTWXoc3GNkUIzKDt0eG058XUra7y3BV+RmI6ih/kRCEP 278+5cBW3HU5Rx3PiJDyl3vPm/JRnL3iyqEmaiCMpr+yFDECSdvA97Edo+55A7fjz8M4 eW5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dYhjc5kWligafOgB8GuVnFGfTxaEiO4j/8IIwD5XiyY=; b=ay+Q8B9aqavW0hHG0F98r9Diwhvlnvl8nuXZ8bRKKTbJIcRVy0ANXmXxL7d2lLcDap 1qQVjkKYCdDGFP0zQgO16Cr9ugB2dhDMHo06eVM5aQrXeHcR681K37owTE5gNWGP8h7g yPiUlGPypsm5Ei8VK9WlBtGnDF3R6G3yTvOyHIgzwnQ5rCrciw7zTg5puHDwD53jJLeF iSxILZ+GXeUWA/+CGW8NmugCBRMtXhTWu4In1VwtM0zd9dw8xkuBQX4j6AN9co2zWRRW zvO457kLMgY+IbWcDQ1Vf/r/s7h/D5wHICcVvntd2+Pe6/KzHQSQLFX1G74fA0DUTHTH v7ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=kRFtQSZV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pq14-20020a17090b3d8e00b0020087bc6415si12420233pjb.16.2022.12.13.07.50.48; Tue, 13 Dec 2022 07:51:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=kRFtQSZV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236206AbiLMPpb (ORCPT <rfc822;jeantsuru.cumc.mandola@gmail.com> + 99 others); Tue, 13 Dec 2022 10:45:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236317AbiLMPpA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 13 Dec 2022 10:45:00 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10E0620BF6; Tue, 13 Dec 2022 07:44:51 -0800 (PST) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BDE94u7024712; Tue, 13 Dec 2022 15:44:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=dYhjc5kWligafOgB8GuVnFGfTxaEiO4j/8IIwD5XiyY=; b=kRFtQSZVJXvCGvpxfXK0gZgaEBMy625C0R0wvE+6K/UckxoFkOfyz5jkf5kZ6KDi0N4l x80IMvjEdX6W1od2vTYwF6WVMvKgdVYwtwD9X1gxrWkUFWmW9zcKcWqKS2F9lxe1N4CO ks7MnPBor2ffacjvN5QsdXXZWlqehVPqm3Wx9zb1ZKY2klH2BKNoc9tCuuuYqHIgpddv ohPEiL5fhK3IyT/rymossDtQfDsJ7GJNX3hBE8vtrpgiDcaoE8OD2jLerfa8YkGVXWtY j/lNkluZW/4oPWXS0pMdUvrrd8yagGYADL2xZhwLZAx2uMOSeyKklH2f8tk//yC4PFIZ GA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3merrwx62t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:48 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2BDE9Ita025290; Tue, 13 Dec 2022 15:44:47 GMT Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3merrwx62g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:47 +0000 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 2BDF0AV9014246; Tue, 13 Dec 2022 15:44:47 GMT Received: from smtprelay03.wdc07v.mail.ibm.com ([9.208.129.113]) by ppma03dal.us.ibm.com (PPS) with ESMTPS id 3mchr71ark-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:47 +0000 Received: from smtpav01.dal12v.mail.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay03.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2BDFijPL12386904 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Dec 2022 15:44:45 GMT Received: from smtpav01.dal12v.mail.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E66E458062; Tue, 13 Dec 2022 15:44:44 +0000 (GMT) Received: from smtpav01.dal12v.mail.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1756A58061; Tue, 13 Dec 2022 15:44:44 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.endicott.ibm.com (unknown [9.60.85.43]) by smtpav01.dal12v.mail.com (Postfix) with ESMTP; Tue, 13 Dec 2022 15:44:43 +0000 (GMT) From: Tony Krowiak <akrowiak@linux.ibm.com> To: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: jjherne@linux.ibm.com, freude@linux.ibm.com, borntraeger@de.ibm.com, cohuck@redhat.com, mjrosato@linux.ibm.com, pasic@linux.ibm.com, alex.williamson@redhat.com, kwankhede@nvidia.com, fiuczy@linux.ibm.com Subject: [PATCH 7/7] s390/vfio_ap: always clean up IRQ resources Date: Tue, 13 Dec 2022 10:44:37 -0500 Message-Id: <20221213154437.15480-8-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221213154437.15480-1-akrowiak@linux.ibm.com> References: <20221213154437.15480-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 0bc9XSk5zSCN7iKKkVrxs2D9oINrkIKo X-Proofpoint-GUID: jtn6kGRV9ID3adBZ7aPC5x3iDqPs2fcn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-13_03,2022-12-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=999 impostorscore=0 suspectscore=0 adultscore=0 priorityscore=1501 phishscore=0 mlxscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212130137 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752114570146282147?= X-GMAIL-MSGID: =?utf-8?q?1752114570146282147?= |
Series |
improve AP queue reset processing
|
|
Commit Message
Anthony Krowiak
Dec. 13, 2022, 3:44 p.m. UTC
Clean up IRQ resources even when a PQAP(ZAPQ) function fails with an error
not handled by a case statement.
Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
---
drivers/s390/crypto/vfio_ap_ops.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 2022-12-13 16:44, Tony Krowiak wrote: > Clean up IRQ resources even when a PQAP(ZAPQ) function fails with an > error > not handled by a case statement. > > Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com> > --- > drivers/s390/crypto/vfio_ap_ops.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/s390/crypto/vfio_ap_ops.c > b/drivers/s390/crypto/vfio_ap_ops.c > index e80c5a6b91be..2dd8db9ddb39 100644 > --- a/drivers/s390/crypto/vfio_ap_ops.c > +++ b/drivers/s390/crypto/vfio_ap_ops.c > @@ -1676,7 +1676,7 @@ static int vfio_ap_mdev_reset_queue(struct > vfio_ap_queue *q) > "PQAP/ZAPQ for %02x.%04x failed with invalid rc=%u\n", > AP_QID_CARD(q->apqn), AP_QID_QUEUE(q->apqn), > status.response_code); > - return -EIO; > + break; > } > > vfio_ap_free_aqic_resources(q); Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
On Tue, 13 Dec 2022 10:44:37 -0500 Tony Krowiak <akrowiak@linux.ibm.com> wrote: > Clean up IRQ resources even when a PQAP(ZAPQ) function fails with an error > not handled by a case statement. Why? I'm afraid this is a step in the wrong direction... > > Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com> > --- > drivers/s390/crypto/vfio_ap_ops.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c > index e80c5a6b91be..2dd8db9ddb39 100644 > --- a/drivers/s390/crypto/vfio_ap_ops.c > +++ b/drivers/s390/crypto/vfio_ap_ops.c > @@ -1676,7 +1676,7 @@ static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q) > "PQAP/ZAPQ for %02x.%04x failed with invalid rc=%u\n", > AP_QID_CARD(q->apqn), AP_QID_QUEUE(q->apqn), > status.response_code); > - return -EIO; > + break; > } > > vfio_ap_free_aqic_resources(q);
On 12/19/22 9:10 AM, Halil Pasic wrote: > On Tue, 13 Dec 2022 10:44:37 -0500 > Tony Krowiak <akrowiak@linux.ibm.com> wrote: > >> Clean up IRQ resources even when a PQAP(ZAPQ) function fails with an error >> not handled by a case statement. > Why? If the ZAPQ failed, then instructions submitted to the same queue will likewise fail. Are you saying it's not safe to assume, therefore, that interrupts will not be occurring? > > I'm afraid this is a step in the wrong direction... Please explain why. > >> Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com> >> --- >> drivers/s390/crypto/vfio_ap_ops.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c >> index e80c5a6b91be..2dd8db9ddb39 100644 >> --- a/drivers/s390/crypto/vfio_ap_ops.c >> +++ b/drivers/s390/crypto/vfio_ap_ops.c >> @@ -1676,7 +1676,7 @@ static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q) >> "PQAP/ZAPQ for %02x.%04x failed with invalid rc=%u\n", >> AP_QID_CARD(q->apqn), AP_QID_QUEUE(q->apqn), >> status.response_code); >> - return -EIO; >> + break; >> } >> >> vfio_ap_free_aqic_resources(q);
On Tue, 20 Dec 2022 09:33:03 -0500 Anthony Krowiak <akrowiak@linux.ibm.com> wrote: > On 12/19/22 9:10 AM, Halil Pasic wrote: > > On Tue, 13 Dec 2022 10:44:37 -0500 > > Tony Krowiak <akrowiak@linux.ibm.com> wrote: > > > >> Clean up IRQ resources even when a PQAP(ZAPQ) function fails with an error > >> not handled by a case statement. > > Why? > > > If the ZAPQ failed, then instructions submitted to the same queue will > likewise fail. Are you saying it's not safe to assume, therefore, that > interrupts will not be occurring? Right. We are talking about the default branch here, and I suppose, the codes where we know that it is safe to assume that no reset is needed handled separately (AP_RESPONSE_DECONFIGURED). I'm not convinced that if we take the default branch we can safely assume, that we won't see any interrupts. For example consider hot-unplug as done by KVM. We modify the CRYCB/APCB with all vCPUS take out of SIE, but we don't keep the vCPUs out of SIE until the resets of the unpugged queues are done, and we don't do any extra interrupt disablement with all vCPUs keept out of SIE. So I believe currently there may be a window where the guest can observe a 01 but the interrupts are still live. That may be a bug, but IMHO it ain't clear cut. But it is not just about interrupts. Before we returned an error code, which gets propagated to the userspace if this reset was triggered via the ioctl. With this change, ret seems to be uninitialized when returned if we take the code path which you change here. So we would end up logging a warning and returning garbage? One could also debate, whether RCs introduced down the road can affect the logic here (even if the statement "if we see an RC other that 00 and 02, we don't need to pursue a reset any further, and interrpts are disabled" were to be guaranteed to be true now, new RCs could theoretically mess this up). > > > > > > I'm afraid this is a step in the wrong direction... > > > Please explain why. > Sorry, I kept this brief because IMHO it is your job to tell us why this needs to be changed. But I gave in, as you see. Regards, Halil
On 12/20/22 12:24 PM, Halil Pasic wrote: > On Tue, 20 Dec 2022 09:33:03 -0500 > Anthony Krowiak <akrowiak@linux.ibm.com> wrote: > >> On 12/19/22 9:10 AM, Halil Pasic wrote: >>> On Tue, 13 Dec 2022 10:44:37 -0500 >>> Tony Krowiak <akrowiak@linux.ibm.com> wrote: >>> >>>> Clean up IRQ resources even when a PQAP(ZAPQ) function fails with an error >>>> not handled by a case statement. >>> Why? >> >> If the ZAPQ failed, then instructions submitted to the same queue will >> likewise fail. Are you saying it's not safe to assume, therefore, that >> interrupts will not be occurring? > Right. We are talking about the default branch here, and I suppose, the > codes where we know that it is safe to assume that no reset is needed > handled separately (AP_RESPONSE_DECONFIGURED). > > I'm not convinced that if we take the default branch we can safely > assume, that we won't see any interrupts. > > For example consider hot-unplug as done by KVM. We modify the > CRYCB/APCB with all vCPUS take out of SIE, but we don't keep > the vCPUs out of SIE until the resets of the unpugged queues > are done, and we don't do any extra interrupt disablement > with all vCPUs keept out of SIE. So I believe currently there > may be a window where the guest can observe a 01 but the > interrupts are still live. That may be a bug, but IMHO it ain't clear > cut. > > But it is not just about interrupts. Before we returned an error > code, which gets propagated to the userspace if this reset was > triggered via the ioctl. > > With this change, ret seems to be uninitialized when returned > if we take the code path which you change here. So we would > end up logging a warning and returning garbage? That was an oversight. The -EIO value was returned previously, so the ret = -EIO should be set in the default case. > > One could also debate, whether RCs introduced down the road > can affect the logic here (even if the statement "if we > see an RC other that 00 and 02, we don't need to pursue a > reset any further, and interrpts are disabled" were to be > guaranteed to be true now, new RCs could theoretically mess > this up). I think that would be the case regardless of this change. If new RCs are introduced, this function ought to be revisited anyway and appropriate changes made. > > >> >>> I'm afraid this is a step in the wrong direction... >> >> Please explain why. >> > Sorry, I kept this brief because IMHO it is your job to tell us why > this needs to be changed. But I gave in, as you see. > > Regards, > Halil
diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index e80c5a6b91be..2dd8db9ddb39 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -1676,7 +1676,7 @@ static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q) "PQAP/ZAPQ for %02x.%04x failed with invalid rc=%u\n", AP_QID_CARD(q->apqn), AP_QID_QUEUE(q->apqn), status.response_code); - return -EIO; + break; } vfio_ap_free_aqic_resources(q);