mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
Mali: utgard: No to call dma_fence_signal(), when checking whether fence has been signaled
Modify the recently introduced calls to dma_fence_is_signaled() to exclude the invocation of dma_fence_signal(). Before this change, running stress tests such as devicetest could result in deadlock related to the aforementioned dma_fence_signal(). Signed-off-by: Zhen Chen <chenzhen@rock-chips.com> Change-Id: Ibf6f86ae0474ed8fad94b5be58b0b79133755b47
This commit is contained in:
@@ -1551,7 +1551,7 @@ static void mali_timeline_do_sync_fence_callback(void *arg)
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)
|
||||
fence_status = atomic_read(&sync_fence->status);
|
||||
#else
|
||||
fence_status = dma_fence_is_signaled(sync_fence->fence);
|
||||
fence_status = mali_dma_fence_is_signaled(sync_fence->fence);
|
||||
#endif
|
||||
|
||||
system = tracker->system;
|
||||
|
||||
@@ -113,7 +113,7 @@ static mali_bool mali_timeline_fence_wait_check_status(struct mali_timeline_syst
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)
|
||||
if (0 < atomic_read(&sync_fence->status)) {
|
||||
#else
|
||||
if (0 == dma_fence_is_signaled(sync_fence->fence)) {
|
||||
if (0 == mali_dma_fence_is_signaled(sync_fence->fence)) {
|
||||
#endif
|
||||
ret = MALI_FALSE;
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ static void mali_internal_fence_check_cb_func(struct dma_fence *fence, struct dm
|
||||
if (ret)
|
||||
wake_up_all(&sync_fence->wq);
|
||||
#else
|
||||
ret = dma_fence_is_signaled(sync_fence->fence);
|
||||
ret = mali_dma_fence_is_signaled(sync_fence->fence);
|
||||
|
||||
if (0 > ret)
|
||||
MALI_PRINT_ERROR(("Mali internal sync:Failed to wait fence 0x%x for sync_fence 0x%x.\n", fence, sync_fence));
|
||||
@@ -557,7 +557,7 @@ int mali_internal_sync_fence_wait_async(struct mali_internal_sync_fence *sync_fe
|
||||
|
||||
return !err;
|
||||
#else
|
||||
err = dma_fence_is_signaled(sync_fence->fence);
|
||||
err = mali_dma_fence_is_signaled(sync_fence->fence);
|
||||
|
||||
if (0 > err)
|
||||
return err;
|
||||
@@ -580,7 +580,7 @@ int mali_internal_sync_fence_wait_async(struct mali_internal_sync_fence *sync_fe
|
||||
waiter->work.private = sync_fence;
|
||||
|
||||
spin_lock_irqsave(&sync_fence->wq.lock, flags);
|
||||
err = dma_fence_is_signaled(sync_fence->fence);
|
||||
err = mali_dma_fence_is_signaled(sync_fence->fence);
|
||||
|
||||
if (0 == err){
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0)
|
||||
|
||||
@@ -187,5 +187,20 @@ int mali_internal_sync_fence_wait_async(struct mali_internal_sync_fence *sync_fe
|
||||
int mali_internal_sync_fence_cancel_async(struct mali_internal_sync_fence *sync_fence,
|
||||
struct mali_internal_sync_fence_waiter *waiter);
|
||||
|
||||
/**
|
||||
* This function is a simplified version of dma_fence_is_signaled(),
|
||||
* dma_fence_signal() is not called here.
|
||||
*/
|
||||
static inline bool mali_dma_fence_is_signaled(struct dma_fence *fence)
|
||||
{
|
||||
if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
|
||||
return true;
|
||||
|
||||
if (fence->ops->signaled && fence->ops->signaled(fence))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif /*LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)*/
|
||||
#endif /* _MALI_INTERNAL_SYNC_H */
|
||||
|
||||
Reference in New Issue
Block a user