From patchwork Tue Aug 20 06:14:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 2846889 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 10AE9BF546 for ; Tue, 20 Aug 2013 07:26:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E9A1F20437 for ; Tue, 20 Aug 2013 07:26:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D719920435 for ; Tue, 20 Aug 2013 07:26:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DD358E69E4 for ; Tue, 20 Aug 2013 00:26:43 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail.bwidawsk.net (bwidawsk.net [166.78.191.112]) by gabe.freedesktop.org (Postfix) with ESMTP id 232BAE5F63 for ; Mon, 19 Aug 2013 23:14:42 -0700 (PDT) Received: by mail.bwidawsk.net (Postfix, from userid 5001) id D2F38599B6; Mon, 19 Aug 2013 23:14:25 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from lundgren.intel.com (c-24-21-100-90.hsd1.or.comcast.net [24.21.100.90]) by mail.bwidawsk.net (Postfix) with ESMTPSA id 4B15B58153; Mon, 19 Aug 2013 23:14:22 -0700 (PDT) From: Ben Widawsky To: intel-gfx@lists.freedesktop.org Date: Mon, 19 Aug 2013 23:14:14 -0700 Message-Id: <1376979255-17887-2-git-send-email-benjamin.widawsky@intel.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1376979255-17887-1-git-send-email-benjamin.widawsky@intel.com> References: <1376979255-17887-1-git-send-email-benjamin.widawsky@intel.com> Cc: Ben Widawsky , Ben Widawsky Subject: [Intel-gfx] [PATCH 2/3] drm/i915/vma: Mark vmas busy during execbuf lookup X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Ben Widawsky --- 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;