mbox series

[v2,0/2] Balance mutex_init and mutex_destroy calls

Message ID 20221108175425.39819-1-mcanal@igalia.com (mailing list archive)
Headers show
Series Balance mutex_init and mutex_destroy calls | expand

Message

Maíra Canal Nov. 8, 2022, 5:54 p.m. UTC
This series introduces some changes to assure the correct resource release on
the V3D driver, especially the mutex. Currently, the V3D has no mutex_destroy()
calls, which means that a mutex is being instantiated, but it is not being
released by the end of its use.

So, use the DRM-managed mutex_init variants when possible to manage the mutex
release and add mutex_destroy() calls when not possible.

Best Regards,
- Maíra Canal

v1 -> v2: https://lore.kernel.org/dri-devel/20221107224656.278135-1-mcanal@igalia.com/T/#m3c23e3f21fe6aaae51138c746c74e94b2a7b3bfc

- Move mutex_destroy() to v3d_perfmon_put() (Daniel Vetter).
- Add mutex_destroy() on error case in v3d_perfmon_create_ioctl() (Daniel Vetter).
- Add Daniel Vetter's tags.

Maíra Canal (2):
  drm/v3d: switch to drmm_mutex_init
  drm/v3d: add missing mutex_destroy

 drivers/gpu/drm/v3d/v3d_gem.c     | 17 +++++++++++++----
 drivers/gpu/drm/v3d/v3d_perfmon.c |  6 +++++-
 2 files changed, 18 insertions(+), 5 deletions(-)

Comments

Melissa Wen Nov. 10, 2022, 12:59 p.m. UTC | #1
On 11/8/22 16:54, Maíra Canal wrote:
> This series introduces some changes to assure the correct resource release on
> the V3D driver, especially the mutex. Currently, the V3D has no mutex_destroy()
> calls, which means that a mutex is being instantiated, but it is not being
> released by the end of its use.
>
> So, use the DRM-managed mutex_init variants when possible to manage the mutex
> release and add mutex_destroy() calls when not possible.
>
> Best Regards,
> - Maíra Canal
>
> v1 -> v2: https://lore.kernel.org/dri-devel/20221107224656.278135-1-mcanal@igalia.com/T/#m3c23e3f21fe6aaae51138c746c74e94b2a7b3bfc
>
> - Move mutex_destroy() to v3d_perfmon_put() (Daniel Vetter).
> - Add mutex_destroy() on error case in v3d_perfmon_create_ioctl() (Daniel Vetter).
> - Add Daniel Vetter's tags.

Applied to drm-misc-next.

Thanks,

Melissa

>
> Maíra Canal (2):
>    drm/v3d: switch to drmm_mutex_init
>    drm/v3d: add missing mutex_destroy
>
>   drivers/gpu/drm/v3d/v3d_gem.c     | 17 +++++++++++++----
>   drivers/gpu/drm/v3d/v3d_perfmon.c |  6 +++++-
>   2 files changed, 18 insertions(+), 5 deletions(-)
>