Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [RFC 0/6] fdinfo alternative memory stats proposal
@ 2023-04-17 15:56 Tvrtko Ursulin
  2023-04-17 15:56 ` [Intel-gfx] [RFC 1/6] drm: Add common fdinfo helper Tvrtko Ursulin
                   ` (9 more replies)
  0 siblings, 10 replies; 35+ messages in thread
From: Tvrtko Ursulin @ 2023-04-17 15:56 UTC (permalink / raw)
  To: Intel-gfx, dri-devel; +Cc: Daniel Vetter, Alex Deucher, Christian König

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

As discussed in the Rob's thread here is a slightly alternative idea on what to
expose and how.

DRM core is still defining a list of common memory categories but it is now up
to drivers to fill in the data and opt into the feature.

There is also no aggregated category and memory regions are always specified in
key names.

Two driver vfuncs are added where DRM core queries the number and names of
memory regions supported by the driver instance, and second where the driver
fills in the usage statistics for centrally defined memory categories.

I think this is a more future proof option since by moving the stat filling to
drivers they are able to show not only the GEM handles but all used memory. For
instance in case of i915 we have contexts, ring buffers, status pages and page
tables all backed by GEM objects too.

It also opens up a route for reporting sub-object size backing store granularity
and allows for not traversing under the file_table lock for drivers which are
able to do it in a more light-weight manner. For the former one example could be
simply adding TTM region helpers.

Not having aggregated counters means we do not need to add a second set of keys
as soon as the first driver wants to provide a more detailed view. And userspace
can trivially aggregate itself anyway.

At the same time two trivial helpers are provided who want to show just the
basic stats.

I have also tried to preserve the drm-memory-$region naming by reserving a
special character ('^') as a suffix ie. drm-memory-$region^$category. Unless I
am missing something this should be compatible with any existing parsers which
would just see more memory regions with more specific names. And they can be
updated to support the format extension.

Series is a bit rough so for discussion only.

Rob Clark (1):
  drm: Add common fdinfo helper

Tvrtko Ursulin (5):
  drm/i915: Use the fdinfo helper
  drm: Add fdinfo memory stats
  drm: Add simple fdinfo memory helpers
  drm/msm: Add basic memory stats
  drm/i915: Implement fdinfo memory stats printing

 Documentation/gpu/drm-usage-stats.rst  |  22 +++-
 drivers/gpu/drm/drm_file.c             | 132 +++++++++++++++++++
 drivers/gpu/drm/i915/i915_driver.c     |  11 +-
 drivers/gpu/drm/i915/i915_drm_client.c | 167 +++++++++++++++++--------
 drivers/gpu/drm/i915/i915_drm_client.h |  30 ++---
 drivers/gpu/drm/i915/i915_drv.h        |   4 +-
 drivers/gpu/drm/i915/i915_gem.c        |   6 +-
 drivers/gpu/drm/msm/msm_drv.c          |   4 +
 include/drm/drm_drv.h                  |  14 +++
 include/drm/drm_file.h                 |  18 +++
 10 files changed, 324 insertions(+), 84 deletions(-)

-- 
2.37.2


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

end of thread, other threads:[~2023-04-21  1:27 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-17 15:56 [Intel-gfx] [RFC 0/6] fdinfo alternative memory stats proposal Tvrtko Ursulin
2023-04-17 15:56 ` [Intel-gfx] [RFC 1/6] drm: Add common fdinfo helper Tvrtko Ursulin
2023-04-17 15:56 ` [Intel-gfx] [RFC 2/6] drm/i915: Use the " Tvrtko Ursulin
2023-04-17 15:56 ` [Intel-gfx] [RFC 3/6] drm: Add fdinfo memory stats Tvrtko Ursulin
2023-04-17 16:20   ` Christian König
2023-04-18 10:47     ` Tvrtko Ursulin
2023-04-18 14:16       ` Rob Clark
2023-04-17 19:39   ` Rob Clark
2023-04-18  8:59     ` Tvrtko Ursulin
2023-04-18 13:49       ` Rob Clark
2023-04-18 14:18         ` Tvrtko Ursulin
2023-04-18 14:36           ` Rob Clark
2023-04-18 14:45             ` Tvrtko Ursulin
2023-04-18 16:13               ` Rob Clark
2023-04-18 16:44                 ` Tvrtko Ursulin
2023-04-18 17:10                   ` Rob Clark
2023-04-17 15:56 ` [Intel-gfx] [RFC 4/6] drm: Add simple fdinfo memory helpers Tvrtko Ursulin
2023-04-18 17:18   ` Rob Clark
2023-04-19 13:16     ` Tvrtko Ursulin
2023-04-19 14:32       ` Rob Clark
2023-04-20 13:14         ` Tvrtko Ursulin
2023-04-21  1:24           ` Rob Clark
2023-04-17 15:56 ` [Intel-gfx] [RFC 5/6] drm/msm: Add basic memory stats Tvrtko Ursulin
2023-04-17 15:56 ` [Intel-gfx] [RFC 6/6] drm/i915: Implement fdinfo memory stats printing Tvrtko Ursulin
2023-04-18 14:39   ` Rob Clark
2023-04-18 14:58     ` Tvrtko Ursulin
2023-04-18 16:08       ` Rob Clark
2023-04-19 14:06         ` Tvrtko Ursulin
2023-04-19 14:38           ` Rob Clark
2023-04-20 13:11             ` Tvrtko Ursulin
2023-04-21  1:26               ` Rob Clark
2023-04-17 19:54 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for fdinfo alternative memory stats proposal Patchwork
2023-04-17 19:54 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-04-17 20:05 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-04-18  7:21 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox