From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Jasmine Newsome <jasmine.newsome@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 1/1] tests/i915/gem_spin_batch: Removing context persistence
Date: Tue, 15 Feb 2022 14:58:54 -0800 [thread overview]
Message-ID: <87k0dvd9e9.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20220214172208.3338908-2-jasmine.newsome@intel.com>
On Mon, 14 Feb 2022 09:22:08 -0800, Jasmine Newsome wrote:
>
> The spin all test relied on context persistence unecessarily
> by trying to destroy contexts while keeping spinners active.
> The current implementation of context persistence in i915
> can cause failures, and persistence is not needed for this
> test.
IGT follows the kernel coding style so 8 wide tabs and no spaces, you can
run kernel checkpatch to check IGT patches "for the most part" (ignoring
kernel specific issues).
> Moving intel_ctx_destroy after igt_spin_end/free.
>
> Signed-off-by: Jasmine Newsome <jasmine.newsome@intel.com>
> ---
> tests/i915/gem_spin_batch.c | 24 ++++++++++++++++--------
> 1 file changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/tests/i915/gem_spin_batch.c b/tests/i915/gem_spin_batch.c
> index 653812c7..65dccd83 100644
> --- a/tests/i915/gem_spin_batch.c
> +++ b/tests/i915/gem_spin_batch.c
> @@ -145,28 +145,31 @@ static void spin_all(int i915, const intel_ctx_t *ctx, unsigned int flags)
> struct igt_spin *spin, *n;
> uint64_t ahnd;
> IGT_LIST_HEAD(list);
> + const intel_ctx_t *local_ctx[GEM_MAX_ENGINES];
> + int num_ctx;
>
> - for_each_ctx_cfg_engine(i915, &cfg, e) {
> + num_ctx = 0;
> + for_each_ctx_cfg_engine(i915, &cfg, e) {
> if (!gem_class_can_store_dword(i915, e->class))
> continue;
>
> if (flags & PARALLEL_SPIN_NEW_CTX)
> - ctx = intel_ctx_create(i915, &cfg);
> + local_ctx[num_ctx] = intel_ctx_create(i915, &cfg);
> ahnd = get_reloc_ahnd(i915, ctx->id);
>
> /* Prevent preemption so only one is allowed on each engine */
> spin = igt_spin_new(i915,
> .ahnd = ahnd,
> - .ctx = ctx,
> + .ctx = local_ctx[num_ctx],
This is not initialized if !PARALLEL_SPIN_NEW_CTX.
I would say local_ctx[] array is not needed. We could do something like:
igt_spin_new(.ctx = flags & PARALLEL_SPIN_NEW_CTX ? intel_ctx_create() : ctx);
And then use intel_ctx_destroy(spin->execbuf.rsvd1) before freeing the spin
in the igt_list_for_each_entry_safe() loop below.
> .engine = e->flags,
> .flags = (IGT_SPIN_POLL_RUN |
> IGT_SPIN_NO_PREEMPTION));
> - if (flags & PARALLEL_SPIN_NEW_CTX)
> - intel_ctx_destroy(i915, ctx);
>
> - igt_spin_busywait_until_started(spin);
> - igt_list_move(&spin->link, &list);
> - }
> + igt_assert_eq(spin->execbuf.rsvd1, local_ctx[num_ctx]->id);
> + igt_spin_busywait_until_started(spin);
> + igt_list_move(&spin->link, &list);
> + num_ctx++;
> + }
>
> igt_list_for_each_entry_safe(spin, n, &list, link) {
> igt_assert(gem_bo_busy(i915, spin->handle));
> @@ -176,6 +179,11 @@ static void spin_all(int i915, const intel_ctx_t *ctx, unsigned int flags)
> igt_spin_free(i915, spin);
> put_ahnd(ahnd);
> }
> +
> + if (flags & PARALLEL_SPIN_NEW_CTX){
> + while (num_ctx)
> + intel_ctx_destroy(i915, local_ctx[--num_ctx]);
> + }
> }
>
> static bool has_userptr(int fd)
> --
> 2.25.1
>
next prev parent reply other threads:[~2022-02-15 22:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-14 17:22 [igt-dev] [PATCH i-g-t 0/1] Fix for gem_spin_batch Jasmine Newsome
2022-02-14 17:22 ` [igt-dev] [PATCH i-g-t 1/1] tests/i915/gem_spin_batch: Removing context persistence Jasmine Newsome
2022-02-15 22:58 ` Dixit, Ashutosh [this message]
2022-02-15 17:18 ` [igt-dev] ✓ Fi.CI.BAT: success for Fix for gem_spin_batch Patchwork
2022-02-15 20:22 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=87k0dvd9e9.wl-ashutosh.dixit@intel.com \
--to=ashutosh.dixit@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jasmine.newsome@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