Mesa (staging/19.3): intel/perf: take into account that reports read can be fairly old

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Dec 4 21:41:12 UTC 2019


Module: Mesa
Branch: staging/19.3
Commit: 1de3548668e3abf6d9d06a4d938cab46a1c245ba
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1de3548668e3abf6d9d06a4d938cab46a1c245ba

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Tue Dec  3 16:19:24 2019 +0200

intel/perf: take into account that reports read can be fairly old

If we read the OA reports late enough after the query happens, we can
get a timestamp in the report that is significantly in the past
compared to the start timestamp of the query. The current code must
deal with the wraparound of the timestamp value (every ~6 minute). So
consider that if the difference is greater than half that wraparound
period, we're probably dealing with an old report and make the caller
aware it should read more reports when they're available.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Cc: <mesa-stable at lists.freedesktop.org>
Reviewed-by: Mark Janes <mark.a.janes at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
(cherry picked from commit b364e920bf8c6805bcc3ff1cedf6b77dbb61b1e0)

---

 src/intel/perf/gen_perf.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/intel/perf/gen_perf.c b/src/intel/perf/gen_perf.c
index 7073afe8f44..2df25487aad 100644
--- a/src/intel/perf/gen_perf.c
+++ b/src/intel/perf/gen_perf.c
@@ -1994,12 +1994,13 @@ read_oa_samples_until(struct gen_perf_context *perf_ctx,
          exec_list_push_tail(&perf_ctx->free_sample_buffers, &buf->link);
 
          if (len < 0) {
-            if (errno == EAGAIN)
-               return ((last_timestamp - start_timestamp) >=
+            if (errno == EAGAIN) {
+               return ((last_timestamp - start_timestamp) < INT32_MAX &&
+                       (last_timestamp - start_timestamp) >=
                        (end_timestamp - start_timestamp)) ?
                       OA_READ_STATUS_FINISHED :
                       OA_READ_STATUS_UNFINISHED;
-            else {
+            } else {
                DBG("Error reading i915 perf samples: %m\n");
             }
          } else




More information about the mesa-commit mailing list