Skip to contentSkip to conversation

IGT PMU support

PATCH Superseded Tvrtko Ursulin 5 participants 17 messages Sep 29, 2017 – Oct 9, 2017

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover IGT PMU support

From: Tvrtko Ursulin <[email protected]>

1.
Fixes for intel-gpu-overlay to work on top of the proposed i915 PMU perf API.

2.
New test to exercise the same API.

3.
Update to gem_wsim and media-bench.pl to be able to use engine busyness via PMU for making balancing decisions.

v2:
* Added gem_wsim and media-bench.pl patches.
* Comments and fixes for the perf_pmu test.

v3:
* A bunch of review feedback implemented.

TODO:
* Tests for wait/sema metrics.
* RAPL PMU access for intel-gpu-overlay.

Tvrtko Ursulin (7):
intel-gpu-overlay: Move local perf implementation to a library
intel-gpu-overlay: Consolidate perf PMU access to library
intel-gpu-overlay: Fix interrupts PMU readout
intel-gpu-overlay: Catch-up to new i915 PMU tests/perf_pmu: Tests for i915 PMU API
gem_wsim: Busy stats balancers
media-bench.pl: Add busy balancers to the list

 benchmarks/Makefile.am   |   2 +-
 benchmarks/gem_wsim.c    | 142 +++++++
 lib/Makefile.am          |   6 +-
 lib/igt_gt.c             |  50 +++
 lib/igt_gt.h             |  38 ++
 lib/igt_perf.c           |  58 +++
 lib/igt_perf.h           |  96 +++++
 overlay/Makefile.am      |   6 +-
 overlay/gem-interrupts.c |  25 +-
 overlay/gpu-freq.c       |  29 +-
 overlay/gpu-perf.c       |   3 +-
 overlay/gpu-top.c        |  87 ++---
 overlay/perf.c           |  26 --
 overlay/perf.h           |  64 ----
 overlay/power.c          |  22 +-
 overlay/rc6.c            |  41 +-
 scripts/media-bench.pl   |   5 +-
 tests/Makefile.am        |   1 +
 tests/Makefile.sources   |   1 +
 tests/perf_pmu.c         | 957 +++++++++++++++++++++++++++++++++++++++++++++++
 20 files changed, 1425 insertions(+), 234 deletions(-)
 create mode 100644 lib/igt_perf.c
 create mode 100644 lib/igt_perf.h
 delete mode 100644 overlay/perf.c
 delete mode 100644 overlay/perf.h
 create mode 100644 tests/perf_pmu.c
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH v3 1/7 intel-gpu-overlay: Move local perf implementation to a library

From: Tvrtko Ursulin <[email protected]>

Idea is to avoid duplication across multiple users in upcoming patches.

v2: Commit message and use a separate library instead of piggy-
backing to libintel_tools. (Chris Wilson)

---
 lib/Makefile.am                  | 6 +++++-
 overlay/perf.c => lib/igt_perf.c | 2 +-
 overlay/perf.h => lib/igt_perf.h | 2 ++
 overlay/Makefile.am              | 6 ++----
 overlay/gem-interrupts.c         | 3 ++-
 overlay/gpu-freq.c               | 3 ++-
 overlay/gpu-perf.c               | 3 ++-
 overlay/gpu-top.c                | 3 ++-
 overlay/power.c                  | 3 ++-
 overlay/rc6.c                    | 3 ++-
 10 files changed, 22 insertions(+), 12 deletions(-)
 rename overlay/perf.c => lib/igt_perf.c (94%)
 rename overlay/perf.h => lib/igt_perf.h (99%)
lib/Makefile.am +5 -1
index 6509593db1c7..e6edd9448e8d 100644
@@ -7,7 +7,11 @@ include Makefile.sources
 
 libintel_tools_la_SOURCES = $(lib_source_list)
 
-noinst_LTLIBRARIES = libintel_tools.la
+libigt_perf_la_SOURCES = \
+	igt_perf.c	 \
+	igt_perf.h
+
+noinst_LTLIBRARIES = libintel_tools.la libigt_perf.la
 noinst_HEADERS = check-ndebug.h
 
 if HAVE_LIBDRM_VC4
