mbox series

[v4,00/11] v3d: Perfmon cleanup

Message ID 20240711135340.84617-1-tursulin@igalia.com (mailing list archive)
Headers show
Series v3d: Perfmon cleanup | expand

Message

Tvrtko Ursulin July 11, 2024, 1:53 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>

When we had to quickly deal with a tree build issue via merging
792d16b5375d ("drm/v3d: Move perfmon init completely into own unit"), we
promised to follow up with a nicer solution.

As in the process of eliminating the hardcoded defines we have discovered a few
issues in handling of corner cases and userspace input validation, the fix has
turned into a larger series, but hopefully the end result is a justifiable
cleanup.

v2:
 * Re-order the patches so fixes come first while last three are optional
   cleanups.

v3:
 * Fixed a bunch of rebase errors I made when re-ordering patches from v1 to v2.
 * Dropped the double underscore from __v3d_timestamp_query_info_free.
 * Added v3d prefix to v3d_copy_query_info.
 * Renamed qinfo to query_info.
 * Fixed some spelling errors and bad patch references.
 * Added mention to get_user to one commit message.
 * Dropped one patch from the series which became redundant due other
   re-ordering.
 * Re-ordered last two patches with the view of dropping the last.

v4:
 * Fixed more rebase errors and details in commit messages.

 Cc: Maíra Canal <mcanal@igalia.com>

Tvrtko Ursulin (11):
  drm/v3d: Prevent out of bounds access in performance query extensions
  drm/v3d: Fix potential memory leak in the timestamp extension
  drm/v3d: Fix potential memory leak in the performance extension
  drm/v3d: Validate passed in drm syncobj handles in the timestamp
    extension
  drm/v3d: Validate passed in drm syncobj handles in the performance
    extension
  drm/v3d: Move part of copying of reset/copy performance extension to a
    helper
  drm/v3d: Size the kperfmon_ids array at runtime
  drm/v3d: Do not use intermediate storage when copying performance
    query results
  drm/v3d: Move perfmon init completely into own unit
  drm/v3d: Prefer get_user for scalar types
  drm/v3d: Add some local variables in queries/extensions

 drivers/gpu/drm/v3d/v3d_drv.c                 |   9 +-
 drivers/gpu/drm/v3d/v3d_drv.h                 |  16 +-
 drivers/gpu/drm/v3d/v3d_perfmon.c             |  44 +--
 .../gpu/drm/v3d/v3d_performance_counters.h    |  16 +-
 drivers/gpu/drm/v3d/v3d_sched.c               | 105 +++++--
 drivers/gpu/drm/v3d/v3d_submit.c              | 294 +++++++++++-------
 6 files changed, 290 insertions(+), 194 deletions(-)

Comments

Maíra Canal July 13, 2024, 3:06 p.m. UTC | #1
On 7/11/24 10:53, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> 
> When we had to quickly deal with a tree build issue via merging
> 792d16b5375d ("drm/v3d: Move perfmon init completely into own unit"), we
> promised to follow up with a nicer solution.
> 
> As in the process of eliminating the hardcoded defines we have discovered a few
> issues in handling of corner cases and userspace input validation, the fix has
> turned into a larger series, but hopefully the end result is a justifiable
> cleanup.
> 
> v2:
>   * Re-order the patches so fixes come first while last three are optional
>     cleanups.
> 
> v3:
>   * Fixed a bunch of rebase errors I made when re-ordering patches from v1 to v2.
>   * Dropped the double underscore from __v3d_timestamp_query_info_free.
>   * Added v3d prefix to v3d_copy_query_info.
>   * Renamed qinfo to query_info.
>   * Fixed some spelling errors and bad patch references.
>   * Added mention to get_user to one commit message.
>   * Dropped one patch from the series which became redundant due other
>     re-ordering.
>   * Re-ordered last two patches with the view of dropping the last.
> 
> v4:
>   * Fixed more rebase errors and details in commit messages.
> 
>   Cc: Maíra Canal <mcanal@igalia.com>
> 
> Tvrtko Ursulin (11):
>    drm/v3d: Prevent out of bounds access in performance query extensions
>    drm/v3d: Fix potential memory leak in the timestamp extension
>    drm/v3d: Fix potential memory leak in the performance extension
>    drm/v3d: Validate passed in drm syncobj handles in the timestamp
>      extension
>    drm/v3d: Validate passed in drm syncobj handles in the performance
>      extension
>    drm/v3d: Move part of copying of reset/copy performance extension to a
>      helper
>    drm/v3d: Size the kperfmon_ids array at runtime
>    drm/v3d: Do not use intermediate storage when copying performance
>      query results
>    drm/v3d: Move perfmon init completely into own unit
>    drm/v3d: Prefer get_user for scalar types
>    drm/v3d: Add some local variables in queries/extensions

I just applied all patches to drm-misc/drm-misc-next!

@Maxime, @Thomas or @Maarten, is it possible to cherry-pick the
following patches to drm-misc-fixes?

f32b5128d2c4 drm/v3d: Prevent out of bounds access in performance query 
extensions
753ce4fea621 drm/v3d: Fix potential memory leak in the timestamp extension
484de39fa5f5 drm/v3d: Fix potential memory leak in the performance extension
8d1276d1b8f7 drm/v3d: Validate passed in drm syncobj handles in the 
timestamp extension
a546b7e4d73c drm/v3d: Validate passed in drm syncobj handles in the 
performance extension

Tvrtko made sure to make them independent (Thanks Tvrtko!), so I believe
it is going to be pretty straight forward to cherry-pick them.

Thanks Tvrtko for the patches and all the maintainers for the great
work!

Best Regards,
- Maíra

> 
>   drivers/gpu/drm/v3d/v3d_drv.c                 |   9 +-
>   drivers/gpu/drm/v3d/v3d_drv.h                 |  16 +-
>   drivers/gpu/drm/v3d/v3d_perfmon.c             |  44 +--
>   .../gpu/drm/v3d/v3d_performance_counters.h    |  16 +-
>   drivers/gpu/drm/v3d/v3d_sched.c               | 105 +++++--
>   drivers/gpu/drm/v3d/v3d_submit.c              | 294 +++++++++++-------
>   6 files changed, 290 insertions(+), 194 deletions(-)
>