From nobody Thu May 2 10:21:27 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=1616525473; cv=none; d=zohomail.com; s=zohoarc; b=B1mfK1bV07o9xnM9SOusz7+DOzlQKhfG4/2jN5wLedGJAEIhmCUt3mfiNaN2zXJvAX/lF1eNpbDwJWEMw74ctebfesxHm83Ckoq9sZg14hYAAwK5Qea7yswmP77cdL95Dkb9m4Jw5ouadZ+6gY5ht9MWd87hxdelsuhbqORSgM4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616525473; 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=WKi1ry/9p+T+OFoIBNzLGmWEt2owlUHdO3pzxjzEI/g=; b=V18UzwoI2lR6VuYjY8Vxh0UNDdUBL0D4O6HdDXzkBUIR6KfpFFMmMYsYA/OTYOtUWB/CB8iPI3C8nnXXgOuxi6+NdllUq5ix4j7WOZq51eUYxRJm4ovBLxV8GXAxOw74YGIvijatb8Fy4Reb2vRPWSexNo46putv3fOtyu9Pbi4= 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) header.from= 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 1616525473081297.77459301572287; Tue, 23 Mar 2021 11:51:13 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-296-BVXs2cQ_Mh-heu2dXpKzkg-1; Tue, 23 Mar 2021 14:51:08 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 29148108BD07; Tue, 23 Mar 2021 18:51:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E29695D6D7; Tue, 23 Mar 2021 18:51:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6D1B54BB7C; Tue, 23 Mar 2021 18:50:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12NIouqw003783 for ; Tue, 23 Mar 2021 14:50:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id CC0A418A77; Tue, 23 Mar 2021 18:50:56 +0000 (UTC) Received: from vhost2.router.laine.org (ovpn-114-23.phx2.redhat.com [10.3.114.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 960485DEAD for ; Tue, 23 Mar 2021 18:50:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616525471; 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=WKi1ry/9p+T+OFoIBNzLGmWEt2owlUHdO3pzxjzEI/g=; b=Z4Rd3iTZN0bsCg16f1GbVUx/i8Z9JadB6IPd6iJGCiVbOFGcGJJyEu9ErVQL71X6P4dmJr I1RJ6P1p5Y2FgNMUFfOjlCe29Yq0TNNIXOJmuTnMhnYUHCEFmR5vsJJn9hP7tO638D+daH IwMQIai1mvubF+RYuLZJXov6HJ5QMvA= X-MC-Unique: BVXs2cQ_Mh-heu2dXpKzkg-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 1/4] conf: new function virDomainDefHasVDPANet() Date: Tue, 23 Mar 2021 14:50:49 -0400 Message-Id: <20210323185052.961910-2-laine@redhat.com> In-Reply-To: <20210323185052.961910-1-laine@redhat.com> References: <20210323185052.961910-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This function returns true if the domain has any interfaces that are type=3D'vdpa'. Signed-off-by: Laine Stump Reviewed-by: Daniel Henrique Barboza --- src/conf/domain_conf.c | 14 ++++++++++++++ src/conf/domain_conf.h | 3 +++ src/libvirt_private.syms | 1 + 3 files changed, 18 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f071bf93d0..736e9de3c8 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -32500,6 +32500,20 @@ virDomainDefHasMdevHostdev(const virDomainDef *def) } =20 =20 +bool +virDomainDefHasVDPANet(const virDomainDef *def) +{ + size_t i; + + for (i =3D 0; i < def->nnets; i++) { + if (virDomainNetGetActualType(def->nets[i]) =3D=3D VIR_DOMAIN_NET_= TYPE_VDPA) + return true; + } + + return false; +} + + bool virDomainDefHasOldStyleUEFI(const virDomainDef *def) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index da32016b01..aa15184821 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -4061,6 +4061,9 @@ virDomainDefHasVFIOHostdev(const virDomainDef *def); bool virDomainDefHasMdevHostdev(const virDomainDef *def); =20 +bool +virDomainDefHasVDPANet(const virDomainDef *def); + bool virDomainDefHasOldStyleUEFI(const virDomainDef *def); =20 diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 526dcee11a..1bf8165520 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -332,6 +332,7 @@ virDomainDefHasOldStyleROUEFI; virDomainDefHasOldStyleUEFI; virDomainDefHasUSB; virDomainDefHasVcpusOffline; +virDomainDefHasVDPANet; virDomainDefHasVFIOHostdev; virDomainDefLifecycleActionAllowed; virDomainDefMaybeAddController; --=20 2.30.2 From nobody Thu May 2 10:21:27 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=1616525472; cv=none; d=zohomail.com; s=zohoarc; b=NLjuzfJKmFVMA7S49IJfWqWqch8g6Cuzlsd+bQf2qwCVwt2AAWziL4P5XH88VXxNMKxC1V4h0poUz6IaQQDM3yoYi4RFZUKF+MrACyv0ZpjKVgOURLbQuyt8Zyc/ToQvMe3Pi00tHn0TtfiGedIo1CtEFJEa2xQx8+SLM23AMWY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616525472; 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=WV+IC8DK9ZP9WW7eR3c/fCXFO3WcNUOUzZexlM2jKzw=; b=R+Zsd5fXXqtVn0If1dVIEBD4LBkdLQipaRU9U+ddnPnDDYEidwktJc/h6dY6d1wOXxEIxd+HPrm4zlzqIXRLZj/sc9RspphesdzrYDv3YybQDPZxkLix7UJnyCUy5+Jx7pjSh69WbmEdhXZUf5IcuQP+GsJkpYgjIrQdGmYwK44= 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) header.from= 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 1616525472400108.52375145784981; Tue, 23 Mar 2021 11:51:12 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-260-Z3aSy66zOQexm5WpzVGu6w-1; Tue, 23 Mar 2021 14:51:08 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 17D7C108BD06; Tue, 23 Mar 2021 18:51:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DAB8522E57; Tue, 23 Mar 2021 18:51:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BC6814A700; Tue, 23 Mar 2021 18:50:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12NIovkT003790 for ; Tue, 23 Mar 2021 14:50:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 600AE18A77; Tue, 23 Mar 2021 18:50:57 +0000 (UTC) Received: from vhost2.router.laine.org (ovpn-114-23.phx2.redhat.com [10.3.114.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 295FE22E57 for ; Tue, 23 Mar 2021 18:50:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616525471; 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=WV+IC8DK9ZP9WW7eR3c/fCXFO3WcNUOUzZexlM2jKzw=; b=gI8RkcvjzL/3HcNXgXr2Xsp823q3UQzFW96kXFinmgiyXJBCA/kboatECGGxZWVw6Qf/sw 6jZHij+G1va7Mr+IX8+zxMrElaGkzZTVepUDCp0GRnGFZ3zH7MXRwbyB0YI/kOax146hiy WoHK6xQuGnYAeMrJ/MRn87KKmYUKQpI= X-MC-Unique: Z3aSy66zOQexm5WpzVGu6w-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 2/4] qemu: simplify qemuDomainGetMemLockLimitBytes() Date: Tue, 23 Mar 2021 14:50:50 -0400 Message-Id: <20210323185052.961910-3-laine@redhat.com> In-Reply-To: <20210323185052.961910-1-laine@redhat.com> References: <20210323185052.961910-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This function goes through a loop checking if each hostdev is a VFIO or mdev device, and then later it calls virDomainDefHasNVMEDisk(). The function qemuDomainNeedsVFIO() does exactly the same thing, so let's just call that instead. Signed-off-by: Laine Stump Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_domain.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 5f0c7f0531..5238a52095 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9258,8 +9258,6 @@ qemuDomainGetMemLockLimitBytes(virDomainDefPtr def, bool forceVFIO) { unsigned long long memKB =3D 0; - bool usesVFIO =3D false; - size_t i; =20 /* prefer the hard limit */ if (virMemoryLimitIsSet(def->mem.hard_limit)) { @@ -9296,20 +9294,7 @@ qemuDomainGetMemLockLimitBytes(virDomainDefPtr def, * * Note that this may not be valid for all platforms. */ - if (!forceVFIO) { - for (i =3D 0; i < def->nhostdevs; i++) { - if (virHostdevIsVFIODevice(def->hostdevs[i]) || - virHostdevIsMdevDevice(def->hostdevs[i])) { - usesVFIO =3D true; - break; - } - } - - if (virDomainDefHasNVMeDisk(def)) - usesVFIO =3D true; - } - - if (usesVFIO || forceVFIO) + if (forceVFIO || qemuDomainNeedsVFIO(def)) memKB =3D virDomainDefGetMemoryTotal(def) + 1024 * 1024; =20 return memKB << 10; --=20 2.30.2 From nobody Thu May 2 10:21:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1616525489; cv=none; d=zohomail.com; s=zohoarc; b=CpM5dg9lX+1pMor84Hl80bwo8t/Ikw9Ujcda5u3fWj1f7if7Cow7dZ8kqf3hUjcLKp+Ec8lA5z/XY9iHzDky+rwDJujou3S6/hY/ndRGQvmmR1hFBrMavDJzhOjJwnXlRnrUuI9mDJjFx6tpZMAd3rKieZIqhWZHpiR3iLmQecg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616525489; 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=xHB9sPF9YWR9t++Wmu1oEed8PVQMMF1bx/1M/e3TIsM=; b=HQd7ld15JSVAJdTPzDoTQDk4mBqEvibMO7G8SMuifBxqLfYmYwKUOfeGrdCdOQROOo201KIjCX+yHyNPN43SDadUuUGtZJaA0nt/vdm04BTCa5PY56gCNk08rZRZh2K/52HFPjhPbGUBSAejrRBcsmnLV81xO5sB+5IrqZ9Co6A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1616525489755968.7111666096833; Tue, 23 Mar 2021 11:51:29 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-129-nmuSof3IP2m0ypQYG-rLxQ-1; Tue, 23 Mar 2021 14:51:24 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 00A068030B5; Tue, 23 Mar 2021 18:51:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C4E2C10023B5; Tue, 23 Mar 2021 18:51:17 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5E69A1800216; Tue, 23 Mar 2021 18:51:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12NIovLo003796 for ; Tue, 23 Mar 2021 14:50:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id E1DC518A77; Tue, 23 Mar 2021 18:50:57 +0000 (UTC) Received: from vhost2.router.laine.org (ovpn-114-23.phx2.redhat.com [10.3.114.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9AE665DEAD; Tue, 23 Mar 2021 18:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616525487; 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=xHB9sPF9YWR9t++Wmu1oEed8PVQMMF1bx/1M/e3TIsM=; b=He3P5wVCsM8EelFiFD5ETqglEMtjSYI0KWL1piVBcFBvFAAAGZEgjetJawaWWdjcoZVaqE tn6+KvAuh0Zvaut+YPtrkvushjd4seCENt7AB/x4xHyjgNuNkUthLYa+Pmp+8yPB+mlvlP kgU81E+HIaK40R4HBMGYIu0sR/hkuVk= X-MC-Unique: nmuSof3IP2m0ypQYG-rLxQ-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 3/4] qemu: account for mdev devices in getPPC64MemLockLimitBytes() Date: Tue, 23 Mar 2021 14:50:51 -0400 Message-Id: <20210323185052.961910-4-laine@redhat.com> In-Reply-To: <20210323185052.961910-1-laine@redhat.com> References: <20210323185052.961910-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This function is a specialized version of qemuDomainGetMemLockLimitBytes() for PPC64. Simplifying it in the same manner as the previous patch has the nice side effect of accounting for the possibility of an mdev device in the config. (I don't know if mdev devices are supported on PPC, but even if not then a) the additional check for mdev devices gained by using qemuDomainNeedsVFIO() in place of open coding will be an effective NOP, and b) if mdev devices are supported on PPC64 in the future, this function will be prepared for it). Signed-off-by: Laine Stump Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_domain.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 5238a52095..e0379e81ba 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9122,7 +9122,6 @@ getPPC64MemLockLimitBytes(virDomainDefPtr def, unsigned long long passthroughLimit =3D 0; size_t i, nPCIHostBridges =3D 0; virPCIDeviceAddressPtr pciAddr; - bool usesVFIO =3D false; bool nvlink2Capable =3D false; =20 for (i =3D 0; i < def->ncontrollers; i++) { @@ -9138,7 +9137,6 @@ getPPC64MemLockLimitBytes(virDomainDefPtr def, virDomainHostdevDefPtr dev =3D def->hostdevs[i]; =20 if (virHostdevIsVFIODevice(dev)) { - usesVFIO =3D true; =20 pciAddr =3D &dev->source.subsys.u.pci.addr; if (virPCIDeviceAddressIsValid(pciAddr, false)) { @@ -9153,9 +9151,6 @@ getPPC64MemLockLimitBytes(virDomainDefPtr def, } } =20 - if (virDomainDefHasNVMeDisk(def)) - usesVFIO =3D true; - memory =3D virDomainDefGetMemoryTotal(def); =20 if (def->mem.max_memory) @@ -9180,7 +9175,7 @@ getPPC64MemLockLimitBytes(virDomainDefPtr def, 8192; =20 /* NVLink2 support in QEMU is a special case of the passthrough - * mechanics explained in the usesVFIO case below. The GPU RAM + * mechanics explained in the forceVFIO case below. The GPU RAM * is placed with a gap after maxMemory. The current QEMU * implementation puts the NVIDIA RAM above the PCI MMIO, which * starts at 32TiB and is the MMIO reserved for the guest main RAM. @@ -9204,7 +9199,7 @@ getPPC64MemLockLimitBytes(virDomainDefPtr def, passthroughLimit =3D maxMemory + 128 * (1ULL<<30) / 512 * nPCIHostBridges + 8192; - } else if (usesVFIO || forceVFIO) { + } else if (forceVFIO || qemuDomainNeedsVFIO(def)) { /* For regular (non-NVLink2 present) VFIO passthrough, the value * of passthroughLimit is: * --=20 2.30.2 From nobody Thu May 2 10:21:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1616525492; cv=none; d=zohomail.com; s=zohoarc; b=OuOLCl4nvsiXxI9+kjlc025dIo5Dj4LubUQDu/KGPdQnhdIbBuHaxUciU7Y9z3GaoUADFsQQ1/0W+ElnExc1qECbWOubGF2ORpkAHkiM3sCsSLe/i83hgmyBLPHq+rHRTLzij2AOrqgc5rciM+s1KNukiO4HPmK8YE08jsY29FY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616525492; 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=2cGIj8PVdpf11jJ+jgGrkNUs/qVtfuEe4GeAEpDJFwc=; b=Ma+dH6fZ5tpMU7jHyGbZbBGWqdpzf3I8eWzvARmx1VCRDOYqVIJgBzYf7253NrLVyi3S8IGRgmFzwtpxGqCjk6oo3rqvQ4WdzUMTjcAbRW+1BGdq3zixsQdwjUEd6AGE5IiGn9J/b2McmSrchiyZmCy8hyTp0TXkR5E/CeerWY4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 161652549243538.44153046180759; Tue, 23 Mar 2021 11:51:32 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-477-FquxBmWeNc6V9bdte4ZLZA-1; Tue, 23 Mar 2021 14:51:27 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 76A51190D342; Tue, 23 Mar 2021 18:51:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5137462467; Tue, 23 Mar 2021 18:51:21 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 124FE4A704; Tue, 23 Mar 2021 18:51:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12NIow4m003803 for ; Tue, 23 Mar 2021 14:50:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 442F518A77; Tue, 23 Mar 2021 18:50:58 +0000 (UTC) Received: from vhost2.router.laine.org (ovpn-114-23.phx2.redhat.com [10.3.114.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0EB8F22E57 for ; Tue, 23 Mar 2021 18:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616525491; 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=2cGIj8PVdpf11jJ+jgGrkNUs/qVtfuEe4GeAEpDJFwc=; b=DnIBPsBWZd44+U9px0Cm0jTSnQBB4N9WEfSE0Fa/b8UKl9RxAtd6GKUaEax6dXtwIhWbq8 KmTzTYs+MN6e9qmNzhEI8MSQ5ZmP1DevHFzI7abfr5piyJ9CAAM28/iMAHLtCpWds3Rswl MEl6ekGzJZSGFw26H3QqMlcgIxKxvuU= X-MC-Unique: FquxBmWeNc6V9bdte4ZLZA-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 4/4] qemu: increase locked memory limit when a vDPA device is present Date: Tue, 23 Mar 2021 14:50:52 -0400 Message-Id: <20210323185052.961910-5-laine@redhat.com> In-Reply-To: <20210323185052.961910-1-laine@redhat.com> References: <20210323185052.961910-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Just like VFIO devices, vDPA devices may need to have all guest memory pages locked/pinned in order to operate properly. In the case of VFIO devices (including mdev and NVME, which also use VFIO) libvirt automatically increases the locked memory limit when one of those devices is present. This patch modifies that code to also increase the limit if there are any vDPA devices present. Resolves: https://bugzilla.redhat.com/1939776 Signed-off-by: Laine Stump Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_domain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e0379e81ba..76e8903dbc 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9199,7 +9199,7 @@ getPPC64MemLockLimitBytes(virDomainDefPtr def, passthroughLimit =3D maxMemory + 128 * (1ULL<<30) / 512 * nPCIHostBridges + 8192; - } else if (forceVFIO || qemuDomainNeedsVFIO(def)) { + } else if (forceVFIO || qemuDomainNeedsVFIO(def) || virDomainDefHasVDP= ANet(def)) { /* For regular (non-NVLink2 present) VFIO passthrough, the value * of passthroughLimit is: * @@ -9289,7 +9289,7 @@ qemuDomainGetMemLockLimitBytes(virDomainDefPtr def, * * Note that this may not be valid for all platforms. */ - if (forceVFIO || qemuDomainNeedsVFIO(def)) + if (forceVFIO || qemuDomainNeedsVFIO(def) || virDomainDefHasVDPANet(de= f)) memKB =3D virDomainDefGetMemoryTotal(def) + 1024 * 1024; =20 return memKB << 10; --=20 2.30.2