22 Feb, 2018

1 commit

  • commit 5bffee867df7494ecd32c1e6ec4e8fc934c521b7 upstream.

    We need to set shared_count even if we already have a fence to wait for.

    v2: init i to -1 as well

    Signed-off-by: Christian König
    Cc: stable@vger.kernel.org
    Tested-by: Lyude Paul
    Reviewed-by: Lyude Paul
    Reviewed-by: Chris Wilson
    Signed-off-by: Alex Deucher
    Link: https://patchwork.freedesktop.org/patch/msgid/20180122200003.6665-1-christian.koenig@amd.com
    Signed-off-by: Greg Kroah-Hartman

    Christian König
     

05 Dec, 2017

1 commit

  • commit 39e16ba16c147e662bf9fbcee9a99d70d420382f upstream.

    Stop requiring that the src reservation object is locked for this operation.

    Acked-by: Chunming Zhou
    Signed-off-by: Christian König
    Signed-off-by: Alex Deucher
    Link: https://patchwork.freedesktop.org/patch/msgid/1504551766-5093-1-git-send-email-deathsimple@vodafone.de
    Signed-off-by: Lyude Paul
    Signed-off-by: Greg Kroah-Hartman

    Christian König
     

15 Aug, 2017

2 commits

  • 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.

    v2: make sure we always wait for the exclusive fence

    Acked-by: Sumit Semwal
    Signed-off-by: Christian König
    Reviewed-by: Alex Deucher
    Reviewed-by: Chunming Zhou
    Signed-off-by: Alex Deucher
    Link: https://patchwork.freedesktop.org/patch/msgid/1502384509-10465-3-git-send-email-alexander.deucher@amd.com

    Christian König
     
  • Allows us to copy all the fences in a reservation object to another one.

    v2: handle NULL src_list

    Signed-off-by: Christian König
    Reviewed-by: Alex Deucher
    Signed-off-by: Alex Deucher
    Link: https://patchwork.freedesktop.org/patch/msgid/1502384509-10465-2-git-send-email-alexander.deucher@amd.com

    Christian König
     

10 Aug, 2017

1 commit


09 Nov, 2016

1 commit

  • Reverts commit fb8b7d2b9d80
    ("reservation: wait only with non-zero timeout specified (v3)")

    Otherwise signaling might never be activated on the fences. This can
    result in infinite waiting with hardware which has unreliable interrupts.

    v2: still return one when the timeout is zero and we don't have any fences.

    Reviewed-by: Alex Deucher
    Signed-off-by: Christian König
    Reviewed-by: Chunming Zhou (v1)
    Signed-off-by: Alex Deucher
    Reviewed-by: Gustavo Padovan
    Signed-off-by: Sumit Semwal
    [sumits: fix checkpatch warnings]
    Link: http://patchwork.freedesktop.org/patch/msgid/1478553376-18575-4-git-send-email-alexander.deucher@amd.com

    Christian König
     

25 Oct, 2016

1 commit

  • I plan to usurp the short name of struct fence for a core kernel struct,
    and so I need to rename the specialised fence/timeline for DMA
    operations to make room.

    A consensus was reached in
    https://lists.freedesktop.org/archives/dri-devel/2016-July/113083.html
    that making clear this fence applies to DMA operations was a good thing.
    Since then the patch has grown a bit as usage increases, so hopefully it
    remains a good thing!

    (v2...: rebase, rerun spatch)
    v3: Compile on msm, spotted a manual fixup that I broke.
    v4: Try again for msm, sorry Daniel

    coccinelle script:
    @@

    @@
    - struct fence
    + struct dma_fence
    @@

    @@
    - struct fence_ops
    + struct dma_fence_ops
    @@

    @@
    - struct fence_cb
    + struct dma_fence_cb
    @@

    @@
    - struct fence_array
    + struct dma_fence_array
    @@

    @@
    - enum fence_flag_bits
    + enum dma_fence_flag_bits
    @@

    @@
    (
    - fence_init
    + dma_fence_init
    |
    - fence_release
    + dma_fence_release
    |
    - fence_free
    + dma_fence_free
    |
    - fence_get
    + dma_fence_get
    |
    - fence_get_rcu
    + dma_fence_get_rcu
    |
    - fence_put
    + dma_fence_put
    |
    - fence_signal
    + dma_fence_signal
    |
    - fence_signal_locked
    + dma_fence_signal_locked
    |
    - fence_default_wait
    + dma_fence_default_wait
    |
    - fence_add_callback
    + dma_fence_add_callback
    |
    - fence_remove_callback
    + dma_fence_remove_callback
    |
    - fence_enable_sw_signaling
    + dma_fence_enable_sw_signaling
    |
    - fence_is_signaled_locked
    + dma_fence_is_signaled_locked
    |
    - fence_is_signaled
    + dma_fence_is_signaled
    |
    - fence_is_later
    + dma_fence_is_later
    |
    - fence_later
    + dma_fence_later
    |
    - fence_wait_timeout
    + dma_fence_wait_timeout
    |
    - fence_wait_any_timeout
    + dma_fence_wait_any_timeout
    |
    - fence_wait
    + dma_fence_wait
    |
    - fence_context_alloc
    + dma_fence_context_alloc
    |
    - fence_array_create
    + dma_fence_array_create
    |
    - to_fence_array
    + to_dma_fence_array
    |
    - fence_is_array
    + dma_fence_is_array
    |
    - trace_fence_emit
    + trace_dma_fence_emit
    |
    - FENCE_TRACE
    + DMA_FENCE_TRACE
    |
    - FENCE_WARN
    + DMA_FENCE_WARN
    |
    - FENCE_ERR
    + DMA_FENCE_ERR
    )
    (
    ...
    )

    Signed-off-by: Chris Wilson
    Reviewed-by: Gustavo Padovan
    Acked-by: Sumit Semwal
    Acked-by: Christian König
    Signed-off-by: Daniel Vetter
    Link: http://patchwork.freedesktop.org/patch/msgid/20161025120045.28839-1-chris@chris-wilson.co.uk

    Chris Wilson
     

