[libvirt] [RFC v2 10/16] qemu: add vhost-user-gpu helper unit

Daniel P. Berrangé berrange at redhat.com
Wed Aug 29 09:29:51 UTC 2018


On Tue, Aug 28, 2018 at 11:39:28PM +0200, marcandre.lureau at redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau at redhat.com>
> 
> Similar to the qemu_tpm.c, add a unit with a few functions to
> start/stop and setup the cgroup of the external vhost-user-gpu
> process. See function documentation.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> ---
>  src/conf/device_conf.h         |   1 +
>  src/qemu/Makefile.inc.am       |   2 +
>  src/qemu/qemu_vhost_user_gpu.c | 318 +++++++++++++++++++++++++++++++++
>  src/qemu/qemu_vhost_user_gpu.h |  48 +++++
>  4 files changed, 369 insertions(+)
>  create mode 100644 src/qemu/qemu_vhost_user_gpu.c
>  create mode 100644 src/qemu/qemu_vhost_user_gpu.h
> 
> diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
> index ff7d6c9d5f..79a7ea9fe2 100644
> --- a/src/conf/device_conf.h
> +++ b/src/conf/device_conf.h
> @@ -175,6 +175,7 @@ struct _virDomainDeviceInfo {
>       * cases we might want to prevent that from happening by
>       * locking the isolation group */
>      bool isolationGroupLocked;
> +    int vhost_user_fd;
>  };
>  
>  int virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst,
> diff --git a/src/qemu/Makefile.inc.am b/src/qemu/Makefile.inc.am
> index 2afa67f195..28daf9d426 100644
> --- a/src/qemu/Makefile.inc.am
> +++ b/src/qemu/Makefile.inc.am
> @@ -56,6 +56,8 @@ QEMU_DRIVER_SOURCES = \
>  	qemu/qemu_qapi.h \
>  	qemu/qemu_tpm.c \
>  	qemu/qemu_tpm.h \
> +	qemu/qemu_vhost_user_gpu.c \
> +	qemu/qemu_vhost_user_gpu.h \
>  	$(NULL)
>  
>  
> diff --git a/src/qemu/qemu_vhost_user_gpu.c b/src/qemu/qemu_vhost_user_gpu.c
> new file mode 100644
> index 0000000000..9007614020
> --- /dev/null
> +++ b/src/qemu/qemu_vhost_user_gpu.c
> @@ -0,0 +1,318 @@
> +/*
> + * qemu_vhost_user_gpu.c: QEMU vhost-user GPU support
> + *
> + * Copyright (C) 2018 Red Hat, Inc.
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library.  If not, see
> + * <http://www.gnu.org/licenses/>.
> + *
> + * Author: Marc-André Lureau <marcandre.lureau at redhat.com>
> + */
> +
> +#include <config.h>
> +
> +#include "qemu_extdevice.h"
> +#include "qemu_domain.h"
> +#include "qemu_security.h"
> +
> +#include "conf/domain_conf.h"
> +#include "vircommand.h"
> +#include "viralloc.h"
> +#include "virlog.h"
> +#include "virutil.h"
> +#include "virfile.h"
> +#include "virstring.h"
> +#include "virtime.h"
> +#include "virpidfile.h"
> +#include "qemu_vhost_user_gpu.h"
> +
> +#define VIR_FROM_THIS VIR_FROM_NONE
> +
> +VIR_LOG_INIT("qemu.vhost-user-gpu")
> +
> +/*
> + * Look up the vhost-user-gpu executable; to be found on the host
> + */
> +static char *vhost_user_gpu_path;
> +
> +static int
> +qemuVhostUserGPUInit(void)
> +{
> +    if (!vhost_user_gpu_path) {
> +        vhost_user_gpu_path = virFindFileInPath("vhost-user-gpu");

This binary is in the 'contrib' directory in QEMU source tree which
generally indicates that it is just a proof of concept / demoware,
not an officially supported part of QEMU.

IMHO we cannot merge code that relies on this. We need something that
is going to be stable & supported indefinitely, at least to the same
level that QEMU itself is.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list