Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Widawsky <ben@bwidawsk.net>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: ioctl to query a bo's cache level
Date: Thu, 22 Sep 2011 15:36:51 +0000	[thread overview]
Message-ID: <20110922153650.GA10332@cloud01> (raw)
In-Reply-To: <20110922073512.GC2924@phenom.ffwll.local>

On Thu, Sep 22, 2011 at 09:35:12AM +0200, Daniel Vetter wrote:
> On Wed, Sep 21, 2011 at 06:47:10PM -0700, Ben Widawsky wrote:
> > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> > index a546a71..362da16 100644
> > --- a/drivers/gpu/drm/i915/i915_gem.c
> > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > @@ -3777,6 +3777,29 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj)
> >  }
> >  
> >  int
> > +i915_gem_get_cache_type_ioctl(struct drm_device *dev, void *data,
> > +			      struct drm_file *file_priv)
> > +{
> > +
> > +	struct drm_i915_gem_get_cache_type *args = data;
> > +	struct drm_i915_gem_object *obj;
> > +	int ret = 0;
> > +
> > +	obj = to_intel_bo(drm_gem_object_lookup(dev, file_priv, args->handle));
> > +	if (&obj->base == NULL) {
> > +		ret = -ENOENT;
> > +		goto out;
> > +	}
> > +
> > +	args->cache_level = obj->cache_level;
> 
> Grab struct_mutex around this, obj->cache_level might change over the
> lifetime of the bo. Yeah, our locking is a mess, I know ;-)

I don't see how a lock by itself helps. The cache_level could change as soon as
you release the lock which results in the same problem.

Ben

  reply	other threads:[~2011-09-22 15:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-20  4:25 [PATCH 1/6] RFCish: write only mappings (aka non-blocking) Ben Widawsky
2011-09-20  4:25 ` [PATCH 1/6] drm/i915: object CPU flush interface Ben Widawsky
2011-09-20  4:25 ` [PATCH 2/6] drm/i915: write only object tracking Ben Widawsky
2011-09-20  4:25 ` [PATCH 3/6] drm/i915: Support write only mappings Ben Widawsky
2011-09-20  5:29   ` Keith Packard
2011-09-20  5:37     ` Ben Widawsky
2011-09-20  8:30   ` Chris Wilson
2011-09-20  4:25 ` [PATCH 4/6] intel: write only map support Ben Widawsky
2011-09-20  4:25 ` [PATCH 5/6] write-only mappings Ben Widawsky
2011-09-20  4:25 ` [PATCH 6/6] intel: use write only maps for MapRangeBuffer Ben Widawsky
2011-09-20 11:06 ` [PATCH 1/6] RFCish: write only mappings (aka non-blocking) Daniel Vetter
2011-09-20 17:17   ` Eric Anholt
2011-09-20 19:19     ` Daniel Vetter
2011-09-21  8:19       ` [PATCH] intel: non-blocking mmaps on the cheap Daniel Vetter
2011-09-21 18:11         ` Eric Anholt
2011-09-21 19:19           ` Daniel Vetter
2011-09-22  1:47             ` [PATCH cont'd] " Ben Widawsky
2011-09-22  1:47               ` [PATCH] drm/i915: ioctl to query a bo's cache level Ben Widawsky
2011-09-22  7:35                 ` Daniel Vetter
2011-09-22 15:36                   ` Ben Widawsky [this message]
2011-09-22 15:49                     ` Chris Wilson
2011-09-22  1:47               ` [PATCH] on top of daniel Ben Widawsky
2011-09-22  7:39                 ` Daniel Vetter
2011-09-22  7:33               ` [PATCH cont'd] intel: non-blocking mmaps on the cheap Daniel Vetter
2011-09-20 21:16   ` [PATCH 1/6] RFCish: write only mappings (aka non-blocking) Chris Wilson
2011-09-21  7:02     ` Daniel Vetter
2011-09-20 22:19   ` Ben Widawsky
2011-09-21  7:07     ` Daniel Vetter

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=20110922153650.GA10332@cloud01 \
    --to=ben@bwidawsk.net \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    /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