From: "Chang, Yu bruce" <yu.bruce.chang@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/selftest: Synchronise with the GPU timestamp
Date: Fri, 5 Feb 2021 00:35:18 +0000 [thread overview]
Message-ID: <3fe13ce156d5447dadf43afdff954b74@intel.com> (raw)
In-Reply-To: <20210205000437.16079-1-chris@chris-wilson.co.uk>
[-- Attachment #1.1: Type: text/plain, Size: 1324 bytes --]
> Wait for the GPU to wake up from the semaphore before measuring the
>time, so that we coordinate the sampling on both the CPU and GPU for
> more accurate comparisons.
>
>Reported-by: Bruce Chang <yu.bruce.chang@intel.com>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: CQ Tang <cq.tang@intel.com>
> ---
> drivers/gpu/drm/i915/gt/selftest_engine_pm.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/selftest_engine_pm.c b/drivers/gpu/drm/i915/gt/selftest_engine_pm.c
>index 3ce8cb3329f3..007a7c790778 100644
> --- a/drivers/gpu/drm/i915/gt/selftest_engine_pm.c
> +++ b/drivers/gpu/drm/i915/gt/selftest_engine_pm.c
> @@ -111,8 +111,10 @@ static int __measure_timestamps(struct intel_context *ce,
>
> /* Run the request for a 100us, sampling timestamps before/after */
> preempt_disable();
> - *dt = local_clock();
> write_semaphore(&sema[2], 0);
> + while (READ_ONCE(sema[1]) == 0) /* wait for the gpu to catch up */
> + cpu_relax();
> + *dt = local_clock();
> udelay(100);
> *dt = local_clock() - *dt;
> write_semaphore(&sema[2], 1);
> --
>2.20.1
>
This trick should work!
Thanks!
Reviewed-by: Bruce Chang <yu.bruce.chang@intel.com>
[-- Attachment #1.2: Type: text/html, Size: 2928 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2021-02-05 0:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-05 0:04 [Intel-gfx] [PATCH] drm/i915/selftest: Synchronise with the GPU timestamp Chris Wilson
2021-02-05 0:35 ` Chang, Yu bruce [this message]
2021-02-05 3:26 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " 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=3fe13ce156d5447dadf43afdff954b74@intel.com \
--to=yu.bruce.chang@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/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