[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKMK7uHEL3WzSHDM3XdLwOBtQUtygK6x-md8W1MVsAryDDgFog@mail.gmail.com>
Date: Thu, 19 Dec 2019 13:42:33 +0100
From: Daniel Vetter <daniel@...ll.ch>
To: Gerd Hoffmann <kraxel@...hat.com>
Cc: John Garry <john.garry@...wei.com>,
Ezequiel Garcia <ezequiel@...labora.com>,
"kongxinwei (A)" <kong.kongxinwei@...ilicon.com>,
"Chenfeng (puck)" <puck.chen@...ilicon.com>,
"airlied@...ux.ie" <airlied@...ux.ie>,
Thomas Zimmermann <tzimmermann@...e.de>,
Linuxarm <linuxarm@...wei.com>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
dbueso@...e.de
Subject: Re: Warnings in DRM code when removing/unbinding a driver
On Thu, Dec 19, 2019 at 12:32 PM Gerd Hoffmann <kraxel@...hat.com> wrote:
>
> Hi,
>
> > > Like I said, for most drivers
> > > > you can pretty much assume that their unload sequence has been broken
> > > > since forever. It's not often tested, and especially the hotunbind
> > > > from a device (as opposed to driver unload) stuff wasn't even possible
> > > > to get right until just recently.
> > >
> > > Do you think it's worth trying to fix this for 5.5 and earlier, or just
> > > switch to the device-managed interface for 5.6 and forget about 5.5 and
> > > earlier?
> >
> > I suspect it's going to be quite some trickery to fix this properly
> > and everywhere, even for just one driver. Lots of drm drivers
> > unfortunately use anti-patterns with wrong lifetimes (e.g. you can't
> > use devm_kmalloc for anything that hangs of a drm_device, like
> > plane/crtc/connector). Except when it's for a real hotunpluggable
> > device (usb) we've never bothered backporting these fixes. Too much
> > broken stuff unfortunately.
>
> While being at it: How would a driver cleanup properly cleanup gem
> objects created by userspace on hotunbind? Specifically a gem object
> pinned to vram?
Two things:
- the mmap needs to be torn down and replaced by something which will
sigbus. Probably should have that as a helper (plus vram fault code
should use drm_dev_enter/exit to plug races).
- otherwise all datastructures need to be properly refcounted.
drm_device now is (if your driver isn't broken), but any dma_fence or
dma_buf we create and export has an independent lifetime, and
currently the refcounting for is still wobbly I think.
So some work to do, both in helpers/core code and in drivers to get updated.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Powered by blists - more mailing lists