drm/v3d: Replace IDR with XArray for perfmon tracking
Subsystems (4)
Maíra Canal
maintainerPATCH v2 1/2 drm/v3d: Replace IDR with XArray for perfmon tracking
The IDR interface is deprecated and the XArray API is the recommended replacement. Replace the per-file IDR used to track perfmons with an XArray. This allows us to remove the external mutex that protects the IDR.
While here, introduce the v3d_perfmon_delete() helper to consolidate the perfmon cleanup logic used by both v3d_perfmon_close_file() and v3d_perfmon_destroy_ioctl().
---
v1 -> v2: https://lore.kernel.org/dri-devel/[email protected]/
- Replace XA_LIMIT(V3D_PERFMONID_MIN, V3D_PERFMONID_MAX) with xa_limit_32b (Tvrtko Ursulin)
--- drivers/gpu/drm/v3d/v3d_drv.h | 5 +-- drivers/gpu/drm/v3d/v3d_perfmon.c | 57 +++++++++++-------------------- 2 files changed, 20 insertions(+), 42 deletions(-)
drivers/gpu/drm/v3d/v3d_drv.h +1 -4
@@ -220,10 +220,7 @@ v3d_has_csd(struct v3d_dev *v3d)struct v3d_file_priv {struct v3d_dev *v3d; -struct { -struct idr idr; -struct mutex lock; - } perfmon; +struct xarray perfmons;struct drm_sched_entity sched_entity[V3D_MAX_QUEUES ];
drivers/gpu/drm/v3d/v3d_perfmon.c +19 -38
119 lines not on this page · raw message
Signature · 1 line
2.52.0
Maíra Canal
maintainerPATCH v2 2/2 drm/vc4: Replace IDR with XArray for perfmon tracking
The IDR interface is deprecated and the XArray API is the recommended replacement. Replace the per-file IDR used to track perfmons with an XArray. This allows us to remove the external mutex that protects the IDR.
While at it, introduce the vc4_perfmon_delete() helper to consolidate the perfmon cleanup logic used by both vc4_perfmon_close_file() and vc4_perfmon_destroy_ioctl(). Also, remove the redundant assignment of vc4file->dev to itself in vc4_perfmon_open_file().
---
v1 -> v2: https://lore.kernel.org/dri-devel/[email protected]/
- Replace XA_LIMIT(VC4_PERFMONID_MIN, VC4_PERFMONID_MAX) with xa_limit_32b (Tvrtko Ursulin)
--- drivers/gpu/drm/vc4/vc4_drv.h | 5 +-- drivers/gpu/drm/vc4/vc4_perfmon.c | 51 +++++++++++++------------------ 2 files changed, 22 insertions(+), 34 deletions(-)
drivers/gpu/drm/vc4/vc4_drv.h +1 -4
@@ -791,10 +791,7 @@ struct vc4_exec_info {struct vc4_file {struct vc4_dev *dev; -struct { -struct idr idr; -struct mutex lock; - } perfmon; +struct xarray perfmons;bool bin_bo_used; };
drivers/gpu/drm/vc4/vc4_perfmon.c +21 -30
114 lines not on this page · raw message
Signature · 1 line
2.52.0
Quoted 10 lines · Maíra Canal
The IDR interface is deprecated and the XArray API is the recommended replacement. Replace the per-file IDR used to track perfmons with an XArray. This allows us to remove the external mutex that protects the IDR.
While here, introduce the
v3d_perfmon_delete()helper to consolidate the perfmon cleanup logic used by bothv3d_perfmon_close_file()andv3d_perfmon_destroy_ioctl().[...]
Applied, thanks!
[1/2] drm/v3d: Replace IDR with XArray for perfmon tracking
commit: 0a5b0d095bcdb219348ed8ae1c97ee99fc4913b8
[2/2] drm/vc4: Replace IDR with XArray for perfmon tracking
commit: b1cc4172cc60b1039235c9dfc08c3c1ffa4fb863Best regards,
- Maíra