Re: [PATCH 0/6] drm/nouveau: GSP telemetry via RUSD, and fdinfo telemetry exposure

[email protected] Tue, 21 Jul 2026 16:40:43 -0400
Newsgroups org.freedesktop.lists.nouveau,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
With the various nits addressed or responded to, for the whole series:

Reviewed-by: Lyude Paul <[email protected]>

(I assume with you moving stuff into nvkm I might need to re-review
later, but that's fine with me)

On Wed, 2026-07-15 at 01:14 +0400, Mohamed Ahmed wrote:
> On the GSP firmware, nouveau reports nothing about the GPU. The GSP
> owns
> the sensors, so the legacy nvkm therm/clk/volt hwmon paths never run,
> and
> monitoring tools have no data to read.
>=20
> GSP on later firmware does publish all of it through a stable
> interface.
> It maintains a shared-memory region called "RM User Shared Data"
> (RUSD),
> which the firmware fills with all the relevant sensor readings like
> power,
> temperatures, clocks, and many others. Consuming it needs only two
> internal subdevice controls: INIT_USER_SHARED_DATA to register the
> buffer,
> and SET_DATA_POLL to tell the GSP which data groups to poll and how
> often.
>=20
> This series makes nouveau a RUSD client and exposes the data through
> two
> main surfaces:
>=20
> =C2=A0 - hwmon, for the values that map onto standard channels: GPU and
> memory
> =C2=A0=C2=A0=C2=A0 temperature, GPU/board/VRAM power, power cap.=20
>=20
> =C2=A0 - sysfs, under /sys/class/drm/cardN/device/rusd/, for everything
> hwmon
> =C2=A0=C2=A0=C2=A0 has no channel type for: clocks, utilisation, pstate, =
throttle
> reason,
> =C2=A0=C2=A0=C2=A0 ECC counters, PCIe error counters, and everything expo=
sed to
> hwmon as
> =C2=A0=C2=A0=C2=A0 well. One value per file according to sysfs convention=
.
>=20
> Polling is demand-driven. GSP polls a group only while a client is
> reading
> it, and a group idles off after 10s after the last read. Polling
> costs
> power, so nothing is polled unless someone is looking. A section that
> has
> not been polled yet, or that the board does not support, reads -
> ENODATA.
>=20
> The sysfs interface is documented in
> Documentation/ABI/testing/sysfs-driver-nouveau.
>=20
> While the original scope was RUSD support only, monitoring tools
> needed
> two extra additions to complete the picture:
>=20
> =C2=A0 - VRAM size and usage on sysfs (patch 5): since this series adds a
> sysfs
> =C2=A0=C2=A0=C2=A0 interface for nouveau, it's better to expose VRAM metr=
ics there
> rather
> =C2=A0=C2=A0=C2=A0 than force monitoring apps to pull in libdrm for the G=
ETPARAM
> memory
> =C2=A0=C2=A0=C2=A0 ioctls.
>=20
> =C2=A0 - fdinfo (patch 6): nouveau implemented none at all, and monitorin=
g
> apps
> =C2=A0=C2=A0=C2=A0 could not show per-process GPU and memory usage. It no=
w reports
> =C2=A0=C2=A0=C2=A0 per-client memory and per-engine busy time, accounted =
from the
> DRM
> =C2=A0=C2=A0=C2=A0 scheduler that the EXEC/VM_BIND path already uses.
>=20
> Limitations, caveats, and additional considerations or questions:
>=20
> =C2=A0 - RUSD needs r570 or newer GSP firmware; r535 does not have the
> needed
> =C2=A0=C2=A0=C2=A0 controls. Pre-GSP and r535 behavior is identical to wh=
at it was:
> the
> =C2=A0=C2=A0=C2=A0 rusd/ group is not created, and hwmon keeps its curren=
t behavior.
>=20
> =C2=A0 - This is all read-only telemetry. Clock, voltage, or power contro=
l
> is
> =C2=A0=C2=A0=C2=A0 through other interfaces out of scope of this series.
>=20
> =C2=A0 - The sysfs interface exposed here should be stable and valid for
> nova
> =C2=A0=C2=A0=C2=A0 as well. RUSD is stable and only grows more fields wit=
h newer GSP
> =C2=A0=C2=A0=C2=A0 firmware (e.g., fan telemetry gets added in r580), so =
it is
> possible
> =C2=A0=C2=A0=C2=A0 to keep the same interface as we use newer firmware or=
 as we move
> to
> =C2=A0=C2=A0=C2=A0 nova and any potential considerations should be ironed=
 out before
> this
> =C2=A0=C2=A0=C2=A0 gets merged and the interface gets frozen.
>=20
> =C2=A0 - amdgpu offers a single binary blob with all the telemetry
> embedded in
> =C2=A0=C2=A0=C2=A0 addition to the sysfs sensor files. This series curren=
tly only
> exposes
> =C2=A0=C2=A0=C2=A0 sensor files, but it is possible to add a similar bina=
ry for a
> v2.
> =C2=A0=C2=A0=C2=A0 This mainly offers a more efficient way to read the te=
lemetry as
> =C2=A0=C2=A0=C2=A0 clients would read only a few files instead of reading=
 all of
> them.
>=20
> =C2=A0 - The last two patches don't depend on RUSD and work on every GPU.
> But
> =C2=A0=C2=A0=C2=A0 they are here because they complete the sensor telemet=
ry story. I
> am
> =C2=A0=C2=A0=C2=A0 happy to split them into their own series if that is p=
referred.
>=20
> Userspace WIP work built on this sysfs surface exists in form of
> nouveau
> backends for nvtop, LACT, and a NVK HUD:
>=20
> =C2=A0 - nvtop: https://github.com/mohamexiety/nvtop/tree/nvtop-nouvtop
>=20
> =C2=A0 - LACT: https://github.com/mohamexiety/LACT/tree/lnouvct
>=20
> =C2=A0 - NVK HUD:
> =C2=A0=C2=A0=C2=A0 https://gitlab.freedesktop.org/mesa/mesa/-/merge_reque=
sts/39898
>=20
> None of these are merged yet and exist for testing only. Upstreaming
> will
> begin when this series gets merged and the interface is stable.
>=20
> Mohamed Ahmed (6):
> =C2=A0 drm/nouveau/gsp: vendor the RUSD header
> =C2=A0 drm/nouveau/gsp: add RUSD telemetry support
> =C2=A0 drm/nouveau: add GSP hwmon support
> =C2=A0 drm/nouveau: expose RUSD telemetry via sysfs
> =C2=A0 drm/nouveau: expose global VRAM size and usage via sysfs
> =C2=A0 drm/nouveau: expose per-client GPU usage via fdinfo
>=20
> =C2=A0.../ABI/testing/sysfs-driver-nouveau=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 | 167 ++++++
> =C2=A0MAINTAINERS=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
 |=C2=A0=C2=A0 1 +
> =C2=A0drivers/gpu/drm/nouveau/Kbuild=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 1 +
> =C2=A0.../gpu/drm/nouveau/include/nvkm/subdev/gsp.h |=C2=A0 33 ++
> =C2=A0.../drm/nouveau/include/nvkm/subdev/rusd.h=C2=A0=C2=A0=C2=A0 | 114 =
++++
> =C2=A0.../gpu/drm/nouveau/include/nvrm/nvtypes.h=C2=A0=C2=A0=C2=A0 |=C2=
=A0=C2=A0 3 +
> =C2=A0drivers/gpu/drm/nouveau/nouveau_abi16.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 |=C2=A0 16 +
> =C2=A0drivers/gpu/drm/nouveau/nouveau_chan.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 2 +
> =C2=A0drivers/gpu/drm/nouveau/nouveau_drm.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0 |=C2=A0 22 +
> =C2=A0drivers/gpu/drm/nouveau/nouveau_drv.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0 |=C2=A0 29 +
> =C2=A0drivers/gpu/drm/nouveau/nouveau_exec.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 3 +
> =C2=A0drivers/gpu/drm/nouveau/nouveau_gem.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0 |=C2=A0 16 +
> =C2=A0drivers/gpu/drm/nouveau/nouveau_hwmon.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 | 375 ++++++++++---
> =C2=A0drivers/gpu/drm/nouveau/nouveau_sched.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 |=C2=A0 87 +++
> =C2=A0drivers/gpu/drm/nouveau/nouveau_sched.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 |=C2=A0 11 +
> =C2=A0drivers/gpu/drm/nouveau/nouveau_sysfs.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 | 311 ++++++++++
> =C2=A0drivers/gpu/drm/nouveau/nouveau_sysfs.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 |=C2=A0 10 +
> =C2=A0.../drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c |=C2=A0 26 +
> =C2=A0.../drm/nouveau/nvkm/subdev/gsp/rm/r535/rm.c=C2=A0 |=C2=A0=C2=A0 1 =
+
> =C2=A0.../nouveau/nvkm/subdev/gsp/rm/r570/Kbuild=C2=A0=C2=A0=C2=A0 |=C2=
=A0=C2=A0 1 +
> =C2=A0.../nvkm/subdev/gsp/rm/r570/nvrm/rusd.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 | 303 ++++++++++
> =C2=A0.../drm/nouveau/nvkm/subdev/gsp/rm/r570/rm.c=C2=A0 |=C2=A0=C2=A0 1 =
+
> =C2=A0.../nouveau/nvkm/subdev/gsp/rm/r570/rusd.c=C2=A0=C2=A0=C2=A0 | 531
> ++++++++++++++++++
> =C2=A0.../gpu/drm/nouveau/nvkm/subdev/gsp/rm/rm.h=C2=A0=C2=A0 |=C2=A0=C2=
=A0 7 +
> =C2=A024 files changed, 1990 insertions(+), 81 deletions(-)
> =C2=A0create mode 100644 Documentation/ABI/testing/sysfs-driver-nouveau
> =C2=A0create mode 100644
> drivers/gpu/drm/nouveau/include/nvkm/subdev/rusd.h
> =C2=A0create mode 100644 drivers/gpu/drm/nouveau/nouveau_sysfs.c
> =C2=A0create mode 100644 drivers/gpu/drm/nouveau/nouveau_sysfs.h
> =C2=A0create mode 100644
> drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/nvrm/rusd.h
> =C2=A0create mode 100644
> drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/rusd.c