mbox series

[0/6,V4] fdinfo shared stats

Message ID 20240212210428.851952-1-alexander.deucher@amd.com (mailing list archive)
Headers show
Series fdinfo shared stats | expand

Message

Alex Deucher Feb. 12, 2024, 9:04 p.m. UTC
We had a request to add shared buffer stats to fdinfo for amdgpu and
while implementing that, Christian mentioned that just looking at
the GEM handle count doesn't take into account buffers shared with other
subsystems like V4L or RDMA.  Those subsystems don't use GEM, so it
doesn't really matter from a GPU top perspective, but it's more
correct if you actually want to see shared buffers.

After further discussions, add a helper and update all fdinfo
implementations to use that helper for consistency.

v4: switch drm_gem_object_is_shared_for_memory_stats() to an inline function

Alex Deucher (6):
  Documentation/gpu: Update documentation on drm-shared-*
  drm: add drm_gem_object_is_shared_for_memory_stats() helper
  drm: update drm_show_memory_stats() for dma-bufs
  drm/amdgpu: add shared fdinfo stats
  drm/i915: Update shared stats to use the new gem helper
  drm/xe: Update shared stats to use the new gem helper

 Documentation/gpu/drm-usage-stats.rst      |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c |  4 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 11 +++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h |  6 ++++++
 drivers/gpu/drm/drm_file.c                 |  2 +-
 drivers/gpu/drm/i915/i915_drm_client.c     |  2 +-
 drivers/gpu/drm/xe/xe_drm_client.c         |  2 +-
 include/drm/drm_gem.h                      | 13 +++++++++++++
 8 files changed, 38 insertions(+), 4 deletions(-)

Comments

Christian König Feb. 15, 2024, 2:12 p.m. UTC | #1
Am 12.02.24 um 22:04 schrieb Alex Deucher:
> We had a request to add shared buffer stats to fdinfo for amdgpu and
> while implementing that, Christian mentioned that just looking at
> the GEM handle count doesn't take into account buffers shared with other
> subsystems like V4L or RDMA.  Those subsystems don't use GEM, so it
> doesn't really matter from a GPU top perspective, but it's more
> correct if you actually want to see shared buffers.
>
> After further discussions, add a helper and update all fdinfo
> implementations to use that helper for consistency.
>
> v4: switch drm_gem_object_is_shared_for_memory_stats() to an inline function

I'm still not sure if looking at the actual handle count is the right 
approach, but it's certainly better than before.

So Reviewed-by: Christian König <christian.koenig@amd.com> for the 
entire series.

Should I take this through drm-misc-next?

Regards,
Christian.

>
> Alex Deucher (6):
>    Documentation/gpu: Update documentation on drm-shared-*
>    drm: add drm_gem_object_is_shared_for_memory_stats() helper
>    drm: update drm_show_memory_stats() for dma-bufs
>    drm/amdgpu: add shared fdinfo stats
>    drm/i915: Update shared stats to use the new gem helper
>    drm/xe: Update shared stats to use the new gem helper
>
>   Documentation/gpu/drm-usage-stats.rst      |  2 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c |  4 ++++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 11 +++++++++++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.h |  6 ++++++
>   drivers/gpu/drm/drm_file.c                 |  2 +-
>   drivers/gpu/drm/i915/i915_drm_client.c     |  2 +-
>   drivers/gpu/drm/xe/xe_drm_client.c         |  2 +-
>   include/drm/drm_gem.h                      | 13 +++++++++++++
>   8 files changed, 38 insertions(+), 4 deletions(-)
>
Alex Deucher Feb. 15, 2024, 2:20 p.m. UTC | #2
On Thu, Feb 15, 2024 at 9:18 AM Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
>
> Am 12.02.24 um 22:04 schrieb Alex Deucher:
> > We had a request to add shared buffer stats to fdinfo for amdgpu and
> > while implementing that, Christian mentioned that just looking at
> > the GEM handle count doesn't take into account buffers shared with other
> > subsystems like V4L or RDMA.  Those subsystems don't use GEM, so it
> > doesn't really matter from a GPU top perspective, but it's more
> > correct if you actually want to see shared buffers.
> >
> > After further discussions, add a helper and update all fdinfo
> > implementations to use that helper for consistency.
> >
> > v4: switch drm_gem_object_is_shared_for_memory_stats() to an inline function
>
> I'm still not sure if looking at the actual handle count is the right
> approach, but it's certainly better than before.

