[PATCH v6 6/6] drm/i915/gvt: Adding interface so user space can get the dma-buf

Gerd Hoffmann kraxel at redhat.com
Fri Jun 2 15:23:58 UTC 2017


  Hi,

> > When i915's dma-buf's release() callback is called it will try to
> > free the gem object associated with the dma-buf if its ref count is
> > 0. But in our case the ref count is 1 so no free callback is called
> > so we can not release allocations there.

Why the ref count is one?  Who holds a reference and why?
Maybe it should be the other way around, i.e. the dmabuf holds a
reference on the vgpu instance backing it, i.e. you can't delete the
vgpu while dma-bufs exist?

> We cannot simply say that the user isn't allowed to release them in
> that order.

Yep, not going to fly.  Can happen even unintentionally because we can
pass around dmabufs to other processes.  Example: qemu passes dmabuf to
spice-client, then qemu crashes.  mgmt fd is closed before dmabuf fd
then.  The kernel must be able to handle that.

cheers,
  Gerd


More information about the intel-gvt-dev mailing list