[v4,3/6] s390/vfio-ap: let 'on_scan_complete' callback filter matrix and update guest's APCB
Message ID | 20240115185441.31526-4-akrowiak@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-26416-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp1887241dyc; Mon, 15 Jan 2024 10:56:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNbdXgw4RRl7dv9P/O+iZ1elgdPyT6mTbxVslF4YA5lpwdc/uaKq8+PtGNyP3rbO28AAfd X-Received: by 2002:a81:9a07:0:b0:5ff:4b02:73b9 with SMTP id r7-20020a819a07000000b005ff4b0273b9mr130219ywg.21.1705344981723; Mon, 15 Jan 2024 10:56:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705344981; cv=none; d=google.com; s=arc-20160816; b=c2lAReDv7ICs7hZROoERFCJybMHfk4kxVPaIbbRVFQIs+x8y17ThP5JEJJO5ZCCE+x XULl6aID0YnvjZTtE/sqsVZItUBRFZH6E+BP67tJX8948/MDirf/I2toBo9EPSSXlS28 hr66vTlm+x/gm+1r6y+RD6Sr0loiYPpotyEV9Tvu89TDkoJHC2VzmH7BPddNcHU8vIKl WafR22KdAG+mxad+buNak5U1jKlnWnCsNIu3mvRrq1Z4/jZAPEFuuG5km9b/zz8bmTXM KmT+p1FRuF2HYyKTidKcotWv4EvvDtJKJQpBzUPfBvFGdT9DG0VibtiUwqvObMg/+Q2n roSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=4WTuNJU7dggzhMxg+LKkTN4UTqO72KHYK9oF7xPUUCg=; fh=M0oRxUbO5PmdBwbCvdqALEcb6RJBVEJ1jCZynSfqY4Y=; b=f2uuQMNi/S+0Okpqj7B5NTVqYSqVp5T1kA0tZs8UDZ38jRkmr6J7KGSbCMfroyFOXJ rb2OSCqHA2wrcSUmdRJOOS4j0E1jtC7az3iH/88gQST8NSNNcG9DMtFKXyNko1zkY0ry UFBeXNS6VrDSnwX/0SLE+ASWs0zWhO7dpU4IQ+W3tHs0MTP354HAmLYDHWvEMESkoqXu N+G9fR4KHaN5iXx/fPw/QEy/L0LmzJbaYu4q298y4bnFlm5o7zmuUiy58lZcZF4ko+UK +YNazitg4YOihrFql7vnSHloFJHZzPli6VzOiyHvzT2OmShJXav5/xW33TJyoMVymv7G XkkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=DRACd0HI; spf=pass (google.com: domain of linux-kernel+bounces-26416-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26416-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y18-20020a0cf152000000b0067a360ada6esi8554023qvl.255.2024.01.15.10.56.21 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 10:56:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26416-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=DRACd0HI; spf=pass (google.com: domain of linux-kernel+bounces-26416-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26416-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 71E691C206A6 for <ouuuleilei@gmail.com>; Mon, 15 Jan 2024 18:56:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08BE5199AF; Mon, 15 Jan 2024 18:54:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="DRACd0HI" Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CB0818C2F; Mon, 15 Jan 2024 18:54:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 40FI1Ea2016044; Mon, 15 Jan 2024 18:54:49 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=4WTuNJU7dggzhMxg+LKkTN4UTqO72KHYK9oF7xPUUCg=; b=DRACd0HImjfPxGQR4oUs+OGXhN4G01JPZhrm3PYu2AtBunpDWA8/onRpDiocSgY/PV57 GmAYdsPCaPd/8VKBDBPzDiRFF8c1ZxaI6H7RQKiTxudgaDLi0HRmu9t6+1MkJOzU89OM ZMnVh69Q5Pn4Wa2Pv4frHC3vRxqciwPiJuQ3/FU6B/wuNUAW/o/+KDbUElCc2saY6p68 jxSD+8BkyCh76tAnm1D1Zh563/D3HKXuP2yvnO/xYY4CrEpJ0jOvTGrlvclzYSOKoiPS 7Id+cSec7WIhuc0gQ2KA6Tdsmdglyk550sZ9JvCUSeDXSbghFXdvrjZJAK+4WL2qFZVI 7w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vn94a1fje-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Jan 2024 18:54:49 +0000 Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 40FInRZW007475; Mon, 15 Jan 2024 18:54:48 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vn94a1fhy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Jan 2024 18:54:48 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 40FHeEi6018627; Mon, 15 Jan 2024 18:54:47 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3vm5una043-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Jan 2024 18:54:47 +0000 Received: from smtpav04.dal12v.mail.ibm.com (smtpav04.dal12v.mail.ibm.com [10.241.53.103]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 40FIskGv27984620 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 15 Jan 2024 18:54:46 GMT Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 16C0B5805A; Mon, 15 Jan 2024 18:54:46 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1EA2A58052; Mon, 15 Jan 2024 18:54:45 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.ibm.com.com (unknown [9.61.164.202]) by smtpav04.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 15 Jan 2024 18:54:45 +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, agordeev@linux.ibm.com, gor@linux.ibm.com, Tony Krowiak <akrowiak@linux.ibm.com> Subject: [PATCH v4 3/6] s390/vfio-ap: let 'on_scan_complete' callback filter matrix and update guest's APCB Date: Mon, 15 Jan 2024 13:54:33 -0500 Message-ID: <20240115185441.31526-4-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240115185441.31526-1-akrowiak@linux.ibm.com> References: <20240115185441.31526-1-akrowiak@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 6ePKe-RCQwp5ce62VQYtqc7CVwyKQB_A X-Proofpoint-GUID: jEjOyPbi8AgNUqHonmDNRZSBd4RiJDMc 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=2024-01-15_13,2024-01-15_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 impostorscore=0 mlxscore=0 clxscore=1015 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401150139 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788183819648931131 X-GMAIL-MSGID: 1788183819648931131 |
Series |
s390/vfio-ap: reset queues removed from guest's AP configuration
|
|
Commit Message
Anthony Krowiak
Jan. 15, 2024, 6:54 p.m. UTC
From: Tony Krowiak <akrowiak@linux.ibm.com> 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> Reviewed-by: Halil Pasic <pasic@linux.ibm.com> --- drivers/s390/crypto/vfio_ap_ops.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
Comments
On Mon, Jan 15, 2024 at 01:54:33PM -0500, Tony Krowiak wrote: Hi Tony, > Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com> > Reviewed-by: Halil Pasic <pasic@linux.ibm.com> No Fixes tag for this patch? Thanks!
On 1/16/24 3:34 AM, Alexander Gordeev wrote: > On Mon, Jan 15, 2024 at 01:54:33PM -0500, Tony Krowiak wrote: > Hi Tony, > >> Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com> >> Reviewed-by: Halil Pasic <pasic@linux.ibm.com> > No Fixes tag for this patch? This patch is more of an enhancement as opposed to a bug, so no Fixes. > > Thanks! >
On Tue, Jan 16, 2024 at 09:57:25AM -0500, Tony Krowiak wrote:
> This patch is more of an enhancement as opposed to a bug, so no Fixes.
The preceding and rest of this series CCs stable@vger.kernel.org and
would not apply without this patch. So I guess backporting the whole
series would be difficult.
Whether propagating the prevous patches' Fixes/stable makes any sense?
Thanks!
On 1/16/24 10:53 AM, Alexander Gordeev wrote: > On Tue, Jan 16, 2024 at 09:57:25AM -0500, Tony Krowiak wrote: >> This patch is more of an enhancement as opposed to a bug, so no Fixes. > The preceding and rest of this series CCs stable@vger.kernel.org and > would not apply without this patch. So I guess backporting the whole > series would be difficult. > > Whether propagating the prevous patches' Fixes/stable makes any sense? Let's put it this way; it doesn't not make sense to make this patch Fixes/stable. To make life easier to apply the whole series, go ahead and add the Fixes/stable tags. > > Thanks!
diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index e825e13847fe..e45d0bf7b126 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -2101,9 +2101,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);