mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
dma-buf: fix dma-fence-chain out of order test
There was probably a misunderstand on how the dma-fence-chain is
supposed to work or what dma_fence_chain_find_seqno() is supposed to
return.
dma_fence_chain_find_seqno() is here to give us the fence to wait upon
for a particular point in the timeline. The timeline progresses only
when all the points prior to a given number have completed.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: dc2f7e67a2
("dma-buf: Exercise dma-fence-chain under selftests")
Link: https://patchwork.freedesktop.org/patch/372960/
Signed-off-by: Christian König <christian.koenig@amd.com>
This commit is contained in:
parent
91fac86d86
commit
4cca2e6416
1 changed files with 21 additions and 22 deletions
|
@ -318,15 +318,16 @@ static int find_out_of_order(void *arg)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fence && fence != fc.chains[1]) {
|
/*
|
||||||
|
* We signaled the middle fence (2) of the 1-2-3 chain. The behavior
|
||||||
|
* of the dma-fence-chain is to make us wait for all the fences up to
|
||||||
|
* the point we want. Since fence 1 is still not signaled, this what
|
||||||
|
* we should get as fence to wait upon (fence 2 being garbage
|
||||||
|
* collected during the traversal of the chain).
|
||||||
|
*/
|
||||||
|
if (fence != fc.chains[0]) {
|
||||||
pr_err("Incorrect chain-fence.seqno:%lld reported for completed seqno:2\n",
|
pr_err("Incorrect chain-fence.seqno:%lld reported for completed seqno:2\n",
|
||||||
fence->seqno);
|
fence ? fence->seqno : 0);
|
||||||
|
|
||||||
dma_fence_get(fence);
|
|
||||||
err = dma_fence_chain_find_seqno(&fence, 2);
|
|
||||||
dma_fence_put(fence);
|
|
||||||
if (err)
|
|
||||||
pr_err("Reported %d for finding self!\n", err);
|
|
||||||
|
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -415,20 +416,18 @@ static int __find_race(void *arg)
|
||||||
if (!fence)
|
if (!fence)
|
||||||
goto signal;
|
goto signal;
|
||||||
|
|
||||||
err = dma_fence_chain_find_seqno(&fence, seqno);
|
/*
|
||||||
if (err) {
|
* We can only find ourselves if we are on fence we were
|
||||||
pr_err("Reported an invalid fence for find-self:%d\n",
|
* looking for.
|
||||||
seqno);
|
*/
|
||||||
dma_fence_put(fence);
|
if (fence->seqno == seqno) {
|
||||||
break;
|
err = dma_fence_chain_find_seqno(&fence, seqno);
|
||||||
}
|
if (err) {
|
||||||
|
pr_err("Reported an invalid fence for find-self:%d\n",
|
||||||
if (fence->seqno < seqno) {
|
seqno);
|
||||||
pr_err("Reported an earlier fence.seqno:%lld for seqno:%d\n",
|
dma_fence_put(fence);
|
||||||
fence->seqno, seqno);
|
break;
|
||||||
err = -EINVAL;
|
}
|
||||||
dma_fence_put(fence);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dma_fence_put(fence);
|
dma_fence_put(fence);
|
||||||
|
|
Loading…
Add table
Reference in a new issue