* [PATCH] drm/i915: fix up locking inconsistency around gem_do_init
@ 2012-01-26 10:41 Daniel Vetter
2012-01-26 13:42 ` Chris Wilson
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Vetter @ 2012-01-26 10:41 UTC (permalink / raw)
To: Intel Graphics Development; +Cc: Daniel Vetter
The locking in our setup and teardown paths is rather arbitrary, but
generally we try to protect gem stuff with dev->struct_mutex. Further,
the ums/gem ioctl to setup gem _does_ take the look. So fix up this
benign inconsistency.
Notice while reading through code.
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/i915/i915_dma.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 448848c..51bbd03 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1196,6 +1196,7 @@ static int i915_load_gem_init(struct drm_device *dev)
/* Basic memrange allocator for stolen space */
drm_mm_init(&dev_priv->mm.stolen, 0, prealloc_size);
+ mutex_lock(&dev->struct_mutex);
/* Let GEM Manage all of the aperture.
*
* However, leave one page at the end still bound to the scratch page.
@@ -1207,7 +1208,6 @@ static int i915_load_gem_init(struct drm_device *dev)
*/
i915_gem_do_init(dev, 0, mappable_size, gtt_size - PAGE_SIZE);
- mutex_lock(&dev->struct_mutex);
ret = i915_gem_init_ringbuffer(dev);
mutex_unlock(&dev->struct_mutex);
if (ret)
--
1.7.8.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/i915: fix up locking inconsistency around gem_do_init
2012-01-26 10:41 [PATCH] drm/i915: fix up locking inconsistency around gem_do_init Daniel Vetter
@ 2012-01-26 13:42 ` Chris Wilson
2012-01-26 13:45 ` Daniel Vetter
2012-02-13 19:05 ` Daniel Vetter
0 siblings, 2 replies; 4+ messages in thread
From: Chris Wilson @ 2012-01-26 13:42 UTC (permalink / raw)
To: Intel Graphics Development; +Cc: Daniel Vetter
On Thu, 26 Jan 2012 11:41:11 +0100, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> The locking in our setup and teardown paths is rather arbitrary, but
> generally we try to protect gem stuff with dev->struct_mutex. Further,
> the ums/gem ioctl to setup gem _does_ take the look. So fix up this
> benign inconsistency.
It is completely arbitrary and only exists to keep lockdep and various
BUG_ON(mutex_lock) happy. From your reading, we would have a lockdep
warning with ums/gem?
The extra little step towards consistency is likely to save a warning
later, so
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/i915: fix up locking inconsistency around gem_do_init
2012-01-26 13:42 ` Chris Wilson
@ 2012-01-26 13:45 ` Daniel Vetter
2012-02-13 19:05 ` Daniel Vetter
1 sibling, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2012-01-26 13:45 UTC (permalink / raw)
To: Chris Wilson; +Cc: Daniel Vetter, Intel Graphics Development
On Thu, Jan 26, 2012 at 01:42:02PM +0000, Chris Wilson wrote:
> On Thu, 26 Jan 2012 11:41:11 +0100, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > The locking in our setup and teardown paths is rather arbitrary, but
> > generally we try to protect gem stuff with dev->struct_mutex. Further,
> > the ums/gem ioctl to setup gem _does_ take the look. So fix up this
> > benign inconsistency.
>
> It is completely arbitrary and only exists to keep lockdep and various
> BUG_ON(mutex_lock) happy. From your reading, we would have a lockdep
> warning with ums/gem?
>
> The extra little step towards consistency is likely to save a warning
> later, so
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Actually no lockdep splat to be expected, because gem_do_init is _really_
simple. But maybe we'll extend the gtt_clear stuff in there to be more
involved and this could indeed change. But currently the only reason for
that change is to satisfy my ocd ;-)
-Daniel
--
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/i915: fix up locking inconsistency around gem_do_init
2012-01-26 13:42 ` Chris Wilson
2012-01-26 13:45 ` Daniel Vetter
@ 2012-02-13 19:05 ` Daniel Vetter
1 sibling, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2012-02-13 19:05 UTC (permalink / raw)
To: Chris Wilson; +Cc: Daniel Vetter, Intel Graphics Development
On Thu, Jan 26, 2012 at 01:42:02PM +0000, Chris Wilson wrote:
> On Thu, 26 Jan 2012 11:41:11 +0100, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > The locking in our setup and teardown paths is rather arbitrary, but
> > generally we try to protect gem stuff with dev->struct_mutex. Further,
> > the ums/gem ioctl to setup gem _does_ take the look. So fix up this
> > benign inconsistency.
>
> It is completely arbitrary and only exists to keep lockdep and various
> BUG_ON(mutex_lock) happy. From your reading, we would have a lockdep
> warning with ums/gem?
>
> The extra little step towards consistency is likely to save a warning
> later, so
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Queued for -next, thanks for the review.
-Daniel
--
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-02-13 19:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-26 10:41 [PATCH] drm/i915: fix up locking inconsistency around gem_do_init Daniel Vetter
2012-01-26 13:42 ` Chris Wilson
2012-01-26 13:45 ` Daniel Vetter
2012-02-13 19:05 ` Daniel Vetter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.