intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Michał Winiarski" <michal.winiarski@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Subject: [PATCH 8/8] drm/i915: Clear range when unbinding closed vma
Date: Mon, 12 Dec 2016 12:48:45 +0100	[thread overview]
Message-ID: <1481543325-2290-2-git-send-email-michal.winiarski@intel.com> (raw)
In-Reply-To: <1481543057-333-1-git-send-email-michal.winiarski@intel.com>

Since we've introduced ppgtt shrinking, most of the vmas should already
be unbounded when ppgtt is being released.
This allows us to take care of leftovers and assert that all vmas are
unbounded, removing the iteration during ppgtt release.

Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Michel Thierry <michel.thierry@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 36 ++----------------------------------
 drivers/gpu/drm/i915/i915_vma.c     |  7 +++----
 2 files changed, 5 insertions(+), 38 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 50d4861..4326dcc 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -898,22 +898,6 @@ static void gen8_ppgtt_insert_entries(struct i915_address_space *vm,
 	}
 }
 
-static void gen8_free_page_tables(struct drm_i915_private *dev_priv,
-				  struct i915_page_directory *pd)
-{
-	int i;
-
-	if (!px_page(pd))
-		return;
-
-	for (i = 0; i < I915_PDES; i++) {
-		if (pd->page_table[i]) {
-			free_pt(dev_priv, pd->page_table[i]);
-			pd->page_table[i] = NULL;
-		}
-	}
-}
-
 static int gen8_init_scratch(struct i915_address_space *vm)
 {
 	struct drm_i915_private *dev_priv = vm->i915;
@@ -1005,30 +989,14 @@ static void gen8_free_scratch(struct i915_address_space *vm)
 static void gen8_ppgtt_cleanup_3lvl(struct drm_i915_private *dev_priv,
 				    struct i915_page_directory_pointer *pdp)
 {
-	int i;
-
-	for (i = 0; i < I915_PDPES_PER_PDP(dev_priv); i++) {
-		if (pdp->page_directory[i]) {
-			gen8_free_page_tables(dev_priv, pdp->page_directory[i]);
-			pdp->page_directory[i] = NULL;
-		}
-	}
-
+	WARN_ON(pdp->num_pdpes != 0);
 	free_pdp(dev_priv, pdp);
 }
 
 static void gen8_ppgtt_cleanup_4lvl(struct drm_i915_private *dev_priv,
 				    struct i915_pml4 *pml4)
 {
-	int i;
-
-	for (i = 0; i < GEN8_PML4ES_PER_PML4; i++) {
-		if (pml4->pdps[i]) {
-			gen8_ppgtt_cleanup_3lvl(dev_priv, pml4->pdps[i]);
-			pml4->pdps[i] = NULL;
-		}
-	}
-
+	WARN_ON(pml4->num_pml4es != 0);
 	cleanup_px(dev_priv, pml4);
 }
 
diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index 37c3eeb..248875f 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -603,10 +603,9 @@ int i915_vma_unbind(struct i915_vma *vma)
 		vma->flags &= ~I915_VMA_CAN_FENCE;
 	}
 
-	if (likely(!vma->vm->closed)) {
-		trace_i915_vma_unbind(vma);
-		vma->vm->unbind_vma(vma);
-	}
+	trace_i915_vma_unbind(vma);
+	vma->vm->unbind_vma(vma);
+
 	vma->flags &= ~(I915_VMA_GLOBAL_BIND | I915_VMA_LOCAL_BIND);
 
 	drm_mm_remove_node(&vma->node);
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-12-12 11:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-12 11:44 [PATCH 0/8] GTT bitmaps purge Michał Winiarski
2016-12-12 11:44 ` [PATCH 1/8] drm/i915/gtt: Don't pass ppgtt to ppgtt_cleanup_4lvl Michał Winiarski
2016-12-12 11:56   ` Chris Wilson
2016-12-12 11:44 ` [PATCH 2/8] drm/i915/gtt: Rename orig_start/orig_length Michał Winiarski
2016-12-12 11:44 ` [PATCH 3/8] drm/i915/gtt: Extract unwind to separate function for gen6_alloc_va_range Michał Winiarski
2016-12-12 11:44 ` [PATCH 4/8] drm/i915/gtt: Don't use temp bitmaps to unwind gen8_alloc_va_range Michał Winiarski
2016-12-12 11:46 ` [PATCH 5/8] drm/i915/gtt: Purge temp bitmaps Michał Winiarski
2016-12-12 11:46   ` [PATCH 6/8] drm/i915: Prepare i915_page_table_entry_map tracepoint for bitmap purge Michał Winiarski
2016-12-12 11:48 ` [PATCH 7/8] drm/i915/gtt: Purge page tracking bitmaps Michał Winiarski
2016-12-12 11:48 ` Michał Winiarski [this message]
2016-12-12 12:00   ` [PATCH 8/8] drm/i915: Clear range when unbinding closed vma 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=1481543325-2290-2-git-send-email-michal.winiarski@intel.com \
    --to=michal.winiarski@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mika.kuoppala@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).