linux/Documentation/gpu
Lucas De Marchi 188ced1e0f drm/xe/client: Print runtime to fdinfo
Print the accumulated runtime for client when printing fdinfo.
Each time a query is done it first does 2 things:

1) loop through all the exec queues for the current client and
   accumulate the runtime, per engine class. CTX_TIMESTAMP is used for
   that, being read from the context image.

2) Read a "GPU timestamp" that can be used for considering "how much GPU
   time has passed" and that has the same unit/refclock as the one
   recording the runtime. RING_TIMESTAMP is used for that via MMIO.

Since for all current platforms RING_TIMESTAMP follows the same
refclock, just read it once, using any first engine available.

This is exported to userspace as 2 numbers in fdinfo:

	drm-cycles-<class>: <RUNTIME>
	drm-total-cycles-<class>: <TIMESTAMP>

Userspace is expected to collect at least 2 samples, which allows to
know the client engine busyness as per:

		    RUNTIME1 - RUNTIME0
	busyness = ---------------------
			  T1 - T0

Since drm-cycles-<class> always starts at 0, it's also possible to know
if and engine was ever used by a client.

It's expected that userspace will read any 2 samples every few seconds.
Given the update frequency of the counters involved and that
CTX_TIMESTAMP is 32-bits, the counter for each exec_queue can wrap
around (assuming 100% utilization) after ~200s. The wraparound is not
perceived by userspace since it's just accumulated for all the
exec_queues in a 64-bit counter) but the measurement will not be
accurate if the samples are too far apart.

This could be mitigated by adding a workqueue to accumulate the counters
every so often, but it's additional complexity for something that is
done already by userspace every few seconds in tools like gputop (from
igt), htop, nvtop, etc, with none of them really defaulting to 1 sample
per minute or more.

Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Acked-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240517204310.88854-9-lucas.demarchi@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
2024-05-21 06:33:40 -07:00
..
amdgpu Documentation/gpu: correct path of reference 2024-04-09 22:19:47 -04:00
bridge
dp-mst
imagination drm/imagination: Numerous documentation fixes. 2023-11-28 18:56:03 +01:00
rfc drm/i915: Drop dead code for xehpsdv 2024-03-22 14:14:39 -07:00
xe drm/xe/client: Print runtime to fdinfo 2024-05-21 06:33:40 -07:00
afbc.rst
automated_testing.rst drm/doc: ci: Add IGT version details for flaky tests 2023-12-13 15:18:30 -03:00
backlight.rst
driver-uapi.rst drm/panthor: Add uAPI 2024-03-01 10:03:59 +01:00
drivers.rst drm/xe: Introduce a new DRM driver for Intel GPUs 2023-12-12 14:05:48 -05:00
drm-client.rst
drm-internals.rst drm/doc: internals: remove section on PCI legacy support 2024-01-12 13:58:35 +01:00
drm-kms-helpers.rst drm/eld: add helpers to modify the SADs of an ELD 2023-11-09 16:48:27 +02:00
drm-kms.rst drm/panic: Add a drm panic handler 2024-04-15 16:12:49 +02:00
drm-mm.rst Documentation/gpu: VM_BIND locking document 2023-11-29 20:54:43 +01:00
drm-uapi.rst drm/doc: use cross-references for macros 2023-10-23 17:03:58 +02:00
drm-usage-stats.rst drm/xe/client: Print runtime to fdinfo 2024-05-21 06:33:40 -07:00
drm-vm-bind-async.rst Documentation/gpu: Add a VM_BIND async document 2023-10-17 10:38:07 +02:00
drm-vm-bind-locking.rst Documentation/gpu: VM_BIND locking document 2023-11-29 20:54:43 +01:00
i915.rst drm/i915/display: add support for DMC wakelocks 2024-04-17 11:41:08 +03:00
implementation_guidelines.rst Documentation/gpu: VM_BIND locking document 2023-11-29 20:54:43 +01:00
index.rst Documentation/gpu: Add a VM_BIND async document 2023-10-17 10:38:07 +02:00
introduction.rst Documentation/gpu: Reference articles on Linux graphics stack 2024-01-19 16:50:54 +01:00
kms-properties.csv Documentation: Fix typos 2023-08-18 11:29:03 -06:00
komeda-kms.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
mcde.rst
meson.rst
msm-crash-dump.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
panfrost.rst drm/panfrost: Replace fdinfo's profiling debugfs knob with sysfs 2024-03-11 13:27:10 +01:00
pl111.rst
tegra.rst
todo.rst drm/todo: Add entry to rename drm_atomic_state 2023-12-18 11:45:40 +01:00
tve200.rst
v3d.rst
vc4.rst drm/vc4: Improve the KUnit documentation 2022-12-15 08:54:08 +01:00
vga-switcheroo.rst
vgaarbiter.rst
vkms.rst drm/vkms: drop "Rotation" TODO 2023-05-08 09:57:24 -03:00
xen-front.rst