12 Oct, 2016

3 commits

  • 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
    Cc: Daniel Vetter
    Cc: Maarten Lankhorst
    Cc: Christian König
    Cc: Alex Deucher
    Cc: Sumit Semwal
    Cc: linux-media@vger.kernel.org
    Cc: dri-devel@lists.freedesktop.org
    Cc: linaro-mm-sig@lists.linaro.org
    Reviewed-by: Daniel Vetter
    Signed-off-by: Sumit Semwal
    Link: http://patchwork.freedesktop.org/patch/msgid/20160829070834.22296-9-chris@chris-wilson.co.uk

    Chris Wilson
     
  • 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
    Cc: Daniel Vetter
    Cc: Maarten Lankhorst
    Cc: Christian König
    Cc: Alex Deucher
    Cc: Sumit Semwal
    Cc: linux-media@vger.kernel.org
    Cc: dri-devel@lists.freedesktop.org
    Cc: linaro-mm-sig@lists.linaro.org
    Reviewed-by: Daniel Vetter
    Signed-off-by: Sumit Semwal
    Link: http://patchwork.freedesktop.org/patch/msgid/20160829070834.22296-8-chris@chris-wilson.co.uk

    Chris Wilson
     
  • 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
    Cc: Daniel Vetter
    Cc: Maarten Lankhorst
    Cc: Christian König
    Cc: Alex Deucher
    Cc: Sumit Semwal
    Cc: linux-media@vger.kernel.org
    Cc: dri-devel@lists.freedesktop.org
    Cc: linaro-mm-sig@lists.linaro.org
    Reviewed-by: Daniel Vetter
    Signed-off-by: Sumit Semwal
    Link: http://patchwork.freedesktop.org/patch/msgid/20160829070834.22296-7-chris@chris-wilson.co.uk

    Chris Wilson
     

22 Aug, 2016

1 commit

  • Signed-off-by: Rob Clark
    [danvet: Mark up as function for proper cross-linking.]
    Signed-off-by: Daniel Vetter
    Link: http://patchwork.freedesktop.org/patch/msgid/1471640134-30888-1-git-send-email-robdclark@gmail.com

    Rob Clark
     

01 Jun, 2016

1 commit


21 May, 2015

1 commit


22 Jan, 2015

2 commits

  • It was causing the return value of fence_is_signaled to be ignored, making
    reservation objects signal too early.

    Cc: stable@vger.kernel.org
    Reviewed-by: Maarten Lankhorst
    Reviewed-by: Alex Deucher
    Signed-off-by: Michel Dänzer
    Signed-off-by: Sumit Semwal

    Michel Dänzer
     
  • When the timeout value passed to reservation_object_wait_timeout_rcu
    is zero, no wait should be done if the fences are not signaled.

    Return '1' for idle and '0' for busy if the specified timeout is '0'
    to keep consistent with the case of non-zero timeout.

    v2: call fence_put if not signaled in the case of timeout==0

    v3: switch to reservation_object_test_signaled_rcu

    Signed-off-by: Jammy Zhou
    Reviewed-by: Christian König
    Reviewed-by: Alex Deucher
    Reviewed-By: Maarten Lankhorst
    Signed-off-by: Sumit Semwal

    Jammy Zhou
     

09 Jul, 2014

3 commits

  • This adds some extra functions to deal with rcu.

    reservation_object_get_fences_rcu() will obtain the list of shared
    and exclusive fences without obtaining the ww_mutex.

    reservation_object_wait_timeout_rcu() will wait on all fences of the
    reservation_object, without obtaining the ww_mutex.

    reservation_object_test_signaled_rcu() will test if all fences of the
    reservation_object are signaled without using the ww_mutex.

    reservation_object_get_excl and reservation_object_get_list require
    the reservation object to be held, updating requires
    write_seqcount_begin/end. If only the exclusive fence is needed,
    rcu_dereference followed by fence_get_rcu can be used, if the shared
    fences are needed it's recommended to use the supplied functions.

    Signed-off-by: Maarten Lankhorst
    Acked-by: Sumit Semwal
    Acked-by: Daniel Vetter
    Reviewed-By: Thomas Hellstrom
    Signed-off-by: Greg Kroah-Hartman

    Maarten Lankhorst
     
  • Move the list of shared fences to a struct, and return it in
    reservation_object_get_list().
    Add reservation_object_get_excl to get the exclusive fence.

    Add reservation_object_reserve_shared(), which reserves space
    in the reservation_object for 1 more shared fence.

    reservation_object_add_shared_fence() and
    reservation_object_add_excl_fence() are used to assign a new
    fence to a reservation_object pointer, to complete a reservation.

    Changes since v1:
    - Add reservation_object_get_excl, reorder code a bit.

    Signed-off-by: Maarten Lankhorst
    Acked-by: Sumit Semwal
    Acked-by: Daniel Vetter
    Signed-off-by: Greg Kroah-Hartman

    Maarten Lankhorst
     
  • Signed-off-by: Maarten Lankhorst
    Acked-by: Sumit Semwal
    Acked-by: Daniel Vetter
    Signed-off-by: Greg Kroah-Hartman

    Maarten Lankhorst