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] tests/gem_exec_await: Adopt to no-reloc mode
Date: Fri, 22 Oct 2021 16:13:02 -0700	[thread overview]
Message-ID: <87fssswt4x.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20211021114400.28238-1-zbigniew.kempczynski@intel.com>

On Thu, 21 Oct 2021 04:44:00 -0700, Zbigniew Kempczyński wrote:
>
> In previous series most of tests were already adopted to no-reloc
> mode but some still requires adoption. This change adds softpinning
> with offset acquired from an allocator.

Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>

> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
> Cc: Petri Latvala <petri.latvala@intel.com>
> ---
>  tests/i915/gem_exec_await.c | 31 +++++++++++++++++++++++++++----
>  1 file changed, 27 insertions(+), 4 deletions(-)
>
> diff --git a/tests/i915/gem_exec_await.c b/tests/i915/gem_exec_await.c
> index bea57c61b..bf8eb6822 100644
> --- a/tests/i915/gem_exec_await.c
> +++ b/tests/i915/gem_exec_await.c
> @@ -72,6 +72,7 @@ static void wide(int fd, const intel_ctx_t *ctx, int ring_size,
>	unsigned engines[I915_EXEC_RING_MASK + 1], nengine;
>	unsigned long count;
>	double time;
> +	uint64_t ahnd = get_reloc_ahnd(fd, 0); /* just offset provider */
>
>	nengine = 0;
>	for_each_ctx_engine(fd, ctx, engine) {
> @@ -97,8 +98,13 @@ static void wide(int fd, const intel_ctx_t *ctx, int ring_size,
>		for (unsigned n = 0; n < ring_size; n++)  {
>			exec[e].obj[n].handle = gem_create(fd, 4096);
>			exec[e].obj[n].flags = EXEC_OBJECT_WRITE;
> +			exec[e].obj[n].offset = get_offset(ahnd, exec[e].obj[n].handle,
> +							   4096, 0);
> +			if (ahnd)
> +				exec[e].obj[n].flags |= EXEC_OBJECT_PINNED;
>
>			obj[e*ring_size + n].handle = exec[e].obj[n].handle;
> +			obj[e*ring_size + n].offset = exec[e].obj[n].offset;
>		}
>
>		exec[e].execbuf.buffers_ptr = to_user_pointer(exec[e].exec);
> @@ -115,6 +121,11 @@ static void wide(int fd, const intel_ctx_t *ctx, int ring_size,
>		}
>
>		exec[e].exec[0].handle = gem_create(fd, 4096);
> +		exec[e].exec[0].offset = get_offset(ahnd, exec[e].exec[0].handle,
> +						    4096, 0);
> +		if (ahnd)
> +			exec[e].exec[0].flags = EXEC_OBJECT_PINNED;
> +
>		exec[e].cmd = gem_mmap__wc(fd, exec[e].exec[0].handle,
>					   0, 4096, PROT_WRITE);
>
> @@ -133,11 +144,17 @@ static void wide(int fd, const intel_ctx_t *ctx, int ring_size,
>			exec[e].reloc.delta = 1;
>
>		exec[e].exec[1].relocs_ptr = to_user_pointer(&exec[e].reloc);
> -		exec[e].exec[1].relocation_count = 1;
> +		exec[e].exec[1].relocation_count = !ahnd ? 1 : 0;
>	}
> +
>	obj[nengine*ring_size].handle = gem_create(fd, 4096);
>	gem_write(fd, obj[nengine*ring_size].handle, 0, &bbe, sizeof(bbe));
>
> +	obj[nengine*ring_size].offset = get_offset(ahnd, obj[nengine*ring_size].handle,
> +						   4096, 0);
> +	if (ahnd)
> +		obj[nengine*ring_size].flags |= EXEC_OBJECT_PINNED;
> +
>	memset(&execbuf, 0, sizeof(execbuf));
>	execbuf.buffers_ptr = to_user_pointer(&obj[nengine*ring_size]);
>	execbuf.buffer_count = 1;
> @@ -222,16 +239,22 @@ static void wide(int fd, const intel_ctx_t *ctx, int ring_size,
>		if (flags & CONTEXTS)
>			intel_ctx_destroy(fd, exec[e].ctx);
>
> -		for (unsigned n = 0; n < ring_size; n++)
> +		for (unsigned n = 0; n < ring_size; n++) {
>			gem_close(fd, exec[e].obj[n].handle);
> +			put_offset(ahnd, exec[e].obj[n].handle);
> +		}
>		free(exec[e].obj);
>
>		munmap(exec[e].cmd, 4096);
>		gem_close(fd, exec[e].exec[1].handle);
> +		put_offset(ahnd, exec[e].exec[1].handle);
>	}
>	free(exec);
> +	put_ahnd(ahnd);
>  }
>
> +#define TIMEOUT 20
> +
>  igt_main
>  {
>	int ring_size = 0;
> @@ -254,11 +277,11 @@ igt_main
>	}
>
>	igt_subtest("wide-all")
> -		wide(device, ctx, ring_size, 20, 0);
> +		wide(device, ctx, ring_size, TIMEOUT, 0);
>
>	igt_subtest("wide-contexts") {
>		gem_require_contexts(device);
> -		wide(device, ctx, ring_size, 20, CONTEXTS);
> +		wide(device, ctx, ring_size, TIMEOUT, CONTEXTS);
>	}
>
>	igt_fixture {
> --
> 2.26.0
>

      parent reply	other threads:[~2021-10-22 23:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21 11:44 [igt-dev] [PATCH i-g-t] tests/gem_exec_await: Adopt to no-reloc mode Zbigniew Kempczyński
2021-10-21 13:01 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2021-10-21 15:00 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2021-10-22  4:08   ` Zbigniew Kempczyński
2021-10-22 23:13 ` Dixit, Ashutosh [this message]

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=87fssswt4x.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