lib/igt_perf.c renamed from overlay/perf.c +1 -1
similarity index 94%
rename from overlay/perf.c
rename to lib/igt_perf.c
index b8fdc675c587..45cccff0ae53 100644
@@ -3,7 +3,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 
-#include "perf.h"
+#include "igt_perf.h"
 
 uint64_t i915_type_id(void)
 {
lib/igt_perf.h renamed from overlay/perf.h +2 -0
similarity index 99%
rename from overlay/perf.h
rename to lib/igt_perf.h
index c44e65f9734c..a80b311cd1d1 100644
@@ -1,6 +1,8 @@
 #ifndef I915_PERF_H
 #define I915_PERF_H
 
+#include <stdint.h>
+
 #include <linux/perf_event.h>
 
 #define I915_SAMPLE_BUSY	0
overlay/Makefile.am +2 -4
index 5472514efc16..e4e78bb33cd6 100644
@@ -4,8 +4,8 @@ endif
 
 AM_CPPFLAGS = -I.
 AM_CFLAGS = $(DRM_CFLAGS) $(PCIACCESS_CFLAGS) $(CWARNFLAGS) \
-	$(CAIRO_CFLAGS) $(OVERLAY_CFLAGS) $(WERROR_CFLAGS)
-LDADD = $(DRM_LIBS) $(PCIACCESS_LIBS) $(CAIRO_LIBS) $(OVERLAY_LIBS)
+	$(CAIRO_CFLAGS) $(OVERLAY_CFLAGS) $(WERROR_CFLAGS) -I$(srcdir)/../lib
+LDADD = $(DRM_LIBS) $(PCIACCESS_LIBS) $(CAIRO_LIBS) $(OVERLAY_LIBS) $(top_builddir)/lib/libigt_perf.la
 
 intel_gpu_overlay_SOURCES = \
 	chart.h \
@@ -29,8 +29,6 @@ intel_gpu_overlay_SOURCES = \
 	igfx.c \
 	overlay.h \
 	overlay.c \
-	perf.h \
-	perf.c \
 	power.h \
 	power.c \
 	rc6.h \
overlay/gem-interrupts.c +2 -1
index 0150a1d03825..7ba54fcd487d 100644
@@ -31,9 +31,10 @@
 #include <string.h>
 #include <ctype.h>
 
+#include "igt_perf.h"
+
 #include "gem-interrupts.h"
 #include "debugfs.h"
-#include "perf.h"
 
 static int perf_open(void)
 {
overlay/gpu-freq.c +2 -1
index 321c93882238..7f29b1aa986e 100644
@@ -28,9 +28,10 @@
 #include <string.h>
 #include <stdio.h>
 
+#include "igt_perf.h"
+
 #include "gpu-freq.h"
 #include "debugfs.h"
-#include "perf.h"
 
 static int perf_i915_open(int config, int group)
 {
overlay/gpu-perf.c +2 -1
index f557b9f06a17..3d4a9be91a94 100644
@@ -34,7 +34,8 @@
 #include <fcntl.h>
 #include <errno.h>
 
-#include "perf.h"
+#include "igt_perf.h"
+
 #include "gpu-perf.h"
 #include "debugfs.h"
 
overlay/gpu-top.c +2 -1
index 891a7ea7c0b1..06f489dfdc83 100644
@@ -31,7 +31,8 @@
 #include <errno.h>
 #include <assert.h>
 
-#include "perf.h"
+#include "igt_perf.h"
+
 #include "igfx.h"
 #include "gpu-top.h"
 
overlay/power.c +2 -1
index 2f1521b82cd6..84d860cae40c 100644
@@ -31,7 +31,8 @@
 #include <time.h>
 #include <errno.h>
 
-#include "perf.h"
+#include "igt_perf.h"
+
 #include "power.h"
 #include "debugfs.h"
 
overlay/rc6.c +2 -1
index d7047c2f4880..3175bb22308f 100644
@@ -31,8 +31,9 @@
 #include <time.h>
 #include <errno.h>
 
+#include "igt_perf.h"
+
 #include "rc6.h"
-#include "perf.h"
 
 static int perf_i915_open(int config, int group)
 {
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

PATCH v3 2/7 intel-gpu-overlay: Consolidate perf PMU access to library

In reply to Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Various tool modules implement their owm PMU open wrapper which can be replaced by calling the library one.

v2:
* Remove extra newline. (Chris Wilson)
* Commit msg.

---
 lib/igt_perf.c           | 32 ++++++++++++++++++++++++++++++++
 lib/igt_perf.h           |  2 ++
 overlay/gem-interrupts.c | 16 +---------------
 overlay/gpu-freq.c       | 22 ++--------------------
 overlay/gpu-top.c        | 32 ++++++++------------------------
 overlay/power.c          | 17 +----------------
 overlay/rc6.c            | 24 +++---------------------
 7 files changed, 49 insertions(+), 96 deletions(-)
lib/igt_perf.c +32 -0
index 45cccff0ae53..961a858af9e3 100644
@@ -2,6 +2,8 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <string.h>
+#include <errno.h>
 
 #include "igt_perf.h"
 
@@ -24,3 +26,33 @@ uint64_t i915_type_id(void)
 	return strtoull(buf, 0, 0);
 }
 
+static int _perf_open(int config, int group, int format)
+{
+	struct perf_event_attr attr;
+
+	memset(&attr, 0, sizeof (attr));
+
+	attr.type = i915_type_id();
+	if (attr.type == 0)
+		return -ENOENT;
+
+	attr.config = config;
+
+	if (group >= 0)
+		format &= ~PERF_FORMAT_GROUP;
+
+	attr.read_format = format;
+
+	return perf_event_open(&attr, -1, 0, group, 0);
+}
+
+int perf_i915_open(int config)
+{
+	return _perf_open(config, -1, PERF_FORMAT_TOTAL_TIME_ENABLED);
+}
+
+int perf_i915_open_group(int config, int group)
+{
+	return _perf_open(config, group,
+			  PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP);
+}
lib/igt_perf.h +2 -0
index a80b311cd1d1..8e674c3a3755 100644
@@ -62,5 +62,7 @@ perf_event_open(struct perf_event_attr *attr,
 }
 
 uint64_t i915_type_id(void);
+int perf_i915_open(int config);
+int perf_i915_open_group(int config, int group);
 
 #endif /* I915_PERF_H */
overlay/gem-interrupts.c +1 -15
index 7ba54fcd487d..a84aef0398a7 100644
@@ -36,20 +36,6 @@
 #include "gem-interrupts.h"
 #include "debugfs.h"
 
-static int perf_open(void)
-{
-	struct perf_event_attr attr;
-
-	memset(&attr, 0, sizeof (attr));
-
-	attr.type = i915_type_id();
-	if (attr.type == 0)
-		return -ENOENT;
-	attr.config = I915_PERF_INTERRUPTS;
-
-	return perf_event_open(&attr, -1, 0, -1, 0);
-}
-
 static long long debugfs_read(void)
 {
 	char buf[8192], *b;
@@ -127,7 +113,7 @@ int gem_interrupts_init(struct gem_interrupts *irqs)
 {
 	memset(irqs, 0, sizeof(*irqs));
 
-	irqs->fd = perf_open();
+	irqs->fd = perf_i915_open(I915_PERF_INTERRUPTS);
 	if (irqs->fd < 0 && interrupts_read() < 0)
 		irqs->error = ENODEV;
 
overlay/gpu-freq.c +2 -20
index 7f29b1aa986e..76c5ed9acfd1 100644
@@ -33,30 +33,12 @@
 #include "gpu-freq.h"
 #include "debugfs.h"
 
-static int perf_i915_open(int config, int group)
-{
-	struct perf_event_attr attr;
-
-	memset(&attr, 0, sizeof (attr));
-
-	attr.type = i915_type_id();
-	if (attr.type == 0)
-		return -ENOENT;
-	attr.config = config;
-
-	attr.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED;
-	if (group == -1)
-		attr.read_format |= PERF_FORMAT_GROUP;
-
-	return perf_event_open(&attr, -1, 0, group, 0);
-}
-
 static int perf_open(void)
 {
 	int fd;
 
-	fd = perf_i915_open(I915_PERF_ACTUAL_FREQUENCY, -1);
-	if (perf_i915_open(I915_PERF_REQUESTED_FREQUENCY, fd) < 0) {
+	fd = perf_i915_open_group(I915_PERF_ACTUAL_FREQUENCY, -1);
+	if (perf_i915_open_group(I915_PERF_REQUESTED_FREQUENCY, fd) < 0) {
 		close(fd);
 		fd = -1;
 	}
overlay/gpu-top.c +8 -24
index 06f489dfdc83..812f47d5aced 100644
@@ -48,24 +48,6 @@
 #define I915_PERF_RING_WAIT(n) (__I915_PERF_RING(n) + 1)
 #define I915_PERF_RING_SEMA(n) (__I915_PERF_RING(n) + 2)
 
-static int perf_i915_open(int config, int group)
-{
-	struct perf_event_attr attr;
-
-	memset(&attr, 0, sizeof (attr));
-
-	attr.type = i915_type_id();
-	if (attr.type == 0)
-		return -ENOENT;
-	attr.config = config;
-
-	attr.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED;
-	if (group == -1)
-		attr.read_format |= PERF_FORMAT_GROUP;
-
-	return perf_event_open(&attr, -1, 0, group, 0);
-}
-
 static int perf_init(struct gpu_top *gt)
 {
 	const char *names[] = {
@@ -77,27 +59,29 @@ static int perf_init(struct gpu_top *gt)
 	};
 	int n;
 
-	gt->fd = perf_i915_open(I915_PERF_RING_BUSY(0), -1);
+	gt->fd = perf_i915_open_group(I915_PERF_RING_BUSY(0), -1);
 	if (gt->fd < 0)
 		return -1;
 
-	if (perf_i915_open(I915_PERF_RING_WAIT(0), gt->fd) >= 0)
+	if (perf_i915_open_group(I915_PERF_RING_WAIT(0), gt->fd) >= 0)
 		gt->have_wait = 1;
 
-	if (perf_i915_open(I915_PERF_RING_SEMA(0), gt->fd) >= 0)
+	if (perf_i915_open_group(I915_PERF_RING_SEMA(0), gt->fd) >= 0)
 		gt->have_sema = 1;
 
 	gt->ring[0].name = names[0];
 	gt->num_rings = 1;
 
 	for (n = 1; names[n]; n++) {
-		if (perf_i915_open(I915_PERF_RING_BUSY(n), gt->fd) >= 0) {
+		if (perf_i915_open_group(I915_PERF_RING_BUSY(n), gt->fd) >= 0) {
 			if (gt->have_wait &&
-			    perf_i915_open(I915_PERF_RING_WAIT(n), gt->fd) < 0)
+			    perf_i915_open_group(I915_PERF_RING_WAIT(n),
+						 gt->fd) < 0)
 				return -1;
 
 			if (gt->have_sema &&
-			    perf_i915_open(I915_PERF_RING_SEMA(n), gt->fd) < 0)
+			    perf_i915_open_group(I915_PERF_RING_SEMA(n),
+						 gt->fd) < 0)
 				return -1;
 
 			gt->ring[gt->num_rings++].name = names[n];
overlay/power.c +1 -16
index 84d860cae40c..dd4aec6bffd9 100644
@@ -38,21 +38,6 @@
 
 /* XXX Is this exposed through RAPL? */
 
-static int perf_open(void)
-{
-	struct perf_event_attr attr;
-
-	memset(&attr, 0, sizeof (attr));
-
-	attr.type = i915_type_id();
-	if (attr.type == 0)
-		return -1;
-	attr.config = I915_PERF_ENERGY;
-
-	attr.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED;
-	return perf_event_open(&attr, -1, 0, -1, 0);
-}
-
 int power_init(struct power *power)
 {
 	char buf[4096];
@@ -60,7 +45,7 @@ int power_init(struct power *power)
 
 	memset(power, 0, sizeof(*power));
 
-	power->fd = perf_open();
+	power->fd = perf_i915_open(I915_PERF_ENERGY);
 	if (power->fd != -1)
 		return 0;
 
overlay/rc6.c +3 -21
index 3175bb22308f..46c975a557ff 100644
@@ -35,24 +35,6 @@
 
 #include "rc6.h"
 
-static int perf_i915_open(int config, int group)
-{
-	struct perf_event_attr attr;
-
-	memset(&attr, 0, sizeof (attr));
-
-	attr.type = i915_type_id();
-	if (attr.type == 0)
-		return -ENOENT;
-	attr.config = config;
-
-	attr.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED;
-	if (group == -1)
-		attr.read_format |= PERF_FORMAT_GROUP;
-
-	return perf_event_open(&attr, -1, 0, group, 0);
-}
-
 #define RC6	(1<<0)
 #define RC6p	(1<<1)
 #define RC6pp	(1<<2)
@@ -61,15 +43,15 @@ static int perf_open(unsigned *flags)
 {
 	int fd;
 
-	fd = perf_i915_open(I915_PERF_RC6_RESIDENCY, -1);
+	fd = perf_i915_open_group(I915_PERF_RC6_RESIDENCY, -1);
 	if (fd < 0)
 		return -1;
 
 	*flags |= RC6;
-	if (perf_i915_open(I915_PERF_RC6p_RESIDENCY, fd) >= 0)
+	if (perf_i915_open_group(I915_PERF_RC6p_RESIDENCY, fd) >= 0)
 		*flags |= RC6p;
 
-	if (perf_i915_open(I915_PERF_RC6pp_RESIDENCY, fd) >= 0)
+	if (perf_i915_open_group(I915_PERF_RC6pp_RESIDENCY, fd) >= 0)
 		*flags |= RC6pp;
 
 	return fd;
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

PATCH v3 3/7 intel-gpu-overlay: Fix interrupts PMU readout

In reply to Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

---
 overlay/gem-interrupts.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
overlay/gem-interrupts.c +5 -1
index a84aef0398a7..3eda24f4d7eb 100644
@@ -136,8 +136,12 @@ int gem_interrupts_update(struct gem_interrupts *irqs)
 		else
 			val = ret;
 	} else {
-		if (read(irqs->fd, &val, sizeof(val)) < 0)
+		uint64_t data[2];
+
+		if (read(irqs->fd, &data, sizeof(data)) < 0)
 			return irqs->error = errno;
+
+		val = data[0];
 	}
 
 	update = irqs->last_count == 0;
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

PATCH v3 4/7 intel-gpu-overlay: Catch-up to new i915 PMU

In reply to Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

v2: Update for i915 changes.

---
 lib/igt_perf.h           | 89 +++++++++++++++++++++++++++++++++---------------
 overlay/gem-interrupts.c |  2 +-
 overlay/gpu-freq.c       |  8 ++---
 overlay/gpu-top.c        | 68 ++++++++++++++++++++----------------
 overlay/power.c          |  4 +--
 overlay/rc6.c            | 20 +++++------
 6 files changed, 116 insertions(+), 75 deletions(-)
lib/igt_perf.h +62 -27
index 8e674c3a3755..e38171da5261 100644
@@ -1,3 +1,27 @@
+/*
+ * Copyright © 2017 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
 #ifndef I915_PERF_H
 #define I915_PERF_H
 
@@ -5,41 +29,52 @@
 
 #include <linux/perf_event.h>
 
-#define I915_SAMPLE_BUSY	0
-#define I915_SAMPLE_WAIT	1
-#define I915_SAMPLE_SEMA	2
+enum drm_i915_gem_engine_class {
+	I915_ENGINE_CLASS_OTHER = 0,
+	I915_ENGINE_CLASS_RENDER = 1,
+	I915_ENGINE_CLASS_COPY = 2,
+	I915_ENGINE_CLASS_VIDEO = 3,
+	I915_ENGINE_CLASS_VIDEO_ENHANCE = 4,
+	I915_ENGINE_CLASS_MAX /* non-ABI */
+};
+
+enum drm_i915_pmu_engine_sample {
+	I915_SAMPLE_BUSY = 0,
+	I915_SAMPLE_WAIT = 1,
+	I915_SAMPLE_SEMA = 2,
+	I915_ENGINE_SAMPLE_MAX /* non-ABI */
+};
 
-#define I915_SAMPLE_RCS		0
-#define I915_SAMPLE_VCS		1
-#define I915_SAMPLE_BCS		2
-#define I915_SAMPLE_VECS	3
+#define I915_PMU_SAMPLE_BITS (4)
+#define I915_PMU_SAMPLE_MASK (0xf)
+#define I915_PMU_SAMPLE_INSTANCE_BITS (8)
+#define I915_PMU_CLASS_SHIFT \
+	(I915_PMU_SAMPLE_BITS + I915_PMU_SAMPLE_INSTANCE_BITS)
 
-#define __I915_PERF_COUNT(ring, id) ((ring) << 4 | (id))
+#define __I915_PMU_ENGINE(class, instance, sample) \
+	((class) << I915_PMU_CLASS_SHIFT | \
+	(instance) << I915_PMU_SAMPLE_BITS | \
+	(sample))
 
-#define I915_PERF_COUNT_RCS_BUSY __I915_PERF_COUNT(I915_SAMPLE_RCS, I915_SAMPLE_BUSY)
-#define I915_PERF_COUNT_RCS_WAIT __I915_PERF_COUNT(I915_SAMPLE_RCS, I915_SAMPLE_WAIT)
-#define I915_PERF_COUNT_RCS_SEMA __I915_PERF_COUNT(I915_SAMPLE_RCS, I915_SAMPLE_SEMA)
+#define I915_PMU_ENGINE_BUSY(class, instance) \
+	__I915_PMU_ENGINE(class, instance, I915_SAMPLE_BUSY)
 
-#define I915_PERF_COUNT_VCS_BUSY __I915_PERF_COUNT(I915_SAMPLE_VCS, I915_SAMPLE_BUSY)
-#define I915_PERF_COUNT_VCS_WAIT __I915_PERF_COUNT(I915_SAMPLE_VCS, I915_SAMPLE_WAIT)
-#define I915_PERF_COUNT_VCS_SEMA __I915_PERF_COUNT(I915_SAMPLE_VCS, I915_SAMPLE_SEMA)
+#define I915_PMU_ENGINE_WAIT(class, instance) \
+	__I915_PMU_ENGINE(class, instance, I915_SAMPLE_WAIT)
 
-#define I915_PERF_COUNT_BCS_BUSY __I915_PERF_COUNT(I915_SAMPLE_BCS, I915_SAMPLE_BUSY)
-#define I915_PERF_COUNT_BCS_WAIT __I915_PERF_COUNT(I915_SAMPLE_BCS, I915_SAMPLE_WAIT)
-#define I915_PERF_COUNT_BCS_SEMA __I915_PERF_COUNT(I915_SAMPLE_BCS, I915_SAMPLE_SEMA)
+#define I915_PMU_ENGINE_SEMA(class, instance) \
+	__I915_PMU_ENGINE(class, instance, I915_SAMPLE_SEMA)
 
-#define I915_PERF_COUNT_VECS_BUSY __I915_PERF_COUNT(I915_SAMPLE_VECS, I915_SAMPLE_BUSY)
-#define I915_PERF_COUNT_VECS_WAIT __I915_PERF_COUNT(I915_SAMPLE_VECS, I915_SAMPLE_WAIT)
-#define I915_PERF_COUNT_VECS_SEMA __I915_PERF_COUNT(I915_SAMPLE_VECS, I915_SAMPLE_SEMA)
+#define __I915_PMU_OTHER(x) (__I915_PMU_ENGINE(0xff, 0xff, 0xf) + 1 + (x))
 
-#define I915_PERF_ACTUAL_FREQUENCY 32
-#define I915_PERF_REQUESTED_FREQUENCY 33
-#define I915_PERF_ENERGY 34
-#define I915_PERF_INTERRUPTS 35
+#define I915_PMU_ACTUAL_FREQUENCY	__I915_PMU_OTHER(0)
+#define I915_PMU_REQUESTED_FREQUENCY	__I915_PMU_OTHER(1)
+#define I915_PMU_INTERRUPTS		__I915_PMU_OTHER(2)
+#define I915_PMU_RC6_RESIDENCY		__I915_PMU_OTHER(3)
+#define I915_PMU_RC6p_RESIDENCY		__I915_PMU_OTHER(4)
+#define I915_PMU_RC6pp_RESIDENCY	__I915_PMU_OTHER(5)
 
-#define I915_PERF_RC6_RESIDENCY		40
-#define I915_PERF_RC6p_RESIDENCY	41
-#define I915_PERF_RC6pp_RESIDENCY	42
+#define I915_PMU_LAST I915_PMU_RC6pp_RESIDENCY
 
 static inline int
 perf_event_open(struct perf_event_attr *attr,
overlay/gem-interrupts.c +1 -1
index 3eda24f4d7eb..add4a9dfd725 100644
@@ -113,7 +113,7 @@ int gem_interrupts_init(struct gem_interrupts *irqs)
 {
 	memset(irqs, 0, sizeof(*irqs));
 
-	irqs->fd = perf_i915_open(I915_PERF_INTERRUPTS);
+	irqs->fd = perf_i915_open(I915_PMU_INTERRUPTS);
 	if (irqs->fd < 0 && interrupts_read() < 0)
 		irqs->error = ENODEV;
 
overlay/gpu-freq.c +4 -4
index 76c5ed9acfd1..2a8e02f68ce5 100644
@@ -37,8 +37,8 @@ static int perf_open(void)
 {
 	int fd;
 
-	fd = perf_i915_open_group(I915_PERF_ACTUAL_FREQUENCY, -1);
-	if (perf_i915_open_group(I915_PERF_REQUESTED_FREQUENCY, fd) < 0) {
+	fd = perf_i915_open_group(I915_PMU_ACTUAL_FREQUENCY, -1);
+	if (perf_i915_open_group(I915_PMU_REQUESTED_FREQUENCY, fd) < 0) {
 		close(fd);
 		fd = -1;
 	}
@@ -176,8 +176,8 @@ int gpu_freq_update(struct gpu_freq *gf)
 			return EAGAIN;
 		}
 
-		gf->current = (s->act - d->act) / d_time;
-		gf->request = (s->req - d->req) / d_time;
+		gf->current = (s->act - d->act) * 1000000000 / d_time;
+		gf->request = (s->req - d->req) * 1000000000 / d_time;
 	}
 
 	return 0;
overlay/gpu-top.c +38 -30

87 lines not on this page · raw message

overlay/power.c +1 -3
index dd4aec6bffd9..805f4ca7805c 100644
@@ -45,9 +45,7 @@ int power_init(struct power *power)
 
 	memset(power, 0, sizeof(*power));
 
-	power->fd = perf_i915_open(I915_PERF_ENERGY);
-	if (power->fd != -1)
-		return 0;
+	power->fd = -1;
 
 	sprintf(buf, "%s/i915_energy_uJ", debugfs_dri_path);
 	fd = open(buf, 0);
overlay/rc6.c +10 -10
index 46c975a557ff..57abea41b3c6 100644
@@ -43,15 +43,15 @@ static int perf_open(unsigned *flags)
 {
 	int fd;
 
-	fd = perf_i915_open_group(I915_PERF_RC6_RESIDENCY, -1);
+	fd = perf_i915_open_group(I915_PMU_RC6_RESIDENCY, -1);
 	if (fd < 0)
 		return -1;
 
 	*flags |= RC6;
-	if (perf_i915_open_group(I915_PERF_RC6p_RESIDENCY, fd) >= 0)
+	if (perf_i915_open_group(I915_PMU_RC6p_RESIDENCY, fd) >= 0)
 		*flags |= RC6p;
 
-	if (perf_i915_open_group(I915_PERF_RC6pp_RESIDENCY, fd) >= 0)
+	if (perf_i915_open_group(I915_PMU_RC6pp_RESIDENCY, fd) >= 0)
 		*flags |= RC6pp;
 
 	return fd;
@@ -132,11 +132,11 @@ int rc6_update(struct rc6 *rc6)
 
 		len = 2;
 		if (rc6->flags & RC6)
-			s->rc6_residency = data[len++];
+			s->rc6_residency = data[len++] / 1000000;
 		if (rc6->flags & RC6p)
-			s->rc6p_residency = data[len++];
+			s->rc6p_residency = data[len++] / 1000000;
 		if (rc6->flags & RC6pp)
-			s->rc6pp_residency = data[len++];
+			s->rc6pp_residency = data[len++] / 1000000;
 	}
 
 	if (rc6->count == 1)
@@ -149,14 +149,14 @@ int rc6_update(struct rc6 *rc6)
 	}
 
 	d_rc6 = s->rc6_residency - d->rc6_residency;
-	rc6->rc6 = (100 * d_rc6 + d_time/2) / d_time;
+	rc6->rc6 = 100 * d_rc6 / d_time;
 
 	d_rc6p = s->rc6p_residency - d->rc6p_residency;
-	rc6->rc6p = (100 * d_rc6p + d_time/2) / d_time;
+	rc6->rc6p = 100 * d_rc6p / d_time;
 
 	d_rc6pp = s->rc6pp_residency - d->rc6pp_residency;
-	rc6->rc6pp = (100 * d_rc6pp + d_time/2) / d_time;
+	rc6->rc6pp = 100 * d_rc6pp / d_time;
 
-	rc6->rc6_combined = (100 * (d_rc6 + d_rc6p + d_rc6pp) + d_time/2) / d_time;
+	rc6->rc6_combined = 100 * (d_rc6 + d_rc6p + d_rc6pp) / d_time;
 	return 0;
 }
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

PATCH v3 5/7 tests/perf_pmu: Tests for i915 PMU API

In reply to Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

A bunch of tests for the new i915 PMU feature.

Parts of the code were initialy sketched by Dmitry Rogozhkin.

v2: (Most suggestions by Chris Wilson)
* Add new class/instance based engine list.
* Add gem_has_engine/gem_require_engine to work with class/instance.
* Use the above two throughout the test.
* Shorten tests to 100ms busy batches, seems enough.
* Add queued counter sanity checks.
* Use igt_nsec_elapsed.
* Skip on perf -ENODEV in some tests instead of embedding knowledge locally.
* Fix multi ordering for busy accounting.
* Use new guranteed_usleep when sleep time is asserted on.
* Check for no queued when idle/busy.
* Add queued counter init test.
* Add queued tests.
* Consolidate and increase multiple busy engines tests to most-busy and all-busy tests.
* Guarantte interrupts by using fences.
* Test RC6 via forcewake.

v3:
* Tweak assert in interrupts subtest.
* Sprinkle of comments.
* Fix multi-client test which got broken in v2.

v4:
* Measured instead of guaranteed sleep.
* Missing sync in no_sema.
* Log busyness before asserts for debug.
* access(2) instead of open(2) to determine if cpu0 is hotpluggable.
* Test frequency reporting via min/max setting instead assuming. ^^ All above suggested by Chris Wilson. ^^
* Drop queued subtests to match i915.
* Use long batches with fences to ensure interrupts.
* Test render node as well.

Cc Chris Wilson <[email protected]>
Cc Dmitry Rogozhkin <[email protected]>
---
 lib/igt_gt.c           |  50 +++
 lib/igt_gt.h           |  38 ++
 lib/igt_perf.h         |   9 +-
 tests/Makefile.am      |   1 +
 tests/Makefile.sources |   1 +
 tests/perf_pmu.c       | 957 +++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 1048 insertions(+), 8 deletions(-)
 create mode 100644 tests/perf_pmu.c
lib/igt_gt.c +50 -0
index b3f3b3809eee..4c75811fb1b3 100644
@@ -568,3 +568,53 @@ bool gem_can_store_dword(int fd, unsigned int engine)
 
 	return true;
 }
+
+const struct intel_execution_engine2 intel_execution_engines2[] = {
+	{ "rcs0", I915_ENGINE_CLASS_RENDER, 0 },
+	{ "bcs0", I915_ENGINE_CLASS_COPY, 0 },
+	{ "vcs0", I915_ENGINE_CLASS_VIDEO, 0 },
+	{ "vcs1", I915_ENGINE_CLASS_VIDEO, 1 },
+	{ "vecs0", I915_ENGINE_CLASS_VIDEO_ENHANCE, 0 },
+};
+
+unsigned int
+gem_class_instance_to_eb_flags(int gem_fd,
+			       enum drm_i915_gem_engine_class class,
+			       unsigned int instance)
+{
+	if (class != I915_ENGINE_CLASS_VIDEO)
+		igt_assert(instance == 0);
+	else
+		igt_assert(instance >= 0 && instance <= 1);
+
+	switch (class) {
+	case I915_ENGINE_CLASS_RENDER:
+		return I915_EXEC_RENDER;
+	case I915_ENGINE_CLASS_COPY:
+		return I915_EXEC_BLT;
+	case I915_ENGINE_CLASS_VIDEO:
+		if (instance == 0) {
+			if (gem_has_bsd2(gem_fd))
+				return I915_EXEC_BSD | I915_EXEC_BSD_RING1;
+			else
+				return I915_EXEC_BSD;
+
+		} else {
+			return I915_EXEC_BSD | I915_EXEC_BSD_RING2;
+		}
+	case I915_ENGINE_CLASS_VIDEO_ENHANCE:
+		return I915_EXEC_VEBOX;
+	case I915_ENGINE_CLASS_OTHER:
+	default:
+		igt_assert(0);
+	};
+}
+
+bool gem_has_engine(int gem_fd,
+		    enum drm_i915_gem_engine_class class,
+		    unsigned int instance)
+{
+	return gem_has_ring(gem_fd,
+			    gem_class_instance_to_eb_flags(gem_fd, class,
+							   instance));
+}
lib/igt_gt.h +38 -0
index 2579cbd37be7..fb67ae1a7d1f 100644
@@ -25,6 +25,7 @@
 #define IGT_GT_H
 
 #include "igt_debugfs.h"
+#include "igt_core.h"
 
 void igt_require_hang_ring(int fd, int ring);
 
@@ -80,4 +81,41 @@ extern const struct intel_execution_engine {
 
 bool gem_can_store_dword(int fd, unsigned int engine);
 
+extern const struct intel_execution_engine2 {
+	const char *name;
+	int class;
+	int instance;
+} intel_execution_engines2[];
+
+#define for_each_engine_class_instance(fd__, e__) \
+	for ((e__) = intel_execution_engines2;\
+	     (e__)->name; \
+	     (e__)++)
+
+enum drm_i915_gem_engine_class {
+	I915_ENGINE_CLASS_OTHER = 0,
+	I915_ENGINE_CLASS_RENDER = 1,
+	I915_ENGINE_CLASS_COPY = 2,
+	I915_ENGINE_CLASS_VIDEO = 3,
+	I915_ENGINE_CLASS_VIDEO_ENHANCE = 4,
+	I915_ENGINE_CLASS_MAX /* non-ABI */
+};
+
+unsigned int
+gem_class_instance_to_eb_flags(int gem_fd,
+			       enum drm_i915_gem_engine_class class,
+			       unsigned int instance);
+
+bool gem_has_engine(int gem_fd,
+		    enum drm_i915_gem_engine_class class,
+		    unsigned int instance);
+
+static inline
+void gem_require_engine(int gem_fd,
+			enum drm_i915_gem_engine_class class,
+			unsigned int instance)
+{
+	igt_require(gem_has_engine(gem_fd, class, instance));
+}
+
 #endif /* IGT_GT_H */
lib/igt_perf.h +1 -8
index e38171da5261..dc4df760f531 100644
@@ -29,14 +29,7 @@
 
 #include <linux/perf_event.h>
 
-enum drm_i915_gem_engine_class {
-	I915_ENGINE_CLASS_OTHER = 0,
-	I915_ENGINE_CLASS_RENDER = 1,
-	I915_ENGINE_CLASS_COPY = 2,
-	I915_ENGINE_CLASS_VIDEO = 3,
-	I915_ENGINE_CLASS_VIDEO_ENHANCE = 4,
-	I915_ENGINE_CLASS_MAX /* non-ABI */
-};
+#include "igt_gt.h"
 
 enum drm_i915_pmu_engine_sample {
 	I915_SAMPLE_BUSY = 0,
tests/Makefile.am +1 -0
index 1cea4036d00f..2819df381df7 100644
@@ -126,6 +126,7 @@ gen7_forcewake_mt_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 gen7_forcewake_mt_LDADD = $(LDADD) -lpthread
 gem_userptr_blits_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 gem_userptr_blits_LDADD = $(LDADD) -lpthread
+perf_pmu_LDADD = $(LDADD) $(top_builddir)/lib/libigt_perf.la
 
 gem_wait_LDADD = $(LDADD) -lrt
 kms_flip_LDADD = $(LDADD) -lrt -lpthread
tests/Makefile.sources +1 -0
index 0adc28a014d2..7d1fdf16892d 100644
@@ -217,6 +217,7 @@ TESTS_progs = \
 	kms_vblank \
 	meta_test \
 	perf \
+	perf_pmu \
 	pm_backlight \
 	pm_lpsp \
 	pm_rc6_residency \
tests/perf_pmu.c new file +957 -0

957 lines not on this page · raw message

Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#13 lore raw

PATCH v3 6/7 gem_wsim: Busy stats balancers

In reply to Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Add busy and busy-avg balancers which make balancing decisions by looking at engine busyness via the i915 PMU.

And thus are able to make decisions on the actual instantaneous load of the system, and not use metrics that lag behind by a batch or two. In doing so, each client should be able to greedily maximise their own usage of the system, leading to improved load balancing even in the face of other uncooperative clients. On the other hand, we are only using the instantaneous load without coupling in the predictive factor for dispatch and execution length.

v2:
* Commit text. (Chris Wilson)
* Rename get_stats to get_pmu_stats. (Chris Wilson)
* Fix PMU readout in VCS remap mode.

---
 benchmarks/Makefile.am |   2 +-
 benchmarks/gem_wsim.c  | 142 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 143 insertions(+), 1 deletion(-)
benchmarks/Makefile.am +1 -1
index 5c2cd19d6b20..2c15468d3be4 100644
@@ -19,6 +19,6 @@ gem_latency_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 gem_latency_LDADD = $(LDADD) -lpthread
 gem_syslatency_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 gem_syslatency_LDADD = $(LDADD) -lpthread -lrt
-gem_wsim_LDADD = $(LDADD) -lpthread
+gem_wsim_LDADD = $(LDADD) $(top_builddir)/lib/libigt_perf.la -lpthread
 
 EXTRA_DIST=README
benchmarks/gem_wsim.c +142 -0

178 lines not on this page · raw message

Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

PATCH v3 7/7 media-bench.pl: Add busy balancers to the list

In reply to Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

---
 scripts/media-bench.pl | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
scripts/media-bench.pl +3 -2
index 0956ef0a0621..78f45199e95d 100755
@@ -47,8 +47,9 @@ my $nop;
 my %opts;
 
 my @balancers = ( 'rr', 'rand', 'qd', 'qdr', 'qdavg', 'rt', 'rtr', 'rtavg',
-		  'context' );
-my %bal_skip_H = ( 'rr' => 1, 'rand' => 1, 'context' => 1 );
+		  'context', 'busy', 'busy-avg' );
+my %bal_skip_H = ( 'rr' => 1, 'rand' => 1, 'context' => 1, , 'busy' => 1,
+		   'busy-avg' => 1 );
 my %bal_skip_R = ( 'context' => 1 );
 
 my @workloads = (
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw

Re: [PATCH i-g-t 5/7] tests/perf_pmu: Tests for i915 PMU API

In reply to Tvrtko Ursulin
Quoted 202 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

A bunch of tests for the new i915 PMU feature.

Parts of the code were initialy sketched by Dmitry Rogozhkin.

v2: (Most suggestions by Chris Wilson)
* Add new class/instance based engine list.
* Add gem_has_engine/gem_require_engine to work with class/instance.
* Use the above two throughout the test.
* Shorten tests to 100ms busy batches, seems enough.
* Add queued counter sanity checks.
* Use igt_nsec_elapsed.
* Skip on perf -ENODEV in some tests instead of embedding knowledge locally.
* Fix multi ordering for busy accounting.
* Use new guranteed_usleep when sleep time is asserted on.
* Check for no queued when idle/busy.
* Add queued counter init test.
* Add queued tests.
* Consolidate and increase multiple busy engines tests to most-busy and all-busy tests.
* Guarantte interrupts by using fences.
* Test RC6 via forcewake.

v3:
* Tweak assert in interrupts subtest.
* Sprinkle of comments.
* Fix multi-client test which got broken in v2.

v4:
* Measured instead of guaranteed sleep.
* Missing sync in no_sema.
* Log busyness before asserts for debug.
* access(2) instead of open(2) to determine if cpu0 is hotpluggable.
* Test frequency reporting via min/max setting instead assuming. ^^ All above suggested by Chris Wilson. ^^
* Drop queued subtests to match i915.
* Use long batches with fences to ensure interrupts.
* Test render node as well.

Cc Chris Wilson <[email protected]>
Cc Dmitry Rogozhkin <[email protected]>
---
 lib/igt_gt.c           |  50 +++
 lib/igt_gt.h           |  38 ++
 lib/igt_perf.h         |   9 +-
 tests/Makefile.am      |   1 +
 tests/Makefile.sources |   1 +
 tests/perf_pmu.c       | 957 +++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 1048 insertions(+), 8 deletions(-)
 create mode 100644 tests/perf_pmu.c
lib/igt_gt.c +50 -0
index b3f3b3809eee..4c75811fb1b3 100644
@@ -568,3 +568,53 @@ bool gem_can_store_dword(int fd, unsigned int engine)
 
 	return true;
 }
+
+const struct intel_execution_engine2 intel_execution_engines2[] = {
+	{ "rcs0", I915_ENGINE_CLASS_RENDER, 0 },
+	{ "bcs0", I915_ENGINE_CLASS_COPY, 0 },
+	{ "vcs0", I915_ENGINE_CLASS_VIDEO, 0 },
+	{ "vcs1", I915_ENGINE_CLASS_VIDEO, 1 },
+	{ "vecs0", I915_ENGINE_CLASS_VIDEO_ENHANCE, 0 },
+};
+
+unsigned int
+gem_class_instance_to_eb_flags(int gem_fd,
+			       enum drm_i915_gem_engine_class class,
+			       unsigned int instance)
+{
+	if (class != I915_ENGINE_CLASS_VIDEO)
+		igt_assert(instance == 0);
+	else
+		igt_assert(instance >= 0 && instance <= 1);
+
+	switch (class) {
+	case I915_ENGINE_CLASS_RENDER:
+		return I915_EXEC_RENDER;
+	case I915_ENGINE_CLASS_COPY:
+		return I915_EXEC_BLT;
+	case I915_ENGINE_CLASS_VIDEO:
+		if (instance == 0) {
+			if (gem_has_bsd2(gem_fd))
+				return I915_EXEC_BSD | I915_EXEC_BSD_RING1;
+			else
+				return I915_EXEC_BSD;
+
+		} else {
+			return I915_EXEC_BSD | I915_EXEC_BSD_RING2;
+		}
+	case I915_ENGINE_CLASS_VIDEO_ENHANCE:
+		return I915_EXEC_VEBOX;
+	case I915_ENGINE_CLASS_OTHER:
+	default:
+		igt_assert(0);
+	};
+}
+
+bool gem_has_engine(int gem_fd,
+		    enum drm_i915_gem_engine_class class,
+		    unsigned int instance)
+{
+	return gem_has_ring(gem_fd,
+			    gem_class_instance_to_eb_flags(gem_fd, class,
+							   instance));
+}
lib/igt_gt.h +38 -0
index 2579cbd37be7..fb67ae1a7d1f 100644
@@ -25,6 +25,7 @@
 #define IGT_GT_H
 
 #include "igt_debugfs.h"
+#include "igt_core.h"
 
 void igt_require_hang_ring(int fd, int ring);
 
@@ -80,4 +81,41 @@ extern const struct intel_execution_engine {
 
 bool gem_can_store_dword(int fd, unsigned int engine);
 
+extern const struct intel_execution_engine2 {
+	const char *name;
+	int class;
+	int instance;
+} intel_execution_engines2[];
+
+#define for_each_engine_class_instance(fd__, e__) \
+	for ((e__) = intel_execution_engines2;\
+	     (e__)->name; \
+	     (e__)++)
+
+enum drm_i915_gem_engine_class {
+	I915_ENGINE_CLASS_OTHER = 0,
+	I915_ENGINE_CLASS_RENDER = 1,
+	I915_ENGINE_CLASS_COPY = 2,
+	I915_ENGINE_CLASS_VIDEO = 3,
+	I915_ENGINE_CLASS_VIDEO_ENHANCE = 4,
+	I915_ENGINE_CLASS_MAX /* non-ABI */
+};
+
+unsigned int
+gem_class_instance_to_eb_flags(int gem_fd,
+			       enum drm_i915_gem_engine_class class,
+			       unsigned int instance);
+
+bool gem_has_engine(int gem_fd,
+		    enum drm_i915_gem_engine_class class,
+		    unsigned int instance);
+
+static inline
+void gem_require_engine(int gem_fd,
+			enum drm_i915_gem_engine_class class,
+			unsigned int instance)
+{
+	igt_require(gem_has_engine(gem_fd, class, instance));
+}
+
 #endif /* IGT_GT_H */
lib/igt_perf.h +1 -8
index e38171da5261..dc4df760f531 100644
@@ -29,14 +29,7 @@
 
 #include <linux/perf_event.h>
 
-enum drm_i915_gem_engine_class {
-	I915_ENGINE_CLASS_OTHER = 0,
-	I915_ENGINE_CLASS_RENDER = 1,
-	I915_ENGINE_CLASS_COPY = 2,
-	I915_ENGINE_CLASS_VIDEO = 3,
-	I915_ENGINE_CLASS_VIDEO_ENHANCE = 4,
-	I915_ENGINE_CLASS_MAX /* non-ABI */
-};
+#include "igt_gt.h"
 
 enum drm_i915_pmu_engine_sample {
 	I915_SAMPLE_BUSY = 0,
tests/Makefile.am +1 -0
index 1cea4036d00f..2819df381df7 100644
@@ -126,6 +126,7 @@ gen7_forcewake_mt_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 gen7_forcewake_mt_LDADD = $(LDADD) -lpthread
 gem_userptr_blits_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 gem_userptr_blits_LDADD = $(LDADD) -lpthread
+perf_pmu_LDADD = $(LDADD) $(top_builddir)/lib/libigt_perf.la
 
 gem_wait_LDADD = $(LDADD) -lrt
 kms_flip_LDADD = $(LDADD) -lrt -lpthread
tests/Makefile.sources +0 -0
index 0adc28a014d2..7d1fdf16892d 100644

tests/Makefile.sources TESTS_progs = \ · line 223

Quoted 7 lines
tests/Makefile.sources +1 -0
@@ -217,6 +217,7 @@ TESTS_progs = \
 	kms_vblank \
 	meta_test \
 	perf \
+	perf_pmu \
 	pm_backlight \
 	pm_lpsp \
 	pm_rc6_residency \

For meson:

# patchwork please this is not a new revision
# diff --git a/tests/meson.build b/tests/meson.build
index 53d02d13..50a97785 100644

tests/meson.build +1 -0
@@ -197,6 +197,7 @@ test_progs = [
 	'kms_vblank',
 	'meta_test',
 	'perf',
+	'perf_pmu',
 	'pm_backlight',
 	'pm_lpsp',
 	'pm_rc6_residency',
Signature · 5 lines
Petri Latvala
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v3 4/7
#10 lore raw

Re: [PATCH i-g-t 4/7] intel-gpu-overlay: Catch-up to new i915 PMU

In reply to Tvrtko Ursulin

Quoting Tvrtko Ursulin (2017-09-29 13:39:36)

Quoted 7 lines

From: Tvrtko Ursulin <[email protected]>

v2: Update for i915 changes.

---

overlay/gpu-freq.c int gpu_freq_update(struct gpu_freq *gf) · line 180

Quoted 7 lines
overlay/gpu-freq.c +2 -2
@@ -176,8 +176,8 @@ int gpu_freq_update(struct gpu_freq *gf)
                        return EAGAIN;
                }
 
-               gf->current = (s->act - d->act) / d_time;
-               gf->request = (s->req - d->req) / d_time;
+               gf->current = (s->act - d->act) * 1000000000 / d_time;
+               gf->request = (s->req - d->req) * 1000000000 / d_time;

1e9 please. (And 1e-6 later)

-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

Re: [PATCH i-g-t 1/7] intel-gpu-overlay: Move local perf implementation to a library

In reply to Tvrtko Ursulin
Quoted 9 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Idea is to avoid duplication across multiple users in upcoming patches.

v2: Commit message and use a separate library instead of piggy-
backing to libintel_tools. (Chris Wilson)

Quoted 14 lines
---
 lib/Makefile.am                  | 6 +++++-
 overlay/perf.c => lib/igt_perf.c | 2 +-
 overlay/perf.h => lib/igt_perf.h | 2 ++
 overlay/Makefile.am              | 6 ++----
 overlay/gem-interrupts.c         | 3 ++-
 overlay/gpu-freq.c               | 3 ++-
 overlay/gpu-perf.c               | 3 ++-
 overlay/gpu-top.c                | 3 ++-
 overlay/power.c                  | 3 ++-
 overlay/rc6.c                    | 3 ++-
 10 files changed, 22 insertions(+), 12 deletions(-)
 rename overlay/perf.c => lib/igt_perf.c (94%)
 rename overlay/perf.h => lib/igt_perf.h (99%)

This one was more of a doozey to mesonize for a newbie.

This is ugly but hopefully will make someone more knowledgeable point out better ways and practices for using build targets vs. just lib names around...

(Now sent with X-Patchwork-Hint, hopefully patchwork doesn't get confused)

benchmarks/meson.build +6 -1
index 9ab738f7..9f2672eb 100644
@@ -31,6 +31,11 @@ endif
 foreach prog : benchmark_progs
 	# FIXME meson doesn't like binaries with the same name
 	# meanwhile just suffix with _bench
+	link = []
+	if prog == 'gem_wsim'
+	   link += lib_igt_perf
+	endif
 	executable(prog + '_bench', prog + '.c',
-			dependencies : test_deps)
+			dependencies : test_deps,
+			link_with : link)
 endforeach
lib/meson.build +4 -0
index 203be520..2c33493d 100644
@@ -178,4 +178,8 @@ lib_igt = declare_dependency(link_with : lib_igt_build,
 
 igt_deps = [ lib_igt ] + lib_deps
 
+lib_igt_perf = static_library('igt_perf',
+    ['igt_perf.c']
+)
+
 subdir('tests')
overlay/meson.build +1 -1
index a92ef895..ffc011cc 100644
@@ -10,7 +10,6 @@ gpu_overlay_src = [
 	'gpu-freq.c',
 	'igfx.c',
 	'overlay.c',
-	'perf.c',
 	'power.c',
 	'rc6.c',
 ]
@@ -56,5 +55,6 @@ if xrandr.found() and cairo.found()
 			include_directories : inc,
 			c_args : gpu_overlay_cflags,
 			dependencies : gpu_overlay_deps,
+			link_with : lib_igt_perf,
 			install : true)
 endif
Signature · 5 lines
Petri Latvala
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#15 lore raw

✓ Fi.CI.BAT: success for IGT PMU support (rev5)

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: IGT PMU support (rev5)
URL : https://patchwork.freedesktop.org/series/28253/
State : success

== Summary ==

IGT patchset tested on top of latest successful build 182b1941d8e221f1f5625c53f74b09bef7d8837a benchmarks: Actually build LIBDRM_INTEL_BENCHMARKS

with latest DRM-Tip kernel build CI_DRM_3157
e650b9cdaff6 drm-tip: 2017y-09m-29d-11h-52m-41s UTC integration manifest

Testlist changes:
+igt@perf_pmu@all-busy-check-all
+igt@perf_pmu@busy-bcs0
+igt@perf_pmu@busy-check-all-bcs0
+igt@perf_pmu@busy-check-all-rcs0
+igt@perf_pmu@busy-check-all-vcs0
+igt@perf_pmu@busy-check-all-vcs1
+igt@perf_pmu@busy-check-all-vecs0
+igt@perf_pmu@busy-no-semaphores-bcs0
+igt@perf_pmu@busy-no-semaphores-rcs0
+igt@perf_pmu@busy-no-semaphores-vcs0
+igt@perf_pmu@busy-no-semaphores-vcs1
+igt@perf_pmu@busy-no-semaphores-vecs0
+igt@perf_pmu@busy-rcs0
+igt@perf_pmu@busy-vcs0
+igt@perf_pmu@busy-vcs1
+igt@perf_pmu@busy-vecs0
+igt@perf_pmu@cpu-hotplug
+igt@perf_pmu@frequency
+igt@perf_pmu@idle-bcs0
+igt@perf_pmu@idle-no-semaphores-bcs0
+igt@perf_pmu@idle-no-semaphores-rcs0
+igt@perf_pmu@idle-no-semaphores-vcs0
+igt@perf_pmu@idle-no-semaphores-vcs1
+igt@perf_pmu@idle-no-semaphores-vecs0
+igt@perf_pmu@idle-rcs0
+igt@perf_pmu@idle-vcs0
+igt@perf_pmu@idle-vcs1
+igt@perf_pmu@idle-vecs0
+igt@perf_pmu@init-busy-bcs0
+igt@perf_pmu@init-busy-rcs0
+igt@perf_pmu@init-busy-vcs0
+igt@perf_pmu@init-busy-vcs1
+igt@perf_pmu@init-busy-vecs0
+igt@perf_pmu@init-sema-bcs0
+igt@perf_pmu@init-sema-rcs0
+igt@perf_pmu@init-sema-vcs0
+igt@perf_pmu@init-sema-vcs1
+igt@perf_pmu@init-sema-vecs0
+igt@perf_pmu@init-wait-bcs0
+igt@perf_pmu@init-wait-rcs0
+igt@perf_pmu@init-wait-vcs0
+igt@perf_pmu@init-wait-vcs1
+igt@perf_pmu@init-wait-vecs0
+igt@perf_pmu@interrupts
+igt@perf_pmu@invalid-init
+igt@perf_pmu@most-busy-check-all-bcs0
+igt@perf_pmu@most-busy-check-all-rcs0
+igt@perf_pmu@most-busy-check-all-vcs0
+igt@perf_pmu@most-busy-check-all-vcs1
+igt@perf_pmu@most-busy-check-all-vecs0
+igt@perf_pmu@multi-client-bcs0
+igt@perf_pmu@multi-client-rcs0
+igt@perf_pmu@multi-client-vcs0
+igt@perf_pmu@multi-client-vcs1
+igt@perf_pmu@multi-client-vecs0
+igt@perf_pmu@other-init-0
+igt@perf_pmu@other-init-1
+igt@perf_pmu@other-init-2
+igt@perf_pmu@other-init-3
+igt@perf_pmu@other-init-4
+igt@perf_pmu@other-init-5
+igt@perf_pmu@other-init-6
+igt@perf_pmu@other-read-0
+igt@perf_pmu@other-read-1
+igt@perf_pmu@other-read-2
+igt@perf_pmu@other-read-3
+igt@perf_pmu@other-read-4
+igt@perf_pmu@other-read-5
+igt@perf_pmu@other-read-6
+igt@perf_pmu@rc6
+igt@perf_pmu@rc6p
+igt@perf_pmu@render-node-busy-bcs0
+igt@perf_pmu@render-node-busy-rcs0
+igt@perf_pmu@render-node-busy-vcs0
+igt@perf_pmu@render-node-busy-vcs1
+igt@perf_pmu@render-node-busy-vecs0

Test chamelium:

        Subgroup hdmi-crc-fast:
                dmesg-warn -> PASS       (fi-skl-6700k) fdo#103019
Test gem_ringfill:
        Subgroup basic-default-hang:
                dmesg-warn -> PASS       (fi-pnv-d510) fdo#101600
Test kms_busy:
        Subgroup basic-flip-c:
                incomplete -> PASS       (fi-bxt-j4205) fdo#102035
Test drv_module_reload:
        Subgroup basic-reload-inject:
                dmesg-warn -> PASS       (fi-glk-1) fdo#102777

fdo#103019 https://bugs.freedesktop.org/show_bug.cgi?id=103019
fdo#101600 https://bugs.freedesktop.org/show_bug.cgi?id=101600
fdo#102035 https://bugs.freedesktop.org/show_bug.cgi?id=102035
fdo#102777 https://bugs.freedesktop.org/show_bug.cgi?id=102777

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:445s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:475s
fi-blb-e6850     total:289  pass:224  dwarn:1   dfail:0   fail:0   skip:64  time:424s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:522s
fi-bwr-2160      total:289  pass:184  dwarn:0   dfail:0   fail:0   skip:105 time:280s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:495s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:522s
fi-byt-j1900     total:289  pass:254  dwarn:1   dfail:0   fail:0   skip:34  time:498s
fi-byt-n2820     total:289  pass:250  dwarn:1   dfail:0   fail:0   skip:38  time:499s
fi-cfl-s         total:289  pass:256  dwarn:1   dfail:0   fail:0   skip:32  time:560s
fi-cnl-y         total:289  pass:261  dwarn:1   dfail:0   fail:0   skip:27  time:657s
fi-elk-e7500     total:289  pass:230  dwarn:0   dfail:0   fail:0   skip:59  time:424s
fi-glk-1         total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:562s
fi-hsw-4770      total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:426s
fi-hsw-4770r     total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:411s
fi-ilk-650       total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:434s
fi-ivb-3520m     total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:493s
fi-ivb-3770      total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:468s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:470s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:581s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:594s
fi-pnv-d510      total:289  pass:224  dwarn:0   dfail:0   fail:0   skip:65  time:540s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:458s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:756s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:496s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:475s
fi-snb-2520m     total:289  pass:251  dwarn:0   dfail:0   fail:0   skip:38  time:570s
fi-snb-2600      total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:419s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_277/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#16 lore raw

✗ Fi.CI.IGT: warning for IGT PMU support (rev5)

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: IGT PMU support (rev5)
URL : https://patchwork.freedesktop.org/series/28253/
State : warning

== Summary ==

Test perf:

        Subgroup blocking:
                fail       -> PASS       (shard-hsw) fdo#102252
Test kms_setmode:
        Subgroup basic:
                fail       -> PASS       (shard-hsw) fdo#99912
Test prime_mmap:
        Subgroup test_userptr:
                pass       -> DMESG-WARN (shard-hsw) fdo#102939
Test kms_flip:
        Subgroup flip-vs-rmfb:
                pass       -> DMESG-WARN (shard-hsw)
Test gem_eio:
        Subgroup wait:
                pass       -> DMESG-WARN (shard-hsw) fdo#102886 +1

fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#102939 https://bugs.freedesktop.org/show_bug.cgi?id=102939
fdo#102886 https://bugs.freedesktop.org/show_bug.cgi?id=102886

shard-hsw total:2454 pass:1298 dwarn:7 dfail:0 fail:9 skip:1140 time:9709s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_277/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Re: [PATCH i-g-t 1/7] intel-gpu-overlay: Move local perf implementation to a library

In reply to Petri Latvala
Quoted 78 lines · Petri Latvala
Quoted 21 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Idea is to avoid duplication across multiple users in upcoming patches.

v2: Commit message and use a separate library instead of piggy-
backing to libintel_tools. (Chris Wilson)

---
  lib/Makefile.am                  | 6 +++++-
  overlay/perf.c => lib/igt_perf.c | 2 +-
  overlay/perf.h => lib/igt_perf.h | 2 ++
  overlay/Makefile.am              | 6 ++----
  overlay/gem-interrupts.c         | 3 ++-
  overlay/gpu-freq.c               | 3 ++-
  overlay/gpu-perf.c               | 3 ++-
  overlay/gpu-top.c                | 3 ++-
  overlay/power.c                  | 3 ++-
  overlay/rc6.c                    | 3 ++-
  10 files changed, 22 insertions(+), 12 deletions(-)
Quoted 2 lines

rename overlay/perf.c => lib/igt_perf.c (94%)
rename overlay/perf.h => lib/igt_perf.h (99%)

This one was more of a doozey to mesonize for a newbie.

This is ugly but hopefully will make someone more knowledgeable point out better ways and practices for using build targets vs. just lib names around...

(Now sent with X-Patchwork-Hint, hopefully patchwork doesn't get confused)

benchmarks/meson.build +6 -1
index 9ab738f7..9f2672eb 100644
@@ -31,6 +31,11 @@ endif
  foreach prog : benchmark_progs
  	# FIXME meson doesn't like binaries with the same name
  	# meanwhile just suffix with _bench
+	link = []
+	if prog == 'gem_wsim'
+	   link += lib_igt_perf
+	endif
  	executable(prog + '_bench', prog + '.c',
-			dependencies : test_deps)
+			dependencies : test_deps,
+			link_with : link)
  endforeach
lib/meson.build +4 -0
index 203be520..2c33493d 100644
@@ -178,4 +178,8 @@ lib_igt = declare_dependency(link_with : lib_igt_build,
 
  igt_deps = [ lib_igt ] + lib_deps
 
+lib_igt_perf = static_library('igt_perf',
+    ['igt_perf.c']
+)
+
  subdir('tests')
overlay/meson.build +0 -1
index a92ef895..ffc011cc 100644
@@ -10,7 +10,6 @@ gpu_overlay_src = [
  	'gpu-freq.c',
  	'igfx.c',
  	'overlay.c',
-	'perf.c',
  	'power.c',
  	'rc6.c',
  ]

overlay/meson.build if xrandr.found() and cairo.found() · line 60

Quoted 6 lines
overlay/meson.build +1 -0
@@ -56,5 +55,6 @@ if xrandr.found() and cairo.found()
  			include_directories : inc,
  			c_args : gpu_overlay_cflags,
  			dependencies : gpu_overlay_deps,
+			link_with : lib_igt_perf,
  			install : true)
  endif

Grumble, can we have a switch over day where it all gets converted to meson by the people in the know, and until then not concern ourselves with a two-headed build system?

At the moment it is just a distraction and time waste if everybody working on IGT has to test both build systems.

I know meson is great and all that by I'd rather focus on the actual work than having to maintain parallel build systems. Especially since I am clueless on it, so it would be one more thing competing for limited brain resources.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Re: [PATCH i-g-t 1/7] intel-gpu-overlay: Move local perf implementation to a library

Quoted 88 lines · Tvrtko Ursulin
Quoted 82 lines · Petri Latvala
Quoted 20 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Idea is to avoid duplication across multiple users in upcoming patches.

v2: Commit message and use a separate library instead of piggy- backing to libintel_tools. (Chris Wilson)

---
  lib/Makefile.am                  | 6 +++++-
  overlay/perf.c => lib/igt_perf.c | 2 +-
  overlay/perf.h => lib/igt_perf.h | 2 ++
  overlay/Makefile.am              | 6 ++----
  overlay/gem-interrupts.c         | 3 ++-
  overlay/gpu-freq.c               | 3 ++-
  overlay/gpu-perf.c               | 3 ++-
  overlay/gpu-top.c                | 3 ++-
  overlay/power.c                  | 3 ++-
  overlay/rc6.c                    | 3 ++-

Quoted 3 lines
  10 files changed, 22 insertions(+), 12 deletions(-)

  rename overlay/perf.c => lib/igt_perf.c (94%)
  rename overlay/perf.h => lib/igt_perf.h (99%)

This one was more of a doozey to mesonize for a newbie.

This is ugly but hopefully will make someone more knowledgeable point out better ways and practices for using build targets vs. just lib names around...

(Now sent with X-Patchwork-Hint, hopefully patchwork doesn't get confused)

benchmarks/meson.build +0 -0
index 9ab738f7..9f2672eb 100644
@@ -31,6 +31,11 @@ endif

  foreach prog : benchmark_progs
      # FIXME meson doesn't like binaries with the same name

      # meanwhile just suffix with _bench
+    link = []
+    if prog == 'gem_wsim'
+       link += lib_igt_perf
+    endif
      executable(prog + '_bench', prog + '.c',
-            dependencies : test_deps)
+            dependencies : test_deps,
+            link_with : link)
  endforeach
lib/meson.build +0 -0
index 203be520..2c33493d 100644
@@ -178,4 +178,8 @@ lib_igt = declare_dependency(link_with : 
 lib_igt_build,

    igt_deps = [ lib_igt ] + lib_deps
  +lib_igt_perf = static_library('igt_perf',
+    ['igt_perf.c']

lib/meson.build +2 -0
+)
+

  subdir('tests')

overlay/meson.build +0 -1
index a92ef895..ffc011cc 100644
@@ -10,7 +10,6 @@ gpu_overlay_src = [
       'gpu-freq.c',
       'igfx.c',
       'overlay.c',
-    'perf.c',
       'power.c',
       'rc6.c',

  ]

overlay/meson.build +1 -0
@@ -56,5 +55,6 @@ if xrandr.found() and cairo.found()
               include_directories : inc,
               c_args : gpu_overlay_cflags,
               dependencies : gpu_overlay_deps,
+            link_with : lib_igt_perf,
               install : true)
Quoted 1 line

  endif

Grumble, can we have a switch over day where it all gets converted to meson by the people in the know, and until then not concern ourselves with a two-headed build system?

Quoted 3 lines

At the moment it is just a distraction and time waste if everybody working on IGT has to test both build systems.

I know meson is great and all that by I'd rather focus on the actual work than having to maintain parallel build systems. Especially since I am clueless on it, so it would be one more thing competing for limited brain resources.

The whole reason I've been sending meson equivalents for autotools-system changes is so that the original author doesn't have to do it. I don't expect everyone to test both, or to even make it mandatory to have the meson changes included. As for "all gets converted", the current state is that meson is able to build everything in git.

Signature · 6 lines
Petri Latvala

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

Re: [PATCH i-g-t 1/7] intel-gpu-overlay: Move local perf implementation to a library

Quoted 88 lines · Petri Latvala
Quoted 87 lines · Tvrtko Ursulin
Quoted 82 lines · Petri Latvala
Quoted 20 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Idea is to avoid duplication across multiple users in upcoming patches.

v2: Commit message and use a separate library instead of piggy- backing to libintel_tools. (Chris Wilson)

---
  lib/Makefile.am                  | 6 +++++-
  overlay/perf.c => lib/igt_perf.c | 2 +-
  overlay/perf.h => lib/igt_perf.h | 2 ++
  overlay/Makefile.am              | 6 ++----
  overlay/gem-interrupts.c         | 3 ++-
  overlay/gpu-freq.c               | 3 ++-
  overlay/gpu-perf.c               | 3 ++-
  overlay/gpu-top.c                | 3 ++-
  overlay/power.c                  | 3 ++-
  overlay/rc6.c                    | 3 ++-

Quoted 3 lines
  10 files changed, 22 insertions(+), 12 deletions(-)

  rename overlay/perf.c => lib/igt_perf.c (94%)
  rename overlay/perf.h => lib/igt_perf.h (99%)

This one was more of a doozey to mesonize for a newbie.

This is ugly but hopefully will make someone more knowledgeable point out better ways and practices for using build targets vs. just lib names around...

(Now sent with X-Patchwork-Hint, hopefully patchwork doesn't get confused)

benchmarks/meson.build +0 -0
index 9ab738f7..9f2672eb 100644
@@ -31,6 +31,11 @@ endif

  foreach prog : benchmark_progs
      # FIXME meson doesn't like binaries with the same name

      # meanwhile just suffix with _bench
+    link = []
+    if prog == 'gem_wsim'
+       link += lib_igt_perf
+    endif
      executable(prog + '_bench', prog + '.c',
-            dependencies : test_deps)
+            dependencies : test_deps,
+            link_with : link)
  endforeach
lib/meson.build +0 -0
index 203be520..2c33493d 100644
@@ -178,4 +178,8 @@ lib_igt = declare_dependency(link_with : 
 lib_igt_build,

    igt_deps = [ lib_igt ] + lib_deps
  +lib_igt_perf = static_library('igt_perf',
+    ['igt_perf.c']

lib/meson.build +2 -0
+)
+

  subdir('tests')

overlay/meson.build +0 -1
index a92ef895..ffc011cc 100644
@@ -10,7 +10,6 @@ gpu_overlay_src = [
       'gpu-freq.c',
       'igfx.c',
       'overlay.c',
-    'perf.c',
       'power.c',
       'rc6.c',

  ]

overlay/meson.build +1 -0
@@ -56,5 +55,6 @@ if xrandr.found() and cairo.found()
               include_directories : inc,
               c_args : gpu_overlay_cflags,
               dependencies : gpu_overlay_deps,
+            link_with : lib_igt_perf,
               install : true)
Quoted 1 line

  endif

Grumble, can we have a switch over day where it all gets converted to meson by the people in the know, and until then not concern ourselves with a two-headed build system?

Quoted 6 lines
Quoted 3 lines

At the moment it is just a distraction and time waste if everybody working on IGT has to test both build systems.

I know meson is great and all that by I'd rather focus on the actual work than having to maintain parallel build systems. Especially since I am clueless on it, so it would be one more thing competing for limited brain resources.

The whole reason I've been sending meson equivalents for autotools-system changes is so that the original author doesn't have to do it. I don't expect everyone to test both, or to even make it mandatory to have the meson changes included. As for "all gets converted", the current state is that meson is able to build everything in git.

If it is fine just to copy&paste your snippets in patches blindly I can do that. Even though I feel uncomfortable doing so (blindly), and at the same time, as I wrote above, I would prefer we only have to deal with one build system at a time. Hopefully, when I integrate these snippets in my patches, someone won't spot a problem in them and ask me to re-spin. Since that would bring us back to my point of every developer wasting time on two build system, instead of having a switch over day and be done with it.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

Re: [PATCH i-g-t 1/7] intel-gpu-overlay: Move local perf implementation to a library

Quoted 108 lines · Tvrtko Ursulin
Quoted 99 lines · Petri Latvala
Quoted 89 lines · Tvrtko Ursulin
Quoted 82 lines · Petri Latvala
Quoted 20 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Idea is to avoid duplication across multiple users in upcoming patches.

v2: Commit message and use a separate library instead of piggy- backing to libintel_tools. (Chris Wilson)

---
  lib/Makefile.am                  | 6 +++++-
  overlay/perf.c => lib/igt_perf.c | 2 +-
  overlay/perf.h => lib/igt_perf.h | 2 ++
  overlay/Makefile.am              | 6 ++----
  overlay/gem-interrupts.c         | 3 ++-
  overlay/gpu-freq.c               | 3 ++-
  overlay/gpu-perf.c               | 3 ++-
  overlay/gpu-top.c                | 3 ++-
  overlay/power.c                  | 3 ++-
  overlay/rc6.c                    | 3 ++-

Quoted 3 lines
  10 files changed, 22 insertions(+), 12 deletions(-)

  rename overlay/perf.c => lib/igt_perf.c (94%)
  rename overlay/perf.h => lib/igt_perf.h (99%)

This one was more of a doozey to mesonize for a newbie.

This is ugly but hopefully will make someone more knowledgeable point out better ways and practices for using build targets vs. just lib names around...

(Now sent with X-Patchwork-Hint, hopefully patchwork doesn't get confused)

benchmarks/meson.build +0 -0
index 9ab738f7..9f2672eb 100644
@@ -31,6 +31,11 @@ endif

  foreach prog : benchmark_progs
      # FIXME meson doesn't like binaries with the same name

      # meanwhile just suffix with _bench
+    link = []
+    if prog == 'gem_wsim'
+       link += lib_igt_perf
+    endif
      executable(prog + '_bench', prog + '.c',
-            dependencies : test_deps)
+            dependencies : test_deps,
+            link_with : link)
  endforeach
lib/meson.build +0 -0
index 203be520..2c33493d 100644
@@ -178,4 +178,8 @@ lib_igt = declare_dependency(link_with :
 lib_igt_build,

    igt_deps = [ lib_igt ] + lib_deps
  +lib_igt_perf = static_library('igt_perf',
+    ['igt_perf.c']

lib/meson.build +2 -0
+)
+

  subdir('tests')

overlay/meson.build +0 -1
index a92ef895..ffc011cc 100644
@@ -10,7 +10,6 @@ gpu_overlay_src = [
       'gpu-freq.c',
       'igfx.c',
       'overlay.c',
-    'perf.c',
       'power.c',
       'rc6.c',

  ]

overlay/meson.build +1 -0
@@ -56,5 +55,6 @@ if xrandr.found() and cairo.found()
               include_directories : inc,
               c_args : gpu_overlay_cflags,
               dependencies : gpu_overlay_deps,
+            link_with : lib_igt_perf,
               install : true)
Quoted 1 line

  endif

Grumble, can we have a switch over day where it all gets converted to meson by the people in the know, and until then not concern ourselves with a two-headed build system?

Quoted 7 lines

At the moment it is just a distraction and time waste if everybody working on IGT has to test both build systems.

I know meson is great and all that by I'd rather focus on the actual work than having to maintain parallel build systems. Especially since I am clueless on it, so it would be one more thing competing for limited brain resources.

Quoted 6 lines

The whole reason I've been sending meson equivalents for autotools-system changes is so that the original author doesn't have to do it. I don't expect everyone to test both, or to even make it mandatory to have the meson changes included. As for "all gets converted", the current state is that meson is able to build everything in git.

Quoted 7 lines

If it is fine just to copy&paste your snippets in patches blindly I can do that. Even though I feel uncomfortable doing so (blindly), and at the same time, as I wrote above, I would prefer we only have to deal with one build system at a time. Hopefully, when I integrate these snippets in my patches, someone won't spot a problem in them and ask me to re-spin. Since that would bring us back to my point of every developer wasting time on two build system, instead of having a switch over day and be done with it.

Up to you how you want to merge, we can make the meson changes separately. Especially with this one, it wasn't a simple "file added / removed" change.

Signature · 5 lines
Petri Latvala
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx