Skip to content

RFC Engine utilization tracking

Tvrtko Ursulin intel-gfx 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3drm/i915: Wrap context schedule notificationdrivers/gpu/drm/i915/intel_lrc.c+15 -70 replies
2/3drm/i915: Engine busy time trackingdrivers/gpu/drm/i915/intel_engine_cs.c drivers/gpu/drm/i915/intel_lrc.c drivers/gpu/drm/i915/intel_ringbuffer.h+47 -01 reply
3/3drm/i915: Export engine busy stats in debugfsdrivers/gpu/drm/i915/i915_debugfs.c+120 -03 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 0/3] Engine utilization tracking

From: Tvrtko Ursulin <[email protected]>

By popular customer demand here is the prototype for cheap engine utilization tracking.

It uses static branches so in the default off case it really should be cheap.

It exports the per engine total time something has been executing (in nano- seconds) in debugfs/i915_engine_stats.

This is a problem for something which would preferrably be a stable ABI but I needed all of the open, release and read hooks for it to work as I imagined it. So far I did not come up with a different location which would support that.

Userspace is supposed to open the file and keep re-reading it by seeking to its beginning. This is because first open and last close are a costly operations, and also because the most interesting is the relative change between two sampling periods.

Example code which does this looks like this:

	#include <stdio.h>
	#include <sys/types.h>
	#include <sys/stat.h>
	#include <fcntl.h>
	#include <unistd.h>

	#include "drmtest.h"
	#include "igt_debugfs.h"

	int main(void)
	{
		int drm_fd, fd;

		drm_fd = drm_open_driver(DRIVER_INTEL);

		fd = igt_debugfs_open(drm_fd, "i915_engine_stats", O_RDONLY);
		igt_assert(fd >= 0);

		for (;;) {
			char buf[4096];
			ssize_t ret;
			off_t off;

			ret = read(fd, buf, sizeof(buf));
			igt_assert(ret > 0);

			ret = write(1, buf, ret);
			printf("\n");

			off = lseek(fd, 0, SEEK_SET);
			igt_assert_eq(off, 0);

			sleep(1);
		}

		close(fd);
		close(drm_fd);

		return 0;
	}

Comments, flames, ideas welcome!

Tvrtko Ursulin (3):
drm/i915: Wrap context schedule notification
drm/i915: Engine busy time tracking
drm/i915: Export engine busy stats in debugfs

 drivers/gpu/drm/i915/i915_debugfs.c     | 120 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_engine_cs.c  |   6 ++
 drivers/gpu/drm/i915/intel_lrc.c        |  24 +++++--
 drivers/gpu/drm/i915/intel_ringbuffer.h |  39 +++++++++++
 4 files changed, 182 insertions(+), 7 deletions(-)
Signature · 6 lines
2.9.3

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