From patchwork Mon Dec 12 11:48:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Micha=C5=82_Winiarski?= X-Patchwork-Id: 9470509 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ED65560476 for ; Mon, 12 Dec 2016 11:49:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1DC628456 for ; Mon, 12 Dec 2016 11:49:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D709528472; Mon, 12 Dec 2016 11:49:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9393A28456 for ; Mon, 12 Dec 2016 11:49:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 78C8C6E2C6; Mon, 12 Dec 2016 11:49:16 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6E0BC6E2C6 for ; Mon, 12 Dec 2016 11:49:10 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP; 12 Dec 2016 03:49:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,336,1477983600"; d="scan'208";a="201600033" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by fmsmga004.fm.intel.com with ESMTP; 12 Dec 2016 03:49:09 -0800 Received: from mwiniars-main.igk.intel.com (172.28.171.152) by IRSMSX102.ger.corp.intel.com (163.33.3.155) with Microsoft SMTP Server id 14.3.248.2; Mon, 12 Dec 2016 11:49:08 +0000 From: =?UTF-8?q?Micha=C5=82=20Winiarski?= To: Date: Mon, 12 Dec 2016 12:48:45 +0100 Message-ID: <1481543325-2290-2-git-send-email-michal.winiarski@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481543057-333-1-git-send-email-michal.winiarski@intel.com> References: <1481543057-333-1-git-send-email-michal.winiarski@intel.com> MIME-Version: 1.0 X-Originating-IP: [172.28.171.152] Cc: Mika Kuoppala Subject: [Intel-gfx] [PATCH 8/8] drm/i915: Clear range when unbinding closed vma X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Chris Wilson Cc: Joonas Lahtinen Cc: Michel Thierry Cc: Mika Kuoppala Signed-off-by: MichaƂ Winiarski --- 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);