lkml.org 
[lkml]   [2009]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 2/3] drm/radeon/kms: Rework radeon object handling
From
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2009-12-04 01:13    [W:0.082 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site