On Fri, Nov 20, 2009 at 11:29 PM, Jerome Glisse <jgli...@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 <jgli...@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.

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to