From: Andi Shyti <andi.shyti@linux.intel.com>
To: Krzysztof Niemiec <krzysztof.niemiec@intel.com>
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
Andi Shyti <andi.shyti@linux.intel.com>,
Jonathan Cavitt <jonathan.cavitt@intel.com>,
Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>,
Krzysztof Karas <krzysztof.karas@intel.com>,
Sebastian Brzezinka <sebastian.brzezinka@intel.com>,
Chris Wilson <chris.p.wilson@linux.intel.com>
Subject: Re: [PATCH v4] drm/i915/selftests: Defer signalling the request fence
Date: Wed, 4 Feb 2026 10:26:32 +0100 [thread overview]
Message-ID: <aYMQyMS1b5PhLPyv@ashyti-mobl2.lan> (raw)
In-Reply-To: <20260130184507.45233-2-krzysztof.niemiec@intel.com>
Hi Krzysztof,
On Fri, Jan 30, 2026 at 07:45:08PM +0100, Krzysztof Niemiec wrote:
> The i915_active selftests live_active_wait and live_active_retire
> operate on an i915_active attached to a mock, empty request, created as
> part of test setup. A fence is attached to this request to control when
> the request is processed. The tests then wait for the completion of the
> active with __i915_active_wait(), and the test is considered successful
> if this results in setting a variable in the active callback.
>
> However, the behavior of __i915_active_wait() is such that if the
> refcount for the active is 0, the function is almost completely skipped;
> waiting on a already completed active yields no effect. This includes a
> subsequent call to the retire() function of the active (which is the
> callback that the test is interested about, and which dictates whether
> its successful or not). So, if the active is completed before the
> aforementioned call to __i915_active_wait(), the test will fail.
>
> Most of the test runs in a single thread, including creating the
> request, creating the fence for it, signalling that fence, and calling
> __i915_active_wait(). However, the request itself is handled
> asynchronously. This creates a race condition where if the request is
> completed after signalling the fence, but before waiting on its active,
> the active callback will not be invoked, failing the test.
>
> Defer signalling the request's fence, to ensure the main test thread
> gets to call __i915_active_wait() before request completion.
>
> v4:
> - Lower the delay timeout to 50ms (Jonathan)
> - Put the check on work_finished inside a helper function (Jonathan)
>
> v3:
> - Embed the variables inside the live_active struct (Andi)
> - Move the schedule_delayed_work call closer to the wait (Andi)
> - Implement error handling in case an error state - the wait has
> finished, but the deferred work didn't run - is somehow achieved (Andi)
>
> v2:
> - Clarify the need for a fix a little more (Krzysztof K., Janusz)
>
> Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/14808
> Signed-off-by: Krzysztof Niemiec <krzysztof.niemiec@intel.com>
BTW, I don't want to block this patch, I'm just not feeling
comfortable at merging it and I don't have better suggestions.
BTW, you already have consensus here:
Reviewed-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
And, BTW, can you please add comments through the lines so that
people understand what you are doing.
Moreover, as Janusz suggested I would also like to have a real
use case description of the issue and how it appeared in our
environment.
Thanks,
Andi
prev parent reply other threads:[~2026-02-04 9:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-30 18:45 [PATCH v4] drm/i915/selftests: Defer signalling the request fence Krzysztof Niemiec
2026-01-30 19:45 ` ✗ i915.CI.BAT: failure for drm/i915/selftests: Defer signalling the request fence (rev6) Patchwork
2026-02-02 7:31 ` [PATCH v4] drm/i915/selftests: Defer signalling the request fence Krzysztof Karas
2026-02-04 0:39 ` Andi Shyti
2026-02-04 9:26 ` Andi Shyti [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=aYMQyMS1b5PhLPyv@ashyti-mobl2.lan \
--to=andi.shyti@linux.intel.com \
--cc=chris.p.wilson@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=janusz.krzysztofik@linux.intel.com \
--cc=jonathan.cavitt@intel.com \
--cc=krzysztof.karas@intel.com \
--cc=krzysztof.niemiec@intel.com \
--cc=sebastian.brzezinka@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