From nobody Tue Feb 10 00:43:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1569235692; cv=none; d=zoho.com; s=zohoarc; b=eOXlWyZnrga/CLDmSyJiHsXRI5jb+4DHWPVjxf96uJcDhapGmv6AaN/LVAjSXY/dzC8IH5jRWuAdc5A25jSEr+lHEK7L0UgTVKLIcYoWm2AyrZ5hINBBehKHqpregJOdYp6MUVB0Y1x6Gc6RyUjzlv9eXlqvwSOTCBR+QeZEs0I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569235692; 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:ARC-Authentication-Results; bh=wiOpSxI1e40gJelXbn4vnTO6RSCpBaXadDpa4DBFKO8=; b=ajV41EaT8fGuaEn2C5wy9VeJ8Gz6jH+Ar1T9XJMawNUBcy4nFZO/n5EaoXbhEDxIlwVC0X4QvcpjBYrMCY799mZ+p+YCKW0uP+NBEOfL/sEygqozGQITDHmsFGr/mlLsfsrge92CFWFHr+cI8AYj11agC/1j20qqIziYzkI12TI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1569235692373798.5860113649903; Mon, 23 Sep 2019 03:48:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E9A302F3666; Mon, 23 Sep 2019 10:48:10 +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 BE2665C207; Mon, 23 Sep 2019 10:48:10 +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 7657E180085A; Mon, 23 Sep 2019 10:48:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8NAm7M1026238 for ; Mon, 23 Sep 2019 06:48:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id EAB7E608C0; Mon, 23 Sep 2019 10:48:07 +0000 (UTC) Received: from localhost (ovpn-112-36.ams2.redhat.com [10.36.112.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0803060852; Mon, 23 Sep 2019 10:48:06 +0000 (UTC) From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Date: Mon, 23 Sep 2019 14:44:41 +0400 Message-Id: <20190923104443.17931-19-marcandre.lureau@redhat.com> In-Reply-To: <20190923104443.17931-1-marcandre.lureau@redhat.com> References: <20190923104443.17931-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , jtomko@redhat.com Subject: [libvirt] [PATCH v5 18/20] qemu: start/stop the vhost-user-gpu external device 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 23 Sep 2019 10:48:11 +0000 (UTC) From: Marc-Andr=C3=A9 Lureau Each vhost-user-gpu needs its own helper gpu process. Start/stop them, and apply the emulator cgroup controller. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Cole Robinson --- src/qemu/qemu_extdevice.c | 45 +++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index 7855fa6770..abcaa9fca2 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -162,6 +162,16 @@ qemuExtDevicesStart(virQEMUDriverPtr driver, if (qemuExtDevicesInitPaths(driver, vm->def) < 0) return -1; =20 + for (i =3D 0; i < vm->def->nvideos; i++) { + virDomainVideoDefPtr video =3D vm->def->videos[i]; + + if (video->backend =3D=3D VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER)= { + ret =3D qemuExtVhostUserGPUStart(driver, vm, video); + if (ret < 0) + return ret; + } + } + if (vm->def->tpm) ret =3D qemuExtTPMStart(driver, vm, incomingMigration); =20 @@ -185,10 +195,17 @@ qemuExtDevicesStop(virQEMUDriverPtr driver, virDomainDefPtr def =3D vm->def; size_t i; =20 - if (qemuExtDevicesInitPaths(driver, vm->def) < 0) + if (qemuExtDevicesInitPaths(driver, def) < 0) return; =20 - if (vm->def->tpm) + for (i =3D 0; i < def->nvideos; i++) { + virDomainVideoDefPtr video =3D def->videos[i]; + + if (video->backend =3D=3D VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) + qemuExtVhostUserGPUStop(driver, vm, video); + } + + if (def->tpm) qemuExtTPMStop(driver, vm); =20 for (i =3D 0; i < def->nnets; i++) { @@ -204,6 +221,13 @@ qemuExtDevicesStop(virQEMUDriverPtr driver, bool qemuExtDevicesHasDevice(virDomainDefPtr def) { + size_t i; + + for (i =3D 0; i < def->nvideos; i++) { + if (def->videos[i]->backend =3D=3D VIR_DOMAIN_VIDEO_BACKEND_TYPE_V= HOSTUSER) + return true; + } + if (def->tpm && def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) return true; =20 @@ -216,10 +240,19 @@ qemuExtDevicesSetupCgroup(virQEMUDriverPtr driver, virDomainDefPtr def, virCgroupPtr cgroup) { - int ret =3D 0; + size_t i; =20 - if (def->tpm) - ret =3D qemuExtTPMSetupCgroup(driver, def, cgroup); + for (i =3D 0; i < def->nvideos; i++) { + virDomainVideoDefPtr video =3D def->videos[i]; =20 - return ret; + if (video->backend =3D=3D VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER = && + qemuExtVhostUserGPUSetupCgroup(driver, def, video, cgroup) < 0) + return -1; + } + + if (def->tpm && + qemuExtTPMSetupCgroup(driver, def, cgroup) < 0) + return -1; + + return 0; } --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list