Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
Cc: igt-dev@lists.freedesktop.org, Petri Latvala <petri.latvala@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 2/2] lib/i915/intel_memory_region: Add fallback for creating gem bo
Date: Mon, 13 Dec 2021 08:45:24 -0800	[thread overview]
Message-ID: <877dc8a1y3.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20211209200453.15885-3-zbigniew.kempczynski@intel.com>

On Thu, 09 Dec 2021 12:04:53 -0800, Zbigniew Kempczyński wrote:
>
> diff --git a/lib/i915/intel_memory_region.c b/lib/i915/intel_memory_region.c
> index fd29eec90..2263f1984 100644
> --- a/lib/i915/intel_memory_region.c
> +++ b/lib/i915/intel_memory_region.c
> @@ -197,8 +197,23 @@ int __gem_create_in_memory_region_list(int fd, uint32_t *handle, uint64_t *size,
>		.num_regions = num_regions,
>		.regions = to_user_pointer(mem_regions),
>	};
> +	int ret;
>
> -	return __gem_create_ext(fd, size, handle, &ext_regions.base);
> +	ret = __gem_create_ext(fd, size, handle, &ext_regions.base);
> +
> +	/*
> +	 * Provide fallback for stable kernels if region passed in the array
> +	 * can be system memory. In this case we get -ENODEV but still
> +	 * we're able to allocate gem bo in system memory using legacy call.
> +	 */
> +	if (ret == -ENODEV)
> +		for (int i = 0; i < num_regions; i++)
> +			if (mem_regions[i].memory_class == I915_MEMORY_CLASS_SYSTEM) {
> +				ret = __gem_create(fd, size, handle);
> +				break;
> +			}

Shouldn't this function return success if mem_regions[] array contains only
a single system memory region entry (that is the sime of mem_regions[]
array is 1 and the only entry is system memory)? But here we are returning
success if /any/ of the regions passed in are system memory? Won't this
cause an error in the caller? I am not sure if checking for -ENODEV return
saves us in any way but I think the code should be changed to return
success if mem_regions[] array contains only a single system memory region.

I think the previous patch "lib/i915/intel_memory_region: Provide system
memory region stub" is fine and serves this purpose of returning a single
system memory region. Do we even need this patch?


> +
> +	return ret;
>  }
>
>  /* gem_create_in_memory_region_list:
> --
> 2.26.0
>

  reply	other threads:[~2021-12-13 16:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09 20:04 [igt-dev] [PATCH i-g-t 0/2] Stop failing on system region on stable kernels Zbigniew Kempczyński
2021-12-09 20:04 ` [igt-dev] [PATCH i-g-t 1/2] lib/i915/intel_memory_region: Provide system memory region stub Zbigniew Kempczyński
2021-12-13 16:55   ` Dixit, Ashutosh
2021-12-13 17:26     ` Zbigniew Kempczyński
2021-12-09 20:04 ` [igt-dev] [PATCH i-g-t 2/2] lib/i915/intel_memory_region: Add fallback for creating gem bo Zbigniew Kempczyński
2021-12-13 16:45   ` Dixit, Ashutosh [this message]
2021-12-13 17:38     ` Zbigniew Kempczyński
2021-12-14  4:58       ` Dixit, Ashutosh
2021-12-09 23:19 ` [igt-dev] ✓ Fi.CI.BAT: success for Stop failing on system region on stable kernels Patchwork
2021-12-10  8:42 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2021-12-10  9:10   ` Zbigniew Kempczyński
2021-12-10 18:06     ` Vudum, Lakshminarayana
2021-12-10 17:09 ` Patchwork
2021-12-10 18:06 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork

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=877dc8a1y3.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=petri.latvala@intel.com \
    --cc=zbigniew.kempczynski@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