All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Maathuis <madman2003@gmail.com>
To: dri-devel@lists.sf.net
Subject: [PATCH 2/2] drm/ttm: don't write to bo->reserved without holding glob->lru_lock
Date: Mon,  1 Mar 2010 19:34:40 +0100	[thread overview]
Message-ID: <1267468480-3430-2-git-send-email-madman2003@gmail.com> (raw)
In-Reply-To: <1267468480-3430-1-git-send-email-madman2003@gmail.com>

- The headerfile says you can't write to it without holding the lock.

Signed-off-by: Maarten Maathuis <madman2003@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;
 }
-- 
1.7.0


------------------------------------------------------------------------------
Download Intel&#174; 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
--

  reply	other threads:[~2010-03-01 18:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-01 18:34 [PATCH 1/2] drm/ttm: remove some bo->mutex remains Maarten Maathuis
2010-03-01 18:34 ` Maarten Maathuis [this message]
2010-03-01 20:54   ` [PATCH 2/2] drm/ttm: don't write to bo->reserved without holding glob->lru_lock Jerome Glisse
2010-03-01 22:06   ` Thomas Hellstrom
2010-03-01 20:55 ` [PATCH 1/2] drm/ttm: remove some bo->mutex remains Jerome Glisse
2010-03-12  8:30   ` Maarten Maathuis

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=1267468480-3430-2-git-send-email-madman2003@gmail.com \
    --to=madman2003@gmail.com \
    --cc=dri-devel@lists.sf.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.