From patchwork Fri Aug 23 16:21:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 172110 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp885705ily; Fri, 23 Aug 2019 09:22:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqznQBFvSQFi+CLfJAgUNAMK4PsLOtC9/HUwnK32DeIXUxmo+jKY3taNeXffXbecy+dAbiyQ X-Received: by 2002:aed:2e24:: with SMTP id j33mr5657375qtd.179.1566577330751; Fri, 23 Aug 2019 09:22:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566577330; cv=none; d=google.com; s=arc-20160816; b=EhKNyx83m1LkcFWvYeCIGW95IGVZhMN2Ow+aQM2POdlA6KSiufh4zI15ZtPNYexl1J KXN9sa5igonomv0dreMk4FD+b6tNlLmcCYANbu/UyKthmkVKJX597OWNUJpj42rNmzNn m+ePI5IGd8za12f6W6wXKX6gARWnkNvHaa2YCN+/GUKwEonVPPz8NvOcmkIlhB/2TMZd Qsajiy/DrAAFRIw+isKZCDDEy3rpbJO89VGHqjXK8Hcz4c2uHMeuPliSEZzS2DcGTBrT bPDGGPZdIdjNyQ40QPZFD4DB8gxVzL9dLf3nGyd4L5NV2Cudb7IaZ8RaiKLlMD/KtqG8 f/6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:message-id:date:to:from:delivered-to; bh=4lM/HS4M3ui7sAF1eTMka2oAI0AkaBcYCLewaW7aWGk=; b=pjL8Up1RuQA41hZZlqSEaXj83661FZBBalY3z+75VNTgICEFm+YvIjn1UMFTwHaDiO iNBu0xvAAmDBpWFskbuzlxnPbmzEN8BCMsSrn3nbmRwjKJPUJ85aD7Rf8cIs7meRi30B 2ifOSzBSNT2cihvg9jXvSS3IalxdiKi0TrJyvJ4ij4ADxtgXTEWy3MJlezcxQ7tqJy6T D/BrkFVbzL1MhLBGwIFlt2ZRzk7nv/9UXZ/xjAYy81mqFCZYbpTy3737VjLqlhYMujT4 yXCnMUErQR3b1i2iSv2rg5nZHtZ6VT2BNvAGFV0p9wwMp9JOWn1uJnnHDqFf/DR8ITvp Cm+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id n6si2242870qkd.181.2019.08.23.09.22.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Aug 2019 09:22:10 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 mx1.redhat.com (Postfix) with ESMTPS id 6E1143086262; Fri, 23 Aug 2019 16:22:09 +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 139C95D6D0; Fri, 23 Aug 2019 16:22:09 +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 1D93C180B536; Fri, 23 Aug 2019 16:22:05 +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 x7NGM3Mi005969 for ; Fri, 23 Aug 2019 12:22:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5DDDC60606; Fri, 23 Aug 2019 16:22:03 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-122-169.rdu2.redhat.com [10.10.122.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4CD9D6092D; Fri, 23 Aug 2019 16:21:57 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Fri, 23 Aug 2019 12:21:44 -0400 Message-Id: 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_Lureau?= Subject: [libvirt] [PATCH v2 00/16] Add vhost-user-gpu support 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 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 23 Aug 2019 16:22:09 +0000 (UTC) v1: https://www.redhat.com/archives/libvir-list/2019-June/msg00102.html This is v2 of Marc-André's series with minor changes. I'm not taking over this series, I just fixed these as part of the patch rebase so I can review it :) Changes since v1: - rebase to master - if test file build by dropping LDADDS usage - syntax-check issues: * use #pragma once * if () bracket issues * jump label indent issues * error message %s usage * size_t for loops I didn't know much about vhost-user-gpu before this series, here's what I've learned. vhost-user is a generic mechanism that allows implementing virtio device dataplane handling in a separate userspace process. vhost-user-gpu here notably moves the virgl 3d handling out of the main qemu process. The external process will be /usr/libexec/vhost-user-gpu, which comes from qemu.git contrib/vhost-user-gpu code, first released in qemu-4.1. Part of this series deals with discovering the location on disk of the vhost-user-gpu binary, and what capabilities it provides. This uses a similar mechanism to firmware.json, described in qemu docs/interop/vhost-user.json https://github.com/qemu/qemu/blob/master/docs/interop/vhost-user.json qemu 4.1 ships a 50-qemu-gpu.json to match. I believe virtio-fs will use a similar mechanism when it lands in upstream qemu, as virtiofsd is a separate process that communicates with qemu over vhost-user. For a bit more background on vhost-user-gpu process handling and the json interop motivation, here's some of the qemu discussion: https://lists.nongnu.org/archive/html/qemu-devel/2018-08/msg02610.html https://lists.nongnu.org/archive/html/qemu-devel/2018-09/msg00807.html For this series, the XML to enable this is: rendernode is optional qemu_vhost_user.c handles vhost-user.json qemu_vhost_user_gpu.c handles the process management for vhost-user-gpu Marc-André Lureau (16): qemu: extract out qemuFetchConfigs from firmware domain: add "vhostuser" attribute to virtio video model domain: add rendernode attribute on qemu-cgroup: allow accel rendernode access qemu: add vhost-user-gpu capabilities checks qemu: check that qemu is vhost-user-vga capable qemu: validate virtio-gpu with vhost-user qemu: restrict 'virgl=' option to non-vhostuser video type qemu: add vhost-user helpers qemu: add qemuSecurityStartVhostUserGPU helper qemu: add vhost-user-gpu helper unit qemu: prepare domain for vhost-user GPU qemu: start/stop the vhost-user-gpu external device qemu: build vhost-user GPU devices tests: mock execv/execve tests: add vhost-user-gpu xml2argv tests docs/formatdomain.html.in | 11 + docs/schemas/domaincommon.rng | 16 +- src/conf/device_conf.c | 1 + src/conf/device_conf.h | 2 + src/conf/domain_conf.c | 32 +- src/conf/domain_conf.h | 2 + src/qemu/Makefile.inc.am | 6 + src/qemu/qemu_capabilities.c | 4 + src/qemu/qemu_capabilities.h | 2 + src/qemu/qemu_cgroup.c | 24 ++ src/qemu/qemu_command.c | 54 ++- src/qemu/qemu_configs.c | 183 ++++++++ src/qemu/qemu_configs.h | 28 ++ src/qemu/qemu_domain.c | 11 +- src/qemu/qemu_extdevice.c | 75 +++- src/qemu/qemu_extdevice.h | 5 + src/qemu/qemu_firmware.c | 144 +------ src/qemu/qemu_process.c | 18 +- src/qemu/qemu_security.c | 47 +++ src/qemu/qemu_security.h | 6 + src/qemu/qemu_vhost_user.c | 394 ++++++++++++++++++ src/qemu/qemu_vhost_user.h | 48 +++ src/qemu/qemu_vhost_user_gpu.c | 305 ++++++++++++++ src/qemu/qemu_vhost_user_gpu.h | 50 +++ tests/Makefile.am | 9 + .../caps_4.1.0.x86_64.xml | 2 + .../etc/qemu/vhost-user/40-gpu.json | 1 + .../etc/qemu/vhost-user/50-gpu.json | 0 .../qemu/vhost-user/test-vhost-user-gpu | 11 + .../usr/share/qemu/vhost-user/30-gpu.json | 1 + .../usr/share/qemu/vhost-user/50-gpu.json | 8 + .../usr/share/qemu/vhost-user/60-gpu.json | 1 + tests/qemuvhostusertest.c | 132 ++++++ .../vhost-user-gpu-secondary.args | 38 ++ .../vhost-user-gpu-secondary.xml | 44 ++ tests/qemuxml2argvdata/vhost-user-vga.args | 35 ++ tests/qemuxml2argvdata/vhost-user-vga.xml | 41 ++ tests/qemuxml2argvtest.c | 21 + tests/virfilewrapper.c | 22 + 39 files changed, 1676 insertions(+), 158 deletions(-) create mode 100644 src/qemu/qemu_configs.c create mode 100644 src/qemu/qemu_configs.h create mode 100644 src/qemu/qemu_vhost_user.c create mode 100644 src/qemu/qemu_vhost_user.h create mode 100644 src/qemu/qemu_vhost_user_gpu.c create mode 100644 src/qemu/qemu_vhost_user_gpu.h create mode 120000 tests/qemuvhostuserdata/etc/qemu/vhost-user/40-gpu.json create mode 100644 tests/qemuvhostuserdata/etc/qemu/vhost-user/50-gpu.json create mode 100755 tests/qemuvhostuserdata/usr/libexec/qemu/vhost-user/test-vhost-user-gpu create mode 120000 tests/qemuvhostuserdata/usr/share/qemu/vhost-user/30-gpu.json create mode 100644 tests/qemuvhostuserdata/usr/share/qemu/vhost-user/50-gpu.json create mode 120000 tests/qemuvhostuserdata/usr/share/qemu/vhost-user/60-gpu.json create mode 100644 tests/qemuvhostusertest.c create mode 100644 tests/qemuxml2argvdata/vhost-user-gpu-secondary.args create mode 100644 tests/qemuxml2argvdata/vhost-user-gpu-secondary.xml create mode 100644 tests/qemuxml2argvdata/vhost-user-vga.args create mode 100644 tests/qemuxml2argvdata/vhost-user-vga.xml