This series addresses two major issues on the GPU stats: 1. Currently, we are incrementing `enabled_ns` twice by the end of each job. 2. There is a race-condition between the IRQ handler and the users Apart from addressing this issues, this series improved the GPU stats code as a hole. We reduced code repetition as a hole, creating functions to start and update the GPU stats. This will likely reduce the odds of issue #1 happen again. Note that I incrementally improved the code, creating small atomics commits to ease the reviewing process. Also, I separated the first patch, that has the fix to issue #1, in order to keep the fix separated from code improvements. The issue #1 is addressed on the first patch, while issue #2 is addressed in the last patch. Patches #2 to #4 are code improvements. Best Regards, - Maíra Maíra Canal (5): drm/v3d: Don't increment `enabled_ns` twice 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 | 24 +++++--- drivers/gpu/drm/v3d/v3d_drv.h | 26 ++++++--- drivers/gpu/drm/v3d/v3d_gem.c | 9 +-- drivers/gpu/drm/v3d/v3d_irq.c | 52 ++---------------- drivers/gpu/drm/v3d/v3d_sched.c | 97 ++++++++++++++++++--------------- drivers/gpu/drm/v3d/v3d_sysfs.c | 18 +++--- 6 files changed, 104 insertions(+), 122 deletions(-) -- 2.44.0