Re: dma-buf and ->dev refcount fun

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

On Tue, Mar 25, 2014 at 9:01 AM, Daniel Vetter <daniel@xxxxxxxx> wrote:
> Besides the issue at hand though I think drivers need to make sure
> that the device they use for attaching does outlive the dma-buf. Which
> for real hotpluggin probably means that drivers need to drop all
> attachment on unplug (the dma mapping is useless anyway) and just keep
> all their imported gem objects alive with just a reference to the
> dma-buf object itself.

Drivers should never touch other drivers or even look at them. There
is no reason i915 is responsible of keeping udl alive. That gets
really messy and may introduce circular dependencies.

I'd like to see exported dma-bufs reference their drm-device owner.
This way, the drm-device stays around until the dma-buf is removed. To
avoid lazy device destruction, a driver can (during unplug) simply
detach all dma-bufs if, and only if, they first made the dma-buf
somehow stand-alone.

For example: udl can just move the allocated pages into the dma-buf,
mark it as dead and detach it. The udl-device can get destructed and
whenever i915 releases the dma-buf, the udl-dma-buf ops see it's dead
and just deref it / release dma-buf resources. But this is all not
needed if the exported dma-bufs just reference "drm_device", which is
imho the easiest fix.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux