[igt-dev] [PATCH i-g-t v2 05/12] i915/gem_mmap_offset: Avoid set_domain when I915_MMAP_OFFSET_FIXED is used

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Sep 2 11:29:48 UTC 2022


Hi,

On 2022-09-02 at 09:52:20 +0200, Zbigniew Kempczyński wrote:
> From: Chris Wilson <chris.p.wilson at linux.intel.com>
> 
> When OFFSET_FIXED mapping is in use avoid to set domain at all.
> 
> Signed-off-by: Chris Wilson <chris.p.wilson at linux.intel.com>
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> ---
>  tests/i915/gem_mmap_offset.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/i915/gem_mmap_offset.c b/tests/i915/gem_mmap_offset.c
> index 5e6b19eb34..ee5e811392 100644
> --- a/tests/i915/gem_mmap_offset.c
> +++ b/tests/i915/gem_mmap_offset.c
> @@ -148,7 +148,8 @@ static void basic_uaf(int i915)
>  		}
>  
>  		expected = calloc(obj_size, sizeof(*expected));
> -		gem_set_domain(i915, handle, t->domain, 0);
> +		if (t->domain)
> +			gem_set_domain(i915, handle, t->domain, 0);
>  		igt_assert_f(memcmp(addr, expected, obj_size) == 0,
>  			     "mmap(%s) not clear on gem_create()\n",
>  			     t->name);
> @@ -157,15 +158,18 @@ static void basic_uaf(int i915)
>  		buf = calloc(obj_size, sizeof(*buf));
>  		memset(buf + 1024, 0x01, 1024);
>  		gem_write(i915, handle, 0, buf, obj_size);
> -		gem_set_domain(i915, handle, t->domain, 0);
> +		if (t->domain)
> +			gem_set_domain(i915, handle, t->domain, 0);
>  		igt_assert_f(memcmp(buf, addr, obj_size) == 0,
>  			     "mmap(%s) not coherent with gem_write()\n",
>  			     t->name);
>  
> -		gem_set_domain(i915, handle, t->domain, t->domain);
> +		if (t->domain != -1)
----------------------------- ^
Should this be like other changes, just
		if (t->domain)

With that fixed you can add my r-b tag.

--
Kamil

> +			gem_set_domain(i915, handle, t->domain, t->domain);
>  		memset(addr + 2048, 0xff, 1024);
>  		gem_read(i915, handle, 0, buf, obj_size);
> -		gem_set_domain(i915, handle, t->domain, 0);
> +		if (t->domain)
> +			gem_set_domain(i915, handle, t->domain, 0);
>  		igt_assert_f(memcmp(buf, addr, obj_size) == 0,
>  			     "mmap(%s) not coherent with gem_read()\n",
>  			     t->name);
> -- 
> 2.34.1
> 


More information about the igt-dev mailing list