dma-buf: Restart reservation_object_test_signaled_rcu() after writes
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 29 Aug 2016 07:08:32 +0000 (08:08 +0100)
committerSumit Semwal <sumit.semwal@linaro.org>
Wed, 12 Oct 2016 14:30:02 +0000 (20:00 +0530)
commitb68d8379c28ddfe74b78be9414082f281332d86c
tree0a702ba375460fb67bee2b7a90a2ac8481a15f46
parent1cec20f0ea0e3bc617aed47e0936f17386c131f9
dma-buf: Restart reservation_object_test_signaled_rcu() after writes

In order to be completely generic, we have to double check the read
seqlock after acquiring a reference to the fence. If the driver is
allocating fences from a SLAB_DESTROY_BY_RCU, or similar freelist, then
within an RCU grace period a fence may be freed and reallocated. The RCU
read side critical section does not prevent this reallocation, instead
we have to inspect the reservation's seqlock to double check if the
fences have been reassigned as we were acquiring our reference.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20160829070834.22296-9-chris@chris-wilson.co.uk
drivers/dma-buf/reservation.c