Skip to content

Commit 5de376b

Browse files
committed
dma-buf: Report signaled links inside dma-fence-chain
Whenever we walk along the dma-fence-chain, we prune signaled links to keep the chain nice and tidy. This leads to situations where we can prune a link and report the earlier fence as the target seqno -- violating our own consistency checks that the seqno is not more advanced than the last element in a dma-fence-chain. Report a NULL fence and success if the seqno has already been signaled. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Tested-by: Venkata Sandeep Dhanalakota <venkata.s.dhanalakota@intel.com> Reviewed-by: Venkata Sandeep Dhanalakota <venkata.s.dhanalakota@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200409110101.18400-2-chris@chris-wilson.co.uk
1 parent 29da47c commit 5de376b

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎drivers/dma-buf/dma-fence-chain.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ int dma_fence_chain_find_seqno(struct dma_fence **pfence, uint64_t seqno)
9999
return -EINVAL;
100100

101101
dma_fence_chain_for_each(*pfence, &chain->base) {
102+
if ((*pfence)->seqno < seqno) { /* already signaled */
103+
dma_fence_put(*pfence);
104+
*pfence = NULL;
105+
break;
106+
}
107+
102108
if ((*pfence)->context != chain->base.context ||
103109
to_dma_fence_chain(*pfence)->prev_seqno < seqno)
104110
break;
@@ -222,6 +228,7 @@ EXPORT_SYMBOL(dma_fence_chain_ops);
222228
* @chain: the chain node to initialize
223229
* @prev: the previous fence
224230
* @fence: the current fence
231+
* @seqno: the sequence number (syncpt) of the fence within the chain
225232
*
226233
* Initialize a new chain node and either start a new chain or add the node to
227234
* the existing chain of the previous fence.

0 commit comments

Comments
 (0)