Re: [PATCH] dma-buf: fix reservation_object_wait_timeout_rcu to wait correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 24.07.2017 um 10:33 schrieb Daniel Vetter:
On Fri, Jul 21, 2017 at 06:20:01PM +0200, Christian König wrote:
From: Christian König <christian.koenig@xxxxxxx>

With hardware resets in mind it is possible that all shared fences are
signaled, but the exlusive isn't. Fix waiting for everything in this situation.
How did you end up with both shared and exclusive fences on the same
reservation object? At least I thought the point of exclusive was that
it's exclusive (and has an implicit barrier on all previous shared
fences). Same for shared fences, they need to wait for the exclusive one
(and replace it).

Is this fallout from the amdgpu trickery where by default you do all
shared fences? I thought we've aligned semantics a while back ...

No, that is perfectly normal even for other drivers. Take a look at the reservation code.

The exclusive fence replaces all shared fences, but adding a shared fence doesn't replace the exclusive fence. That actually makes sense, cause when you want to add move shared fences those need to wait for the last exclusive fence as well.

Now normally I would agree that when you have shared fences it is sufficient to wait for all of them cause those operations can't start before the exclusive one finishes. But with GPU reset and/or the ability to abort already submitted operations it is perfectly possible that you end up with an exclusive fence which isn't signaled and a shared fence which is signaled in the same reservation object.

Christian.

-Daniel

Signed-off-by: Christian König <christian.koenig@xxxxxxx>
---
  drivers/dma-buf/reservation.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
index e2eff86..ce3f9c1 100644
--- a/drivers/dma-buf/reservation.c
+++ b/drivers/dma-buf/reservation.c
@@ -461,7 +461,7 @@ long reservation_object_wait_timeout_rcu(struct reservation_object *obj,
  		}
  	}
- if (!shared_count) {
+	if (!fence) {
  		struct dma_fence *fence_excl = rcu_dereference(obj->fence_excl);
if (fence_excl &&
--
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel


_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux