public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ben Widawsky <benjamin.widawsky@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Ben Widawsky <ben@bwidawsk.net>,
	Ben Widawsky <benjamin.widawsky@intel.com>
Subject: [PATCH 2/3] drm/i915/vma: Mark vmas busy during execbuf lookup
Date: Mon, 19 Aug 2013 23:14:14 -0700	[thread overview]
Message-ID: <1376979255-17887-2-git-send-email-benjamin.widawsky@intel.com> (raw)
In-Reply-To: <1376979255-17887-1-git-send-email-benjamin.widawsky@intel.com>

The exec_list is a somewhat fragile list containing all the VMAs we've
looked up. It does processing in a multi-stage approach where elements
on the list are expected to not be removed for the duration of the
stages.

The next patch will fix an oversight where destroying a VMA does not
remove it from the exec_list. As such, we must mark the VMA busy for the
multi stage execbuf or else the above assertion we mentioned cannot be
guaranteed.

NOTE: This patch isn't quite tested yet. It just fixes the theoretical
issue.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 9b3b5f8..7d8c841 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -516,6 +516,8 @@ i915_gem_execbuffer_unreserve_vma(struct i915_vma *vma)
 		i915_gem_object_unpin(obj);
 
 	entry->flags &= ~(__EXEC_OBJECT_HAS_FENCE | __EXEC_OBJECT_HAS_PIN);
+
+	vma->busy = 0;
 }
 
 static int
@@ -535,6 +537,7 @@ i915_gem_execbuffer_reserve(struct intel_ring_buffer *ring,
 		bool need_fence, need_mappable;
 
 		vma = list_first_entry(vmas, struct i915_vma, exec_list);
+		vma->busy = true;
 		obj = vma->obj;
 		entry = vma->exec_entry;
 
-- 
1.8.3.4

  reply	other threads:[~2013-08-20  6:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-20  6:14 [PATCH 1/3] drm/i915/vma: Add a busy flag; means don't destroy Ben Widawsky
2013-08-20  6:14 ` Ben Widawsky [this message]
2013-08-20  6:14 ` [PATCH 3/3] drm/i915/vma: Remove VMA from exec_list on destroy Ben Widawsky
2013-08-20  8:01   ` Chris Wilson

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=1376979255-17887-2-git-send-email-benjamin.widawsky@intel.com \
    --to=benjamin.widawsky@intel.com \
    --cc=ben@bwidawsk.net \
    --cc=intel-gfx@lists.freedesktop.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