From mboxrd@z Thu Jan 1 00:00:00 1970 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 D2B90C43334 for ; Wed, 15 Jun 2022 15:54:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 194F3112590; Wed, 15 Jun 2022 15:54:46 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5F390112583 for ; Wed, 15 Jun 2022 15:54:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655308484; x=1686844484; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to; bh=+8SI2XY4fp+HOhN2Ftn+PUAmitnua0yd0sRzH2Yqt1M=; b=kI6aMDb7heewgptjePIVQ4RAB0BDTGfiX7ZBzsJFTNwQNLzv/pM4YLA7 fRl4ZS5d6FaGiuvtc126/i01z8pVxe2ekqKom7QZeCXFknn/wQVHmtb4U aGQUCD1YYHmRcZLiZ3clotP7By9Vg4zOIzVuF9pkDW3eKi86fLszQYGf6 Rt+JJjQDYDYjJL1A1BP8AbryCpOQ1tAKqoaz6uhMUzAHmpuFW2pUm5FQ5 b7+DKQI6v0AiDslRNonVGVQ95bNAq81lJvsd/oxjQwm5BnqsuX9SULrNY 2I4+6K8Frez9Tdkl/ljiHabg60DgC0fwBhOSZ+UsJtbiCORUUogpj9pXS A==; X-IronPort-AV: E=McAfee;i="6400,9594,10379"; a="277802509" X-IronPort-AV: E=Sophos;i="5.91,302,1647327600"; d="scan'208,217";a="277802509" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2022 08:54:35 -0700 X-IronPort-AV: E=Sophos;i="5.91,302,1647327600"; d="scan'208,217";a="641071087" Received: from nirmoyda-mobl.ger.corp.intel.com (HELO [10.249.40.148]) ([10.249.40.148]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2022 08:54:33 -0700 Content-Type: multipart/alternative; boundary="------------3z8YxcPifdnZOJdDIi2K2NCF" Message-ID: <13125ed8-5881-be96-8a0f-955fd6dd75ce@linux.intel.com> Date: Wed, 15 Jun 2022 17:54:31 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Content-Language: en-US To: Gwan-gyeong Mun , intel-gfx@lists.freedesktop.org References: <20220603093830.1529520-1-gwan-gyeong.mun@intel.com> <20220603093830.1529520-6-gwan-gyeong.mun@intel.com> From: "Das, Nirmoy" In-Reply-To: <20220603093830.1529520-6-gwan-gyeong.mun@intel.com> Subject: Re: [Intel-gfx] [PATCH 5/6] drm/i915: Use error code as -E2BIG when the size of gem ttm object is too large 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: Jani Nikula , thomas.hellstrom@linux.intel.com, matthew.auld@intel.com, chris@chris-wilson.co.uk Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" This is a multi-part message in MIME format. --------------3z8YxcPifdnZOJdDIi2K2NCF Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Gwan-gyeong, On 6/3/2022 11:38 AM, Gwan-gyeong Mun wrote: > The ttm_bo_init_reserved() functions returns -ENOSPC if the size is too big > to add vma. The direct function that returns -ENOSPC is drm_mm_insert_node_in_range(). > To handle the same error as other code returning -E2BIG when the size is > too large, it converts return value to -E2BIG. > > Signed-off-by: Gwan-gyeong Mun > Cc: Chris Wilson > Cc: Matthew Auld > Cc: Thomas Hellström > Testcase: igt@gem_create@create-massive > Closes:https://gitlab.freedesktop.org/drm/intel/-/issues/4991 This "Closes" tag should move to the last patch as you are removing the |GEM_WARN_ON() from there.| |The series is ||Reviewed-by: Nirmoy Das once Jani's  concern is | |addressed and this series can go as it is.| | | |Thanks,| |Nirmoy | || || > --- > drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c > index 8231a6fc5437..f162e2492cd3 100644 > --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c > +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c > @@ -1243,6 +1243,17 @@ int __i915_gem_ttm_object_init(struct intel_memory_region *mem, > bo_type, &i915_sys_placement, > page_size >> PAGE_SHIFT, > &ctx, NULL, NULL, i915_ttm_bo_destroy); > + > + /* > + * XXX: The ttm_bo_init_reserved() functions returns -ENOSPC if the size > + * is too big to add vma. The direct function that returns -ENOSPC is > + * drm_mm_insert_node_in_range(). To handle the same error as other code > + * that returns -E2BIG when the size is too large, it converts -ENOSPC to > + * -E2BIG. > + */ > + if (size >> PAGE_SHIFT > INT_MAX && ret == -ENOSPC) > + ret = -E2BIG; > + > if (ret) > return i915_ttm_err_to_gem(ret); > --------------3z8YxcPifdnZOJdDIi2K2NCF Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi Gwan-gyeong,

On 6/3/2022 11:38 AM, Gwan-gyeong Mun wrote:
The ttm_bo_init_reserved() functions returns -ENOSPC if the size is too big
to add vma. The direct function that returns -ENOSPC is drm_mm_insert_node_in_range().
To handle the same error as other code returning -E2BIG when the size is
too large, it converts return value to -E2BIG.

Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Testcase: igt@gem_create@create-massive
Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/4991

This "Closes" tag should move to the last patch as you are removing the GEM_WARN_ON() from there.

The series is Reviewed-by: Nirmoy Das <nirmoy.das@intel.com> once Jani's  concern is

addressed and this series can go as it is.


Thanks,

Nirmoy


---
 drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
index 8231a6fc5437..f162e2492cd3 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
@@ -1243,6 +1243,17 @@ int __i915_gem_ttm_object_init(struct intel_memory_region *mem,
 				   bo_type, &i915_sys_placement,
 				   page_size >> PAGE_SHIFT,
 				   &ctx, NULL, NULL, i915_ttm_bo_destroy);
+
+	/*
+	 * XXX: The ttm_bo_init_reserved() functions returns -ENOSPC if the size
+	 * is too big to add vma. The direct function that returns -ENOSPC is
+	 * drm_mm_insert_node_in_range(). To handle the same error as other code
+	 * that returns -E2BIG when the size is too large, it converts -ENOSPC to
+	 * -E2BIG.
+	 */
+	if (size >> PAGE_SHIFT > INT_MAX && ret == -ENOSPC)
+		ret = -E2BIG;
+
 	if (ret)
 		return i915_ttm_err_to_gem(ret);
 
--------------3z8YxcPifdnZOJdDIi2K2NCF--