From nobody Mon Sep 16 18:56:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1694469241; cv=none; d=zohomail.com; s=zohoarc; b=bX5k8bvzV0uDrB15iPp5kLBRXskP4RDIPgEnbTU014b3wkfW+WtewH8jMkJBhPqx5diiBggewdoGiZF7BgyPMidm844i2AJ7K7gXUlRy4OxnC5uHDvT9GOnfA0SN5FYjp/hck6rSCcI/v8kum68+gWWloGOy0IRD03ExpKlsfuY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694469241; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2SZefzKNdXfVptjGGN9rQCxryX0wOB+mhPMRMcsgVjI=; b=hvLEBaf9V30hYA8/NztVYZDkmUX3FoOqR+gSpUkyy9AiScRsAM3XnHFPgrokJMaCvpOi2EaEKW8gRuYJh7GtZQ7yv5JpK1rllICUEtqpyBk8q5k1p0dK90ZUR1Un9O5UOLr6tqoPuNBxINwi16DAoxtalHOXcGMYDeto9vNNjGk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1694469241293103.5496603625395; Mon, 11 Sep 2023 14:54:01 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-624-hi0qRuGrMKi1AmjrB56gng-1; Mon, 11 Sep 2023 17:53:56 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 48B588A074F; Mon, 11 Sep 2023 21:53:52 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 320FF40C6EC0; Mon, 11 Sep 2023 21:53:52 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 04B2F1946A74; Mon, 11 Sep 2023 21:53:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 54AF81946597 for ; Mon, 11 Sep 2023 21:53:49 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2D57040C6EBF; Mon, 11 Sep 2023 21:53:49 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.34.54]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0165740C6EA8; Mon, 11 Sep 2023 21:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694469240; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2SZefzKNdXfVptjGGN9rQCxryX0wOB+mhPMRMcsgVjI=; b=h9i4e5gWReuws0PMWPDpUhke8HQmjDc5aLYuFh4GEC1l+gEyVRTmgz98C5DWZ2awBUsQO7 gsuLMEW4ourI7v7VtVy5LsFUrkH4Hk88FAqKYeMQjc47s74NvUZe8ReT3xC/5YxsIfumz6 6ujARbZiCRED8Mee44y7txRHHUYO+KA= X-MC-Unique: hi0qRuGrMKi1AmjrB56gng-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v2 4/5] qemu: consider vdpa block devices for memlock limits Date: Mon, 11 Sep 2023 16:53:46 -0500 Message-ID: <20230911215347.1160427-5-jjongsma@redhat.com> In-Reply-To: <20230911215347.1160427-1-jjongsma@redhat.com> References: <20230911215347.1160427-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Krempa Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1694469241496100007 Content-Type: text/plain; charset="utf-8"; x-default="true" vDPA block devices will also need the same consideration for memlock limits as other vdpa devices, so consider these devices when calculating memlock limits. Signed-off-by: Jonathon Jongsma Reviewed-by: Peter Krempa --- src/qemu/qemu_domain.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c7d64e1b5c..52ea8f649d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9652,7 +9652,7 @@ qemuDomainGetNumNVMeDisks(const virDomainDef *def) =20 =20 static int -qemuDomainGetNumVDPANetDevices(const virDomainDef *def) +qemuDomainGetNumVDPADevices(const virDomainDef *def) { size_t i; int n =3D 0; @@ -9662,6 +9662,14 @@ qemuDomainGetNumVDPANetDevices(const virDomainDef *d= ef) n++; } =20 + for (i =3D 0; i < def->ndisks; i++) { + virStorageSource *src; + for (src =3D def->disks[i]->src; src; src =3D src->backingStore) { + if (src->type =3D=3D VIR_STORAGE_TYPE_VHOST_VDPA) + n++; + } + } + return n; } =20 @@ -9704,7 +9712,7 @@ qemuDomainGetMemLockLimitBytes(virDomainDef *def) =20 nvfio =3D qemuDomainGetNumVFIOHostdevs(def); nnvme =3D qemuDomainGetNumNVMeDisks(def); - nvdpa =3D qemuDomainGetNumVDPANetDevices(def); + nvdpa =3D qemuDomainGetNumVDPADevices(def); /* For device passthrough using VFIO the guest memory and MMIO memory * regions need to be locked persistent in order to allow DMA. * --=20 2.41.0