From: Anshuman Gupta <anshuman.gupta@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Chris P Wilson <chris.p.wilson@intel.com>
Subject: [Intel-gfx] [PATCH v2] drm/i915/selftest: Disable IRQ for timestamp calculation
Date: Fri, 12 Nov 2021 16:59:06 +0530 [thread overview]
Message-ID: <20211112112906.12209-1-anshuman.gupta@intel.com> (raw)
In-Reply-To: <=20211026134022.20597-1-anshuman.gupta@intel.com>
gt_pm selftest calculates engine ticks cycles and wall time
cycles by delta of respective engine elapsed TIMESTAMP and ktime
for period of 1000us.
It compares the engine ticks cycles with wall time cycles.
Disable local cpu interrupt so that interrupt handler does not
switch out the thread during measure_clocks() and prevent
miscalculation of engine tick cycles.
Suggested-by: Chris P Wilson <chris.p.wilson@intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>
---
drivers/gpu/drm/i915/gt/selftest_gt_pm.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/i915/gt/selftest_gt_pm.c b/drivers/gpu/drm/i915/gt/selftest_gt_pm.c
index b9441217ca3d..4c4953044548 100644
--- a/drivers/gpu/drm/i915/gt/selftest_gt_pm.c
+++ b/drivers/gpu/drm/i915/gt/selftest_gt_pm.c
@@ -40,9 +40,11 @@ static void measure_clocks(struct intel_engine_cs *engine,
{
ktime_t dt[5];
u32 cycles[5];
+ unsigned long flags;
int i;
for (i = 0; i < 5; i++) {
+ local_irq_save(flags);
preempt_disable();
cycles[i] = -ENGINE_READ_FW(engine, RING_TIMESTAMP);
dt[i] = ktime_get();
@@ -52,6 +54,7 @@ static void measure_clocks(struct intel_engine_cs *engine,
dt[i] = ktime_sub(ktime_get(), dt[i]);
cycles[i] += ENGINE_READ_FW(engine, RING_TIMESTAMP);
preempt_enable();
+ local_irq_restore(flags);
}
/* Use the median of both cycle/dt; close enough */
--
2.26.2
next parent reply other threads:[~2021-11-12 11:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <=20211026134022.20597-1-anshuman.gupta@intel.com>
2021-11-12 11:29 ` Anshuman Gupta [this message]
2021-11-12 11:42 ` [Intel-gfx] ✗ Fi.CI.DOCS: warning for drm/i915/selftest: Disable IRQ for timestamp calculation Patchwork
2021-11-12 12:22 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2021-11-16 9:25 ` [Intel-gfx] ✗ Fi.CI.DOCS: warning for drm/i915/selftest: Disable IRQ for timestamp calculation (rev2) Patchwork
2021-11-16 9:52 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-11-16 11:11 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=20211112112906.12209-1-anshuman.gupta@intel.com \
--to=anshuman.gupta@intel.com \
--cc=chris.p.wilson@intel.com \
--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