From: Daniel Vetter <daniel@ffwll.ch>
To: "Cheng, Yao" <yao.cheng@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"emil.l.velikov@gmail.com" <emil.l.velikov@gmail.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"Chehab, John" <john.chehab@intel.com>,
"Jiang, Fei" <fei.jiang@intel.com>,
"Barbalho, Rafael" <rafael.barbalho@intel.com>,
"Beckett, Robert" <robert.beckett@intel.com>
Subject: Re: [RFC PATCH v3 4/4] tests/drv_module_reload: add ipvr support
Date: Mon, 5 Jan 2015 09:39:50 +0100 [thread overview]
Message-ID: <20150105083950.GO2711@phenom.ffwll.local> (raw)
In-Reply-To: <8FF7D634BEE4C2428EFFAB6B7E919E4B01853AE5@shsmsx102.ccr.corp.intel.com>
On Sun, Dec 21, 2014 at 02:40:24PM +0000, Cheng, Yao wrote:
> > -----Original Message-----
> > From: Daniel Vetter [mailto:daniel.vetter@ffwll.ch]
> > Sent: Thursday, December 18, 2014 19:21
> > To: Thierry Reding
> > Cc: Cheng, Yao; intel-gfx@lists.freedesktop.org; dri-
> > devel@lists.freedesktop.org; Kelley, Sean V; Chehab, John;
> > emil.l.velikov@gmail.com; Jiang, Fei
> > Subject: Re: [RFC PATCH v3 4/4] tests/drv_module_reload: add ipvr support
> >
> > On Thu, Dec 18, 2014 at 11:04 AM, Thierry Reding <thierry.reding@gmail.com>
> > wrote:
> > >> I double checked the symptom and found it was a deadlock on
> > drm_global_mutex.
> > >> When i915_driver_load() registers the platform device while ipvr module
> > is in the system, ipvr's probe() function tries to lock drm_global_mutex which
> > was already held by i915.
> > >> I think either of the following 2 actions need to be moved to a bottom half
> > e.g. a work queue:
> > >> platform_device_add () call in i915_ved.c (called during
> > i915_driver_load())
> > >> drm_dev_register() call during ipvr's probe() Which one makes
> > >> more sense? pls kindly advise (I personally prefer the former one.).
> > >
> > > Yes, that's somewhat ugly, but I don't see a way around that. I'd also
> > > think that moving platform_device_add() to a workqueue would be the
> > > best option here.
> >
> > Or we simply kill drm_global_mutex for platform drivers that don't use the -
> > >probe hook. It should work when they have a correct order betwen
> > drm_dev_alloc and _register and all the code in between. So just ditch the -
> > >load callback in teh ipvr driver and rework the load sequence as suggested
> > somewhere else and this is fixed already. No need for bottom halfs I think.
>
> Daniel, sorry I didn't quite understand "platform drivers that don't use
> the probe hook". For initialization, the ipvr platform driver's probe()
> is called in following 2 possible paths:
> 1. ipvr installed before i915. In this case, ipvr's probe() is called
> inside i915_driver_load() and falls into the drm_global_mutex dead lock.
> 2. i915 installed before ipvr. In this case, ipvr's probe() is called
> without drm_global_mutex held by i915 and no dead lock issue.
> If we kill drm_global_mutex, will path 2 run into issue? And in your
> suggestion, how to rework the load sequence? Do you mean calling ipvr's
> load() callback directly during platform driver probe()?
Hm right it's not that simple really. What we need in more detail is:
- Move the mutex_lock(&drm_global_mutex) out of drm_dev_register into
all the callers. If a driver has a ->load() callback it most likely is
racy with the usual load ordering issues.
- Rework ipvr to no longer have a ->load callback. Insteaed use the
following sequence (in the platform ->probe callback):
drm_dev_alloc();
ipvr_load();
drm_dev_register();
With that ordering we don't need the additional guarantees that
drm_global_mutex provides and we can avoid to take that lock around
drm_dev_registrer() call in the ipvr code.
This should resolve the deadlock I hope.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-01-05 8:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-21 19:10 [RFC PATCH v3 4/4] tests/drv_module_reload: add ipvr support Yao Cheng
2014-11-21 20:27 ` Thierry Reding
2014-11-21 20:36 ` Daniel Vetter
2014-11-24 9:55 ` Thierry Reding
2014-11-24 13:14 ` Daniel Vetter
2014-12-01 3:06 ` Cheng, Yao
2014-12-17 8:13 ` Thierry Reding
2014-12-18 5:44 ` Cheng, Yao
2014-12-18 10:04 ` Thierry Reding
2014-12-18 11:21 ` Daniel Vetter
2014-12-21 14:40 ` Cheng, Yao
2015-01-05 8:39 ` Daniel Vetter [this message]
2015-01-06 14:14 ` Cheng, Yao
2015-01-07 7:33 ` Daniel Vetter
2014-12-17 8:02 ` Thierry Reding
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=20150105083950.GO2711@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=emil.l.velikov@gmail.com \
--cc=fei.jiang@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=john.chehab@intel.com \
--cc=rafael.barbalho@intel.com \
--cc=robert.beckett@intel.com \
--cc=yao.cheng@intel.com \
/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