DRM IDR to Xarray conversions
Subsystems (2)
v3 cover DRM IDR to Xarray conversions
v2[2] -> v3:
- indicate the indentifiers do not change in the commit mesage per Jani Nikula
v1[1] -> v2:
- rebase onto latest mainline v6.17-rc2
- fix build error in patch 1 per Intel Test Robot
This series is part of a project to depcrecate the IDR in favor of the Xarray. This simplifies the code as locking is handled by the Xarray internally and removes the need for a seperate mutex to proect the IDR.
The patches are from this tree and have been rebased to v6.17-rc2
https://git.infradead.org/?p=users/willy/xarray.git;a=shortlog;h=refs/heads/xarray-conv
The series has been compiled and tested with drivers/gpu/drm/tests/.kunitconfig and passes all tests.
[15:22:04] Testing complete. Ran 608 tests: passed: 608
[15:22:04] Elapsed time: 34.792s total, 3.086s configuring, 31.541s building, 0.141s running
[1]: https://lore.kernel.org/dri-devel/[email protected]/
[2]: https://lore.kernel.org/dri-devel/[email protected]/
Matthew Wilcox (6):
drm: Convert aux_idr to XArray
drm: Convert object_name_idr to XArray
drm: Convert syncobj_idr to XArray
drm: Convert magic_map to XArray
drm: Convert lessee_idr to XArray
drm: Convert tile_idr to XArray
drivers/gpu/drm/display/drm_dp_aux_dev.c | 38 ++++++-------- drivers/gpu/drm/drm_auth.c | 22 ++++---- drivers/gpu/drm/drm_connector.c | 26 ++++------ drivers/gpu/drm/drm_debugfs.c | 19 +++---- drivers/gpu/drm/drm_gem.c | 11 ++-- drivers/gpu/drm/drm_lease.c | 15 +++--- drivers/gpu/drm/drm_mode_config.c | 3 +- drivers/gpu/drm/drm_syncobj.c | 64 ++++++++---------------- include/drm/drm_auth.h | 9 ++-- include/drm/drm_device.h | 4 +- include/drm/drm_file.h | 6 +-- include/drm/drm_mode_config.h | 12 ++--- 12 files changed, 86 insertions(+), 143 deletions(-)
Signature · 1 line
2.43.0
PATCH v3 1/6 drm: Convert aux_idr to XArray
From: Matthew Wilcox <[email protected]>
From: Matthew Wilcox <[email protected]>
Remove aux_idr_mutex by converting aux_idr to an XArray. aux_xa->index and aux_dev is not modified so the indentifier value is unchanged.
--- drivers/gpu/drm/display/drm_dp_aux_dev.c | 38 ++++++++++-------------- 1 file changed, 15 insertions(+), 23 deletions(-)
drivers/gpu/drm/display/drm_dp_aux_dev.c +15 -23
@@ -52,8 +52,7 @@ struct drm_dp_aux_dev {#define DRM_AUX_MINORS 256#define AUX_MAX_OFFSET (1 << 20) -static DEFINE_IDR (aux_idr); -static DEFINE_MUTEX (aux_idr_mutex); +static DEFINE_XARRAY_ALLOC (aux_xa);static struct class *drm_dp_aux_dev_class;static int drm_dev_major =-1 ;
@@ -61,11 +60,11 @@ static struct drm_dp_aux_dev *drm_dp_aux_dev_get_by_minor(unsigned index) {struct drm_dp_aux_dev *aux_dev =NULL ; -mutex_lock (&aux_idr_mutex); - aux_dev =idr_find (&aux_idr, index); +xa_lock (&aux_xa); + aux_dev =xa_load (&aux_xa, index);if (aux_dev && !kref_get_unless_zero (&aux_dev->refcount)) aux_dev =NULL ; -mutex_unlock (&aux_idr_mutex); +xa_unlock (&aux_xa);return aux_dev; }
@@ -73,7 +72,7 @@ static struct drm_dp_aux_dev *drm_dp_aux_dev_get_by_minor(unsigned index)static struct drm_dp_aux_dev *alloc_drm_dp_aux_dev (struct drm_dp_aux *aux) {struct drm_dp_aux_dev *aux_dev; -int index; +int err; aux_dev =kzalloc (sizeof (*aux_dev),GFP_KERNEL );if (!aux_dev)
@@ -82,14 +81,12 @@ static struct drm_dp_aux_dev *alloc_drm_dp_aux_dev(struct drm_dp_aux *aux)atomic_set (&aux_dev->usecount,1 );kref_init (&aux_dev->refcount); -mutex_lock (&aux_idr_mutex); - index =idr_alloc (&aux_idr, aux_dev,0 ,DRM_AUX_MINORS ,GFP_KERNEL ); -mutex_unlock (&aux_idr_mutex); -if (index <0 ) { + err =xa_alloc (&aux_xa, &aux_dev->index, aux_dev, +XA_LIMIT (0 ,DRM_AUX_MINORS -1 ),GFP_KERNEL ); +if (err <0 ) {kfree (aux_dev); -return ERR_PTR (index); +return ERR_PTR (err); } - aux_dev->index = index;return aux_dev; }
@@ -250,22 +247,19 @@ static const struct file_operations auxdev_fops = {static struct drm_dp_aux_dev *drm_dp_aux_dev_get_by_aux (struct drm_dp_aux *aux) { -struct drm_dp_aux_dev *iter, *aux_dev =NULL ; -int id; +struct drm_dp_aux_dev *aux_dev; +unsigned long id;/* don't increase kref count here because this function should only be * used by drm_dp_aux_unregister_devnode. Thus, it will always have at * least one reference - the one that drm_dp_aux_register_devnode * created */ -mutex_lock (&aux_idr_mutex); -idr_for_each_entry (&aux_idr, iter, id) { -if (iter->aux == aux) { - aux_dev = iter; +xa_for_each (&aux_xa, id, aux_dev) { +if (aux_dev->aux == aux)break ; - } } -mutex_unlock (&aux_idr_mutex); +return aux_dev; }
@@ -284,9 +278,7 @@ void drm_dp_aux_unregister_devnode(struct drm_dp_aux *aux)*/ aux->drm_dev =NULL ; -mutex_lock (&aux_idr_mutex); -idr_remove (&aux_idr, aux_dev->index); -mutex_unlock (&aux_idr_mutex); +xa_erase (&aux_xa, aux_dev->index);atomic_dec (&aux_dev->usecount);wait_var_event (&aux_dev->usecount, !atomic_read (&aux_dev->usecount));
Signature · 1 line
2.43.0
PATCH v3 2/6 drm: Convert object_name_idr to XArray
In reply to Sidhartha KumarFrom: Matthew Wilcox <[email protected]>
From: Matthew Wilcox <[email protected]>
It's not possible to replace object_name_lock as it protects more code than should be reasonably be run under a spinlock, so the xa_lock is nested under the object_name_lock.
obj->name and obj is not modified so the indentifier value is unchanged after this change.
--- drivers/gpu/drm/drm_debugfs.c | 19 ++++++------------- drivers/gpu/drm/drm_gem.c | 11 +++++------ include/drm/drm_device.h | 4 ++-- 3 files changed, 13 insertions(+), 21 deletions(-)
drivers/gpu/drm/drm_debugfs.c +6 -13
@@ -122,27 +122,20 @@ static int drm_clients_info(struct seq_file *m, void *data)return 0 ; } -static int drm_gem_one_name_info (int id,void *ptr,void *data) -{ -struct drm_gem_object *obj = ptr; -struct seq_file *m = data; - -seq_printf (m,"%6d %8zd %7d %8d\n" , - obj->name, obj->size, - obj->handle_count, -kref_read (&obj->refcount)); -return 0 ; -} -static int drm_gem_name_info (struct seq_file *m,void *data) {struct drm_debugfs_entry *entry = m->private;struct drm_device *dev = entry->dev; +struct drm_gem_object *obj; +unsigned long index;seq_printf (m," name size handles refcount\n" );mutex_lock (&dev->object_name_lock); -idr_for_each (&dev->object_name_idr, drm_gem_one_name_info, m); +xa_for_each (&dev->object_names, index, obj) { +seq_printf (m,"%6d %8zd %7d %8d\n" , obj->name, obj->size, + obj->handle_count,kref_read (&obj->refcount)); + }mutex_unlock (&dev->object_name_lock);return 0 ;
drivers/gpu/drm/drm_gem.c +5 -6
@@ -97,7 +97,7 @@ drm_gem_init(struct drm_device *dev)struct drm_vma_offset_manager *vma_offset_manager;mutex_init (&dev->object_name_lock); -idr_init_base (&dev->object_name_idr,1 ); +xa_init_flags (&dev->object_names,XA_FLAGS_ALLOC1 ); vma_offset_manager =drmm_kzalloc (dev,sizeof (*vma_offset_manager),GFP_KERNEL );
@@ -269,7 +269,7 @@ static void drm_gem_object_handle_free(struct drm_gem_object *obj)/* Remove any name for this object */ if (obj->name) { -idr_remove (&dev->object_name_idr, obj->name); +xa_erase (&dev->object_names, obj->name); obj->name =0 ; } }
@@ -927,11 +927,10 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data, }if (!obj->name) { - ret =idr_alloc (&dev->object_name_idr, obj,1 ,0 ,GFP_KERNEL ); + ret =xa_alloc (&dev->object_names, &obj->name, obj, + xa_limit_32b,GFP_KERNEL );if (ret <0 ) goto err; - - obj->name = ret; } args->name = (uint64_t ) obj->name;
@@ -967,7 +966,7 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,return -EOPNOTSUPP ;mutex_lock (&dev->object_name_lock); - obj =idr_find (&dev->object_name_idr, (int ) args->name); + obj =xa_load (&dev->object_names, (int ) args->name);if (obj) {drm_gem_object_get (obj); }else {
include/drm/drm_device.h +2 -2
@@ -325,8 +325,8 @@ struct drm_device {/** @object_name_lock: GEM information */ struct mutex object_name_lock; -/** @object_name_idr: GEM information */ -struct idr object_name_idr; +/** @object_names: GEM information */ +struct xarray object_names;/** @vma_offset_manager: GEM information */ struct drm_vma_offset_manager *vma_offset_manager;
Signature · 1 line
2.43.0
PATCH v3 3/6 drm: Convert syncobj_idr to XArray
In reply to Sidhartha KumarFrom: Matthew Wilcox <[email protected]>
From: Matthew Wilcox <[email protected]>
Remove syncobj_table_lock by converting the syncobj_idr to an XArray. handle and syncobj is not modified in this change so the indentifier value remains the same.
--- drivers/gpu/drm/drm_syncobj.c | 64 +++++++++++------------------------ include/drm/drm_file.h | 6 ++-- 2 files changed, 22 insertions(+), 48 deletions(-)
drivers/gpu/drm/drm_syncobj.c +20 -44
@@ -250,14 +250,12 @@ struct drm_syncobj *drm_syncobj_find(struct drm_file *file_private, {struct drm_syncobj *syncobj; -spin_lock (&file_private->syncobj_table_lock); - -/* Check if we currently have a reference on the object */ - syncobj =idr_find (&file_private->syncobj_idr, handle); +/* Get a reference on the object */ +xa_lock (&file_private->syncobjs); + syncobj =xa_load (&file_private->syncobjs, handle);if (syncobj)drm_syncobj_get (syncobj); - -spin_unlock (&file_private->syncobj_table_lock); +xa_unlock (&file_private->syncobjs);return syncobj; }
@@ -598,23 +596,16 @@ int drm_syncobj_get_handle(struct drm_file *file_private, {int ret; -/* take a reference to put in the idr */ +/* take a reference to put in the XArray */ drm_syncobj_get (syncobj); -idr_preload (GFP_KERNEL ); -spin_lock (&file_private->syncobj_table_lock); - ret =idr_alloc (&file_private->syncobj_idr, syncobj,1 ,0 ,GFP_NOWAIT ); -spin_unlock (&file_private->syncobj_table_lock); + ret =xa_alloc (&file_private->syncobjs, handle, syncobj, xa_limit_31b, +GFP_KERNEL ); -idr_preload_end (); - -if (ret <0 ) { +if (ret <0 )drm_syncobj_put (syncobj); -return ret; - } - *handle = ret; -return 0 ; +return ret; }EXPORT_SYMBOL (drm_syncobj_get_handle);
@@ -638,9 +629,7 @@ static int drm_syncobj_destroy(struct drm_file *file_private, {struct drm_syncobj *syncobj; -spin_lock (&file_private->syncobj_table_lock); - syncobj =idr_remove (&file_private->syncobj_idr, handle); -spin_unlock (&file_private->syncobj_table_lock); + syncobj =xa_erase (&file_private->syncobjs, handle);if (!syncobj)return -EINVAL ;
@@ -726,16 +715,10 @@ static int drm_syncobj_fd_to_handle(struct drm_file *file_private, syncobj =fd_file (f)->private_data;drm_syncobj_get (syncobj); -idr_preload (GFP_KERNEL ); -spin_lock (&file_private->syncobj_table_lock); - ret =idr_alloc (&file_private->syncobj_idr, syncobj,1 ,0 ,GFP_NOWAIT ); -spin_unlock (&file_private->syncobj_table_lock); -idr_preload_end (); + ret =xa_alloc (&file_private->syncobjs, handle, syncobj, xa_limit_31b, +GFP_KERNEL ); -if (ret >0 ) { - *handle = ret; - ret =0 ; - }else +if (ret <0 )drm_syncobj_put (syncobj);return ret;
@@ -814,17 +797,7 @@ static int drm_syncobj_export_sync_file(struct drm_file *file_private,void drm_syncobj_open (struct drm_file *file_private) { -idr_init_base (&file_private->syncobj_idr,1 ); -spin_lock_init (&file_private->syncobj_table_lock); -} - -static int -drm_syncobj_release_handle (int id,void *ptr,void *data) -{ -struct drm_syncobj *syncobj = ptr; - -drm_syncobj_put (syncobj); -return 0 ; +xa_init_flags (&file_private->syncobjs,XA_FLAGS_ALLOC1 ); }/**
@@ -838,9 +811,12 @@ drm_syncobj_release_handle(int id, void *ptr, void *data)void drm_syncobj_release (struct drm_file *file_private) { -idr_for_each (&file_private->syncobj_idr, - &drm_syncobj_release_handle, file_private); -idr_destroy (&file_private->syncobj_idr); +struct drm_syncobj *syncobj; +unsigned long index; + +xa_for_each (&file_private->syncobjs, index, syncobj) +drm_syncobj_put (syncobj); +xa_destroy (&file_private->syncobjs); }int
include/drm/drm_file.h +2 -4
@@ -309,10 +309,8 @@ struct drm_file {/** @table_lock: Protects @object_idr. */ spinlock_t table_lock; -/** @syncobj_idr: Mapping of sync object handles to object pointers. */ -struct idr syncobj_idr; -/** @syncobj_table_lock: Protects @syncobj_idr. */ -spinlock_t syncobj_table_lock; +/** @syncobjs: Mapping of sync object handles to object pointers. */ +struct xarray syncobjs;/** @filp: Pointer to the core file structure. */ struct file *filp;
Signature · 1 line
2.43.0
PATCH v3 4/6 drm: Convert magic_map to XArray
In reply to Sidhartha KumarFrom: Matthew Wilcox <[email protected]>
From: Matthew Wilcox <[email protected]>
Part of the mass conversion of IDR users to the XArray API. file_priv->master->magic_map, auth->magic, and file_priv->magic so the indentifiers are unchanged.
--- drivers/gpu/drm/drm_auth.c | 18 ++++++++---------- include/drm/drm_auth.h | 5 ++--- 2 files changed, 10 insertions(+), 13 deletions(-)
drivers/gpu/drm/drm_auth.c +8 -10
@@ -98,16 +98,15 @@ int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)guard (mutex)(&dev->master_mutex);if (!file_priv->magic) { - ret =idr_alloc (&file_priv->master->magic_map, file_priv, -1 ,0 ,GFP_KERNEL ); -if (ret >=0 ) - file_priv->magic = ret; + ret =xa_alloc (&file_priv->master->magic_map, + &file_priv->magic, file_priv, + xa_limit_31b,GFP_KERNEL ); } auth->magic = file_priv->magic;drm_dbg_core (dev,"%u\n" , auth->magic); -return ret <0 ? ret :0 ; +return ret; } int drm_authmagic(struct drm_device *dev, void *data,
@@ -119,10 +118,10 @@ int drm_authmagic(struct drm_device *dev, void *data,drm_dbg_core (dev,"%u\n" , auth->magic);guard (mutex)(&dev->master_mutex); - file =idr_find (&file_priv->master->magic_map, auth->magic); + file =xa_load (&file_priv->master->magic_map, auth->magic);if (file) { file->authenticated =1 ; -idr_replace (&file_priv->master->magic_map,NULL , auth->magic); +xa_store (&file_priv->master->magic_map, auth->magic,NULL ,0 ); }return file ?0 : -EINVAL ;
@@ -137,7 +136,7 @@ struct drm_master *drm_master_create(struct drm_device *dev)return NULL ;kref_init (&master->refcount); -idr_init_base (&master->magic_map,1 ); +xa_init_flags (&master->magic_map,XA_FLAGS_ALLOC1 ); master->dev = dev;/* initialize the tree of output resource lessees */
@@ -342,7 +341,7 @@ void drm_master_release(struct drm_file *file_priv)guard (mutex)(&dev->master_mutex); master = file_priv->master;if (file_priv->magic) -idr_remove (&file_priv->master->magic_map, file_priv->magic); +xa_erase (&file_priv->master->magic_map, file_priv->magic);if (!drm_is_current_master_locked (file_priv)) goto out;
@@ -408,7 +407,6 @@ static void drm_master_destroy(struct kref *kref)if (drm_core_check_feature (dev,DRIVER_MODESET ))drm_lease_destroy (master); -idr_destroy (&master->magic_map);idr_destroy (&master->leases);idr_destroy (&master->lessee_idr);
include/drm/drm_auth.h +2 -3
@@ -58,10 +58,9 @@ struct drm_master {*/ int unique_len;/** -* @magic_map: Map of used authentication tokens. Protected by -* &drm_device.master_mutex. +* @magic_map: Map of used authentication tokens. */ -struct idr magic_map; +struct xarray magic_map;void *driver_priv;/**
Signature · 1 line
2.43.0
PATCH v3 5/6 drm: Convert lessee_idr to XArray
In reply to Sidhartha KumarFrom: Matthew Wilcox <[email protected]>
From: Matthew Wilcox <[email protected]>
Part of the mass conversion of IDR users to the XArray API. lessee_id and lessee are not modified so the indentifiers are unchanged.
--- drivers/gpu/drm/drm_auth.c | 4 +--- drivers/gpu/drm/drm_lease.c | 15 ++++++--------- include/drm/drm_auth.h | 4 ++-- 3 files changed, 9 insertions(+), 14 deletions(-)
drivers/gpu/drm/drm_auth.c +1 -3
@@ -142,8 +142,7 @@ struct drm_master *drm_master_create(struct drm_device *dev)/* initialize the tree of output resource lessees */ INIT_LIST_HEAD (&master->lessees);INIT_LIST_HEAD (&master->lessee_list); -idr_init (&master->leases); -idr_init_base (&master->lessee_idr,1 ); +xa_init_flags (&master->lessee_xa,XA_FLAGS_ALLOC1 );return master; }
@@ -408,7 +407,6 @@ static void drm_master_destroy(struct kref *kref)drm_lease_destroy (master);idr_destroy (&master->leases); -idr_destroy (&master->lessee_idr);kfree (master->unique);kfree (master);
drivers/gpu/drm/drm_lease.c +6 -9
@@ -82,7 +82,7 @@ static struct drm_master* _drm_find_lessee(struct drm_master *master, int lessee_id) {lockdep_assert_held (&master->dev->mode_config.idr_mutex); -return idr_find (&drm_lease_owner (master)->lessee_idr, lessee_id); +return xa_load (&drm_lease_owner (master)->lessee_xa, lessee_id); }static int _drm_lease_held_master (struct drm_master *master,int id)
@@ -210,7 +210,6 @@ static struct drm_master *drm_lease_create(struct drm_master *lessor, struct idrint error;struct drm_master *lessee;int object; -int id;void *entry;drm_dbg_lease (dev,"lessor %d\n" , lessor->lessee_id);
@@ -237,13 +236,11 @@ static struct drm_master *drm_lease_create(struct drm_master *lessor, struct idr }/* Insert the new lessee into the tree */ - id =idr_alloc (&(drm_lease_owner (lessor)->lessee_idr), lessee,1 ,0 ,GFP_KERNEL ); -if (id <0 ) { - error = id; + error =xa_alloc (&drm_lease_owner (lessor)->lessee_xa, + &lessee->lessee_id, lessee, xa_limit_32b,GFP_KERNEL ); +if (error <0 ) goto out_lessee; - } - lessee->lessee_id = id; lessee->lessor =drm_master_get (lessor);list_add_tail (&lessee->lessee_list, &lessor->lessees);
@@ -276,11 +273,11 @@ void drm_lease_destroy(struct drm_master *master)*/ WARN_ON (!list_empty (&master->lessees)); -/* Remove this master from the lessee idr in the owner */ +/* Remove this master from the lessee array in the owner */ if (master->lessee_id !=0 ) {drm_dbg_lease (dev,"remove master %d from device list of lessees\n" , master->lessee_id); -idr_remove (&(drm_lease_owner (master)->lessee_idr), master->lessee_id); +xa_erase (&drm_lease_owner (master)->lessee_xa, master->lessee_id); }/* Remove this master from any lessee list it may be on */
include/drm/drm_auth.h +2 -2
@@ -120,12 +120,12 @@ struct drm_master {struct idr leases;/** -* @lessee_idr: +* @lessee_xa: * * All lessees under this owner (only used where @lessor is NULL). * Protected by &drm_device.mode_config's &drm_mode_config.idr_mutex. */ -struct idr lessee_idr; +struct xarray lessee_xa; };struct drm_master *drm_master_get (struct drm_master *master);
Signature · 1 line
2.43.0
PATCH v3 6/6 drm: Convert tile_idr to XArray
In reply to Sidhartha KumarFrom: Matthew Wilcox <[email protected]>
From: Matthew Wilcox <[email protected]>
Convert tile_idr to an Xarray. tg->id and tg are not modified so the indentifiers are unchanged.
--- drivers/gpu/drm/drm_connector.c | 26 ++++++++++---------------- drivers/gpu/drm/drm_mode_config.c | 3 +-- include/drm/drm_mode_config.h | 12 ++++++------ 3 files changed, 17 insertions(+), 24 deletions(-)
drivers/gpu/drm/drm_connector.c +10 -16
@@ -3531,9 +3531,7 @@ static void drm_tile_group_free(struct kref *kref) struct drm_tile_group *tg = container_of(kref, struct drm_tile_group, refcount);struct drm_device *dev = tg->dev; -mutex_lock (&dev->mode_config.idr_mutex); -idr_remove (&dev->mode_config.tile_idr, tg->id); -mutex_unlock (&dev->mode_config.idr_mutex); +xa_erase (&dev->mode_config.tiles, tg->id);kfree (tg); }
@@ -3565,19 +3563,18 @@ struct drm_tile_group *drm_mode_get_tile_group(struct drm_device *dev, const char topology[8]) {struct drm_tile_group *tg; -int id; +unsigned long id; -mutex_lock (&dev->mode_config.idr_mutex); -idr_for_each_entry (&dev->mode_config.tile_idr, tg, id) { +xa_lock (&dev->mode_config.tiles); +xa_for_each (&dev->mode_config.tiles, id, tg) {if (!memcmp (tg->group_data, topology,8 )) {if (!kref_get_unless_zero (&tg->refcount)) tg =NULL ; -mutex_unlock (&dev->mode_config.idr_mutex); -return tg; +break ; } } -mutex_unlock (&dev->mode_config.idr_mutex); -return NULL ; +xa_unlock (&dev->mode_config.tiles); +return tg; }EXPORT_SYMBOL (drm_mode_get_tile_group);
@@ -3606,16 +3603,13 @@ struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,memcpy (tg->group_data, topology,8 ); tg->dev = dev; -mutex_lock (&dev->mode_config.idr_mutex); - ret =idr_alloc (&dev->mode_config.tile_idr, tg,1 ,0 ,GFP_KERNEL ); -if (ret >=0 ) { - tg->id = ret; - }else { + ret =xa_alloc (&dev->mode_config.tiles, &tg->id, tg, xa_limit_32b, +GFP_KERNEL ); +if (ret <0 ) {kfree (tg); tg =NULL ; } -mutex_unlock (&dev->mode_config.idr_mutex);return tg; }EXPORT_SYMBOL (drm_mode_create_tile_group);
drivers/gpu/drm/drm_mode_config.c +1 -2
@@ -439,7 +439,7 @@ int drmm_mode_config_init(struct drm_device *dev)INIT_LIST_HEAD (&dev->mode_config.plane_list);INIT_LIST_HEAD (&dev->mode_config.privobj_list);idr_init_base (&dev->mode_config.object_idr,1 ); -idr_init_base (&dev->mode_config.tile_idr,1 ); +xa_init_flags (&dev->mode_config.tiles,XA_FLAGS_ALLOC1 );ida_init (&dev->mode_config.connector_ida);spin_lock_init (&dev->mode_config.connector_list_lock);
@@ -578,7 +578,6 @@ void drm_mode_config_cleanup(struct drm_device *dev) }ida_destroy (&dev->mode_config.connector_ida); -idr_destroy (&dev->mode_config.tile_idr);idr_destroy (&dev->mode_config.object_idr);drm_modeset_lock_fini (&dev->mode_config.connection_mutex); }
include/drm/drm_mode_config.h +6 -6
@@ -393,8 +393,8 @@ struct drm_mode_config {/** * @idr_mutex: * -* Mutex for KMS ID allocation and management. Protects both @object_idr -* and @tile_idr. +* Mutex for KMS ID allocation and management. Protects the +* objects in @object_idr. */ struct mutex idr_mutex;
@@ -407,12 +407,12 @@ struct drm_mode_config {struct idr object_idr;/** -* @tile_idr: +* @tiles: * -* Use this idr for allocating new IDs for tiled sinks like use in some -* high-res DP MST screens. +* Use this for allocating new IDs for tiled sinks like those +* used in some high-res DP MST screens. */ -struct idr tile_idr; +struct xarray tiles;/** @fb_lock: Mutex to protect fb the global @fb_list and @num_fb. */ struct mutex fb_lock;
Signature · 1 line
2.43.0
Quoted 4 lines · Sidhartha Kumar
v2[2] -> v3:
- indicate the indentifiers do not change in the commit mesage per Jani Nikula
Just a friendly ping to check if this series needs anything else before landing.
Thanks,
Sid
Quoted 44 lines
v1[1] -> v2:
- rebase onto latest mainline v6.17-rc2
- fix build error in patch 1 per Intel Test RobotThis series is part of a project to depcrecate the IDR in favor of the Xarray. This simplifies the code as locking is handled by the Xarray internally and removes the need for a seperate mutex to proect the IDR.
The patches are from this tree and have been rebased to v6.17-rc2
https://git.infradead.org/?p=users/willy/xarray.git;a=shortlog;h=refs/heads/xarray-convThe series has been compiled and tested with
drivers/gpu/drm/tests/.kunitconfigand passes all tests.[15:22:04] Testing complete. Ran 608 tests: passed: 608
[15:22:04] Elapsed time: 34.792s total, 3.086s configuring, 31.541s building, 0.141s running[1]: https://lore.kernel.org/dri-devel/[email protected]/
[2]: https://lore.kernel.org/dri-devel/[email protected]/Matthew Wilcox (6):
drm: Convertaux_idrto XArray
drm: Convertobject_name_idrto XArray
drm: Convertsyncobj_idrto XArray
drm: Convertmagic_mapto XArray
drm: Convertlessee_idrto XArray
drm: Converttile_idrto XArraydrivers/gpu/drm/display/drm_dp_aux_dev.c | 38 ++++++-------- drivers/gpu/drm/drm_auth.c | 22 ++++---- drivers/gpu/drm/drm_connector.c | 26 ++++------ drivers/gpu/drm/drm_debugfs.c | 19 +++---- drivers/gpu/drm/drm_gem.c | 11 ++-- drivers/gpu/drm/drm_lease.c | 15 +++--- drivers/gpu/drm/drm_mode_config.c | 3 +- drivers/gpu/drm/drm_syncobj.c | 64 ++++++++---------------- include/drm/drm_auth.h | 9 ++-- include/drm/drm_device.h | 4 +- include/drm/drm_file.h | 6 +-- include/drm/drm_mode_config.h | 12 ++--- 12 files changed, 86 insertions(+), 143 deletions(-)