<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 09-01-2025 15:00,
      <a class="moz-txt-link-abbreviated" href="mailto:sk.anirban@intel.com">sk.anirban@intel.com</a> wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:20250109093010.3879245-1-sk.anirban@intel.com">
      <pre wrap="" class="moz-quote-pre">From: Sk Anirban <a class="moz-txt-link-rfc2396E" href="mailto:sk.anirban@intel.com"><sk.anirban@intel.com></a>

Fix the frequency calculation by ensuring it is adjusted
only once during power measurement. Update live_rps_power test
to use the correct frequency values for logging and comparison.

v2:
  - Improved frequency logging (Riana)

Signed-off-by: Sk Anirban <a class="moz-txt-link-rfc2396E" href="mailto:sk.anirban@intel.com"><sk.anirban@intel.com></a>
Reviewed-by: Riana Tauro <a class="moz-txt-link-rfc2396E" href="mailto:riana.tauro@intel.com"><riana.tauro@intel.com></a>
---
 drivers/gpu/drm/i915/gt/selftest_rps.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/selftest_rps.c b/drivers/gpu/drm/i915/gt/selftest_rps.c
index c207a4fb03bf..e515d7eb628a 100644
--- a/drivers/gpu/drm/i915/gt/selftest_rps.c
+++ b/drivers/gpu/drm/i915/gt/selftest_rps.c
@@ -1126,6 +1126,7 @@ static u64 measure_power_at(struct intel_rps *rps, int *freq)
 {
        *freq = rps_set_check(rps, *freq);
        msleep(100);
+       *freq = intel_gpu_freq(rps, *freq);</pre>
    </blockquote>
    <pre>
I am seeing <span style="white-space: pre-wrap">rps_set_check will wait till act freq become desired freq, in case of timeout act freq could be different.
</span><span style="white-space: pre-wrap">I think it would be good to check freq returned by r</span><span style="white-space: pre-wrap">ps_set_check is expected freq if not then read freq again after msleep.

Regards,
Badal</span>

</pre>
    <blockquote type="cite" cite="mid:20250109093010.3879245-1-sk.anirban@intel.com">
      <pre wrap="" class="moz-quote-pre">
        return measure_power(rps, freq);
 }
 
@@ -1202,13 +1203,13 @@ int live_rps_power(void *arg)
 
                pr_info("%s: min:%llumW @ %uMHz, max:%llumW @ %uMHz\n",
                        engine->name,
-                       min.power, intel_gpu_freq(rps, min.freq),
-                       max.power, intel_gpu_freq(rps, max.freq));
+                       min.power, min.freq,
+                       max.power, max.freq);
 
                if (10 * min.freq >= 9 * max.freq) {
-                       pr_notice("Could not control frequency, ran at [%d:%uMHz, %d:%uMhz]\n",
-                                 min.freq, intel_gpu_freq(rps, min.freq),
-                                 max.freq, intel_gpu_freq(rps, max.freq));
+                       pr_notice("Could not control frequency, ran at [%uMHz, %uMhz]\n",
+                                 min.freq,
+                                 max.freq);
                        continue;
                }
 
</pre>
    </blockquote>
  </body>
</html>