From nobody Wed Feb 11 02:54:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1686085881; cv=none; d=zohomail.com; s=zohoarc; b=RmJiLYj9C36BT7pDmCHnRVNXB44PEGh4IWjWAUYEEl8rMV5aEKFdOcUizt9/lLQWXEypm/UsYs/hqNhhnrrtDfWdDX64E0x4oqnOVDFOZTfBKfUztVJwv7vNwotuZ8o06qP03tiwViZSOfyWk+O8EQg5nBo7f3zNIdrLOrUBuGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686085881; h=Content-Type:Content-Transfer-Encoding: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=ukI2YYpOdoI0tk1kdsZBdj0pJSBS9LGNpN5uEwgPxPA=; b=gNymUIEHwJgYf99YEXnwPV/yRm8aTlxN84gbS4O/KualXYyvc6MKNGJKnjjFHCipYcsaKsvMLjixVnVkRHFMfpDuziIQxgjarHJiqBpoFzNenzR6+G4IBc+bQq5LG96lguQG/PvmNxErrVFREkNBHDC0KvhemSXWGC721d6k9k8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1686085881299891.4702888638311; Tue, 6 Jun 2023 14:11:21 -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-35-G4j-llLhMT-y7LNS2H1sKA-1; Tue, 06 Jun 2023 17:11:16 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 799741019C99; Tue, 6 Jun 2023 21:11:13 +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 62F0440218C; Tue, 6 Jun 2023 21:11:11 +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 2F67A19465BD; Tue, 6 Jun 2023 21:11:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2086F19465BA for ; Tue, 6 Jun 2023 21:11:06 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 03C9B1121314; Tue, 6 Jun 2023 21:11:06 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.18.117]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D6C181121318 for ; Tue, 6 Jun 2023 21:11:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686085880; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=ukI2YYpOdoI0tk1kdsZBdj0pJSBS9LGNpN5uEwgPxPA=; b=TVQ3Jlw9h3ogGsdGTR2LCTAV3iJrlhrY53e4GoH8Ozz4xwvdP36eore7yYcg2FOgymW+oB zsvDg/7tXinwtg/Rjhk05oj+7BPEIpOISkzc3y7HV5LpccMZgMETM6rrVVfQV2NPYJxNk2 EoflgA72KTZhhqFl0vfdJwj9ZRk4v70= X-MC-Unique: G4j-llLhMT-y7LNS2H1sKA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH 4/5] qemu: consider vdpa block devices for memlock limits Date: Tue, 6 Jun 2023 16:11:03 -0500 Message-Id: <20230606211104.1632426-5-jjongsma@redhat.com> In-Reply-To: <20230606211104.1632426-1-jjongsma@redhat.com> References: <20230606211104.1632426-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: 1686085882457100005 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 8f77e8fc58..2f6b32e394 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9564,7 +9564,7 @@ qemuDomainGetNumNVMeDisks(const virDomainDef *def) =20 =20 static int -qemuDomainGetNumVDPANetDevices(const virDomainDef *def) +qemuDomainGetNumVDPADevices(const virDomainDef *def) { size_t i; int n =3D 0; @@ -9574,6 +9574,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 @@ -9616,7 +9624,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.40.1