mbox series

[v2,0/4] drm/v3d: Fix GPU stats inconsistencies and race-condition

Message ID 20240417011021.600889-1-mcanal@igalia.com (mailing list archive)
Headers show
Series drm/v3d: Fix GPU stats inconsistencies and race-condition | expand

Message

Maíra Canal April 17, 2024, 12:53 a.m. UTC
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 as a whole, creating functions
to start and update the GPU stats. This will likely reduce the odds of
issue #1 happen again.

Best Regards,
- Maíra

v1 -> v2: https://lore.kernel.org/dri-devel/20240403203517.731876-1-mcanal@igalia.com/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)

Maíra Canal (4):
  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: Fix race-condition between sysfs/fdinfo and interrupt handler

 drivers/gpu/drm/v3d/v3d_drv.c   | 19 +++----
 drivers/gpu/drm/v3d/v3d_drv.h   | 40 +++++++++++---
 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, 105 insertions(+), 118 deletions(-)