[PATCH v3] drm: Provide a driver hook for drm_dev_release()
Chris Wilson
chris at chris-wilson.co.uk
Mon Jan 23 09:45:50 UTC 2017
On Sat, Jan 21, 2017 at 11:21:28PM +0200, Laurent Pinchart wrote:
> Hi Chris,
>
> Thank you for the patch.
>
> On Saturday 21 Jan 2017 10:58:25 Chris Wilson wrote:
> > Some state is coupled into the device lifetime outside of the
> > load/unload timeframe and requires teardown during final unreference
> > from drm_dev_release(). For example, dmabufs hold both a device and
> > module reference and may live longer than expected (i.e. the current
> > pattern of the driver tearing down its state and then releasing a
> > reference to the drm device) and yet touch driver private state when
> > destroyed.
> >
> > v2: Export drm_dev_fini() and move the responsible for finalizing the
> > drm_device and freeing it to the release callback. (If no callback is
> > provided, the core will call drm_dev_fini() and kfree(dev) as before.)
> > v3: Remember to add drm_dev_fini() to drm_drv.h
>
> This takes my comments into account, thank you for that. Do you have a patch
> that shows usage of the release callback in a driver ?
I haven't yet dared start to split i915 between pci-device teardown and
system teardown, but
https://cgit.freedesktop.org/~ickle/linux-2.6/commit/?h=prescheduler&id=00a6ab3689ad09a0f2ea1df8e4a03a38721d2328
shows a use of driver->release to avoid the memory corruption with
dmabuf versus the virtual device. vgem should also provide a useful
example.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the dri-devel
mailing list