All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] drm/etnaviv: Report GPU clock changes to userspace
@ 2026-11-20 10:40 Christian Gmeiner
  2026-11-20 10:40 ` [PATCH 1/7] drm/etnaviv: Don't set up a GPU on resume that is not initialized Christian Gmeiner
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Christian Gmeiner @ 2026-11-20 10:40 UTC (permalink / raw)
  To: Lucas Stach, Russell King, Christian Gmeiner, David Airlie,
	Simona Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann
  Cc: kernel-dev, etnaviv, dri-devel, linux-kernel, Christian Gmeiner,
	stable, stable+noautosel

Userspace that converts GPU cycle counts to time, like Mesa, needs the
core clock rate a job ran at. The thermal cooling device can change
this rate at any time, and userspace has no way to learn about it.

This series adds a CLOCK_HISTORY ioctl that returns the last clock
rate changes of a GPU with their timestamps. Userspace compares them
with the fence timestamp of a job and knows the rate the job ran at.
A trace event reports the same changes.

For this a job must run at a single rate. Today the cooling device
changes the clock while a job is running, which can also hang the GPU.
On a GC7000 rev 6009 I toggled the cooling state every 200 ms during
glmark2 runs and got 25 hang recoveries in 24 runs. With this series I
got none in 34 runs. So the first patches fix the cooling device:

- Patch 1 fixes the GPU state after a failed init and after unbind.
  Patch 4 uses this state to decide if the clock can be changed.
- Patches 2-4 change the order of the cooling device registration,
  skip requests that keep the clock and close a race with runtime
  suspend.
- Patch 5 makes a clock change wait for the queued jobs.
- Patch 6 adds the trace event.
- Patch 7 keeps the last 256 changes in a ring buffer and adds the
  ioctl to read them.

Tested on GC7000 rev 6214 (i.MX8MQ), and with backports to 6.6 on
GC7000 rev 6009 (i.MX8QM) and to 6.12 on GC2000 rev 5108 (i.MX6Q,
FSCALE path).

Link to the Mesa MR implementing the userspace side:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/46538

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
---
Christian Gmeiner (7):
      drm/etnaviv: Don't set up a GPU on resume that is not initialized
      drm/etnaviv: Register the cooling device last and unregister it first
      drm/etnaviv: Skip cooling requests that keep the clock
      drm/etnaviv: Don't change the clock of a suspended GPU
      drm/etnaviv: Change the GPU clock between jobs
      drm/etnaviv: Add a GPU clock change trace event
      drm/etnaviv: Add an ioctl to read back GPU clock changes

 drivers/gpu/drm/etnaviv/Makefile               |   5 +-
 drivers/gpu/drm/etnaviv/etnaviv_drv.c          |  20 ++-
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c          | 240 ++++++++++++++++++++++---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.h          |  12 ++
 drivers/gpu/drm/etnaviv/etnaviv_trace.h        |  62 +++++++
 drivers/gpu/drm/etnaviv/etnaviv_trace_points.c |   9 +
 include/uapi/drm/etnaviv_drm.h                 |  62 ++++++-
 7 files changed, 378 insertions(+), 32 deletions(-)
---
base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
change-id: 20261116-etnaviv-gpu-freq-trace-52e421b3f72d

Best regards,
-- 
Christian Gmeiner <cgmeiner@igalia.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-11-20 10:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 10:40 [PATCH 0/7] drm/etnaviv: Report GPU clock changes to userspace Christian Gmeiner
2026-11-20 10:40 ` [PATCH 1/7] drm/etnaviv: Don't set up a GPU on resume that is not initialized Christian Gmeiner
2026-11-20 10:53   ` sashiko-bot
2026-11-20 10:40 ` [PATCH 2/7] drm/etnaviv: Register the cooling device last and unregister it first Christian Gmeiner
2026-11-20 10:40 ` [PATCH 3/7] drm/etnaviv: Skip cooling requests that keep the clock Christian Gmeiner
2026-11-20 10:40 ` [PATCH 4/7] drm/etnaviv: Don't change the clock of a suspended GPU Christian Gmeiner
2026-11-20 10:40 ` [PATCH 5/7] drm/etnaviv: Change the GPU clock between jobs Christian Gmeiner
2026-11-20 10:40 ` [PATCH 6/7] drm/etnaviv: Add a GPU clock change trace event Christian Gmeiner
2026-11-20 10:40 ` [PATCH 7/7] drm/etnaviv: Add an ioctl to read back GPU clock changes Christian Gmeiner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.