From patchwork Mon Dec 19 11:36:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 13076492 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D70A8C4332F for ; Mon, 19 Dec 2022 11:37:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 867B810E22F; Mon, 19 Dec 2022 11:37:07 +0000 (UTC) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id D98C410E22F for ; Mon, 19 Dec 2022 11:37:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671449823; x=1702985823; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=DlpFzKa8DFA7K4mS+Rw1I7R8WbelOtHAJZsbuQJC3t8=; b=Dpa6Gf20XXv+vkhBDwlo1UXu1f21N1WBrH0DORKS4R+Om8jpvKCN+nQC TKsmbe6s4eMkFb+u1R45eQPGTKsrBpwc8y6gw3R3sDLGkZ1I5MxL1EgQD pEP2FVTG1+/RTgKV+G7wXRkfC4X1D5WQmqZLaY5weI8crvXqR72daMSDG UPsvDYiTw16Cm1Cd1ps9hWKEOWl2rLGqqljy88V8FJXjTD9lZgvGsEYC6 9u2euO3KMJGb0hhrEWiL2Mkw4n2jJue0dR05oHIZ9MWvxFIqGb5IHqkz+ Gm3k0FyylwlP8uwt9ghhHov2bMY0enEYGepeGQC0EU7SIeYOYpwFBRxRw w==; X-IronPort-AV: E=McAfee;i="6500,9779,10565"; a="320500267" X-IronPort-AV: E=Sophos;i="5.96,255,1665471600"; d="scan'208";a="320500267" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2022 03:37:03 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10565"; a="774896417" X-IronPort-AV: E=Sophos;i="5.96,255,1665471600"; d="scan'208";a="774896417" Received: from nirmoyda-desk.igk.intel.com ([10.102.13.19]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2022 03:37:01 -0800 From: Nirmoy Das To: intel-gfx@lists.freedesktop.org Date: Mon, 19 Dec 2022 12:36:49 +0100 Message-Id: <20221219113649.21926-1-nirmoy.das@intel.com> X-Mailer: git-send-email 2.38.0 MIME-Version: 1.0 Organization: Intel Deutschland GmbH, Registered Address: Am Campeon 10, 85579 Neubiberg, Germany, Commercial Register: Amtsgericht Muenchen HRB 186928 Subject: [Intel-gfx] [PATCH] drm/i915: Accomodate for nested dma_resv fence addition X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Thomas_Hellstr=C3=B6m?= , Nirmoy Das Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" We have below nested fence slot reservation and then fence addition to that dma_resv. dma_resv_reserve_fences() from --> ttm_bo_handle_move_mem() dma_resv_reserve_fences() from --> i915_vma_unbind_async() dma_resv_add_fence() from --> i915_vma_unbind_async() dma_resv_add_fence() from -->ttm_bo_move_accel_cleanup() A nested dma_resv_reserve_fences will not reserve extra slots and if the BO comes with lots of fences in its dma_resv, we might see: BUG_ON(fobj->num_fences >= fobj->max_fences); Suggested-by: Thomas Hellström Signed-off-by: Nirmoy Das --- drivers/gpu/drm/i915/i915_vma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c index 7d044888ac33..5ac4c1c2403c 100644 --- a/drivers/gpu/drm/i915/i915_vma.c +++ b/drivers/gpu/drm/i915/i915_vma.c @@ -2149,7 +2149,7 @@ int i915_vma_unbind_async(struct i915_vma *vma, bool trylock_vm) if (!obj->mm.rsgt) return -EBUSY; - err = dma_resv_reserve_fences(obj->base.resv, 1); + err = dma_resv_reserve_fences(obj->base.resv, 2); if (err) return -EBUSY;