* [igt-dev] [PATCH i-g-t v3] i915/perf: Find the associated perf-type for a particular device
@ 2020-01-10 11:53 Chris Wilson
2020-01-10 14:08 ` [igt-dev] ✓ Fi.CI.BAT: success for i915/perf: Find the associated perf-type for a particular device (rev4) Patchwork
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Chris Wilson @ 2020-01-10 11:53 UTC (permalink / raw)
To: intel-gfx; +Cc: igt-dev, Tvrtko Ursulin
Since with multiple devices, we may have multiple different perf_pmu
each with their own type, we want to find the right one for the job.
The tests are run with a specific fd, from which we can extract the
appropriate bus-id and find the associated perf-type. The performance
monitoring tools are a little more general and not yet ready to probe
all device or bind to one in particular, so we just assume the default
igfx for the time being.
v2: Extract the bus address from out of sysfs
v3: A new name for a new decade!
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: "Robert M. Fosha" <robert.m.fosha@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: "Robert M. Fosha" <robert.m.fosha@intel.com> #v2
---
benchmarks/gem_wsim.c | 4 +-
lib/igt_perf.c | 91 +++++++++++++++++++++++++++++++---
lib/igt_perf.h | 13 +++--
overlay/gem-interrupts.c | 2 +-
overlay/gpu-freq.c | 4 +-
overlay/gpu-top.c | 12 ++---
overlay/rc6.c | 2 +-
tests/i915/gem_ctx_freq.c | 2 +-
tests/i915/gem_ctx_sseu.c | 2 +-
tests/i915/gem_exec_balancer.c | 18 ++++---
tests/perf_pmu.c | 84 ++++++++++++++++---------------
tools/intel_gpu_top.c | 2 +-
12 files changed, 166 insertions(+), 70 deletions(-)
diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index 6305e0d7a..9156fdc90 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -2268,8 +2268,8 @@ busy_init(const struct workload_balancer *balancer, struct workload *wrk)
for (d = &engines[0]; d->id != VCS; d++) {
int pfd;
- pfd = perf_i915_open_group(I915_PMU_ENGINE_BUSY(d->class,
- d->inst),
+ pfd = perf_igfx_open_group(I915_PMU_ENGINE_BUSY(d->class,
+ d->inst),
bb->fd);
if (pfd < 0) {
if (d->id != VCS2)
diff --git a/lib/igt_perf.c b/lib/igt_perf.c
index e3dec2cc2..418c1c188 100644
--- a/lib/igt_perf.c
+++ b/lib/igt_perf.c
@@ -4,17 +4,84 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <sys/stat.h>
#include <sys/sysinfo.h>
+#include <sys/sysmacros.h>
#include "igt_perf.h"
-uint64_t i915_type_id(void)
+static char *bus_address(int i915, char *path, int pathlen)
+{
+ struct stat st;
+ int len = -1;
+ int dir;
+ char *s;
+
+ if (fstat(i915, &st) || !S_ISCHR(st.st_mode))
+ return NULL;
+
+ snprintf(path, pathlen, "/sys/dev/char/%d:%d",
+ major(st.st_rdev), minor(st.st_rdev));
+
+ dir = open(path, O_RDONLY);
+ if (dir != -1) {
+ len = readlinkat(dir, "device", path, pathlen - 1);
+ close(dir);
+ }
+ if (len < 0)
+ return NULL;
+
+ path[len] = '\0';
+
+ /* strip off the relative path */
+ s = strrchr(path, '/');
+ if (s)
+ memmove(path, s + 1, len - (s - path) + 1);
+
+ return path;
+}
+
+const char *i915_perf_device(int i915, char *buf, int buflen)
+{
+ char *s;
+
+#define prefix "i915_"
+#define plen strlen(prefix)
+
+ if (!buf || buflen < plen)
+ return "i915";
+
+ memcpy(buf, prefix, plen);
+
+ if (!bus_address(i915, buf + plen, buflen - plen) ||
+ strcmp(buf + plen, "0000:00:02.0") == 0) /* legacy name for igfx */
+ buf[plen - 1] = '\0';
+
+ /* Convert all colons in the address to '_', thanks perf! */
+ for (s = buf; *s; s++)
+ if (*s == ':')
+ *s = '_';
+
+ return buf;
+}
+
+uint64_t i915_perf_type_id(int i915)
+{
+ char buf[80];
+
+ return igt_perf_type_id(i915_perf_device(i915, buf, sizeof(buf)));
+}
+
+uint64_t igt_perf_type_id(const char *device)
{
char buf[64];
ssize_t ret;
int fd;
- fd = open("/sys/bus/event_source/devices/i915/type", O_RDONLY);
+ snprintf(buf, sizeof(buf),
+ "/sys/bus/event_source/devices/%s/type", device);
+
+ fd = open(buf, O_RDONLY);
if (fd < 0)
return 0;
@@ -52,15 +119,27 @@ _perf_open(uint64_t type, uint64_t config, int group, uint64_t format)
return ret;
}
-int perf_i915_open(uint64_t config)
+int perf_igfx_open(uint64_t config)
+{
+ return _perf_open(igt_perf_type_id("i915"), config, -1,
+ PERF_FORMAT_TOTAL_TIME_ENABLED);
+}
+
+int perf_igfx_open_group(uint64_t config, int group)
+{
+ return _perf_open(igt_perf_type_id("i915"), config, group,
+ PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP);
+}
+
+int perf_i915_open(int i915, uint64_t config)
{
- return _perf_open(i915_type_id(), config, -1,
+ return _perf_open(i915_perf_type_id(i915), config, -1,
PERF_FORMAT_TOTAL_TIME_ENABLED);
}
-int perf_i915_open_group(uint64_t config, int group)
+int perf_i915_open_group(int i915, uint64_t config, int group)
{
- return _perf_open(i915_type_id(), config, group,
+ return _perf_open(i915_perf_type_id(i915), config, group,
PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP);
}
diff --git a/lib/igt_perf.h b/lib/igt_perf.h
index e00718f47..a8328c70c 100644
--- a/lib/igt_perf.h
+++ b/lib/igt_perf.h
@@ -51,10 +51,17 @@ perf_event_open(struct perf_event_attr *attr,
return syscall(__NR_perf_event_open, attr, pid, cpu, group_fd, flags);
}
-uint64_t i915_type_id(void);
-int perf_i915_open(uint64_t config);
-int perf_i915_open_group(uint64_t config, int group);
+uint64_t igt_perf_type_id(const char *device);
int igt_perf_open(uint64_t type, uint64_t config);
int igt_perf_open_group(uint64_t type, uint64_t config, int group);
+const char *i915_perf_device(int i915, char *buf, int buflen);
+uint64_t i915_perf_type_id(int i915);
+
+int perf_igfx_open(uint64_t config);
+int perf_igfx_open_group(uint64_t config, int group);
+
+int perf_i915_open(int i915, uint64_t config);
+int perf_i915_open_group(int i915, uint64_t config, int group);
+
#endif /* I915_PERF_H */
diff --git a/overlay/gem-interrupts.c b/overlay/gem-interrupts.c
index 0233fbb05..be73b6931 100644
--- a/overlay/gem-interrupts.c
+++ b/overlay/gem-interrupts.c
@@ -113,7 +113,7 @@ int gem_interrupts_init(struct gem_interrupts *irqs)
{
memset(irqs, 0, sizeof(*irqs));
- irqs->fd = perf_i915_open(I915_PMU_INTERRUPTS);
+ irqs->fd = perf_igfx_open(I915_PMU_INTERRUPTS);
if (irqs->fd < 0 && interrupts_read() < 0)
irqs->error = ENODEV;
diff --git a/overlay/gpu-freq.c b/overlay/gpu-freq.c
index 0d8032592..b73157d39 100644
--- a/overlay/gpu-freq.c
+++ b/overlay/gpu-freq.c
@@ -37,8 +37,8 @@ static int perf_open(void)
{
int fd;
- fd = perf_i915_open_group(I915_PMU_ACTUAL_FREQUENCY, -1);
- if (perf_i915_open_group(I915_PMU_REQUESTED_FREQUENCY, fd) < 0) {
+ fd = perf_igfx_open_group(I915_PMU_ACTUAL_FREQUENCY, -1);
+ if (perf_igfx_open_group(I915_PMU_REQUESTED_FREQUENCY, fd) < 0) {
close(fd);
fd = -1;
}
diff --git a/overlay/gpu-top.c b/overlay/gpu-top.c
index 6cec2e943..32123abdd 100644
--- a/overlay/gpu-top.c
+++ b/overlay/gpu-top.c
@@ -58,16 +58,16 @@ static int perf_init(struct gpu_top *gt)
d = &engines[0];
- gt->fd = perf_i915_open_group(I915_PMU_ENGINE_BUSY(d->class, d->inst),
+ gt->fd = perf_igfx_open_group(I915_PMU_ENGINE_BUSY(d->class, d->inst),
-1);
if (gt->fd < 0)
return -1;
- if (perf_i915_open_group(I915_PMU_ENGINE_WAIT(d->class, d->inst),
+ if (perf_igfx_open_group(I915_PMU_ENGINE_WAIT(d->class, d->inst),
gt->fd) >= 0)
gt->have_wait = 1;
- if (perf_i915_open_group(I915_PMU_ENGINE_SEMA(d->class, d->inst),
+ if (perf_igfx_open_group(I915_PMU_ENGINE_SEMA(d->class, d->inst),
gt->fd) >= 0)
gt->have_sema = 1;
@@ -75,19 +75,19 @@ static int perf_init(struct gpu_top *gt)
gt->num_rings = 1;
for (d++; d->name; d++) {
- if (perf_i915_open_group(I915_PMU_ENGINE_BUSY(d->class,
+ if (perf_igfx_open_group(I915_PMU_ENGINE_BUSY(d->class,
d->inst),
gt->fd) < 0)
continue;
if (gt->have_wait &&
- perf_i915_open_group(I915_PMU_ENGINE_WAIT(d->class,
+ perf_igfx_open_group(I915_PMU_ENGINE_WAIT(d->class,
d->inst),
gt->fd) < 0)
return -1;
if (gt->have_sema &&
- perf_i915_open_group(I915_PMU_ENGINE_SEMA(d->class,
+ perf_igfx_open_group(I915_PMU_ENGINE_SEMA(d->class,
d->inst),
gt->fd) < 0)
return -1;
diff --git a/overlay/rc6.c b/overlay/rc6.c
index b5286f0cf..69f95f288 100644
--- a/overlay/rc6.c
+++ b/overlay/rc6.c
@@ -39,7 +39,7 @@ int rc6_init(struct rc6 *rc6)
{
memset(rc6, 0, sizeof(*rc6));
- rc6->fd = perf_i915_open(I915_PMU_RC6_RESIDENCY);
+ rc6->fd = perf_igfx_open(I915_PMU_RC6_RESIDENCY);
if (rc6->fd < 0) {
struct stat st;
if (stat("/sys/class/drm/card0/power", &st) < 0)
diff --git a/tests/i915/gem_ctx_freq.c b/tests/i915/gem_ctx_freq.c
index 89f3d11ef..5d2d3ec31 100644
--- a/tests/i915/gem_ctx_freq.c
+++ b/tests/i915/gem_ctx_freq.c
@@ -136,7 +136,7 @@ static void sysfs_range(int i915)
triangle_fill(frequencies, N_STEPS, sys_min, sys_max);
- pmu = perf_i915_open(I915_PMU_REQUESTED_FREQUENCY);
+ pmu = perf_i915_open(i915, I915_PMU_REQUESTED_FREQUENCY);
igt_require(pmu >= 0);
for (int outer = 0; outer <= 2*N_STEPS; outer++) {
diff --git a/tests/i915/gem_ctx_sseu.c b/tests/i915/gem_ctx_sseu.c
index 48e4411c8..38dc584bc 100644
--- a/tests/i915/gem_ctx_sseu.c
+++ b/tests/i915/gem_ctx_sseu.c
@@ -119,7 +119,7 @@ kernel_has_per_context_sseu_support(int fd)
static bool has_engine(int fd, unsigned int class, unsigned int instance)
{
- int pmu = perf_i915_open(I915_PMU_ENGINE_BUSY(class, instance));
+ int pmu = perf_i915_open(fd, I915_PMU_ENGINE_BUSY(class, instance));
if (pmu >= 0)
close(pmu);
diff --git a/tests/i915/gem_exec_balancer.c b/tests/i915/gem_exec_balancer.c
index f4909a978..cebcc39c7 100644
--- a/tests/i915/gem_exec_balancer.c
+++ b/tests/i915/gem_exec_balancer.c
@@ -60,7 +60,7 @@ static bool has_class_instance(int i915, uint16_t class, uint16_t instance)
{
int fd;
- fd = perf_i915_open(I915_PMU_ENGINE_BUSY(class, instance));
+ fd = perf_i915_open(i915, I915_PMU_ENGINE_BUSY(class, instance));
if (fd != -1) {
close(fd);
return true;
@@ -483,9 +483,11 @@ static void measure_all_load(int pmu, double *v, unsigned int num, int period_us
}
}
-static int add_pmu(int pmu, const struct i915_engine_class_instance *ci)
+static int
+add_pmu(int i915, int pmu, const struct i915_engine_class_instance *ci)
{
- return perf_i915_open_group(I915_PMU_ENGINE_BUSY(ci->engine_class,
+ return perf_i915_open_group(i915,
+ I915_PMU_ENGINE_BUSY(ci->engine_class,
ci->engine_instance),
pmu);
}
@@ -514,7 +516,8 @@ static void check_individual_engine(int i915,
double load;
int pmu;
- pmu = perf_i915_open(I915_PMU_ENGINE_BUSY(ci[idx].engine_class,
+ pmu = perf_i915_open(i915,
+ I915_PMU_ENGINE_BUSY(ci[idx].engine_class,
ci[idx].engine_instance));
spin = igt_spin_new(i915, .ctx = ctx, .engine = idx + 1);
@@ -636,8 +639,9 @@ static void bonded(int i915, unsigned int flags)
pmu[0] = -1;
for (int i = 0; i < limit; i++)
- pmu[i] = add_pmu(pmu[0], &siblings[i]);
- pmu[limit] = add_pmu(pmu[0], &master_engines[bond]);
+ pmu[i] = add_pmu(i915, pmu[0], &siblings[i]);
+ pmu[limit] = add_pmu(i915,
+ pmu[0], &master_engines[bond]);
igt_assert(siblings[bond].engine_class !=
master_engines[bond].engine_class);
@@ -1346,7 +1350,7 @@ static void full(int i915, unsigned int flags)
for (unsigned int n = 0; n < count; n++) {
uint32_t ctx;
- pmu[n] = add_pmu(pmu[0], &ci[n]);
+ pmu[n] = add_pmu(i915, pmu[0], &ci[n]);
if (flags & PULSE) {
struct drm_i915_gem_execbuffer2 eb = {
diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index e1bbf2410..3e179daef 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -50,22 +50,22 @@ IGT_TEST_DESCRIPTION("Test the i915 pmu perf interface");
const double tolerance = 0.05f;
const unsigned long batch_duration_ns = 500e6;
-static int open_pmu(uint64_t config)
+static int open_pmu(int i915, uint64_t config)
{
int fd;
- fd = perf_i915_open(config);
+ fd = perf_i915_open(i915, config);
igt_skip_on(fd < 0 && errno == ENODEV);
igt_assert(fd >= 0);
return fd;
}
-static int open_group(uint64_t config, int group)
+static int open_group(int i915, uint64_t config, int group)
{
int fd;
- fd = perf_i915_open_group(config, group);
+ fd = perf_i915_open_group(i915, config, group);
igt_skip_on(fd < 0 && errno == ENODEV);
igt_assert(fd >= 0);
@@ -79,7 +79,8 @@ init(int gem_fd, const struct intel_execution_engine2 *e, uint8_t sample)
bool exists;
errno = 0;
- fd = perf_i915_open(__I915_PMU_ENGINE(e->class, e->instance, sample));
+ fd = perf_i915_open(gem_fd,
+ __I915_PMU_ENGINE(e->class, e->instance, sample));
if (fd < 0)
err = errno;
@@ -278,7 +279,7 @@ single(int gem_fd, const struct intel_execution_engine2 *e, unsigned int flags)
uint64_t val;
int fd;
- fd = open_pmu(I915_PMU_ENGINE_BUSY(e->class, e->instance));
+ fd = open_pmu(gem_fd, I915_PMU_ENGINE_BUSY(e->class, e->instance));
if (flags & TEST_BUSY)
spin = spin_sync(gem_fd, 0, e);
@@ -332,7 +333,7 @@ busy_start(int gem_fd, const struct intel_execution_engine2 *e)
spin = __spin_sync(gem_fd, 0, e);
- fd = open_pmu(I915_PMU_ENGINE_BUSY(e->class, e->instance));
+ fd = open_pmu(gem_fd, I915_PMU_ENGINE_BUSY(e->class, e->instance));
val = __pmu_read_single(fd, &ts[0]);
slept = measured_usleep(batch_duration_ns / 1000);
@@ -384,7 +385,7 @@ busy_double_start(int gem_fd, const struct intel_execution_engine2 *e)
* Open PMU as fast as possible after the second spin batch in attempt
* to be faster than the driver handling lite-restore.
*/
- fd = open_pmu(I915_PMU_ENGINE_BUSY(e->class, e->instance));
+ fd = open_pmu(gem_fd, I915_PMU_ENGINE_BUSY(e->class, e->instance));
val = __pmu_read_single(fd, &ts[0]);
slept = measured_usleep(batch_duration_ns / 1000);
@@ -453,7 +454,8 @@ busy_check_all(int gem_fd, const struct intel_execution_engine2 *e,
if (e->class == e_->class && e->instance == e_->instance)
busy_idx = i;
- fd[i++] = open_group(I915_PMU_ENGINE_BUSY(e_->class,
+ fd[i++] = open_group(gem_fd,
+ I915_PMU_ENGINE_BUSY(e_->class,
e_->instance),
fd[0]);
}
@@ -527,7 +529,7 @@ most_busy_check_all(int gem_fd, const struct intel_execution_engine2 *e,
fd[0] = -1;
for (i = 0; i < num_engines; i++)
- fd[i] = open_group(val[i], fd[0]);
+ fd[i] = open_group(gem_fd, val[i], fd[0]);
/* Small delay to allow engines to start. */
usleep(__spin_wait(gem_fd, spin) * num_engines / 1e3);
@@ -581,7 +583,7 @@ all_busy_check_all(int gem_fd, const unsigned int num_engines,
fd[0] = -1;
for (i = 0; i < num_engines; i++)
- fd[i] = open_group(val[i], fd[0]);
+ fd[i] = open_group(gem_fd, val[i], fd[0]);
/* Small delay to allow engines to start. */
usleep(__spin_wait(gem_fd, spin) * num_engines / 1e3);
@@ -613,8 +615,9 @@ no_sema(int gem_fd, const struct intel_execution_engine2 *e, unsigned int flags)
uint64_t val[2][2];
int fd;
- fd = open_group(I915_PMU_ENGINE_SEMA(e->class, e->instance), -1);
- open_group(I915_PMU_ENGINE_WAIT(e->class, e->instance), fd);
+ fd = open_group(gem_fd,
+ I915_PMU_ENGINE_SEMA(e->class, e->instance), -1);
+ open_group(gem_fd, I915_PMU_ENGINE_WAIT(e->class, e->instance), fd);
if (flags & TEST_BUSY)
spin = spin_sync(gem_fd, 0, e);
@@ -712,7 +715,7 @@ sema_wait(int gem_fd, const struct intel_execution_engine2 *e,
* to expected time spent in semaphore wait state.
*/
- fd = open_pmu(I915_PMU_ENGINE_SEMA(e->class, e->instance));
+ fd = open_pmu(gem_fd, I915_PMU_ENGINE_SEMA(e->class, e->instance));
val[0] = pmu_read_single(fd);
@@ -817,8 +820,9 @@ sema_busy(int gem_fd,
igt_require(gem_scheduler_has_semaphores(gem_fd));
- fd = open_group(I915_PMU_ENGINE_SEMA(e->class, e->instance), -1);
- open_group(I915_PMU_ENGINE_BUSY(e->class, e->instance), fd);
+ fd = open_group(gem_fd,
+ I915_PMU_ENGINE_SEMA(e->class, e->instance), -1);
+ open_group(gem_fd, I915_PMU_ENGINE_BUSY(e->class, e->instance), fd);
__for_each_physical_engine(gem_fd, signal) {
if (e->class == signal->class &&
@@ -992,7 +996,8 @@ event_wait(int gem_fd, const struct intel_execution_engine2 *e)
data.pipe = p;
prepare_crtc(&data, gem_fd, output);
- fd = open_pmu(I915_PMU_ENGINE_WAIT(e->class, e->instance));
+ fd = open_pmu(gem_fd,
+ I915_PMU_ENGINE_WAIT(e->class, e->instance));
val[0] = pmu_read_single(fd);
@@ -1044,14 +1049,14 @@ multi_client(int gem_fd, const struct intel_execution_engine2 *e)
gem_quiescent_gpu(gem_fd);
- fd[0] = open_pmu(config);
+ fd[0] = open_pmu(gem_fd, config);
/*
* Second PMU client which is initialized after the first one,
* and exists before it, should not affect accounting as reported
* in the first client.
*/
- fd[1] = open_pmu(config);
+ fd[1] = open_pmu(gem_fd, config);
spin = spin_sync(gem_fd, 0, e);
@@ -1085,7 +1090,7 @@ multi_client(int gem_fd, const struct intel_execution_engine2 *e)
* - cpu != 0 is not supported since i915 PMU only allows running on one cpu
* and that is normally CPU0.
*/
-static void invalid_init(void)
+static void invalid_init(int i915)
{
struct perf_event_attr attr;
@@ -1093,7 +1098,7 @@ static void invalid_init(void)
do { \
memset(&attr, 0, sizeof (attr)); \
attr.config = I915_PMU_ENGINE_BUSY(I915_ENGINE_CLASS_RENDER, 0); \
- attr.type = i915_type_id(); \
+ attr.type = i915_perf_type_id(i915); \
igt_assert(attr.type != 0); \
errno = 0; \
} while(0)
@@ -1112,11 +1117,11 @@ do { \
igt_assert_eq(errno, EINVAL);
}
-static void init_other(unsigned int i, bool valid)
+static void init_other(int i915, unsigned int i, bool valid)
{
int fd;
- fd = perf_i915_open(__I915_PMU_OTHER(i));
+ fd = perf_i915_open(i915, __I915_PMU_OTHER(i));
igt_require(!(fd < 0 && errno == ENODEV));
if (valid) {
igt_assert(fd >= 0);
@@ -1128,11 +1133,11 @@ static void init_other(unsigned int i, bool valid)
close(fd);
}
-static void read_other(unsigned int i, bool valid)
+static void read_other(int i915, unsigned int i, bool valid)
{
int fd;
- fd = perf_i915_open(__I915_PMU_OTHER(i));
+ fd = perf_i915_open(i915, __I915_PMU_OTHER(i));
igt_require(!(fd < 0 && errno == ENODEV));
if (valid) {
igt_assert(fd >= 0);
@@ -1163,7 +1168,8 @@ static void cpu_hotplug(int gem_fd)
igt_require(cpu0_hotplug_support());
- fd = open_pmu(I915_PMU_ENGINE_BUSY(I915_ENGINE_CLASS_RENDER, 0));
+ fd = open_pmu(gem_fd,
+ I915_PMU_ENGINE_BUSY(I915_ENGINE_CLASS_RENDER, 0));
/*
* Create two spinners so test can ensure shorter gaps in engine
@@ -1292,7 +1298,7 @@ test_interrupts(int gem_fd)
gem_quiescent_gpu(gem_fd);
- fd = open_pmu(I915_PMU_INTERRUPTS);
+ fd = open_pmu(gem_fd, I915_PMU_INTERRUPTS);
/* Queue spinning batches. */
for (int i = 0; i < target; i++) {
@@ -1355,7 +1361,7 @@ test_interrupts_sync(int gem_fd)
gem_quiescent_gpu(gem_fd);
- fd = open_pmu(I915_PMU_INTERRUPTS);
+ fd = open_pmu(gem_fd, I915_PMU_INTERRUPTS);
/* Queue spinning batches. */
for (int i = 0; i < target; i++)
@@ -1409,8 +1415,8 @@ test_frequency(int gem_fd)
igt_require(max_freq > min_freq);
igt_require(boost_freq > min_freq);
- fd = open_group(I915_PMU_REQUESTED_FREQUENCY, -1);
- open_group(I915_PMU_ACTUAL_FREQUENCY, fd);
+ fd = open_group(gem_fd, I915_PMU_REQUESTED_FREQUENCY, -1);
+ open_group(gem_fd, I915_PMU_ACTUAL_FREQUENCY, fd);
/*
* Set GPU to min frequency and read PMU counters.
@@ -1499,8 +1505,8 @@ test_frequency_idle(int gem_fd)
/* While parked, our convention is to report the GPU at 0Hz */
- fd = open_group(I915_PMU_REQUESTED_FREQUENCY, -1);
- open_group(I915_PMU_ACTUAL_FREQUENCY, fd);
+ fd = open_group(gem_fd, I915_PMU_REQUESTED_FREQUENCY, -1);
+ open_group(gem_fd, I915_PMU_ACTUAL_FREQUENCY, fd);
gem_quiescent_gpu(gem_fd); /* Be idle! */
measured_usleep(2000); /* Wait for timers to cease */
@@ -1554,7 +1560,7 @@ test_rc6(int gem_fd, unsigned int flags)
gem_quiescent_gpu(gem_fd);
- fd = open_pmu(I915_PMU_RC6_RESIDENCY);
+ fd = open_pmu(gem_fd, I915_PMU_RC6_RESIDENCY);
if (flags & TEST_RUNTIME_PM) {
drmModeRes *res;
@@ -1651,7 +1657,7 @@ test_enable_race(int gem_fd, const struct intel_execution_engine2 *e)
usleep(500e3);
/* Enable the PMU. */
- fd = open_pmu(config);
+ fd = open_pmu(gem_fd, config);
/* Stop load and close the PMU. */
igt_stop_helper(&engine_load);
@@ -1797,7 +1803,7 @@ accuracy(int gem_fd, const struct intel_execution_engine2 *e,
igt_spin_free(gem_fd, spin);
}
- fd = open_pmu(I915_PMU_ENGINE_BUSY(e->class, e->instance));
+ fd = open_pmu(gem_fd, I915_PMU_ENGINE_BUSY(e->class, e->instance));
/* Let the child run. */
read(link[0], &expected, sizeof(expected));
@@ -1835,7 +1841,7 @@ igt_main
fd = drm_open_driver_master(DRIVER_INTEL);
igt_require_gem(fd);
- igt_require(i915_type_id() > 0);
+ igt_require(i915_perf_type_id(fd) > 0);
__for_each_physical_engine(fd, e)
num_engines++;
@@ -1845,7 +1851,7 @@ igt_main
* Test invalid access via perf API is rejected.
*/
igt_subtest("invalid-init")
- invalid_init();
+ invalid_init(fd);
__for_each_physical_engine(fd, e) {
const unsigned int pct[] = { 2, 50, 98 };
@@ -1996,10 +2002,10 @@ igt_main
*/
for (i = 0; i < num_other_metrics + 1; i++) {
igt_subtest_f("other-init-%u", i)
- init_other(i, i < num_other_metrics);
+ init_other(fd, i, i < num_other_metrics);
igt_subtest_f("other-read-%u", i)
- read_other(i, i < num_other_metrics);
+ read_other(fd, i, i < num_other_metrics);
}
/**
diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index cc8db7c53..8197482dd 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -423,7 +423,7 @@ static const char *imc_data_writes_unit(void)
({ \
int fd__; \
\
- fd__ = perf_i915_open_group((pmu)->config, (fd)); \
+ fd__ = perf_igfx_open_group((pmu)->config, (fd)); \
if (fd__ >= 0) { \
if ((fd) == -1) \
(fd) = fd__; \
--
2.25.0.rc2
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 6+ messages in thread* [igt-dev] ✓ Fi.CI.BAT: success for i915/perf: Find the associated perf-type for a particular device (rev4) 2020-01-10 11:53 [igt-dev] [PATCH i-g-t v3] i915/perf: Find the associated perf-type for a particular device Chris Wilson @ 2020-01-10 14:08 ` Patchwork 2020-01-13 21:41 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork 2020-01-14 10:09 ` [igt-dev] [PATCH i-g-t v3] i915/perf: Find the associated perf-type for a particular device Tvrtko Ursulin 2 siblings, 0 replies; 6+ messages in thread From: Patchwork @ 2020-01-10 14:08 UTC (permalink / raw) To: Chris Wilson; +Cc: igt-dev == Series Details == Series: i915/perf: Find the associated perf-type for a particular device (rev4) URL : https://patchwork.freedesktop.org/series/71609/ State : success == Summary == CI Bug Log - changes from IGT_5362 -> IGTPW_3914 ==================================================== Summary ------- **SUCCESS** No regressions found. External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/index.html Known issues ------------ Here are the changes found in IGTPW_3914 that come from known issues: ### IGT changes ### #### Issues hit #### * igt@gem_exec_suspend@basic-s0: - fi-cml-s: [PASS][1] -> [FAIL][2] ([fdo#103375]) [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/fi-cml-s/igt@gem_exec_suspend@basic-s0.html [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/fi-cml-s/igt@gem_exec_suspend@basic-s0.html * igt@i915_selftest@live_gt_engines: - fi-bxt-dsi: [PASS][3] -> [DMESG-FAIL][4] ([i915#889]) +7 similar issues [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/fi-bxt-dsi/igt@i915_selftest@live_gt_engines.html [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/fi-bxt-dsi/igt@i915_selftest@live_gt_engines.html * igt@i915_selftest@live_mman: - fi-bxt-dsi: [PASS][5] -> [DMESG-WARN][6] ([i915#889]) +23 similar issues [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/fi-bxt-dsi/igt@i915_selftest@live_mman.html [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/fi-bxt-dsi/igt@i915_selftest@live_mman.html #### Possible fixes #### * igt@gem_close_race@basic-threads: - fi-byt-j1900: [TIMEOUT][7] ([i915#816]) -> [PASS][8] [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/fi-byt-j1900/igt@gem_close_race@basic-threads.html [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/fi-byt-j1900/igt@gem_close_race@basic-threads.html * igt@gem_exec_suspend@basic-s3: - fi-cml-s: [DMESG-WARN][9] ([fdo#111764]) -> [PASS][10] [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/fi-cml-s/igt@gem_exec_suspend@basic-s3.html [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/fi-cml-s/igt@gem_exec_suspend@basic-s3.html * igt@i915_module_load@reload-with-fault-injection: - fi-cfl-8700k: [DMESG-WARN][11] ([i915#889]) -> [PASS][12] [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/fi-cfl-8700k/igt@i915_module_load@reload-with-fault-injection.html [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/fi-cfl-8700k/igt@i915_module_load@reload-with-fault-injection.html - fi-skl-6770hq: [INCOMPLETE][13] ([i915#671]) -> [PASS][14] [13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/fi-skl-6770hq/igt@i915_module_load@reload-with-fault-injection.html [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/fi-skl-6770hq/igt@i915_module_load@reload-with-fault-injection.html #### Warnings #### * igt@i915_selftest@live_blt: - fi-hsw-4770: [DMESG-FAIL][15] ([i915#725]) -> [DMESG-FAIL][16] ([i915#553] / [i915#725]) [15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/fi-hsw-4770/igt@i915_selftest@live_blt.html [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/fi-hsw-4770/igt@i915_selftest@live_blt.html [fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375 [fdo#111764]: https://bugs.freedesktop.org/show_bug.cgi?id=111764 [i915#553]: https://gitlab.freedesktop.org/drm/intel/issues/553 [i915#671]: https://gitlab.freedesktop.org/drm/intel/issues/671 [i915#725]: https://gitlab.freedesktop.org/drm/intel/issues/725 [i915#816]: https://gitlab.freedesktop.org/drm/intel/issues/816 [i915#889]: https://gitlab.freedesktop.org/drm/intel/issues/889 Participating hosts (52 -> 42) ------------------------------ Missing (10): fi-kbl-soraka fi-hsw-4200u fi-hsw-peppy fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-gdg-551 fi-elk-e7500 fi-byt-clapper fi-skl-6600u Build changes ------------- * CI: CI-20190529 -> None * IGT: IGT_5362 -> IGTPW_3914 CI-20190529: 20190529 CI_DRM_7716: b532d43e8d71b07d1cd0619915b1d4039002b5b9 @ git://anongit.freedesktop.org/gfx-ci/linux IGTPW_3914: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/index.html IGT_5362: c2843f8e06a2cf7d372cd154310bf0e3b7722ab8 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/index.html _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 6+ messages in thread
* [igt-dev] ✗ Fi.CI.IGT: failure for i915/perf: Find the associated perf-type for a particular device (rev4) 2020-01-10 11:53 [igt-dev] [PATCH i-g-t v3] i915/perf: Find the associated perf-type for a particular device Chris Wilson 2020-01-10 14:08 ` [igt-dev] ✓ Fi.CI.BAT: success for i915/perf: Find the associated perf-type for a particular device (rev4) Patchwork @ 2020-01-13 21:41 ` Patchwork 2020-01-14 10:09 ` [igt-dev] [PATCH i-g-t v3] i915/perf: Find the associated perf-type for a particular device Tvrtko Ursulin 2 siblings, 0 replies; 6+ messages in thread From: Patchwork @ 2020-01-13 21:41 UTC (permalink / raw) To: Chris Wilson; +Cc: igt-dev == Series Details == Series: i915/perf: Find the associated perf-type for a particular device (rev4) URL : https://patchwork.freedesktop.org/series/71609/ State : failure == Summary == CI Bug Log - changes from IGT_5362_full -> IGTPW_3914_full ==================================================== Summary ------- **FAILURE** Serious unknown changes coming with IGTPW_3914_full absolutely need to be verified manually. If you think the reported changes have nothing to do with the changes introduced in IGTPW_3914_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI. External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/index.html Possible new issues ------------------- Here are the unknown changes that may have been introduced in IGTPW_3914_full: ### IGT changes ### #### Possible regressions #### * igt@gem_pwrite@big-cpu-forwards: - shard-tglb: [PASS][1] -> [INCOMPLETE][2] [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-tglb7/igt@gem_pwrite@big-cpu-forwards.html [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-tglb2/igt@gem_pwrite@big-cpu-forwards.html Known issues ------------ Here are the changes found in IGTPW_3914_full that come from known issues: ### IGT changes ### #### Issues hit #### * igt@gem_busy@busy-vcs1: - shard-iclb: [PASS][3] -> [SKIP][4] ([fdo#112080]) +17 similar issues [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb2/igt@gem_busy@busy-vcs1.html [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb5/igt@gem_busy@busy-vcs1.html * igt@gem_ctx_isolation@bcs0-s3: - shard-apl: [PASS][5] -> [DMESG-WARN][6] ([i915#180]) +1 similar issue [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-apl6/igt@gem_ctx_isolation@bcs0-s3.html [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-apl6/igt@gem_ctx_isolation@bcs0-s3.html * igt@gem_ctx_persistence@vcs1-queued: - shard-iclb: [PASS][7] -> [SKIP][8] ([fdo#109276] / [fdo#112080]) +2 similar issues [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb1/igt@gem_ctx_persistence@vcs1-queued.html [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb7/igt@gem_ctx_persistence@vcs1-queued.html * igt@gem_ctx_persistence@vecs0-mixed-process: - shard-apl: [PASS][9] -> [FAIL][10] ([i915#679]) [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-apl1/igt@gem_ctx_persistence@vecs0-mixed-process.html [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-apl8/igt@gem_ctx_persistence@vecs0-mixed-process.html * igt@gem_ctx_shared@q-smoketest-all: - shard-tglb: [PASS][11] -> [INCOMPLETE][12] ([fdo#111735]) [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-tglb7/igt@gem_ctx_shared@q-smoketest-all.html [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-tglb7/igt@gem_ctx_shared@q-smoketest-all.html * igt@gem_exec_create@basic: - shard-tglb: [PASS][13] -> [INCOMPLETE][14] ([fdo#111736] / [i915#472]) [13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-tglb2/igt@gem_exec_create@basic.html [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-tglb3/igt@gem_exec_create@basic.html * igt@gem_exec_schedule@independent-bsd2: - shard-iclb: [PASS][15] -> [SKIP][16] ([fdo#109276]) +18 similar issues [15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb1/igt@gem_exec_schedule@independent-bsd2.html [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb6/igt@gem_exec_schedule@independent-bsd2.html * igt@gem_exec_schedule@pi-shared-iova-bsd: - shard-iclb: [PASS][17] -> [SKIP][18] ([i915#677]) +1 similar issue [17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb3/igt@gem_exec_schedule@pi-shared-iova-bsd.html [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb4/igt@gem_exec_schedule@pi-shared-iova-bsd.html * igt@gem_exec_schedule@preempt-queue-bsd1: - shard-tglb: [PASS][19] -> [INCOMPLETE][20] ([fdo#111677] / [i915#472]) [19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-tglb1/igt@gem_exec_schedule@preempt-queue-bsd1.html [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-tglb3/igt@gem_exec_schedule@preempt-queue-bsd1.html * igt@gem_exec_schedule@preempt-queue-render: - shard-tglb: [PASS][21] -> [INCOMPLETE][22] ([fdo#111606] / [fdo#111677] / [i915#472]) [21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-tglb1/igt@gem_exec_schedule@preempt-queue-render.html [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-tglb6/igt@gem_exec_schedule@preempt-queue-render.html * igt@gem_exec_schedule@preemptive-hang-bsd: - shard-iclb: [PASS][23] -> [SKIP][24] ([fdo#112146]) +4 similar issues [23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb8/igt@gem_exec_schedule@preemptive-hang-bsd.html [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb1/igt@gem_exec_schedule@preemptive-hang-bsd.html * igt@gem_linear_blits@interruptible: - shard-kbl: [PASS][25] -> [DMESG-WARN][26] ([i915#667]) [25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-kbl4/igt@gem_linear_blits@interruptible.html [26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-kbl7/igt@gem_linear_blits@interruptible.html * igt@gem_partial_pwrite_pread@reads: - shard-snb: [PASS][27] -> [DMESG-WARN][28] ([fdo#110789] / [i915#478]) [27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-snb6/igt@gem_partial_pwrite_pread@reads.html [28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-snb4/igt@gem_partial_pwrite_pread@reads.html * igt@gem_persistent_relocs@forked-interruptible-thrashing: - shard-tglb: [PASS][29] -> [FAIL][30] ([i915#520]) [29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-tglb4/igt@gem_persistent_relocs@forked-interruptible-thrashing.html [30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-tglb5/igt@gem_persistent_relocs@forked-interruptible-thrashing.html * igt@gem_persistent_relocs@forked-thrashing: - shard-snb: [PASS][31] -> [FAIL][32] ([i915#520]) [31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-snb6/igt@gem_persistent_relocs@forked-thrashing.html [32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-snb5/igt@gem_persistent_relocs@forked-thrashing.html - shard-iclb: [PASS][33] -> [TIMEOUT][34] ([fdo#112271] / [i915#530]) [33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb7/igt@gem_persistent_relocs@forked-thrashing.html [34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb2/igt@gem_persistent_relocs@forked-thrashing.html * igt@gem_sync@basic-store-all: - shard-tglb: [PASS][35] -> [INCOMPLETE][36] ([i915#472]) +2 similar issues [35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-tglb5/igt@gem_sync@basic-store-all.html [36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-tglb3/igt@gem_sync@basic-store-all.html * igt@kms_cursor_crc@pipe-c-cursor-size-change: - shard-apl: [PASS][37] -> [FAIL][38] ([i915#54]) [37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-apl1/igt@kms_cursor_crc@pipe-c-cursor-size-change.html [38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-apl6/igt@kms_cursor_crc@pipe-c-cursor-size-change.html - shard-kbl: [PASS][39] -> [FAIL][40] ([i915#54]) [39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-kbl2/igt@kms_cursor_crc@pipe-c-cursor-size-change.html [40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-kbl2/igt@kms_cursor_crc@pipe-c-cursor-size-change.html * igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-shrfb-draw-mmap-gtt: - shard-glk: [PASS][41] -> [FAIL][42] ([i915#49]) [41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-glk9/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-shrfb-draw-mmap-gtt.html [42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-glk5/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-shrfb-draw-mmap-gtt.html * igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-shrfb-draw-pwrite: - shard-tglb: [PASS][43] -> [FAIL][44] ([i915#49]) +2 similar issues [43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-tglb6/igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-shrfb-draw-pwrite.html [44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-tglb1/igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-shrfb-draw-pwrite.html * igt@kms_psr@psr2_cursor_mmap_cpu: - shard-iclb: [PASS][45] -> [SKIP][46] ([fdo#109441]) +2 similar issues [45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb2/igt@kms_psr@psr2_cursor_mmap_cpu.html [46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb3/igt@kms_psr@psr2_cursor_mmap_cpu.html * igt@kms_vblank@pipe-a-ts-continuation-suspend: - shard-kbl: [PASS][47] -> [DMESG-WARN][48] ([i915#180]) +2 similar issues [47]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-kbl6/igt@kms_vblank@pipe-a-ts-continuation-suspend.html [48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-kbl6/igt@kms_vblank@pipe-a-ts-continuation-suspend.html #### Possible fixes #### * igt@gem_ctx_persistence@vcs1-mixed-process: - shard-iclb: [SKIP][49] ([fdo#109276] / [fdo#112080]) -> [PASS][50] +1 similar issue [49]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb5/igt@gem_ctx_persistence@vcs1-mixed-process.html [50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb4/igt@gem_ctx_persistence@vcs1-mixed-process.html * igt@gem_ctx_shared@q-smoketest-blt: - shard-tglb: [INCOMPLETE][51] ([fdo#111735]) -> [PASS][52] [51]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-tglb3/igt@gem_ctx_shared@q-smoketest-blt.html [52]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-tglb2/igt@gem_ctx_shared@q-smoketest-blt.html * igt@gem_eio@in-flight-suspend: - shard-apl: [DMESG-WARN][53] ([i915#180]) -> [PASS][54] +1 similar issue [53]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-apl6/igt@gem_eio@in-flight-suspend.html [54]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-apl8/igt@gem_eio@in-flight-suspend.html * igt@gem_eio@kms: - shard-snb: [INCOMPLETE][55] ([i915#82]) -> [PASS][56] [55]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-snb4/igt@gem_eio@kms.html [56]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-snb1/igt@gem_eio@kms.html - shard-tglb: [INCOMPLETE][57] ([i915#476]) -> [PASS][58] [57]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-tglb3/igt@gem_eio@kms.html [58]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-tglb5/igt@gem_eio@kms.html * igt@gem_exec_create@forked: - shard-tglb: [INCOMPLETE][59] ([fdo#108838] / [i915#472]) -> [PASS][60] [59]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-tglb6/igt@gem_exec_create@forked.html [60]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-tglb2/igt@gem_exec_create@forked.html * igt@gem_exec_schedule@pi-common-bsd: - shard-iclb: [SKIP][61] ([i915#677]) -> [PASS][62] [61]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb4/igt@gem_exec_schedule@pi-common-bsd.html [62]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb6/igt@gem_exec_schedule@pi-common-bsd.html * igt@gem_exec_schedule@preempt-queue-contexts-chain-render: - shard-tglb: [INCOMPLETE][63] ([fdo#111677] / [i915#472]) -> [PASS][64] [63]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-tglb6/igt@gem_exec_schedule@preempt-queue-contexts-chain-render.html [64]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-tglb3/igt@gem_exec_schedule@preempt-queue-contexts-chain-render.html * igt@gem_exec_schedule@smoketest-all: - shard-tglb: [INCOMPLETE][65] ([i915#463] / [i915#472]) -> [PASS][66] [65]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-tglb2/igt@gem_exec_schedule@smoketest-all.html [66]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-tglb5/igt@gem_exec_schedule@smoketest-all.html * igt@gem_exec_schedule@wide-bsd: - shard-iclb: [SKIP][67] ([fdo#112146]) -> [PASS][68] +4 similar issues [67]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb4/igt@gem_exec_schedule@wide-bsd.html [68]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb7/igt@gem_exec_schedule@wide-bsd.html * igt@gem_persistent_relocs@forked-faulting-reloc-thrashing: - shard-iclb: [INCOMPLETE][69] ([i915#140] / [i915#530]) -> [PASS][70] [69]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb5/igt@gem_persistent_relocs@forked-faulting-reloc-thrashing.html [70]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb8/igt@gem_persistent_relocs@forked-faulting-reloc-thrashing.html * igt@gem_persistent_relocs@forked-interruptible-thrashing: - shard-iclb: [FAIL][71] ([i915#520]) -> [PASS][72] [71]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb1/igt@gem_persistent_relocs@forked-interruptible-thrashing.html [72]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb5/igt@gem_persistent_relocs@forked-interruptible-thrashing.html * igt@gem_ppgtt@flink-and-close-vma-leak: - shard-glk: [FAIL][73] ([i915#644]) -> [PASS][74] [73]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-glk6/igt@gem_ppgtt@flink-and-close-vma-leak.html [74]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-glk2/igt@gem_ppgtt@flink-and-close-vma-leak.html * igt@gem_softpin@noreloc-s3: - shard-iclb: [DMESG-WARN][75] ([fdo#111764]) -> [PASS][76] [75]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb8/igt@gem_softpin@noreloc-s3.html [76]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb3/igt@gem_softpin@noreloc-s3.html * igt@gem_userptr_blits@sync-unmap: - shard-snb: [DMESG-WARN][77] ([fdo#111870]) -> [PASS][78] +1 similar issue [77]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-snb5/igt@gem_userptr_blits@sync-unmap.html [78]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-snb4/igt@gem_userptr_blits@sync-unmap.html * igt@gem_workarounds@suspend-resume-fd: - shard-kbl: [DMESG-WARN][79] ([i915#180]) -> [PASS][80] +1 similar issue [79]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-kbl6/igt@gem_workarounds@suspend-resume-fd.html [80]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-kbl7/igt@gem_workarounds@suspend-resume-fd.html * igt@i915_pm_backlight@fade_with_suspend: - shard-tglb: [INCOMPLETE][81] ([i915#456] / [i915#460]) -> [PASS][82] [81]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-tglb6/igt@i915_pm_backlight@fade_with_suspend.html [82]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-tglb3/igt@i915_pm_backlight@fade_with_suspend.html * igt@i915_pm_dc@dc6-psr: - shard-iclb: [FAIL][83] ([i915#454]) -> [PASS][84] [83]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb6/igt@i915_pm_dc@dc6-psr.html [84]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb2/igt@i915_pm_dc@dc6-psr.html * igt@kms_frontbuffer_tracking@fbc-rgb565-draw-pwrite: - shard-tglb: [FAIL][85] ([i915#49]) -> [PASS][86] [85]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-tglb5/igt@kms_frontbuffer_tracking@fbc-rgb565-draw-pwrite.html [86]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-tglb3/igt@kms_frontbuffer_tracking@fbc-rgb565-draw-pwrite.html * igt@kms_frontbuffer_tracking@fbc-suspend: - shard-kbl: [INCOMPLETE][87] ([fdo#103665]) -> [PASS][88] [87]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-kbl2/igt@kms_frontbuffer_tracking@fbc-suspend.html [88]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-kbl7/igt@kms_frontbuffer_tracking@fbc-suspend.html * igt@kms_psr@psr2_cursor_plane_move: - shard-iclb: [SKIP][89] ([fdo#109441]) -> [PASS][90] +2 similar issues [89]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb6/igt@kms_psr@psr2_cursor_plane_move.html [90]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb2/igt@kms_psr@psr2_cursor_plane_move.html * igt@perf_pmu@busy-accuracy-2-vcs1: - shard-iclb: [SKIP][91] ([fdo#112080]) -> [PASS][92] +8 similar issues [91]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb6/igt@perf_pmu@busy-accuracy-2-vcs1.html [92]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb1/igt@perf_pmu@busy-accuracy-2-vcs1.html * igt@prime_busy@hang-bsd2: - shard-iclb: [SKIP][93] ([fdo#109276]) -> [PASS][94] +12 similar issues [93]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb6/igt@prime_busy@hang-bsd2.html [94]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb2/igt@prime_busy@hang-bsd2.html #### Warnings #### * igt@gem_ctx_isolation@vcs1-nonpriv: - shard-iclb: [FAIL][95] ([IGT#28]) -> [SKIP][96] ([fdo#109276] / [fdo#112080]) [95]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb4/igt@gem_ctx_isolation@vcs1-nonpriv.html [96]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb6/igt@gem_ctx_isolation@vcs1-nonpriv.html * igt@gem_ctx_isolation@vcs1-nonpriv-switch: - shard-iclb: [SKIP][97] ([fdo#109276] / [fdo#112080]) -> [FAIL][98] ([IGT#28]) [97]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-iclb5/igt@gem_ctx_isolation@vcs1-nonpriv-switch.html [98]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-iclb1/igt@gem_ctx_isolation@vcs1-nonpriv-switch.html * igt@gem_userptr_blits@map-fixed-invalidate-overlap-busy-gup: - shard-snb: [DMESG-WARN][99] ([fdo#111870]) -> [DMESG-WARN][100] ([fdo#110789] / [fdo#111870]) [99]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5362/shard-snb2/igt@gem_userptr_blits@map-fixed-invalidate-overlap-busy-gup.html [100]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/shard-snb4/igt@gem_userptr_blits@map-fixed-invalidate-overlap-busy-gup.html [IGT#28]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/28 [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665 [fdo#108838]: https://bugs.freedesktop.org/show_bug.cgi?id=108838 [fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276 [fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441 [fdo#110789]: https://bugs.freedesktop.org/show_bug.cgi?id=110789 [fdo#111606]: https://bugs.freedesktop.org/show_bug.cgi?id=111606 [fdo#111677]: https://bugs.freedesktop.org/show_bug.cgi?id=111677 [fdo#111735]: https://bugs.freedesktop.org/show_bug.cgi?id=111735 [fdo#111736]: https://bugs.freedesktop.org/show_bug.cgi?id=111736 [fdo#111764]: https://bugs.freedesktop.org/show_bug.cgi?id=111764 [fdo#111870]: https://bugs.freedesktop.org/show_bug.cgi?id=111870 [fdo#112080]: https://bugs.freedesktop.org/show_bug.cgi?id=112080 [fdo#112146]: https://bugs.freedesktop.org/show_bug.cgi?id=112146 [fdo#112271]: https://bugs.freedesktop.org/show_bug.cgi?id=112271 [i915#140]: https://gitlab.freedesktop.org/drm/intel/issues/140 [i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180 [i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454 [i915#456]: https://gitlab.freedesktop.org/drm/intel/issues/456 [i915#460]: https://gitlab.freedesktop.org/drm/intel/issues/460 [i915#463]: https://gitlab.freedesktop.org/drm/intel/issues/463 [i915#472]: https://gitlab.freedesktop.org/drm/intel/issues/472 [i915#476]: https://gitlab.freedesktop.org/drm/intel/issues/476 [i915#478]: https://gitlab.freedesktop.org/drm/intel/issues/478 [i915#49]: https://gitlab.freedesktop.org/drm/intel/issues/49 [i915#520]: https://gitlab.freedesktop.org/drm/intel/issues/520 [i915#530]: https://gitlab.freedesktop.org/drm/intel/issues/530 [i915#54]: https://gitlab.freedesktop.org/drm/intel/issues/54 [i915#644]: https://gitlab.freedesktop.org/drm/intel/issues/644 [i915#667]: https://gitlab.freedesktop.org/drm/intel/issues/667 [i915#677]: https://gitlab.freedesktop.org/drm/intel/issues/677 [i915#679]: https://gitlab.freedesktop.org/drm/intel/issues/679 [i915#82]: https://gitlab.freedesktop.org/drm/intel/issues/82 Participating hosts (8 -> 8) ------------------------------ No changes in participating hosts Build changes ------------- * CI: CI-20190529 -> None * IGT: IGT_5362 -> IGTPW_3914 CI-20190529: 20190529 CI_DRM_7716: b532d43e8d71b07d1cd0619915b1d4039002b5b9 @ git://anongit.freedesktop.org/gfx-ci/linux IGTPW_3914: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/index.html IGT_5362: c2843f8e06a2cf7d372cd154310bf0e3b7722ab8 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3914/index.html _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v3] i915/perf: Find the associated perf-type for a particular device 2020-01-10 11:53 [igt-dev] [PATCH i-g-t v3] i915/perf: Find the associated perf-type for a particular device Chris Wilson 2020-01-10 14:08 ` [igt-dev] ✓ Fi.CI.BAT: success for i915/perf: Find the associated perf-type for a particular device (rev4) Patchwork 2020-01-13 21:41 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork @ 2020-01-14 10:09 ` Tvrtko Ursulin 2020-01-14 10:15 ` Chris Wilson 2 siblings, 1 reply; 6+ messages in thread From: Tvrtko Ursulin @ 2020-01-14 10:09 UTC (permalink / raw) To: Chris Wilson, intel-gfx; +Cc: igt-dev, Tvrtko Ursulin On 10/01/2020 11:53, Chris Wilson wrote: > Since with multiple devices, we may have multiple different perf_pmu > each with their own type, we want to find the right one for the job. > > The tests are run with a specific fd, from which we can extract the > appropriate bus-id and find the associated perf-type. The performance > monitoring tools are a little more general and not yet ready to probe > all device or bind to one in particular, so we just assume the default > igfx for the time being. > > v2: Extract the bus address from out of sysfs > v3: A new name for a new decade! > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: "Robert M. Fosha" <robert.m.fosha@intel.com> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > Cc: Michal Wajdeczko <michal.wajdeczko@intel.com> > Reviewed-by: "Robert M. Fosha" <robert.m.fosha@intel.com> #v2 > --- > benchmarks/gem_wsim.c | 4 +- > lib/igt_perf.c | 91 +++++++++++++++++++++++++++++++--- > lib/igt_perf.h | 13 +++-- > overlay/gem-interrupts.c | 2 +- > overlay/gpu-freq.c | 4 +- > overlay/gpu-top.c | 12 ++--- > overlay/rc6.c | 2 +- > tests/i915/gem_ctx_freq.c | 2 +- > tests/i915/gem_ctx_sseu.c | 2 +- > tests/i915/gem_exec_balancer.c | 18 ++++--- > tests/perf_pmu.c | 84 ++++++++++++++++--------------- > tools/intel_gpu_top.c | 2 +- > 12 files changed, 166 insertions(+), 70 deletions(-) > > diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c > index 6305e0d7a..9156fdc90 100644 > --- a/benchmarks/gem_wsim.c > +++ b/benchmarks/gem_wsim.c > @@ -2268,8 +2268,8 @@ busy_init(const struct workload_balancer *balancer, struct workload *wrk) > for (d = &engines[0]; d->id != VCS; d++) { > int pfd; > > - pfd = perf_i915_open_group(I915_PMU_ENGINE_BUSY(d->class, > - d->inst), > + pfd = perf_igfx_open_group(I915_PMU_ENGINE_BUSY(d->class, > + d->inst), > bb->fd); > if (pfd < 0) { > if (d->id != VCS2) > diff --git a/lib/igt_perf.c b/lib/igt_perf.c > index e3dec2cc2..418c1c188 100644 > --- a/lib/igt_perf.c > +++ b/lib/igt_perf.c > @@ -4,17 +4,84 @@ > #include <stdlib.h> > #include <string.h> > #include <errno.h> > +#include <sys/stat.h> > #include <sys/sysinfo.h> > +#include <sys/sysmacros.h> > > #include "igt_perf.h" > > -uint64_t i915_type_id(void) > +static char *bus_address(int i915, char *path, int pathlen) > +{ > + struct stat st; > + int len = -1; > + int dir; > + char *s; > + > + if (fstat(i915, &st) || !S_ISCHR(st.st_mode)) > + return NULL; > + > + snprintf(path, pathlen, "/sys/dev/char/%d:%d", > + major(st.st_rdev), minor(st.st_rdev)); > + > + dir = open(path, O_RDONLY); > + if (dir != -1) { > + len = readlinkat(dir, "device", path, pathlen - 1); > + close(dir); > + } > + if (len < 0) > + return NULL; > + > + path[len] = '\0'; In the realm of hypothetical but an assert that no truncation occurred would be good. if (len == pathlen - 1) return NULL; ? Although it is not clear to me from man readlinkat how do we distinguish between truncation and exact fit. Or you were counting on failure at a later step if truncation occurred? Maybe try stat(2) in this wrapper to be sure function returns a valid path? Regards, Tvrtko > + > + /* strip off the relative path */ > + s = strrchr(path, '/'); > + if (s) > + memmove(path, s + 1, len - (s - path) + 1); > + > + return path; > +} > + > +const char *i915_perf_device(int i915, char *buf, int buflen) > +{ > + char *s; > + > +#define prefix "i915_" > +#define plen strlen(prefix) > + > + if (!buf || buflen < plen) > + return "i915"; > + > + memcpy(buf, prefix, plen); > + > + if (!bus_address(i915, buf + plen, buflen - plen) || > + strcmp(buf + plen, "0000:00:02.0") == 0) /* legacy name for igfx */ > + buf[plen - 1] = '\0'; > + > + /* Convert all colons in the address to '_', thanks perf! */ > + for (s = buf; *s; s++) > + if (*s == ':') > + *s = '_'; > + > + return buf; > +} > + > +uint64_t i915_perf_type_id(int i915) > +{ > + char buf[80]; > + > + return igt_perf_type_id(i915_perf_device(i915, buf, sizeof(buf))); > +} > + > +uint64_t igt_perf_type_id(const char *device) > { > char buf[64]; > ssize_t ret; > int fd; > > - fd = open("/sys/bus/event_source/devices/i915/type", O_RDONLY); > + snprintf(buf, sizeof(buf), > + "/sys/bus/event_source/devices/%s/type", device); > + > + fd = open(buf, O_RDONLY); > if (fd < 0) > return 0; > > @@ -52,15 +119,27 @@ _perf_open(uint64_t type, uint64_t config, int group, uint64_t format) > return ret; > } > > -int perf_i915_open(uint64_t config) > +int perf_igfx_open(uint64_t config) > +{ > + return _perf_open(igt_perf_type_id("i915"), config, -1, > + PERF_FORMAT_TOTAL_TIME_ENABLED); > +} > + > +int perf_igfx_open_group(uint64_t config, int group) > +{ > + return _perf_open(igt_perf_type_id("i915"), config, group, > + PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP); > +} > + > +int perf_i915_open(int i915, uint64_t config) > { > - return _perf_open(i915_type_id(), config, -1, > + return _perf_open(i915_perf_type_id(i915), config, -1, > PERF_FORMAT_TOTAL_TIME_ENABLED); > } > > -int perf_i915_open_group(uint64_t config, int group) > +int perf_i915_open_group(int i915, uint64_t config, int group) > { > - return _perf_open(i915_type_id(), config, group, > + return _perf_open(i915_perf_type_id(i915), config, group, > PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP); > } > > diff --git a/lib/igt_perf.h b/lib/igt_perf.h > index e00718f47..a8328c70c 100644 > --- a/lib/igt_perf.h > +++ b/lib/igt_perf.h > @@ -51,10 +51,17 @@ perf_event_open(struct perf_event_attr *attr, > return syscall(__NR_perf_event_open, attr, pid, cpu, group_fd, flags); > } > > -uint64_t i915_type_id(void); > -int perf_i915_open(uint64_t config); > -int perf_i915_open_group(uint64_t config, int group); > +uint64_t igt_perf_type_id(const char *device); > int igt_perf_open(uint64_t type, uint64_t config); > int igt_perf_open_group(uint64_t type, uint64_t config, int group); > > +const char *i915_perf_device(int i915, char *buf, int buflen); > +uint64_t i915_perf_type_id(int i915); > + > +int perf_igfx_open(uint64_t config); > +int perf_igfx_open_group(uint64_t config, int group); > + > +int perf_i915_open(int i915, uint64_t config); > +int perf_i915_open_group(int i915, uint64_t config, int group); > + > #endif /* I915_PERF_H */ > diff --git a/overlay/gem-interrupts.c b/overlay/gem-interrupts.c > index 0233fbb05..be73b6931 100644 > --- a/overlay/gem-interrupts.c > +++ b/overlay/gem-interrupts.c > @@ -113,7 +113,7 @@ int gem_interrupts_init(struct gem_interrupts *irqs) > { > memset(irqs, 0, sizeof(*irqs)); > > - irqs->fd = perf_i915_open(I915_PMU_INTERRUPTS); > + irqs->fd = perf_igfx_open(I915_PMU_INTERRUPTS); > if (irqs->fd < 0 && interrupts_read() < 0) > irqs->error = ENODEV; > > diff --git a/overlay/gpu-freq.c b/overlay/gpu-freq.c > index 0d8032592..b73157d39 100644 > --- a/overlay/gpu-freq.c > +++ b/overlay/gpu-freq.c > @@ -37,8 +37,8 @@ static int perf_open(void) > { > int fd; > > - fd = perf_i915_open_group(I915_PMU_ACTUAL_FREQUENCY, -1); > - if (perf_i915_open_group(I915_PMU_REQUESTED_FREQUENCY, fd) < 0) { > + fd = perf_igfx_open_group(I915_PMU_ACTUAL_FREQUENCY, -1); > + if (perf_igfx_open_group(I915_PMU_REQUESTED_FREQUENCY, fd) < 0) { > close(fd); > fd = -1; > } > diff --git a/overlay/gpu-top.c b/overlay/gpu-top.c > index 6cec2e943..32123abdd 100644 > --- a/overlay/gpu-top.c > +++ b/overlay/gpu-top.c > @@ -58,16 +58,16 @@ static int perf_init(struct gpu_top *gt) > > d = &engines[0]; > > - gt->fd = perf_i915_open_group(I915_PMU_ENGINE_BUSY(d->class, d->inst), > + gt->fd = perf_igfx_open_group(I915_PMU_ENGINE_BUSY(d->class, d->inst), > -1); > if (gt->fd < 0) > return -1; > > - if (perf_i915_open_group(I915_PMU_ENGINE_WAIT(d->class, d->inst), > + if (perf_igfx_open_group(I915_PMU_ENGINE_WAIT(d->class, d->inst), > gt->fd) >= 0) > gt->have_wait = 1; > > - if (perf_i915_open_group(I915_PMU_ENGINE_SEMA(d->class, d->inst), > + if (perf_igfx_open_group(I915_PMU_ENGINE_SEMA(d->class, d->inst), > gt->fd) >= 0) > gt->have_sema = 1; > > @@ -75,19 +75,19 @@ static int perf_init(struct gpu_top *gt) > gt->num_rings = 1; > > for (d++; d->name; d++) { > - if (perf_i915_open_group(I915_PMU_ENGINE_BUSY(d->class, > + if (perf_igfx_open_group(I915_PMU_ENGINE_BUSY(d->class, > d->inst), > gt->fd) < 0) > continue; > > if (gt->have_wait && > - perf_i915_open_group(I915_PMU_ENGINE_WAIT(d->class, > + perf_igfx_open_group(I915_PMU_ENGINE_WAIT(d->class, > d->inst), > gt->fd) < 0) > return -1; > > if (gt->have_sema && > - perf_i915_open_group(I915_PMU_ENGINE_SEMA(d->class, > + perf_igfx_open_group(I915_PMU_ENGINE_SEMA(d->class, > d->inst), > gt->fd) < 0) > return -1; > diff --git a/overlay/rc6.c b/overlay/rc6.c > index b5286f0cf..69f95f288 100644 > --- a/overlay/rc6.c > +++ b/overlay/rc6.c > @@ -39,7 +39,7 @@ int rc6_init(struct rc6 *rc6) > { > memset(rc6, 0, sizeof(*rc6)); > > - rc6->fd = perf_i915_open(I915_PMU_RC6_RESIDENCY); > + rc6->fd = perf_igfx_open(I915_PMU_RC6_RESIDENCY); > if (rc6->fd < 0) { > struct stat st; > if (stat("/sys/class/drm/card0/power", &st) < 0) > diff --git a/tests/i915/gem_ctx_freq.c b/tests/i915/gem_ctx_freq.c > index 89f3d11ef..5d2d3ec31 100644 > --- a/tests/i915/gem_ctx_freq.c > +++ b/tests/i915/gem_ctx_freq.c > @@ -136,7 +136,7 @@ static void sysfs_range(int i915) > > triangle_fill(frequencies, N_STEPS, sys_min, sys_max); > > - pmu = perf_i915_open(I915_PMU_REQUESTED_FREQUENCY); > + pmu = perf_i915_open(i915, I915_PMU_REQUESTED_FREQUENCY); > igt_require(pmu >= 0); > > for (int outer = 0; outer <= 2*N_STEPS; outer++) { > diff --git a/tests/i915/gem_ctx_sseu.c b/tests/i915/gem_ctx_sseu.c > index 48e4411c8..38dc584bc 100644 > --- a/tests/i915/gem_ctx_sseu.c > +++ b/tests/i915/gem_ctx_sseu.c > @@ -119,7 +119,7 @@ kernel_has_per_context_sseu_support(int fd) > > static bool has_engine(int fd, unsigned int class, unsigned int instance) > { > - int pmu = perf_i915_open(I915_PMU_ENGINE_BUSY(class, instance)); > + int pmu = perf_i915_open(fd, I915_PMU_ENGINE_BUSY(class, instance)); > > if (pmu >= 0) > close(pmu); > diff --git a/tests/i915/gem_exec_balancer.c b/tests/i915/gem_exec_balancer.c > index f4909a978..cebcc39c7 100644 > --- a/tests/i915/gem_exec_balancer.c > +++ b/tests/i915/gem_exec_balancer.c > @@ -60,7 +60,7 @@ static bool has_class_instance(int i915, uint16_t class, uint16_t instance) > { > int fd; > > - fd = perf_i915_open(I915_PMU_ENGINE_BUSY(class, instance)); > + fd = perf_i915_open(i915, I915_PMU_ENGINE_BUSY(class, instance)); > if (fd != -1) { > close(fd); > return true; > @@ -483,9 +483,11 @@ static void measure_all_load(int pmu, double *v, unsigned int num, int period_us > } > } > > -static int add_pmu(int pmu, const struct i915_engine_class_instance *ci) > +static int > +add_pmu(int i915, int pmu, const struct i915_engine_class_instance *ci) > { > - return perf_i915_open_group(I915_PMU_ENGINE_BUSY(ci->engine_class, > + return perf_i915_open_group(i915, > + I915_PMU_ENGINE_BUSY(ci->engine_class, > ci->engine_instance), > pmu); > } > @@ -514,7 +516,8 @@ static void check_individual_engine(int i915, > double load; > int pmu; > > - pmu = perf_i915_open(I915_PMU_ENGINE_BUSY(ci[idx].engine_class, > + pmu = perf_i915_open(i915, > + I915_PMU_ENGINE_BUSY(ci[idx].engine_class, > ci[idx].engine_instance)); > > spin = igt_spin_new(i915, .ctx = ctx, .engine = idx + 1); > @@ -636,8 +639,9 @@ static void bonded(int i915, unsigned int flags) > > pmu[0] = -1; > for (int i = 0; i < limit; i++) > - pmu[i] = add_pmu(pmu[0], &siblings[i]); > - pmu[limit] = add_pmu(pmu[0], &master_engines[bond]); > + pmu[i] = add_pmu(i915, pmu[0], &siblings[i]); > + pmu[limit] = add_pmu(i915, > + pmu[0], &master_engines[bond]); > > igt_assert(siblings[bond].engine_class != > master_engines[bond].engine_class); > @@ -1346,7 +1350,7 @@ static void full(int i915, unsigned int flags) > for (unsigned int n = 0; n < count; n++) { > uint32_t ctx; > > - pmu[n] = add_pmu(pmu[0], &ci[n]); > + pmu[n] = add_pmu(i915, pmu[0], &ci[n]); > > if (flags & PULSE) { > struct drm_i915_gem_execbuffer2 eb = { > diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c > index e1bbf2410..3e179daef 100644 > --- a/tests/perf_pmu.c > +++ b/tests/perf_pmu.c > @@ -50,22 +50,22 @@ IGT_TEST_DESCRIPTION("Test the i915 pmu perf interface"); > const double tolerance = 0.05f; > const unsigned long batch_duration_ns = 500e6; > > -static int open_pmu(uint64_t config) > +static int open_pmu(int i915, uint64_t config) > { > int fd; > > - fd = perf_i915_open(config); > + fd = perf_i915_open(i915, config); > igt_skip_on(fd < 0 && errno == ENODEV); > igt_assert(fd >= 0); > > return fd; > } > > -static int open_group(uint64_t config, int group) > +static int open_group(int i915, uint64_t config, int group) > { > int fd; > > - fd = perf_i915_open_group(config, group); > + fd = perf_i915_open_group(i915, config, group); > igt_skip_on(fd < 0 && errno == ENODEV); > igt_assert(fd >= 0); > > @@ -79,7 +79,8 @@ init(int gem_fd, const struct intel_execution_engine2 *e, uint8_t sample) > bool exists; > > errno = 0; > - fd = perf_i915_open(__I915_PMU_ENGINE(e->class, e->instance, sample)); > + fd = perf_i915_open(gem_fd, > + __I915_PMU_ENGINE(e->class, e->instance, sample)); > if (fd < 0) > err = errno; > > @@ -278,7 +279,7 @@ single(int gem_fd, const struct intel_execution_engine2 *e, unsigned int flags) > uint64_t val; > int fd; > > - fd = open_pmu(I915_PMU_ENGINE_BUSY(e->class, e->instance)); > + fd = open_pmu(gem_fd, I915_PMU_ENGINE_BUSY(e->class, e->instance)); > > if (flags & TEST_BUSY) > spin = spin_sync(gem_fd, 0, e); > @@ -332,7 +333,7 @@ busy_start(int gem_fd, const struct intel_execution_engine2 *e) > > spin = __spin_sync(gem_fd, 0, e); > > - fd = open_pmu(I915_PMU_ENGINE_BUSY(e->class, e->instance)); > + fd = open_pmu(gem_fd, I915_PMU_ENGINE_BUSY(e->class, e->instance)); > > val = __pmu_read_single(fd, &ts[0]); > slept = measured_usleep(batch_duration_ns / 1000); > @@ -384,7 +385,7 @@ busy_double_start(int gem_fd, const struct intel_execution_engine2 *e) > * Open PMU as fast as possible after the second spin batch in attempt > * to be faster than the driver handling lite-restore. > */ > - fd = open_pmu(I915_PMU_ENGINE_BUSY(e->class, e->instance)); > + fd = open_pmu(gem_fd, I915_PMU_ENGINE_BUSY(e->class, e->instance)); > > val = __pmu_read_single(fd, &ts[0]); > slept = measured_usleep(batch_duration_ns / 1000); > @@ -453,7 +454,8 @@ busy_check_all(int gem_fd, const struct intel_execution_engine2 *e, > if (e->class == e_->class && e->instance == e_->instance) > busy_idx = i; > > - fd[i++] = open_group(I915_PMU_ENGINE_BUSY(e_->class, > + fd[i++] = open_group(gem_fd, > + I915_PMU_ENGINE_BUSY(e_->class, > e_->instance), > fd[0]); > } > @@ -527,7 +529,7 @@ most_busy_check_all(int gem_fd, const struct intel_execution_engine2 *e, > > fd[0] = -1; > for (i = 0; i < num_engines; i++) > - fd[i] = open_group(val[i], fd[0]); > + fd[i] = open_group(gem_fd, val[i], fd[0]); > > /* Small delay to allow engines to start. */ > usleep(__spin_wait(gem_fd, spin) * num_engines / 1e3); > @@ -581,7 +583,7 @@ all_busy_check_all(int gem_fd, const unsigned int num_engines, > > fd[0] = -1; > for (i = 0; i < num_engines; i++) > - fd[i] = open_group(val[i], fd[0]); > + fd[i] = open_group(gem_fd, val[i], fd[0]); > > /* Small delay to allow engines to start. */ > usleep(__spin_wait(gem_fd, spin) * num_engines / 1e3); > @@ -613,8 +615,9 @@ no_sema(int gem_fd, const struct intel_execution_engine2 *e, unsigned int flags) > uint64_t val[2][2]; > int fd; > > - fd = open_group(I915_PMU_ENGINE_SEMA(e->class, e->instance), -1); > - open_group(I915_PMU_ENGINE_WAIT(e->class, e->instance), fd); > + fd = open_group(gem_fd, > + I915_PMU_ENGINE_SEMA(e->class, e->instance), -1); > + open_group(gem_fd, I915_PMU_ENGINE_WAIT(e->class, e->instance), fd); > > if (flags & TEST_BUSY) > spin = spin_sync(gem_fd, 0, e); > @@ -712,7 +715,7 @@ sema_wait(int gem_fd, const struct intel_execution_engine2 *e, > * to expected time spent in semaphore wait state. > */ > > - fd = open_pmu(I915_PMU_ENGINE_SEMA(e->class, e->instance)); > + fd = open_pmu(gem_fd, I915_PMU_ENGINE_SEMA(e->class, e->instance)); > > val[0] = pmu_read_single(fd); > > @@ -817,8 +820,9 @@ sema_busy(int gem_fd, > > igt_require(gem_scheduler_has_semaphores(gem_fd)); > > - fd = open_group(I915_PMU_ENGINE_SEMA(e->class, e->instance), -1); > - open_group(I915_PMU_ENGINE_BUSY(e->class, e->instance), fd); > + fd = open_group(gem_fd, > + I915_PMU_ENGINE_SEMA(e->class, e->instance), -1); > + open_group(gem_fd, I915_PMU_ENGINE_BUSY(e->class, e->instance), fd); > > __for_each_physical_engine(gem_fd, signal) { > if (e->class == signal->class && > @@ -992,7 +996,8 @@ event_wait(int gem_fd, const struct intel_execution_engine2 *e) > data.pipe = p; > prepare_crtc(&data, gem_fd, output); > > - fd = open_pmu(I915_PMU_ENGINE_WAIT(e->class, e->instance)); > + fd = open_pmu(gem_fd, > + I915_PMU_ENGINE_WAIT(e->class, e->instance)); > > val[0] = pmu_read_single(fd); > > @@ -1044,14 +1049,14 @@ multi_client(int gem_fd, const struct intel_execution_engine2 *e) > > gem_quiescent_gpu(gem_fd); > > - fd[0] = open_pmu(config); > + fd[0] = open_pmu(gem_fd, config); > > /* > * Second PMU client which is initialized after the first one, > * and exists before it, should not affect accounting as reported > * in the first client. > */ > - fd[1] = open_pmu(config); > + fd[1] = open_pmu(gem_fd, config); > > spin = spin_sync(gem_fd, 0, e); > > @@ -1085,7 +1090,7 @@ multi_client(int gem_fd, const struct intel_execution_engine2 *e) > * - cpu != 0 is not supported since i915 PMU only allows running on one cpu > * and that is normally CPU0. > */ > -static void invalid_init(void) > +static void invalid_init(int i915) > { > struct perf_event_attr attr; > > @@ -1093,7 +1098,7 @@ static void invalid_init(void) > do { \ > memset(&attr, 0, sizeof (attr)); \ > attr.config = I915_PMU_ENGINE_BUSY(I915_ENGINE_CLASS_RENDER, 0); \ > - attr.type = i915_type_id(); \ > + attr.type = i915_perf_type_id(i915); \ > igt_assert(attr.type != 0); \ > errno = 0; \ > } while(0) > @@ -1112,11 +1117,11 @@ do { \ > igt_assert_eq(errno, EINVAL); > } > > -static void init_other(unsigned int i, bool valid) > +static void init_other(int i915, unsigned int i, bool valid) > { > int fd; > > - fd = perf_i915_open(__I915_PMU_OTHER(i)); > + fd = perf_i915_open(i915, __I915_PMU_OTHER(i)); > igt_require(!(fd < 0 && errno == ENODEV)); > if (valid) { > igt_assert(fd >= 0); > @@ -1128,11 +1133,11 @@ static void init_other(unsigned int i, bool valid) > close(fd); > } > > -static void read_other(unsigned int i, bool valid) > +static void read_other(int i915, unsigned int i, bool valid) > { > int fd; > > - fd = perf_i915_open(__I915_PMU_OTHER(i)); > + fd = perf_i915_open(i915, __I915_PMU_OTHER(i)); > igt_require(!(fd < 0 && errno == ENODEV)); > if (valid) { > igt_assert(fd >= 0); > @@ -1163,7 +1168,8 @@ static void cpu_hotplug(int gem_fd) > > igt_require(cpu0_hotplug_support()); > > - fd = open_pmu(I915_PMU_ENGINE_BUSY(I915_ENGINE_CLASS_RENDER, 0)); > + fd = open_pmu(gem_fd, > + I915_PMU_ENGINE_BUSY(I915_ENGINE_CLASS_RENDER, 0)); > > /* > * Create two spinners so test can ensure shorter gaps in engine > @@ -1292,7 +1298,7 @@ test_interrupts(int gem_fd) > > gem_quiescent_gpu(gem_fd); > > - fd = open_pmu(I915_PMU_INTERRUPTS); > + fd = open_pmu(gem_fd, I915_PMU_INTERRUPTS); > > /* Queue spinning batches. */ > for (int i = 0; i < target; i++) { > @@ -1355,7 +1361,7 @@ test_interrupts_sync(int gem_fd) > > gem_quiescent_gpu(gem_fd); > > - fd = open_pmu(I915_PMU_INTERRUPTS); > + fd = open_pmu(gem_fd, I915_PMU_INTERRUPTS); > > /* Queue spinning batches. */ > for (int i = 0; i < target; i++) > @@ -1409,8 +1415,8 @@ test_frequency(int gem_fd) > igt_require(max_freq > min_freq); > igt_require(boost_freq > min_freq); > > - fd = open_group(I915_PMU_REQUESTED_FREQUENCY, -1); > - open_group(I915_PMU_ACTUAL_FREQUENCY, fd); > + fd = open_group(gem_fd, I915_PMU_REQUESTED_FREQUENCY, -1); > + open_group(gem_fd, I915_PMU_ACTUAL_FREQUENCY, fd); > > /* > * Set GPU to min frequency and read PMU counters. > @@ -1499,8 +1505,8 @@ test_frequency_idle(int gem_fd) > > /* While parked, our convention is to report the GPU at 0Hz */ > > - fd = open_group(I915_PMU_REQUESTED_FREQUENCY, -1); > - open_group(I915_PMU_ACTUAL_FREQUENCY, fd); > + fd = open_group(gem_fd, I915_PMU_REQUESTED_FREQUENCY, -1); > + open_group(gem_fd, I915_PMU_ACTUAL_FREQUENCY, fd); > > gem_quiescent_gpu(gem_fd); /* Be idle! */ > measured_usleep(2000); /* Wait for timers to cease */ > @@ -1554,7 +1560,7 @@ test_rc6(int gem_fd, unsigned int flags) > > gem_quiescent_gpu(gem_fd); > > - fd = open_pmu(I915_PMU_RC6_RESIDENCY); > + fd = open_pmu(gem_fd, I915_PMU_RC6_RESIDENCY); > > if (flags & TEST_RUNTIME_PM) { > drmModeRes *res; > @@ -1651,7 +1657,7 @@ test_enable_race(int gem_fd, const struct intel_execution_engine2 *e) > usleep(500e3); > > /* Enable the PMU. */ > - fd = open_pmu(config); > + fd = open_pmu(gem_fd, config); > > /* Stop load and close the PMU. */ > igt_stop_helper(&engine_load); > @@ -1797,7 +1803,7 @@ accuracy(int gem_fd, const struct intel_execution_engine2 *e, > igt_spin_free(gem_fd, spin); > } > > - fd = open_pmu(I915_PMU_ENGINE_BUSY(e->class, e->instance)); > + fd = open_pmu(gem_fd, I915_PMU_ENGINE_BUSY(e->class, e->instance)); > > /* Let the child run. */ > read(link[0], &expected, sizeof(expected)); > @@ -1835,7 +1841,7 @@ igt_main > fd = drm_open_driver_master(DRIVER_INTEL); > > igt_require_gem(fd); > - igt_require(i915_type_id() > 0); > + igt_require(i915_perf_type_id(fd) > 0); > > __for_each_physical_engine(fd, e) > num_engines++; > @@ -1845,7 +1851,7 @@ igt_main > * Test invalid access via perf API is rejected. > */ > igt_subtest("invalid-init") > - invalid_init(); > + invalid_init(fd); > > __for_each_physical_engine(fd, e) { > const unsigned int pct[] = { 2, 50, 98 }; > @@ -1996,10 +2002,10 @@ igt_main > */ > for (i = 0; i < num_other_metrics + 1; i++) { > igt_subtest_f("other-init-%u", i) > - init_other(i, i < num_other_metrics); > + init_other(fd, i, i < num_other_metrics); > > igt_subtest_f("other-read-%u", i) > - read_other(i, i < num_other_metrics); > + read_other(fd, i, i < num_other_metrics); > } > > /** > diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c > index cc8db7c53..8197482dd 100644 > --- a/tools/intel_gpu_top.c > +++ b/tools/intel_gpu_top.c > @@ -423,7 +423,7 @@ static const char *imc_data_writes_unit(void) > ({ \ > int fd__; \ > \ > - fd__ = perf_i915_open_group((pmu)->config, (fd)); \ > + fd__ = perf_igfx_open_group((pmu)->config, (fd)); \ > if (fd__ >= 0) { \ > if ((fd) == -1) \ > (fd) = fd__; \ > _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v3] i915/perf: Find the associated perf-type for a particular device 2020-01-14 10:09 ` [igt-dev] [PATCH i-g-t v3] i915/perf: Find the associated perf-type for a particular device Tvrtko Ursulin @ 2020-01-14 10:15 ` Chris Wilson 2020-01-14 10:21 ` Tvrtko Ursulin 0 siblings, 1 reply; 6+ messages in thread From: Chris Wilson @ 2020-01-14 10:15 UTC (permalink / raw) To: Tvrtko Ursulin, intel-gfx; +Cc: igt-dev, Tvrtko Ursulin Quoting Tvrtko Ursulin (2020-01-14 10:09:15) > > On 10/01/2020 11:53, Chris Wilson wrote: > > -uint64_t i915_type_id(void) > > +static char *bus_address(int i915, char *path, int pathlen) > > +{ > > + struct stat st; > > + int len = -1; > > + int dir; > > + char *s; > > + > > + if (fstat(i915, &st) || !S_ISCHR(st.st_mode)) > > + return NULL; > > + > > + snprintf(path, pathlen, "/sys/dev/char/%d:%d", > > + major(st.st_rdev), minor(st.st_rdev)); > > + > > + dir = open(path, O_RDONLY); > > + if (dir != -1) { > > + len = readlinkat(dir, "device", path, pathlen - 1); > > + close(dir); > > + } > > + if (len < 0) > > + return NULL; > > + > > + path[len] = '\0'; > > In the realm of hypothetical but an assert that no truncation occurred > would be good. > > if (len == pathlen - 1) > return NULL; > > ? > > Although it is not clear to me from man readlinkat how do we distinguish > between truncation and exact fit. > > Or you were counting on failure at a later step if truncation occurred? I did not expect a partial match to ever succeed. We at least know for the moment the names are fixed. > Maybe try stat(2) in this wrapper to be sure function returns a valid path? That would have the same danger of a partial match. I think the foolproof solution here is having pmu_name in /sys/class/drm/cardN/pmu_name. (Or rather /sys/dev/char/%d:%d/device/pnu_name. :) -Chris _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v3] i915/perf: Find the associated perf-type for a particular device 2020-01-14 10:15 ` Chris Wilson @ 2020-01-14 10:21 ` Tvrtko Ursulin 0 siblings, 0 replies; 6+ messages in thread From: Tvrtko Ursulin @ 2020-01-14 10:21 UTC (permalink / raw) To: Chris Wilson, intel-gfx; +Cc: igt-dev, Tvrtko Ursulin On 14/01/2020 10:15, Chris Wilson wrote: > Quoting Tvrtko Ursulin (2020-01-14 10:09:15) >> >> On 10/01/2020 11:53, Chris Wilson wrote: >>> -uint64_t i915_type_id(void) >>> +static char *bus_address(int i915, char *path, int pathlen) >>> +{ >>> + struct stat st; >>> + int len = -1; >>> + int dir; >>> + char *s; >>> + >>> + if (fstat(i915, &st) || !S_ISCHR(st.st_mode)) >>> + return NULL; >>> + >>> + snprintf(path, pathlen, "/sys/dev/char/%d:%d", >>> + major(st.st_rdev), minor(st.st_rdev)); >>> + >>> + dir = open(path, O_RDONLY); >>> + if (dir != -1) { >>> + len = readlinkat(dir, "device", path, pathlen - 1); >>> + close(dir); >>> + } >>> + if (len < 0) >>> + return NULL; >>> + >>> + path[len] = '\0'; >> >> In the realm of hypothetical but an assert that no truncation occurred >> would be good. >> >> if (len == pathlen - 1) >> return NULL; >> >> ? >> >> Although it is not clear to me from man readlinkat how do we distinguish >> between truncation and exact fit. >> >> Or you were counting on failure at a later step if truncation occurred? > > I did not expect a partial match to ever succeed. We at least know for > the moment the names are fixed. > >> Maybe try stat(2) in this wrapper to be sure function returns a valid path? > > That would have the same danger of a partial match. True, it would need more string validation - that the returned string matches the PCI bus address format of xxxx:yy:zz. Failure at a later step works for now I guess. Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > I think the foolproof solution here is having pmu_name in > /sys/class/drm/cardN/pmu_name. (Or rather > /sys/dev/char/%d:%d/device/pnu_name. :) True. Regards, Tvrtko _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-01-14 10:21 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-01-10 11:53 [igt-dev] [PATCH i-g-t v3] i915/perf: Find the associated perf-type for a particular device Chris Wilson 2020-01-10 14:08 ` [igt-dev] ✓ Fi.CI.BAT: success for i915/perf: Find the associated perf-type for a particular device (rev4) Patchwork 2020-01-13 21:41 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork 2020-01-14 10:09 ` [igt-dev] [PATCH i-g-t v3] i915/perf: Find the associated perf-type for a particular device Tvrtko Ursulin 2020-01-14 10:15 ` Chris Wilson 2020-01-14 10:21 ` Tvrtko Ursulin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox