On Fri, Sep 13, 2019 at 04:50:51PM +0400, marcandre.lureau(a)redhat.com wrote:
From: Marc-André Lureau <marcandre.lureau(a)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.
The vhost-user connection fd is set on qemuDomainVideoPrivate struct.
Signed-off-by: Marc-André Lureau <marcandre.lureau(a)redhat.com>
---
src/qemu/Makefile.inc.am | 2 +
src/qemu/qemu_domain.c | 5 +-
src/qemu/qemu_domain.h | 2 +-
src/qemu/qemu_vhost_user_gpu.c | 276 +++++++++++++++++++++++++++++++++
src/qemu/qemu_vhost_user_gpu.h | 49 ++++++
5 files changed, 332 insertions(+), 2 deletions(-)
create mode 100644 src/qemu/qemu_vhost_user_gpu.c
create mode 100644 src/qemu/qemu_vhost_user_gpu.h
+/*
+ * qemuExtVhostUserGPUSetupCgroup:
+ *
+ * @driver: QEMU driver
+ * @def: domain definition
+ * @video: the video device
+ * @cgroupe: a cgroup
+ *
+ * Add the vhost-user-gpu PID to the given cgroup.
+ */
+int
+qemuExtVhostUserGPUSetupCgroup(virQEMUDriverPtr driver,
+ virDomainDefPtr def,
+ virDomainVideoDefPtr video,
+ virCgroupPtr cgroup)
+{
+ VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
+ VIR_AUTOFREE(char *) pidfile = NULL;
Clang fails to compile this:
qemu/qemu_vhost_user_gpu.c:256:26: error: unused variable 'pidfile'
[-Werror,-Wunused-variable]
VIR_AUTOFREE(char *) pidfile = NULL;
^
1 error generated.
+ VIR_AUTOFREE(char *) shortname = NULL;
+ int rc;
+ pid_t pid;
+
Jano