linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: John Garry <john.garry@huawei.com>
Cc: Ezequiel Garcia <ezequiel@collabora.com>,
	"kongxinwei (A)" <kong.kongxinwei@hisilicon.com>,
	"Chenfeng (puck)" <puck.chen@hisilicon.com>,
	"airlied@linux.ie" <airlied@linux.ie>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Linuxarm <linuxarm@huawei.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Gerd Hoffmann <kraxel@redhat.com>,
	dbueso@suse.de
Subject: Re: Warnings in DRM code when removing/unbinding a driver
Date: Thu, 19 Dec 2019 11:10:37 +0100	[thread overview]
Message-ID: <CAKMK7uE+nfR2hv1ybfv1ZApZbGnnX7ZHfjFCv5K72ZaAmdtfug@mail.gmail.com> (raw)
In-Reply-To: <fcca5732-c7dc-6e1d-dcbe-bfd914a4295b@huawei.com>

On Thu, Dec 19, 2019 at 11:03 AM John Garry <john.garry@huawei.com> wrote:
>
> On 19/12/2019 09:54, Daniel Vetter wrote:
> > On Wed, Dec 18, 2019 at 7:08 PM John Garry <john.garry@huawei.com> wrote:
> >>
> >> +
> >>
> >> So the v5.4 kernel does not have this issue.
> >>
> >> I have bisected the initial occurrence to:
> >>
> >> commit 37a48adfba6cf6e87df9ba8b75ab85d514ed86d8
> >> Author: Thomas Zimmermann <tzimmermann@suse.de>
> >> Date:   Fri Sep 6 14:20:53 2019 +0200
> >>
> >>       drm/vram: Add kmap ref-counting to GEM VRAM objects
> >>
> >>       The kmap and kunmap operations of GEM VRAM buffers can now be called
> >>       in interleaving pairs. The first call to drm_gem_vram_kmap() maps the
> >>       buffer's memory to kernel address space and the final call to
> >>       drm_gem_vram_kunmap() unmaps the memory. Intermediate calls to these
> >>       functions increment or decrement a reference counter.
> >>
> >> So this either exposes or creates the issue.
> >
> > Yeah that's just shooting the messenger.
>
> OK, so it exposes it.
>
>   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.
-Daniel

>
> Thanks,
> John



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2019-12-19 10:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-16 17:23 Warnings in DRM code when removing/unbinding a driver John Garry
2019-12-17  9:20 ` John Garry
2019-12-17 13:24   ` Daniel Vetter
2019-12-17 16:34 ` Ezequiel Garcia
2019-12-17 17:27   ` John Garry
2019-12-18 18:08     ` John Garry
2019-12-19  9:54       ` Daniel Vetter
2019-12-19 10:03         ` John Garry
2019-12-19 10:10           ` Daniel Vetter [this message]
2019-12-19 11:31             ` Gerd Hoffmann
2019-12-19 12:42               ` Daniel Vetter
2019-12-23  9:00                 ` SIGBUS on device disappearance (Re: Warnings in DRM code when removing/unbinding a driver) Pekka Paalanen
2020-01-07 15:42                   ` Daniel Vetter
2020-01-10 10:49 ` Warnings in DRM code when removing/unbinding a driver Thomas Zimmermann
2020-01-10 12:54   ` John Garry
2020-01-13  8:05     ` Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKMK7uE+nfR2hv1ybfv1ZApZbGnnX7ZHfjFCv5K72ZaAmdtfug@mail.gmail.com \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=dbueso@suse.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ezequiel@collabora.com \
    --cc=john.garry@huawei.com \
    --cc=kong.kongxinwei@hisilicon.com \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=puck.chen@hisilicon.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).