devm actions and hw clenaup (was Re: [PATCH 01/11] drm: Add devm_drm_dev_init/register)

Greg KH gregkh at linuxfoundation.org
Wed Jan 30 07:14:56 UTC 2019


On Wed, Jan 30, 2019 at 12:14:46AM +0100, Daniel Vetter wrote:
> On Tue, Jan 29, 2019 at 8:27 PM Greg KH <gregkh at linuxfoundation.org> wrote:
> > On Tue, Jan 29, 2019 at 07:10:55PM +0100, Daniel Vetter wrote:
> > > The problem is when drivers use devm_ not to allocate hw resources and
> > > related things, but structures for objects with other lifetimes. Like
> > > open file descriptors shared with the world.
> >
> > And irqs, which bites everyone in the end.  You have to be careful here,
> > never tie a devm allocation to an object with another reference count,
> > that's just a bug.
> 
> The classic "I forgot to shut down the interrupt before releasing
> driver structures and now the irq handler oopsed" or something more
> sinister?

The classic is always the best, and most common :)

> gpus definitely needs lots of interrupt stuff, so if that is
> fundamentally broken then our devm ideas won't work out at all.

You better not be using devm for your irqs right now then.

good luck!

greg k-h


More information about the dri-devel mailing list