From: Dave Airlie <airlied@gmail.com>
To: Jerome Glisse <jglisse@redhat.com>
Cc: dri-devel@lists.sf.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] drm/radeon/kms: Rework radeon object handling
Date: Fri, 4 Dec 2009 10:10:23 +1000 [thread overview]
Message-ID: <21d7e9970912031610s26055089o30a4c2824f50dbf3@mail.gmail.com> (raw)
In-Reply-To: <1258723764-4399-3-git-send-email-jglisse@redhat.com>
On Fri, Nov 20, 2009 at 11:29 PM, Jerome Glisse <jglisse@redhat.com> wrote:
> The locking & protection of radeon object was somewhat messy.
> This patch completely rework it to now use ttm reserve as a
> protection for the radeon object structure member. It also
> shrink down the various radeon object structure by removing
> field which were redondant with the ttm information. Last it
> converts few simple functions to inline which should with
> performances.
>
> Signed-off-by: Jerome Glisse <jglisse@redhat.com>
>
> int radeon_gem_busy_ioctl(struct drm_device *dev, void *data,
> @@ -264,7 +261,7 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data,
> {
> struct drm_radeon_gem_busy *args = data;
> struct drm_gem_object *gobj;
> - struct radeon_object *robj;
> + struct radeon_bo *robj;
> int r;
> uint32_t cur_placement;
>
> @@ -273,7 +270,7 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data,
> return -EINVAL;
> }
> robj = gobj->driver_private;
> - r = radeon_object_busy_domain(robj, &cur_placement);
> + r = radeon_bo_wait(robj, &cur_placement, true);
Here we pass an uninitialised cur_placement to busy ioctl.
> +static inline int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type,
> + bool no_wait)
> +{
> + int r;
> +
> +retry:
> + r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0);
> + if (unlikely(r != 0)) {
> + if (r == -ERESTART)
> + goto retry;
> + dev_err(bo->rdev->dev, "%p reserve failed for wait\n", bo);
> + return r;
> + }
> + spin_lock(&bo->tbo.lock);
> + if (mem_type)
> + *mem_type = bo->tbo.mem.mem_type;
> + if (bo->tbo.sync_obj)
> + r = ttm_bo_wait(&bo->tbo, true, true, no_wait);
> + spin_unlock(&bo->tbo.lock);
> + ttm_bo_unreserve(&bo->tbo);
> + if (unlikely(r == -ERESTART))
> + goto retry;
> + return r;
> +}
If this return early mem_type never gets set to anything useful.
The compiler warns on this here.
Can you send a fix up patch as I've merged this to drm-radeon-next already.
Dave.
next prev parent reply other threads:[~2009-12-04 0:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-20 13:29 Jerome Glisse
2009-11-20 13:29 ` [PATCH 1/3] drm/ttm: Add range validation function Jerome Glisse
2009-11-20 13:29 ` [PATCH 2/3] drm/radeon/kms: Rework radeon object handling Jerome Glisse
2009-11-20 13:29 ` [PATCH 3/3] drm/radeon/kms: Add range pinning to crtc/cursor bo Jerome Glisse
2009-11-20 16:47 ` Alex Deucher
2009-11-20 18:04 ` Jerome Glisse
2009-12-04 0:10 ` Dave Airlie [this message]
2009-12-02 10:04 ` [PATCH 1/3] drm/ttm: Add range validation function Thomas Hellström
2009-12-01 23:53 ` Dave Airlie
2009-12-02 7:17 ` Re: Thomas Hellstrom
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=21d7e9970912031610s26055089o30a4c2824f50dbf3@mail.gmail.com \
--to=airlied@gmail.com \
--cc=dri-devel@lists.sf.net \
--cc=jglisse@redhat.com \
--cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).