[Nouveau] [PATCH RFC 00/20] expose global performance counters

Samuel Pitoiset samuel.pitoiset at gmail.com
Sun Jun 7 13:40:10 PDT 2015


This series exposes global performance counters (PCOUNTER) to the userspace
through the nvif interface by reworking most of the code related to the PM

This interface will allow the userspace to control and monitor complex hardware
events like the proprietary driver already does, for example with CUPTI and

For now, this series only exposes performance counters on NV50, but this is
going to be pretty similar for other families. My plan is to submit more
patches for Fermi and Kepler after this series will be reviewed.

The code of this series can be found here:


And the corresponding libdrm branch can be found here:


A full example which exposes both compute and graphics hardware events on NV50
can be found here:


Most of the code will be implemented in mesa once the kernel interface is
going to be upstream and stable.

Below, you can find a summary of the series:

Patches 1-2:	fix a bug related to the PM engine context
Patches 3-4:	remove useless PMU signals and unused functions
Patches 5-6:	reorganize the nvif interface to expose more stuff
Patches 7-11:	expose PCOUNTER domains to the userspace
Patches 12-14:	implement concept of sources (ie. multiplexers)
Patches 15-17:	allow to monitor complex hardware events
Patches 18:	add compute/graphics signals/sources
Patches 19-20:  expose a software methods interface for controlling PM

Feel free to make a review.
Thanks in advance!

Samuel Pitoiset (20):
  pm: prevent freeing the wrong engine context
  pm: fix a potential race condition when creating an engine context
  pm: remove pmu signals
  pm: remove unused nvkm_perfsig_wrap() function
  pm: reorganize the nvif interface
  pm: prevent creating a perfctr object when signals are not found
  pm: implement NVIF_PERFMON_V0_QUERY_DOMAIN method
  pm: allow to query signals by domain
  pm: change signal iter to u16
  pm: use hardware signals indexes instead of user-readable names
  pm: allow to monitor hardware signal index 0x00
  pm: add concept of sources
  pm: allow to query the number of sources for a signal
  pm: implement NVIF_PERFMON_V0_QUERY_SOURCE method
  pm: allow the userspace to schedule hardware counters
  pm: allow to configure domains instead of simple counters
  pm: allow the userspace to configure sources
  pm/nv50: add compute and graphics signals/sources
  sw/nv50: add some private functions to factorize code
  sw/nv50: add and interface for controlling performance counters

 bin/nv_perfmon.c                      | 324 ++++++++++++----
 drm/nouveau/include/nvif/class.h      |  68 +++-
 drm/nouveau/include/nvif/ioctl.h      |   5 +-
 drm/nouveau/include/nvkm/engine/pm.h  |   6 +-
 drm/nouveau/nvkm/engine/device/nv50.c |   2 +-
 drm/nouveau/nvkm/engine/pm/Kbuild     |   2 +-
 drm/nouveau/nvkm/engine/pm/base.c     | 685 +++++++++++++++++++++++++---------
 drm/nouveau/nvkm/engine/pm/daemon.c   | 108 ------
 drm/nouveau/nvkm/engine/pm/g84.c      | 101 ++++-
 drm/nouveau/nvkm/engine/pm/gf100.c    |  13 +-
 drm/nouveau/nvkm/engine/pm/gk104.c    |   6 -
 drm/nouveau/nvkm/engine/pm/gk110.c    |   4 -
 drm/nouveau/nvkm/engine/pm/gt200.c    | 163 ++++++++
 drm/nouveau/nvkm/engine/pm/gt215.c    | 104 ++++--
 drm/nouveau/nvkm/engine/pm/nv40.c     |   8 +-
 drm/nouveau/nvkm/engine/pm/nv50.c     | 136 ++++++-
 drm/nouveau/nvkm/engine/pm/priv.h     |  53 ++-
 drm/nouveau/nvkm/engine/sw/nv50.c     | 216 ++++++++++-
 drm/nouveau/nvkm/engine/sw/nv50.h     |   6 +
 19 files changed, 1561 insertions(+), 449 deletions(-)
 delete mode 100644 drm/nouveau/nvkm/engine/pm/daemon.c
 create mode 100644 drm/nouveau/nvkm/engine/pm/gt200.c


More information about the Nouveau mailing list