Skip to content

drm/v3d: Fix GPU stats inconsistencies and race-condition

Maíra Canal dri-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest5 patches 4 repliesIn review
  2. v24 patches 1 replySuperseded
  3. v15 patches 10 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5drm/v3d: Create two functions to update all GPU stats variablesdrivers/gpu/drm/v3d/v3d_drv.h drivers/gpu/drm/v3d/v3d_irq.c drivers/gpu/drm/v3d/v3d_sched.c+40 -890 replies
2/5drm/v3d: Create a struct to store the GPU statsdrivers/gpu/drm/v3d/v3d_drv.c drivers/gpu/drm/v3d/v3d_drv.h drivers/gpu/drm/v3d/v3d_gem.c +2 more+39 -320 replies
3/5drm/v3d: Create function to update a set of GPU statsdrivers/gpu/drm/v3d/v3d_sched.c+10 -70 replies
4/5drm/v3d: Decouple stats calculation from printingdrivers/gpu/drm/v3d/v3d_drv.c drivers/gpu/drm/v3d/v3d_drv.h drivers/gpu/drm/v3d/v3d_sysfs.c+21 -121 reply
5/5drm/v3d: Fix race-condition between sysfs/fdinfo and interrupt handlerdrivers/gpu/drm/v3d/v3d_drv.c drivers/gpu/drm/v3d/v3d_drv.h drivers/gpu/drm/v3d/v3d_gem.c +1 more+25 -40 replies

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchTvrtko UrsulinJose Maria Casanova Crespo
1/5R-b
2/5R-b R-b
3/5R-b R-b
4/5R-b
5/5R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/5] drm/v3d: Fix GPU stats inconsistencies and race-condition

The first version of this series had the intention to fix two major issues with the GPU stats:

1. We were incrementing enabled_ns twice by the end of each job.
2. There is a race-condition between the IRQ handler and the users

The first of the issues was already addressed and the fix was applied to drm-misc-fixes. Now, what is left, addresses the second issue.

Apart from addressing this issue, this series improved the GPU stats code as a whole. We reduced code repetition, creating functions to start and update the GPU stats. This will likely reduce the odds of issue #1 happen again.

v1 -> v2: https://lore.kernel.org/dri-devel/[email protected]/T/

- As the first patch was a bugfix, it was pushed to drm-misc-fixes.
- [1/4] Add Chema Casanova's R-b
- [2/4] s/jobs_sent/jobs_completed and add the reasoning in the commit message (Chema Casanova)
- [2/4] Add Chema Casanova's and Tvrtko Ursulin's R-b
- [3/4] Call local_clock() only once, by adding a new parameter to the v3d_stats_update function (Chema Casanova)
- [4/4] Move new line to the correct patch [2/4] (Tvrtko Ursulin)
- [4/4] Use seqcount_t as locking primitive instead of a rw_lock (Tvrtko Ursulin)

v2 -> v3: https://lore.kernel.org/dri-devel/[email protected]/T/

- [4/5] New patch: separates the code refactor from the race-condition fix (Tvrtko Ursulin)
- [5/5] s/interruption/interrupt (Tvrtko Ursulin)
- [5/5] s/matches/match (Tvrtko Ursulin)
- [5/5] Add Tvrtko Ursulin's R-b

Best Regards,
- Maíra

Maíra Canal (5):
drm/v3d: Create two functions to update all GPU stats variables drm/v3d: Create a struct to store the GPU stats
drm/v3d: Create function to update a set of GPU stats drm/v3d: Decouple stats calculation from printing
drm/v3d: Fix race-condition between sysfs/fdinfo and interrupt handler

 drivers/gpu/drm/v3d/v3d_drv.c   | 33 ++++++++----
 drivers/gpu/drm/v3d/v3d_drv.h   | 30 ++++++++---
 drivers/gpu/drm/v3d/v3d_gem.c   |  9 ++--
 drivers/gpu/drm/v3d/v3d_irq.c   | 48 ++---------------
 drivers/gpu/drm/v3d/v3d_sched.c | 94 +++++++++++++++++----------------
 drivers/gpu/drm/v3d/v3d_sysfs.c | 13 ++---
 6 files changed, 109 insertions(+), 118 deletions(-)
Signature · 1 line
2.44.0