Mesa (staging/19.1): intel/perf: improve dynamic loading config detection

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 11 08:27:56 UTC 2019


Module: Mesa
Branch: staging/19.1
Commit: 90623adb1679cdf819125d27043aa476e95bbfcc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=90623adb1679cdf819125d27043aa476e95bbfcc

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Wed Jun  5 11:20:23 2019 +0300

intel/perf: improve dynamic loading config detection

We're currently trying to detect dynamic loading config support by
trying to remove to test config (hard coded in the i915 driver) and
checking we get ENOENT.

This can fail if the test config was updated in Mesa but not yet in
i915.

A better way to do this is to pick an invalid ID and check for ENOENT.

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

---

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

diff --git a/src/intel/perf/gen_perf.c b/src/intel/perf/gen_perf.c
index cd440f7690d..648ec460afc 100644
--- a/src/intel/perf/gen_perf.c
+++ b/src/intel/perf/gen_perf.c
@@ -212,22 +212,10 @@ enumerate_sysfs_metrics(struct gen_perf *perf)
 static bool
 kernel_has_dynamic_config_support(struct gen_perf *perf, int fd)
 {
-   hash_table_foreach(perf->oa_metrics_table, entry) {
-      struct gen_perf_query_info *query = entry->data;
-      char config_path[280];
-      uint64_t config_id;
+   uint64_t invalid_config_id = UINT64_MAX;
 
-      snprintf(config_path, sizeof(config_path), "%s/metrics/%s/id",
-               perf->sysfs_dev_dir, query->guid);
-
-      /* Look for the test config, which we know we can't replace. */
-      if (read_file_uint64(config_path, &config_id) && config_id == 1) {
-         return perf->ioctl(fd, DRM_IOCTL_I915_PERF_REMOVE_CONFIG,
-                            &config_id) < 0 && errno == ENOENT;
-      }
-   }
-
-   return false;
+   return perf->ioctl(fd, DRM_IOCTL_I915_PERF_REMOVE_CONFIG,
+                      &invalid_config_id) < 0 && errno == ENOENT;
 }
 
 bool




More information about the mesa-commit mailing list