[v1,3/6] s390/vfio-ap: let 'on_scan_complete' callback filter matrix and update guest's APCB
Message ID | 20231208162256.10633-4-akrowiak@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5564948vqy; Fri, 8 Dec 2023 08:23:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IF1NRFkZFZDERsm2pNVMc4XUOYELy9pqZAIX7qZsbP968hRzr/FOaDm/bBX0s9vIgh0nNl2 X-Received: by 2002:a05:6871:a005:b0:1fa:e2e4:ecbe with SMTP id vp5-20020a056871a00500b001fae2e4ecbemr350563oab.6.1702052618534; Fri, 08 Dec 2023 08:23:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702052618; cv=none; d=google.com; s=arc-20160816; b=i88EFQg9AHAs4X4MqMhxxCV4/Jx5cYLrA6RZhuLDqy/4OU88zlkxEeRlFBA13Dc5Vj 2/Mk/yUbUEtr5SaG9jXACHQvc0O9tHL0s7OQu2hQw6/d7O8T+o5ytxJOywqAfFADg7wx aJiYk8vXG3YVDttoozDlxn87FNEpaDdS6R8TFv8V9b86Fr2vyi4IXiXJ9hcLRFnRY46O sKjt88ZTrxQPwbi8uedOGEIlrV3AS1uBchq8C6BYJCP59Gg1zKsPrTPLTKpSF81sN4aW aFKQ/nsd2AIjG8+MWEmvf9Mln1cQrSd/trCcGr8XLYx/dEl0hEiQ+p15anzIFa6tcEy3 xLPw== 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=BrL9cLcoos8OUrrFviFcgpkOZczpwLcNVeseNGIUVoI=; fh=9kM08SNvNCV/491z4P/0od8SLPJE1APHr0sNclRdvng=; b=nl5nwwwsAvVJApDp7bHjjW8R6mv9ixVCYEGLogepfooz9OOL6vr1/95+19MHD01Pcp 2etzeehj8Z6uaFUb2rAKirJ7cCfhvC0EB9ZjmZZZEFGbqPdaI0qweKImYfcuv4/WK9fx JSlm9JyYOTbgn4Mj0ub4EEGOy4RtiGY5RPJKTqWr3eHjFvJZAgog09sQMHtYsDq7I4pF 3gbwTMbSNGZ7cawYIr6oyZOvTBoNyZso7rqs0Zc9y2cEKTjiChb7K03Z/pYCTWysG9oR PjR0gKEu+0tzPtyzrDzG5zm+zEKzJH94S7JObDL3hj6ENJd2J/5q6nTaCzPxTApNcth/ T/ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=QBxTVyba; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id z25-20020a656659000000b005c67791904bsi1680399pgv.777.2023.12.08.08.23.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 08:23:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=QBxTVyba; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 6BB8B837E66D; Fri, 8 Dec 2023 08:23:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233647AbjLHQXM (ORCPT <rfc822;pusanteemu@gmail.com> + 99 others); Fri, 8 Dec 2023 11:23:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573811AbjLHQXB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 8 Dec 2023 11:23:01 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D2D2173F; Fri, 8 Dec 2023 08:23:08 -0800 (PST) Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B8GID0j020666; Fri, 8 Dec 2023 16:23:06 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=BrL9cLcoos8OUrrFviFcgpkOZczpwLcNVeseNGIUVoI=; b=QBxTVybaw8Csng1wsQyksoK7MAoNvGaZ181iAvZHRYdVGe7hXa1fGx6QkZ8ZzjrZc3mQ lnp8AU/FiOVF0f+8lWA1BZqo/mq0ejhmtbiaJ4drPgaA+mrcqYXV1rqJLiA+Yc1EQ1mU tSPe7SP4Euu436YWklO8W+nvY+Q7d0PspU23iM7MPdztOcHUN0fcdfJhSEsjTYSZ1CUL 18Exen6SNaacDexAiQYxN7IlKDwo+zqezoLrIjQ7DVk/b9us8F+Q3zklMZZJhVJk+7ck kr3rZnamRd5BL3J2Ew2w7l2OZ4xpiIF6O36h3tQUrvS/W61PT1PAtvV5eMB7lLMbZuCe BA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uv6htr6bd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 Dec 2023 16:23:06 +0000 Received: from m0353724.ppops.net (m0353724.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3B8GIgJQ022621; Fri, 8 Dec 2023 16:23:05 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uv6htr6b1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 Dec 2023 16:23:05 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3B8GLjU1001561; Fri, 8 Dec 2023 16:23:04 GMT Received: from smtprelay05.wdc07v.mail.ibm.com ([172.16.1.72]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3utav2tjf7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 Dec 2023 16:23:04 +0000 Received: from smtpav06.wdc07v.mail.ibm.com (smtpav06.wdc07v.mail.ibm.com [10.39.53.233]) by smtprelay05.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3B8GN3RI60686616 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 8 Dec 2023 16:23:03 GMT Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 90F7058054; Fri, 8 Dec 2023 16:23:03 +0000 (GMT) Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6AB7C5803F; Fri, 8 Dec 2023 16:23:02 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.ibm.com.com (unknown [9.61.47.9]) by smtpav06.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 8 Dec 2023 16:23:02 +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, borntraeger@de.ibm.com, pasic@linux.ibm.com, pbonzini@redhat.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, alex.williamson@redhat.com, kwankhede@nvidia.com Subject: [PATCH v1 3/6] s390/vfio-ap: let 'on_scan_complete' callback filter matrix and update guest's APCB Date: Fri, 8 Dec 2023 11:22:48 -0500 Message-ID: <20231208162256.10633-4-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231208162256.10633-1-akrowiak@linux.ibm.com> References: <20231208162256.10633-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: SfTKicTGCbIMKwWGabBkNUbRK9MIUwcR X-Proofpoint-ORIG-GUID: qMPkzXcrSBIXq6dqE6c5cwqjdHUQark_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-08_11,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 suspectscore=0 malwarescore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 priorityscore=1501 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2312080135 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 08 Dec 2023 08:23:25 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784731526336449386 X-GMAIL-MSGID: 1784731526336449386 |
Series |
s390/vfio-ap: reset queues removed from guest's AP configuration
|
|
Commit Message
Anthony Krowiak
Dec. 8, 2023, 4:22 p.m. UTC
When adapters and/or domains are added to the host's AP configuration, this
may result in multiple queue devices getting created and probed by the
vfio_ap device driver. For each queue device probed, the matrix of adapters
and domains assigned to a matrix mdev will be filtered to update the
guest's APCB. If any adapters or domains get added to or removed from the
APCB, the guest's AP configuration will be dynamically updated (i.e., hot
plug/unplug). To dynamically update the guest's configuration, its VCPUs
must be taken out of SIE for the period of time it takes to make the
update. This is disruptive to the guest's operation and if there are many
queues probed due to a change in the host's AP configuration, this could be
troublesome. The problem is exacerbated by the fact that the
'on_scan_complete' callback also filters the mdev's matrix and updates
the guest's AP configuration.
In order to reduce the potential amount of disruption to the guest that may
result from a change to the host's AP configuration, let's bypass the
filtering of the matrix and updating of the guest's AP configuration in the
probe callback - if due to a host config change - and defer it until the
'on_scan_complete' callback is invoked after the AP bus finishes its device
scan operation. This way the filtering and updating will be performed only
once regardless of the number of queues added.
Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
---
drivers/s390/crypto/vfio_ap_ops.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index 47232e19a50e..26bd4aca497a 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -2083,9 +2083,22 @@ int vfio_ap_mdev_probe_queue(struct ap_device *apdev) if (matrix_mdev) { vfio_ap_mdev_link_queue(matrix_mdev, q); + /* + * If we're in the process of handling the adding of adapters or + * domains to the host's AP configuration, then let the + * vfio_ap device driver's on_scan_complete callback filter the + * matrix and update the guest's AP configuration after all of + * the new queue devices are probed. + */ + if (!bitmap_empty(matrix_mdev->apm_add, AP_DEVICES) || + !bitmap_empty(matrix_mdev->aqm_add, AP_DOMAINS)) + goto done; + if (vfio_ap_mdev_filter_matrix(matrix_mdev)) vfio_ap_mdev_update_guest_apcb(matrix_mdev); } + +done: dev_set_drvdata(&apdev->device, q); release_update_locks_for_mdev(matrix_mdev);