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/20240403203517.731876-1-mcanal@xxxxxxxxxx/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/20240417011021.600889-1-mcanal@xxxxxxxxxx/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(-) -- 2.44.0