All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] drm/syncobj: Allocation avoiding fast path
@ 2026-11-17 10:39 Tvrtko Ursulin
  2026-11-17 10:39 ` [PATCH 1/3] drm/syncobj: Use vmemdup_array_user in drm_syncobj_array_find Tvrtko Ursulin
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Tvrtko Ursulin @ 2026-11-17 10:39 UTC (permalink / raw)
  To: dri-devel
  Cc: kernel-dev, Tvrtko Ursulin, Maíra Canal, Fei Yu,
	Christian König

In practice there are multiple DRM syncobj operations (and/or ioctls) per
rendered frame, and vast majority of them operates on a just a couple of
handles, or timeline points.

This series adds a fast path to avoid the temporary allocations for those cases.

Cc: Maíra Canal <mcanal@igalia.com>
Cc: Fei Yu <fei.yu@intel.com>
Cc: Christian König <christian.koenig@amd.com>

Tvrtko Ursulin (3):
  drm/syncobj: Use vmemdup_array_user in drm_syncobj_array_find
  drm/syncobj: Add a fast path to drm_syncobj_array_wait_timeout
  drm/syncobj: Add a fast path to drm_syncobj_array_find

 drivers/gpu/drm/drm_syncobj.c | 134 +++++++++++++++++++++++++---------
 1 file changed, 99 insertions(+), 35 deletions(-)

-- 
2.56.0


^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: [PATCH 3/3] drm/syncobj: Add a fast path to drm_syncobj_array_find
@ 2025-11-10 15:11 kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2025-11-10 15:11 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20251106132645.28208-4-tvrtko.ursulin@igalia.com>
References: <20251106132645.28208-4-tvrtko.ursulin@igalia.com>
TO: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
TO: dri-devel@lists.freedesktop.org
CC: kernel-dev@igalia.com
CC: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
CC: "Maíra Canal" <mcanal@igalia.com>

Hi Tvrtko,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm/drm-next]
[also build test WARNING on drm-exynos/exynos-drm-next drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-misc/drm-misc-next drm-tip/drm-tip linus/master v6.18-rc5 next-20251110]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Tvrtko-Ursulin/drm-syncobj-Use-vmemdup_array_user-in-drm_syncobj_array_find/20251106-212904
base:   git://anongit.freedesktop.org/drm/drm drm-next
patch link:    https://lore.kernel.org/r/20251106132645.28208-4-tvrtko.ursulin%40igalia.com
patch subject: [PATCH 3/3] drm/syncobj: Add a fast path to drm_syncobj_array_find
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: i386-randconfig-141-20251110 (https://download.01.org/0day-ci/archive/20251110/202511102233.GPoKgaPv-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202511102233.GPoKgaPv-lkp@intel.com/

smatch warnings:
drivers/gpu/drm/drm_syncobj.c:1339 drm_syncobj_array_find() warn: missing unwind goto?

vim +1339 drivers/gpu/drm/drm_syncobj.c

5e60a10eaebab9 Dave Airlie    2017-08-25  1309  
3e6fb72d6cef6a Faith Ekstrand 2017-08-25  1310  static int drm_syncobj_array_find(struct drm_file *file_private,
9e5544627339ec Ville Syrjälä  2017-09-01  1311  				  void __user *user_handles,
9e5544627339ec Ville Syrjälä  2017-09-01  1312  				  uint32_t count_handles,
6cbb5aa2c8c162 Tvrtko Ursulin 2025-11-06  1313  				  uint32_t *stack_handles,
6cbb5aa2c8c162 Tvrtko Ursulin 2025-11-06  1314  				  struct drm_syncobj **stack_syncobjs,
6cbb5aa2c8c162 Tvrtko Ursulin 2025-11-06  1315  				  u32 stack_count,
3e6fb72d6cef6a Faith Ekstrand 2017-08-25  1316  				  struct drm_syncobj ***syncobjs_out)
5e60a10eaebab9 Dave Airlie    2017-08-25  1317  {
3e6fb72d6cef6a Faith Ekstrand 2017-08-25  1318  	uint32_t i, *handles;
e7aca5031a2fb5 Faith Ekstrand 2017-08-25  1319  	struct drm_syncobj **syncobjs;
3e6fb72d6cef6a Faith Ekstrand 2017-08-25  1320  	int ret;
5e60a10eaebab9 Dave Airlie    2017-08-25  1321  
6cbb5aa2c8c162 Tvrtko Ursulin 2025-11-06  1322  	if (count_handles > stack_count) {
b4ebe6f6bf86ff Tvrtko Ursulin 2025-11-06  1323  		handles = memdup_array_user(user_handles, count_handles,
b4ebe6f6bf86ff Tvrtko Ursulin 2025-11-06  1324  					    sizeof(*handles));
b4ebe6f6bf86ff Tvrtko Ursulin 2025-11-06  1325  		if (IS_ERR(handles))
b4ebe6f6bf86ff Tvrtko Ursulin 2025-11-06  1326  			return PTR_ERR(handles);
5e60a10eaebab9 Dave Airlie    2017-08-25  1327  
6cbb5aa2c8c162 Tvrtko Ursulin 2025-11-06  1328  		syncobjs = kmalloc_array(count_handles, sizeof(*syncobjs),
6cbb5aa2c8c162 Tvrtko Ursulin 2025-11-06  1329  					 GFP_KERNEL);
6cbb5aa2c8c162 Tvrtko Ursulin 2025-11-06  1330  		if (!syncobjs) {
5e60a10eaebab9 Dave Airlie    2017-08-25  1331  			ret = -ENOMEM;
5e60a10eaebab9 Dave Airlie    2017-08-25  1332  			goto err_free_handles;
5e60a10eaebab9 Dave Airlie    2017-08-25  1333  		}
6cbb5aa2c8c162 Tvrtko Ursulin 2025-11-06  1334  	} else {
6cbb5aa2c8c162 Tvrtko Ursulin 2025-11-06  1335  		handles = stack_handles;
6cbb5aa2c8c162 Tvrtko Ursulin 2025-11-06  1336  		syncobjs = stack_syncobjs;
6cbb5aa2c8c162 Tvrtko Ursulin 2025-11-06  1337  		if (copy_from_user(handles, user_handles,
6cbb5aa2c8c162 Tvrtko Ursulin 2025-11-06  1338  				   count_handles * sizeof(*handles)))
6cbb5aa2c8c162 Tvrtko Ursulin 2025-11-06 @1339  			return -EFAULT;
6cbb5aa2c8c162 Tvrtko Ursulin 2025-11-06  1340  	}
5e60a10eaebab9 Dave Airlie    2017-08-25  1341  
3e6fb72d6cef6a Faith Ekstrand 2017-08-25  1342  	for (i = 0; i < count_handles; i++) {
e7aca5031a2fb5 Faith Ekstrand 2017-08-25  1343  		syncobjs[i] = drm_syncobj_find(file_private, handles[i]);
e7aca5031a2fb5 Faith Ekstrand 2017-08-25  1344  		if (!syncobjs[i]) {
e7aca5031a2fb5 Faith Ekstrand 2017-08-25  1345  			ret = -ENOENT;
3e6fb72d6cef6a Faith Ekstrand 2017-08-25  1346  			goto err_put_syncobjs;
5e60a10eaebab9 Dave Airlie    2017-08-25  1347  		}
e7aca5031a2fb5 Faith Ekstrand 2017-08-25  1348  	}
5e60a10eaebab9 Dave Airlie    2017-08-25  1349  
6cbb5aa2c8c162 Tvrtko Ursulin 2025-11-06  1350  	if (handles != stack_handles)
3e6fb72d6cef6a Faith Ekstrand 2017-08-25  1351  		kfree(handles);
3e6fb72d6cef6a Faith Ekstrand 2017-08-25  1352  	*syncobjs_out = syncobjs;
3e6fb72d6cef6a Faith Ekstrand 2017-08-25  1353  	return 0;
5e60a10eaebab9 Dave Airlie    2017-08-25  1354  
3e6fb72d6cef6a Faith Ekstrand 2017-08-25  1355  err_put_syncobjs:
e7aca5031a2fb5 Faith Ekstrand 2017-08-25  1356  	while (i-- > 0)
e7aca5031a2fb5 Faith Ekstrand 2017-08-25  1357  		drm_syncobj_put(syncobjs[i]);
6cbb5aa2c8c162 Tvrtko Ursulin 2025-11-06  1358  	if (syncobjs != stack_syncobjs)
e7aca5031a2fb5 Faith Ekstrand 2017-08-25  1359  		kfree(syncobjs);
5e60a10eaebab9 Dave Airlie    2017-08-25  1360  err_free_handles:
6cbb5aa2c8c162 Tvrtko Ursulin 2025-11-06  1361  	if (handles != stack_handles)
5e60a10eaebab9 Dave Airlie    2017-08-25  1362  		kfree(handles);
5e60a10eaebab9 Dave Airlie    2017-08-25  1363  
5e60a10eaebab9 Dave Airlie    2017-08-25  1364  	return ret;
5e60a10eaebab9 Dave Airlie    2017-08-25  1365  }
3e6fb72d6cef6a Faith Ekstrand 2017-08-25  1366  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCH 0/3] DRM syncobj wait fast path
@ 2025-11-06 13:26 Tvrtko Ursulin
  2025-11-06 13:26 ` [PATCH 3/3] drm/syncobj: Add a fast path to drm_syncobj_array_find Tvrtko Ursulin
  0 siblings, 1 reply; 11+ messages in thread
From: Tvrtko Ursulin @ 2025-11-06 13:26 UTC (permalink / raw)
  To: dri-devel; +Cc: kernel-dev, Tvrtko Ursulin

In practice there are multiple DRM syncobj operations (and/or ioctls) per
rendered frame, and vast majority of them operates on a just a couple of
handles, or timeline points.

This series adds a fast path to avoid the temporary allocations for those cases.

Tvrtko Ursulin (3):
  drm/syncobj: Use vmemdup_array_user in drm_syncobj_array_find
  drm/syncobj: Add a fast path to drm_syncobj_array_wait_timeout
  drm/syncobj: Add a fast path to drm_syncobj_array_find

 drivers/gpu/drm/drm_syncobj.c | 141 +++++++++++++++++++++++++---------
 1 file changed, 106 insertions(+), 35 deletions(-)

-- 
2.48.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-11-18  8:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 10:39 [PATCH 0/3] drm/syncobj: Allocation avoiding fast path Tvrtko Ursulin
2026-11-17 10:39 ` [PATCH 1/3] drm/syncobj: Use vmemdup_array_user in drm_syncobj_array_find Tvrtko Ursulin
2026-11-17 12:57   ` Maíra Canal
2026-11-17 13:23   ` Christian König
2026-11-17 10:39 ` [PATCH 2/3] drm/syncobj: Add a fast path to drm_syncobj_array_wait_timeout Tvrtko Ursulin
2026-11-18  8:06   ` Yu, Fei
2026-11-17 10:39 ` [PATCH 3/3] drm/syncobj: Add a fast path to drm_syncobj_array_find Tvrtko Ursulin
2026-11-18  8:06   ` Yu, Fei
2026-11-18  8:06 ` [PATCH 0/3] drm/syncobj: Allocation avoiding fast path Yu, Fei
  -- strict thread matches above, loose matches on Subject: below --
2025-11-10 15:11 [PATCH 3/3] drm/syncobj: Add a fast path to drm_syncobj_array_find kernel test robot
2025-11-06 13:26 [PATCH 0/3] DRM syncobj wait fast path Tvrtko Ursulin
2025-11-06 13:26 ` [PATCH 3/3] drm/syncobj: Add a fast path to drm_syncobj_array_find Tvrtko Ursulin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.