Well, it's consistent across drivers.

>
> So Reviewed-by: Christian König <christian.koenig@amd.com> for the
> entire series.
>
> Should I take this through drm-misc-next?

Yes, please.

Thanks,

Alex

>
> Regards,
> Christian.
>
> >
> > Alex Deucher (6):
> >    Documentation/gpu: Update documentation on drm-shared-*
> >    drm: add drm_gem_object_is_shared_for_memory_stats() helper
> >    drm: update drm_show_memory_stats() for dma-bufs
> >    drm/amdgpu: add shared fdinfo stats
> >    drm/i915: Update shared stats to use the new gem helper
> >    drm/xe: Update shared stats to use the new gem helper
> >
> >   Documentation/gpu/drm-usage-stats.rst      |  2 +-
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c |  4 ++++
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 11 +++++++++++
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_object.h |  6 ++++++
> >   drivers/gpu/drm/drm_file.c                 |  2 +-
> >   drivers/gpu/drm/i915/i915_drm_client.c     |  2 +-
> >   drivers/gpu/drm/xe/xe_drm_client.c         |  2 +-
> >   include/drm/drm_gem.h                      | 13 +++++++++++++
> >   8 files changed, 38 insertions(+), 4 deletions(-)
> >
>
Christian König Feb. 16, 2024, 12:45 p.m. UTC | #3
Am 15.02.24 um 15:20 schrieb Alex Deucher:
> On Thu, Feb 15, 2024 at 9:18 AM Christian König
> <ckoenig.leichtzumerken@gmail.com> wrote:
>> Am 12.02.24 um 22:04 schrieb Alex Deucher:
>>> We had a request to add shared buffer stats to fdinfo for amdgpu and
>>> while implementing that, Christian mentioned that just looking at
>>> the GEM handle count doesn't take into account buffers shared with other
>>> subsystems like V4L or RDMA.  Those subsystems don't use GEM, so it
>>> doesn't really matter from a GPU top perspective, but it's more
>>> correct if you actually want to see shared buffers.
>>>
>>> After further discussions, add a helper and update all fdinfo
>>> implementations to use that helper for consistency.
>>>
>>> v4: switch drm_gem_object_is_shared_for_memory_stats() to an inline function
>> I'm still not sure if looking at the actual handle count is the right
>> approach, but it's certainly better than before.
> Well, it's consistent across drivers.

Yeah, which makes it easy to change if we find something better.

>
>> So Reviewed-by: Christian König <christian.koenig@amd.com> for the
>> entire series.
>>
>> Should I take this through drm-misc-next?
> Yes, please.

Done.

Regards,
Christian.

>
> Thanks,
>
> Alex
>
>> Regards,
>> Christian.
>>
>>> Alex Deucher (6):
>>>     Documentation/gpu: Update documentation on drm-shared-*
>>>     drm: add drm_gem_object_is_shared_for_memory_stats() helper
>>>     drm: update drm_show_memory_stats() for dma-bufs
>>>     drm/amdgpu: add shared fdinfo stats
>>>     drm/i915: Update shared stats to use the new gem helper
>>>     drm/xe: Update shared stats to use the new gem helper
>>>
>>>    Documentation/gpu/drm-usage-stats.rst      |  2 +-
>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c |  4 ++++
>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 11 +++++++++++
>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_object.h |  6 ++++++
>>>    drivers/gpu/drm/drm_file.c                 |  2 +-
>>>    drivers/gpu/drm/i915/i915_drm_client.c     |  2 +-
>>>    drivers/gpu/drm/xe/xe_drm_client.c         |  2 +-
>>>    include/drm/drm_gem.h                      | 13 +++++++++++++
>>>    8 files changed, 38 insertions(+), 4 deletions(-)
>>>