Maarten Maathuis wrote: > - The headerfile says you can't write to it without holding the lock. > NAK.
The header-file is incorrect. It should say that the lru_lock needs to be held only when we transition from 0 to 1. That guarantees that if the lru lock is held, and we read 0, we can safely assume that we're the only ones trying to lock. /Thomas > Signed-off-by: Maarten Maathuis <madman2...@gmail.com> > --- > drivers/gpu/drm/ttm/ttm_bo.c | 8 +++++++- > 1 files changed, 7 insertions(+), 1 deletions(-) > > diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c > index f5333d9..2104885 100644 > --- a/drivers/gpu/drm/ttm/ttm_bo.c > +++ b/drivers/gpu/drm/ttm/ttm_bo.c > @@ -476,9 +476,9 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object > *bo, bool remove_all) > drm_mm_put_block(bo->mem.mm_node); > bo->mem.mm_node = NULL; > } > - spin_unlock(&glob->lru_lock); > > atomic_set(&bo->reserved, 0); > + spin_unlock(&glob->lru_lock); > > while (put_count--) > kref_put(&bo->list_kref, ttm_bo_ref_bug); > @@ -1707,8 +1707,12 @@ EXPORT_SYMBOL(ttm_bo_wait); > > void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo) > { > + struct ttm_bo_global *glob = bo->glob; > + > + spin_lock(&glob->lru_lock); > atomic_set(&bo->reserved, 0); > wake_up_all(&bo->event_queue); > + spin_unlock(&glob->lru_lock); > } > > int ttm_bo_block_reservation(struct ttm_buffer_object *bo, bool > interruptible, > @@ -1849,8 +1853,10 @@ out: > * already swapped buffer. > */ > > + spin_lock(&glob->lru_lock); > atomic_set(&bo->reserved, 0); > wake_up_all(&bo->event_queue); > + spin_unlock(&glob->lru_lock); > kref_put(&bo->list_kref, ttm_bo_release_list); > return ret; > } > ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- _______________________________________________ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel