dma fence can be used at various points in the code and it's very hard
to distinguish dma fences between different usages. Using a single
dept_key for all the dma fences could trigger false positive reports.
Assign unique dept_key to each distinct dma fence wait to avoid false
positive reports.
Signed-off-by: Byungchul Park <byungchul@sk.com>
---
drivers/dma-buf/dma-fence.c | 12 +++---
include/linux/dma-fence.h | 74 +++++++++++++++++++++++++++++--------
2 files changed, 65 insertions(+), 21 deletions(-)
diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index a45e5416f2dd..5215ac4eecfb 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -499,7 +499,7 @@ EXPORT_SYMBOL(dma_fence_signal);
* See also dma_fence_wait() and dma_fence_wait_any_timeout().
*/
signed long
-dma_fence_wait_timeout(struct dma_fence *fence, bool intr, signed long timeout)
+__dma_fence_wait_timeout(struct dma_fence *fence, bool intr, signed long timeout)
{
signed long ret;
@@ -520,7 +520,7 @@ dma_fence_wait_timeout(struct dma_fence *fence, bool intr, signed long timeout)
trace_dma_fence_wait_end(fence);
return ret;
}
-EXPORT_SYMBOL(dma_fence_wait_timeout);
+EXPORT_SYMBOL(__dma_fence_wait_timeout);
/**
* dma_fence_release - default release function for fences
@@ -759,7 +759,7 @@ dma_fence_default_wait_cb(struct dma_fence *fence, struct dma_fence_cb *cb)
* functions taking a jiffies timeout.
*/
signed long
-dma_fence_default_wait(struct dma_fence *fence, bool intr, signed long timeout)
+__dma_fence_default_wait(struct dma_fence *fence, bool intr, signed long timeout)
{
struct default_wait_cb cb;
unsigned long flags;
@@ -808,7 +808,7 @@ dma_fence_default_wait(struct dma_fence *fence, bool intr, signed long timeout)
spin_unlock_irqrestore(fence->lock, flags);
return ret;
}
-EXPORT_SYMBOL(dma_fence_default_wait);
+EXPORT_SYMBOL(__dma_fence_default_wait);
static bool
dma_fence_test_signaled_any(struct dma_fence **fences, uint32_t count,
@@ -848,7 +848,7 @@ dma_fence_test_signaled_any(struct dma_fence **fences, uint32_t count,
* See also dma_fence_wait() and dma_fence_wait_timeout().
*/
signed long
-dma_fence_wait_any_timeout(struct dma_fence **fences, uint32_t count,
+__dma_fence_wait_any_timeout(struct dma_fence **fences, uint32_t count,
bool intr, signed long timeout, uint32_t *idx)
{
struct default_wait_cb *cb;
@@ -916,7 +916,7 @@ dma_fence_wait_any_timeout(struct dma_fence **fences, uint32_t count,
return ret;
}
-EXPORT_SYMBOL(dma_fence_wait_any_timeout);
+EXPORT_SYMBOL(__dma_fence_wait_any_timeout);
/**
* DOC: deadline hints
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index e7ad819962e3..d7dc7dcd213f 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -393,8 +393,22 @@ int dma_fence_signal_locked(struct dma_fence *fence);
int dma_fence_signal_timestamp(struct dma_fence *fence, ktime_t timestamp);
int dma_fence_signal_timestamp_locked(struct dma_fence *fence,
ktime_t timestamp);
-signed long dma_fence_default_wait(struct dma_fence *fence,
+signed long __dma_fence_default_wait(struct dma_fence *fence,
bool intr, signed long timeout);
+
+/*
+ * Associate every caller with its own dept map.
+ */
+#define dma_fence_default_wait(f, intr, t) \
+({ \
+ signed long __ret; \
+ \
+ sdt_might_sleep_start_timeout(NULL, t); \
+ __ret = __dma_fence_default_wait(f, intr, t); \
+ sdt_might_sleep_end(); \
+ __ret; \
+})
+
int dma_fence_add_callback(struct dma_fence *fence,
struct dma_fence_cb *cb,
dma_fence_func_t func);
@@ -609,12 +623,37 @@ static inline ktime_t dma_fence_timestamp(struct dma_fence *fence)
return fence->timestamp;
}
-signed long dma_fence_wait_timeout(struct dma_fence *,
+signed long __dma_fence_wait_timeout(struct dma_fence *,
bool intr, signed long timeout);
-signed long dma_fence_wait_any_timeout(struct dma_fence **fences,
+signed long __dma_fence_wait_any_timeout(struct dma_fence **fences,
uint32_t count,
bool intr, signed long timeout,
uint32_t *idx);
+/*
+ * Associate every caller with its own dept map.
+ */
+#define dma_fence_wait_timeout(f, intr, t) \
+({ \
+ signed long __ret; \
+ \
+ sdt_might_sleep_start_timeout(NULL, t); \
+ __ret = __dma_fence_wait_timeout(f, intr, t); \
+ sdt_might_sleep_end(); \
+ __ret; \
+})
+
+/*
+ * Associate every caller with its own dept map.
+ */
+#define dma_fence_wait_any_timeout(fpp, count, intr, t, idx) \
+({ \
+ signed long __ret; \
+ \
+ sdt_might_sleep_start_timeout(NULL, t); \
+ __ret = __dma_fence_wait_any_timeout(fpp, count, intr, t, idx); \
+ sdt_might_sleep_end(); \
+ __ret; \
+})
/**
* dma_fence_wait - sleep until the fence gets signaled
@@ -630,19 +669,24 @@ signed long dma_fence_wait_any_timeout(struct dma_fence **fences,
* fence might be freed before return, resulting in undefined behavior.
*
* See also dma_fence_wait_timeout() and dma_fence_wait_any_timeout().
+ *
+ * Associate every caller with its own dept map.
*/
-static inline signed long dma_fence_wait(struct dma_fence *fence, bool intr)
-{
- signed long ret;
-
- /* Since dma_fence_wait_timeout cannot timeout with
- * MAX_SCHEDULE_TIMEOUT, only valid return values are
- * -ERESTARTSYS and MAX_SCHEDULE_TIMEOUT.
- */
- ret = dma_fence_wait_timeout(fence, intr, MAX_SCHEDULE_TIMEOUT);
-
- return ret < 0 ? ret : 0;
-}
+#define dma_fence_wait(f, intr) \
+({ \
+ signed long __ret; \
+ \
+ sdt_might_sleep_start_timeout(NULL, MAX_SCHEDULE_TIMEOUT); \
+ __ret = __dma_fence_wait_timeout(f, intr, MAX_SCHEDULE_TIMEOUT);\
+ sdt_might_sleep_end(); \
+ \
+ /* \
+ * Since dma_fence_wait_timeout cannot timeout with \
+ * MAX_SCHEDULE_TIMEOUT, only valid return values are \
+ * -ERESTARTSYS and MAX_SCHEDULE_TIMEOUT. \
+ */ \
+ __ret < 0 ? __ret : 0; \
+})
void dma_fence_set_deadline(struct dma_fence *fence, ktime_t deadline);
--
2.17.1
Hi Byungchul,
kernel test robot noticed the following build errors:
[auto build test ERROR on 82f2b0b97b36ee3fcddf0f0780a9a0825d52fec3]
url: https://github.com/intel-lab-lkp/linux/commits/Byungchul-Park/llist-move-llist_-head-node-definition-to-types-h/20250513-181346
base: 82f2b0b97b36ee3fcddf0f0780a9a0825d52fec3
patch link: https://lore.kernel.org/r/20250513100730.12664-34-byungchul%40sk.com
patch subject: [PATCH v15 33/43] dept: assign unique dept_key to each distinct dma fence caller
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20250514/202505142049.8vYH34nZ-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250514/202505142049.8vYH34nZ-lkp@intel.com/reproduce)
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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505142049.8vYH34nZ-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1372:3: error: cannot jump from this indirect goto statement to one of its possible targets
1372 | drm_exec_retry_on_contention(&exec);
| ^
include/drm/drm_exec.h:123:4: note: expanded from macro 'drm_exec_retry_on_contention'
123 | goto *__drm_exec_retry_ptr; \
| ^
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1399:2: note: possible target of indirect goto statement
1399 | dma_fence_wait(fence, false);
| ^
include/linux/dma-fence.h:679:2: note: expanded from macro 'dma_fence_wait'
679 | sdt_might_sleep_start_timeout(NULL, MAX_SCHEDULE_TIMEOUT); \
| ^
include/linux/dept_sdt.h:45:45: note: expanded from macro 'sdt_might_sleep_start_timeout'
45 | dept_stage_wait(__m, __m ? NULL : &__key, _THIS_IP_, __func__, t);\
| ^
include/linux/instruction_pointer.h:10:41: note: expanded from macro '_THIS_IP_'
10 | #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
| ^
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1399:2: note: jump enters a statement expression
include/linux/dma-fence.h:679:2: note: expanded from macro 'dma_fence_wait'
679 | sdt_might_sleep_start_timeout(NULL, MAX_SCHEDULE_TIMEOUT); \
| ^
include/linux/dept_sdt.h:45:45: note: expanded from macro 'sdt_might_sleep_start_timeout'
45 | dept_stage_wait(__m, __m ? NULL : &__key, _THIS_IP_, __func__, t);\
| ^
include/linux/instruction_pointer.h:10:20: note: expanded from macro '_THIS_IP_'
10 | #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
| ^
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1399:2: note: jump enters a statement expression
include/linux/dma-fence.h:675:38: note: expanded from macro 'dma_fence_wait'
675 | #define dma_fence_wait(f, intr) \
| ^
1 error generated.
--
>> drivers/gpu/drm/xe/xe_svm.c:807:3: error: cannot jump from this indirect goto statement to one of its possible targets
807 | drm_exec_retry_on_contention(&exec);
| ^
include/drm/drm_exec.h:123:4: note: expanded from macro 'drm_exec_retry_on_contention'
123 | goto *__drm_exec_retry_ptr; \
| ^
drivers/gpu/drm/xe/xe_svm.c:831:2: note: possible target of indirect goto statement
831 | dma_fence_wait(fence, false);
| ^
include/linux/dma-fence.h:679:2: note: expanded from macro 'dma_fence_wait'
679 | sdt_might_sleep_start_timeout(NULL, MAX_SCHEDULE_TIMEOUT); \
| ^
include/linux/dept_sdt.h:45:45: note: expanded from macro 'sdt_might_sleep_start_timeout'
45 | dept_stage_wait(__m, __m ? NULL : &__key, _THIS_IP_, __func__, t);\
| ^
include/linux/instruction_pointer.h:10:41: note: expanded from macro '_THIS_IP_'
10 | #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
| ^
drivers/gpu/drm/xe/xe_svm.c:831:2: note: jump enters a statement expression
include/linux/dma-fence.h:679:2: note: expanded from macro 'dma_fence_wait'
679 | sdt_might_sleep_start_timeout(NULL, MAX_SCHEDULE_TIMEOUT); \
| ^
include/linux/dept_sdt.h:45:45: note: expanded from macro 'sdt_might_sleep_start_timeout'
45 | dept_stage_wait(__m, __m ? NULL : &__key, _THIS_IP_, __func__, t);\
| ^
include/linux/instruction_pointer.h:10:20: note: expanded from macro '_THIS_IP_'
10 | #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
| ^
drivers/gpu/drm/xe/xe_svm.c:831:2: note: jump enters a statement expression
include/linux/dma-fence.h:675:38: note: expanded from macro 'dma_fence_wait'
675 | #define dma_fence_wait(f, intr) \
| ^
1 error generated.
--
>> drivers/gpu/drm/xe/xe_gt_pagefault.c:164:3: error: cannot jump from this indirect goto statement to one of its possible targets
164 | drm_exec_retry_on_contention(&exec);
| ^
include/drm/drm_exec.h:123:4: note: expanded from macro 'drm_exec_retry_on_contention'
123 | goto *__drm_exec_retry_ptr; \
| ^
drivers/gpu/drm/xe/xe_gt_pagefault.c:181:2: note: possible target of indirect goto statement
181 | dma_fence_wait(fence, false);
| ^
include/linux/dma-fence.h:679:2: note: expanded from macro 'dma_fence_wait'
679 | sdt_might_sleep_start_timeout(NULL, MAX_SCHEDULE_TIMEOUT); \
| ^
include/linux/dept_sdt.h:45:45: note: expanded from macro 'sdt_might_sleep_start_timeout'
45 | dept_stage_wait(__m, __m ? NULL : &__key, _THIS_IP_, __func__, t);\
| ^
include/linux/instruction_pointer.h:10:41: note: expanded from macro '_THIS_IP_'
10 | #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
| ^
drivers/gpu/drm/xe/xe_gt_pagefault.c:181:2: note: jump enters a statement expression
include/linux/dma-fence.h:679:2: note: expanded from macro 'dma_fence_wait'
679 | sdt_might_sleep_start_timeout(NULL, MAX_SCHEDULE_TIMEOUT); \
| ^
include/linux/dept_sdt.h:45:45: note: expanded from macro 'sdt_might_sleep_start_timeout'
45 | dept_stage_wait(__m, __m ? NULL : &__key, _THIS_IP_, __func__, t);\
| ^
include/linux/instruction_pointer.h:10:20: note: expanded from macro '_THIS_IP_'
10 | #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
| ^
drivers/gpu/drm/xe/xe_gt_pagefault.c:181:2: note: jump enters a statement expression
include/linux/dma-fence.h:675:38: note: expanded from macro 'dma_fence_wait'
675 | #define dma_fence_wait(f, intr) \
| ^
1 error generated.
vim +1372 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
f1d93c9c2722a2 Jack Xiao 2020-03-27 1357
737dad0b5d609f Jack Xiao 2020-09-09 1358 int amdgpu_mes_ctx_unmap_meta_data(struct amdgpu_device *adev,
737dad0b5d609f Jack Xiao 2020-09-09 1359 struct amdgpu_mes_ctx_data *ctx_data)
737dad0b5d609f Jack Xiao 2020-09-09 1360 {
737dad0b5d609f Jack Xiao 2020-09-09 1361 struct amdgpu_bo_va *bo_va = ctx_data->meta_data_va;
737dad0b5d609f Jack Xiao 2020-09-09 1362 struct amdgpu_bo *bo = ctx_data->meta_data_obj;
737dad0b5d609f Jack Xiao 2020-09-09 1363 struct amdgpu_vm *vm = bo_va->base.vm;
2acc73f81f2500 Christian König 2022-08-16 1364 struct dma_fence *fence;
2acc73f81f2500 Christian König 2022-08-16 1365 struct drm_exec exec;
2acc73f81f2500 Christian König 2022-08-16 1366 long r;
2acc73f81f2500 Christian König 2022-08-16 1367
05d249352f1ae9 Rob Clark 2023-11-20 1368 drm_exec_init(&exec, 0, 0);
2acc73f81f2500 Christian König 2022-08-16 1369 drm_exec_until_all_locked(&exec) {
2acc73f81f2500 Christian König 2022-08-16 1370 r = drm_exec_lock_obj(&exec,
2acc73f81f2500 Christian König 2022-08-16 1371 &ctx_data->meta_data_obj->tbo.base);
2acc73f81f2500 Christian König 2022-08-16 @1372 drm_exec_retry_on_contention(&exec);
2acc73f81f2500 Christian König 2022-08-16 1373 if (unlikely(r))
2acc73f81f2500 Christian König 2022-08-16 1374 goto out_unlock;
737dad0b5d609f Jack Xiao 2020-09-09 1375
2acc73f81f2500 Christian König 2022-08-16 1376 r = amdgpu_vm_lock_pd(vm, &exec, 0);
2acc73f81f2500 Christian König 2022-08-16 1377 drm_exec_retry_on_contention(&exec);
2acc73f81f2500 Christian König 2022-08-16 1378 if (unlikely(r))
2acc73f81f2500 Christian König 2022-08-16 1379 goto out_unlock;
737dad0b5d609f Jack Xiao 2020-09-09 1380 }
737dad0b5d609f Jack Xiao 2020-09-09 1381
737dad0b5d609f Jack Xiao 2020-09-09 1382 amdgpu_vm_bo_del(adev, bo_va);
737dad0b5d609f Jack Xiao 2020-09-09 1383 if (!amdgpu_vm_ready(vm))
737dad0b5d609f Jack Xiao 2020-09-09 1384 goto out_unlock;
737dad0b5d609f Jack Xiao 2020-09-09 1385
2acc73f81f2500 Christian König 2022-08-16 1386 r = dma_resv_get_singleton(bo->tbo.base.resv, DMA_RESV_USAGE_BOOKKEEP,
2acc73f81f2500 Christian König 2022-08-16 1387 &fence);
737dad0b5d609f Jack Xiao 2020-09-09 1388 if (r)
737dad0b5d609f Jack Xiao 2020-09-09 1389 goto out_unlock;
737dad0b5d609f Jack Xiao 2020-09-09 1390 if (fence) {
737dad0b5d609f Jack Xiao 2020-09-09 1391 amdgpu_bo_fence(bo, fence, true);
737dad0b5d609f Jack Xiao 2020-09-09 1392 fence = NULL;
737dad0b5d609f Jack Xiao 2020-09-09 1393 }
737dad0b5d609f Jack Xiao 2020-09-09 1394
737dad0b5d609f Jack Xiao 2020-09-09 1395 r = amdgpu_vm_clear_freed(adev, vm, &fence);
737dad0b5d609f Jack Xiao 2020-09-09 1396 if (r || !fence)
737dad0b5d609f Jack Xiao 2020-09-09 1397 goto out_unlock;
737dad0b5d609f Jack Xiao 2020-09-09 1398
737dad0b5d609f Jack Xiao 2020-09-09 1399 dma_fence_wait(fence, false);
737dad0b5d609f Jack Xiao 2020-09-09 1400 amdgpu_bo_fence(bo, fence, true);
737dad0b5d609f Jack Xiao 2020-09-09 1401 dma_fence_put(fence);
737dad0b5d609f Jack Xiao 2020-09-09 1402
737dad0b5d609f Jack Xiao 2020-09-09 1403 out_unlock:
737dad0b5d609f Jack Xiao 2020-09-09 1404 if (unlikely(r < 0))
737dad0b5d609f Jack Xiao 2020-09-09 1405 dev_err(adev->dev, "failed to clear page tables (%ld)\n", r);
2acc73f81f2500 Christian König 2022-08-16 1406 drm_exec_fini(&exec);
737dad0b5d609f Jack Xiao 2020-09-09 1407
737dad0b5d609f Jack Xiao 2020-09-09 1408 return r;
737dad0b5d609f Jack Xiao 2020-09-09 1409 }
737dad0b5d609f Jack Xiao 2020-09-09 1410
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Byungchul,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 82f2b0b97b36ee3fcddf0f0780a9a0825d52fec3]
url: https://github.com/intel-lab-lkp/linux/commits/Byungchul-Park/llist-move-llist_-head-node-definition-to-types-h/20250513-181346
base: 82f2b0b97b36ee3fcddf0f0780a9a0825d52fec3
patch link: https://lore.kernel.org/r/20250513100730.12664-34-byungchul%40sk.com
patch subject: [PATCH v15 33/43] dept: assign unique dept_key to each distinct dma fence caller
config: arm-randconfig-002-20250514 (https://download.01.org/0day-ci/archive/20250514/202505140631.FOWO8B5L-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250514/202505140631.FOWO8B5L-lkp@intel.com/reproduce)
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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505140631.FOWO8B5L-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/dma-buf/dma-fence.c:503: warning: expecting prototype for dma_fence_wait_timeout(). Prototype was for __dma_fence_wait_timeout() instead
>> drivers/dma-buf/dma-fence.c:763: warning: expecting prototype for dma_fence_default_wait(). Prototype was for __dma_fence_default_wait() instead
>> drivers/dma-buf/dma-fence.c:853: warning: expecting prototype for dma_fence_wait_any_timeout(). Prototype was for __dma_fence_wait_any_timeout() instead
vim +503 drivers/dma-buf/dma-fence.c
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 482
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 483 /**
f54d1867005c33 drivers/dma-buf/dma-fence.c Chris Wilson 2016-10-25 484 * dma_fence_wait_timeout - sleep until the fence gets signaled
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 485 * or until timeout elapses
4dd3cdb281f7a3 drivers/dma-buf/dma-fence.c Simona Vetter 2018-07-04 486 * @fence: the fence to wait on
4dd3cdb281f7a3 drivers/dma-buf/dma-fence.c Simona Vetter 2018-07-04 487 * @intr: if true, do an interruptible wait
4dd3cdb281f7a3 drivers/dma-buf/dma-fence.c Simona Vetter 2018-07-04 488 * @timeout: timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 489 *
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 490 * Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or the
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 491 * remaining timeout in jiffies on success. Other error values may be
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 492 * returned on custom implementations.
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 493 *
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 494 * Performs a synchronous wait on this fence. It is assumed the caller
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 495 * directly or indirectly (buf-mgr between reservation and committing)
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 496 * holds a reference to the fence, otherwise the fence might be
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 497 * freed before return, resulting in undefined behavior.
4dd3cdb281f7a3 drivers/dma-buf/dma-fence.c Simona Vetter 2018-07-04 498 *
4dd3cdb281f7a3 drivers/dma-buf/dma-fence.c Simona Vetter 2018-07-04 499 * See also dma_fence_wait() and dma_fence_wait_any_timeout().
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 500 */
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 501 signed long
15fe92c1e1cf69 drivers/dma-buf/dma-fence.c Byungchul Park 2025-05-13 502 __dma_fence_wait_timeout(struct dma_fence *fence, bool intr, signed long timeout)
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 @503 {
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 504 signed long ret;
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 505
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 506 if (WARN_ON(timeout < 0))
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 507 return -EINVAL;
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 508
ef8255506f6682 drivers/dma-buf/dma-fence.c Simona Vetter 2020-05-19 509 might_sleep();
ef8255506f6682 drivers/dma-buf/dma-fence.c Simona Vetter 2020-05-19 510
5fbff813a4a328 drivers/dma-buf/dma-fence.c Simona Vetter 2020-07-07 511 __dma_fence_might_wait();
5fbff813a4a328 drivers/dma-buf/dma-fence.c Simona Vetter 2020-07-07 512
b96fb1e724ae68 drivers/dma-buf/dma-fence.c Arvind Yadav 2022-09-14 513 dma_fence_enable_sw_signaling(fence);
b96fb1e724ae68 drivers/dma-buf/dma-fence.c Arvind Yadav 2022-09-14 514
f54d1867005c33 drivers/dma-buf/dma-fence.c Chris Wilson 2016-10-25 515 trace_dma_fence_wait_start(fence);
418cc6ca06071e drivers/dma-buf/dma-fence.c Simona Vetter 2018-05-03 516 if (fence->ops->wait)
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 517 ret = fence->ops->wait(fence, intr, timeout);
418cc6ca06071e drivers/dma-buf/dma-fence.c Simona Vetter 2018-05-03 518 else
418cc6ca06071e drivers/dma-buf/dma-fence.c Simona Vetter 2018-05-03 519 ret = dma_fence_default_wait(fence, intr, timeout);
f54d1867005c33 drivers/dma-buf/dma-fence.c Chris Wilson 2016-10-25 520 trace_dma_fence_wait_end(fence);
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 521 return ret;
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 522 }
15fe92c1e1cf69 drivers/dma-buf/dma-fence.c Byungchul Park 2025-05-13 523 EXPORT_SYMBOL(__dma_fence_wait_timeout);
e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 524
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
On Wed, May 14, 2025 at 06:49:42AM +0800, kernel test robot wrote:
> Hi Byungchul,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on 82f2b0b97b36ee3fcddf0f0780a9a0825d52fec3]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Byungchul-Park/llist-move-llist_-head-node-definition-to-types-h/20250513-181346
> base: 82f2b0b97b36ee3fcddf0f0780a9a0825d52fec3
> patch link: https://lore.kernel.org/r/20250513100730.12664-34-byungchul%40sk.com
> patch subject: [PATCH v15 33/43] dept: assign unique dept_key to each distinct dma fence caller
> config: arm-randconfig-002-20250514 (https://download.01.org/0day-ci/archive/20250514/202505140631.FOWO8B5L-lkp@intel.com/config)
> compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250514/202505140631.FOWO8B5L-lkp@intel.com/reproduce)
>
> 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>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202505140631.FOWO8B5L-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> >> drivers/dma-buf/dma-fence.c:503: warning: expecting prototype for dma_fence_wait_timeout(). Prototype was for __dma_fence_wait_timeout() instead
> >> drivers/dma-buf/dma-fence.c:763: warning: expecting prototype for dma_fence_default_wait(). Prototype was for __dma_fence_default_wait() instead
> >> drivers/dma-buf/dma-fence.c:853: warning: expecting prototype for dma_fence_wait_any_timeout(). Prototype was for __dma_fence_wait_any_timeout() instead
I have just fixed it. Thanks.
Byungchul
>
> vim +503 drivers/dma-buf/dma-fence.c
>
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 482
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 483 /**
> f54d1867005c33 drivers/dma-buf/dma-fence.c Chris Wilson 2016-10-25 484 * dma_fence_wait_timeout - sleep until the fence gets signaled
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 485 * or until timeout elapses
> 4dd3cdb281f7a3 drivers/dma-buf/dma-fence.c Simona Vetter 2018-07-04 486 * @fence: the fence to wait on
> 4dd3cdb281f7a3 drivers/dma-buf/dma-fence.c Simona Vetter 2018-07-04 487 * @intr: if true, do an interruptible wait
> 4dd3cdb281f7a3 drivers/dma-buf/dma-fence.c Simona Vetter 2018-07-04 488 * @timeout: timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 489 *
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 490 * Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or the
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 491 * remaining timeout in jiffies on success. Other error values may be
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 492 * returned on custom implementations.
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 493 *
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 494 * Performs a synchronous wait on this fence. It is assumed the caller
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 495 * directly or indirectly (buf-mgr between reservation and committing)
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 496 * holds a reference to the fence, otherwise the fence might be
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 497 * freed before return, resulting in undefined behavior.
> 4dd3cdb281f7a3 drivers/dma-buf/dma-fence.c Simona Vetter 2018-07-04 498 *
> 4dd3cdb281f7a3 drivers/dma-buf/dma-fence.c Simona Vetter 2018-07-04 499 * See also dma_fence_wait() and dma_fence_wait_any_timeout().
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 500 */
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 501 signed long
> 15fe92c1e1cf69 drivers/dma-buf/dma-fence.c Byungchul Park 2025-05-13 502 __dma_fence_wait_timeout(struct dma_fence *fence, bool intr, signed long timeout)
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 @503 {
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 504 signed long ret;
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 505
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 506 if (WARN_ON(timeout < 0))
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 507 return -EINVAL;
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 508
> ef8255506f6682 drivers/dma-buf/dma-fence.c Simona Vetter 2020-05-19 509 might_sleep();
> ef8255506f6682 drivers/dma-buf/dma-fence.c Simona Vetter 2020-05-19 510
> 5fbff813a4a328 drivers/dma-buf/dma-fence.c Simona Vetter 2020-07-07 511 __dma_fence_might_wait();
> 5fbff813a4a328 drivers/dma-buf/dma-fence.c Simona Vetter 2020-07-07 512
> b96fb1e724ae68 drivers/dma-buf/dma-fence.c Arvind Yadav 2022-09-14 513 dma_fence_enable_sw_signaling(fence);
> b96fb1e724ae68 drivers/dma-buf/dma-fence.c Arvind Yadav 2022-09-14 514
> f54d1867005c33 drivers/dma-buf/dma-fence.c Chris Wilson 2016-10-25 515 trace_dma_fence_wait_start(fence);
> 418cc6ca06071e drivers/dma-buf/dma-fence.c Simona Vetter 2018-05-03 516 if (fence->ops->wait)
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 517 ret = fence->ops->wait(fence, intr, timeout);
> 418cc6ca06071e drivers/dma-buf/dma-fence.c Simona Vetter 2018-05-03 518 else
> 418cc6ca06071e drivers/dma-buf/dma-fence.c Simona Vetter 2018-05-03 519 ret = dma_fence_default_wait(fence, intr, timeout);
> f54d1867005c33 drivers/dma-buf/dma-fence.c Chris Wilson 2016-10-25 520 trace_dma_fence_wait_end(fence);
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 521 return ret;
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 522 }
> 15fe92c1e1cf69 drivers/dma-buf/dma-fence.c Byungchul Park 2025-05-13 523 EXPORT_SYMBOL(__dma_fence_wait_timeout);
> e941759c74a44d drivers/dma-buf/fence.c Maarten Lankhorst 2014-07-01 524
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
© 2016 - 2026 Red Hat, Inc.