<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <pre class="content" style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 14.3px; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: white; border: 0px; border-radius: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">A couple of comments below, after addressing those this is:
<span class="acked-by" style="box-sizing: border-box; color: rgb(45, 69, 102);">
Reviewed-by: Badal Nilawar <a class="moz-txt-link-rfc2396E" href="mailto:badal.nilawar@intel.com"><badal.nilawar@intel.com></a></span></pre>
    <div class="moz-cite-prefix">On 26-10-2021 19:10, Anshuman Gupta
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:20211026134022.20597-1-anshuman.gupta@intel.com">
      <pre class="moz-quote-pre" wrap="">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
should not preempt the measure_clocks() to calculate
correct engine ticks cycles.

Suggested-by: Chris P Wilson <a class="moz-txt-link-rfc2396E" href="mailto:chris.p.wilson@intel.com"><chris.p.wilson@intel.com></a>
Signed-off-by: Anshuman Gupta <a class="moz-txt-link-rfc2396E" href="mailto:anshuman.gupta@intel.com"><anshuman.gupta@intel.com></a>
---
 drivers/gpu/drm/i915/gt/selftest_gt_pm.c | 2 ++
 1 file changed, 2 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..9cf76398bdf5 100644
--- a/drivers/gpu/drm/i915/gt/selftest_gt_pm.c
+++ b/drivers/gpu/drm/i915/gt/selftest_gt_pm.c
@@ -43,6 +43,7 @@ static void measure_clocks(struct intel_engine_cs *engine,
        int i;
 
        for (i = 0; i < 5; i++) {
+               local_irq_disable();</pre>
    </blockquote>
    <p>How about saving interrupt state before disabling it. <br>
    </p>
    <p>Use local_irq_save here.<br>
    </p>
    <blockquote type="cite" cite="mid:20211026134022.20597-1-anshuman.gupta@intel.com">
      <pre class="moz-quote-pre" wrap="">
                preempt_disable();
                cycles[i] = -ENGINE_READ_FW(engine, RING_TIMESTAMP);
                dt[i] = ktime_get();
@@ -52,6 +53,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_enable();</pre>
    </blockquote>
    Use local_irq_restore here. <br>
    <blockquote type="cite" cite="mid:20211026134022.20597-1-anshuman.gupta@intel.com">
      <pre class="moz-quote-pre" wrap="">
        }
 
        /* Use the median of both cycle/dt; close enough */
</pre>
    </blockquote>
  </body>
</html>