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 4/5] tests/gem_exec_schedule: Adopt to use allocator
Date: Mon, 16 Aug 2021 19:20:01 -0700	[thread overview]
Message-ID: <87o89wzub2.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20210816115626.22759-5-zbigniew.kempczynski@intel.com>

On Mon, 16 Aug 2021 04:56:25 -0700, Zbigniew Kempczyński wrote:
>
> @@ -117,12 +119,23 @@ static uint32_t __store_dword(int fd, const intel_ctx_t *ctx, unsigned ring,
>
> +	if (ahnd) {
> +		obj[0].offset = cork_offset;
> +		obj[0].flags |= EXEC_OBJECT_PINNED;
> +		obj[1].offset = target_offset;
> +		obj[1].flags |= EXEC_OBJECT_PINNED;
> +		if (write_domain)
> +			obj[1].flags |= EXEC_OBJECT_WRITE;
> +		obj[2].offset = get_offset(ahnd, obj[2].handle, 4096, 0);
> +		obj[2].flags |= EXEC_OBJECT_PINNED;
> +	} else {
> +		obj[0].offset = cork << 20;
> +		obj[1].offset = target << 20;
> +		obj[2].offset = 256 << 10;
> +		obj[2].offset += (random() % 128) << 12;
> +	}
>
>	memset(&reloc, 0, sizeof(reloc));
>	reloc.target_handle = obj[1].handle;
> @@ -132,13 +145,13 @@ static uint32_t __store_dword(int fd, const intel_ctx_t *ctx, unsigned ring,
>	reloc.read_domains = I915_GEM_DOMAIN_INSTRUCTION;
>	reloc.write_domain = write_domain;
>	obj[2].relocs_ptr = to_user_pointer(&reloc);
> -	obj[2].relocation_count = 1;
> +	obj[2].relocation_count = !ahnd ? 1 : 0;
>
>	i = 0;
>	batch[i] = MI_STORE_DWORD_IMM | (gen < 6 ? 1 << 22 : 0);
>	if (gen >= 8) {
>		batch[++i] = reloc.presumed_offset + reloc.delta;
> -		batch[++i] = 0;
> +		batch[++i] = (reloc.presumed_offset + reloc.delta) >> 32;
>	} else if (gen >= 4) {
>		batch[++i] = 0;
>		batch[++i] = reloc.presumed_offset + reloc.delta;
> @@ -155,31 +168,38 @@ static uint32_t __store_dword(int fd, const intel_ctx_t *ctx, unsigned ring,

I think we need this here (or in the callers):

	if (ahnd)
		put_offset(ahnd, obj[2].offset);

> @@ -2584,12 +2824,14 @@ static void measure_semaphore_power(int i915, const intel_ctx_t *ctx)
>		} s_spin[2], s_sema[2];
>		double baseline, total;
>		int64_t jiffie = 1;
> -		igt_spin_t *spin;
> +		igt_spin_t *spin, *sema[GEM_MAX_ENGINES] = {};
> +		int i;
>
>		if (!gem_class_can_store_dword(i915, signaler->class))
>			continue;
>
>		spin = __igt_spin_new(i915,
> +				      .ahnd = ahnd,
>				      .ctx = ctx,
>				      .engine = signaler->flags,
>				      .flags = IGT_SPIN_POLL_RUN);
> @@ -2603,19 +2845,23 @@ static void measure_semaphore_power(int i915, const intel_ctx_t *ctx)
>		rapl_read(&pkg, &s_spin[1].pkg);
>
>		/* Add a waiter to each engine */
> +		i = 0;
>		for_each_ctx_engine(i915, ctx, e) {
> -			igt_spin_t *sema;
> -
> -			if (e->flags == signaler->flags)
> +			if (e->flags == signaler->flags) {
> +				i++;
>				continue;
> +			}
>
> -			sema = __igt_spin_new(i915,
> -					      .ctx = ctx,
> -					      .engine = e->flags,
> -					      .dependency = spin->handle);
> -
> -			igt_spin_free(i915, sema);
> +			sema[i] = __igt_spin_new(i915,
> +						 .ahnd = ahnd,
> +						 .ctx = ctx,
> +						 .engine = e->flags,
> +						 .dependency = spin->handle);
> +			i++;
>		}
> +		for (i = 0; i < GEM_MAX_ENGINES; i++)
> +			if (sema[i])
> +				igt_spin_free(i915, sema[i]);

Did we create this array etc. to avoid the stall when the spin is freed and
the offset is reused? Or is there a different reason?

Otherwise this is:

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

  reply	other threads:[~2021-08-17  2:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-16 11:56 [igt-dev] [PATCH i-g-t 0/5] Adopt to use allocator Zbigniew Kempczyński
2021-08-16 11:56 ` [igt-dev] [PATCH i-g-t 1/5] tests/gem_exec_capture: Remove unnecessary multiprocess stop() call Zbigniew Kempczyński
2021-08-17  0:25   ` Dixit, Ashutosh
2021-08-16 11:56 ` [igt-dev] [PATCH i-g-t 2/5] tests/gem_exec_big: Move check of pressumed offset out of no-reloc scope Zbigniew Kempczyński
2021-08-17  0:31   ` Dixit, Ashutosh
2021-08-16 11:56 ` [igt-dev] [PATCH i-g-t 3/5] tests/gem_exec_fence: Adopt to use allocator Zbigniew Kempczyński
2021-08-16 11:56 ` [igt-dev] [PATCH i-g-t 4/5] tests/gem_exec_schedule: " Zbigniew Kempczyński
2021-08-17  2:20   ` Dixit, Ashutosh [this message]
2021-08-17  4:11     ` Dixit, Ashutosh
2021-08-17  5:21       ` Zbigniew Kempczyński
2021-08-17  5:18     ` Zbigniew Kempczyński
2021-08-16 11:56 ` [igt-dev] [PATCH i-g-t 5/5] HAX: remove gttfill for tgl ci Zbigniew Kempczyński
2021-08-16 14:19 ` [igt-dev] ✓ Fi.CI.BAT: success for Adopt to use allocator (rev3) Patchwork
2021-08-16 17:22 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2021-08-17  6:31 [igt-dev] [PATCH i-g-t 0/5] Adopt to use allocator Zbigniew Kempczyński
2021-08-17  6:31 ` [igt-dev] [PATCH i-g-t 4/5] tests/gem_exec_schedule: " Zbigniew Kempczyński

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