[PATCH 10/10] dma-buf/resv: add other operations

Ville Syrjälä ville.syrjala at linux.intel.com
Thu Aug 22 12:28:38 UTC 2019


On Wed, Aug 21, 2019 at 02:31:47PM +0200, Christian König wrote:
> Additional to readers and writers add another class of operations
> which never participate in implicit synchronization.
> 
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
>  drivers/dma-buf/dma-resv.c | 27 ++++++++++++++++++++++++---
>  include/linux/dma-resv.h   |  2 ++
>  2 files changed, 26 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c
> index 8ef7dbc7fd8e..c6dd6c36dba2 100644
> --- a/drivers/dma-buf/dma-resv.c
> +++ b/drivers/dma-buf/dma-resv.c
> @@ -280,6 +280,7 @@ void dma_resv_init(struct dma_resv *obj)
>  
>  	dma_resv_fences_init(&obj->writers);
>  	dma_resv_fences_init(&obj->readers);
> +	dma_resv_fences_init(&obj->others);
>  }
>  EXPORT_SYMBOL(dma_resv_init);
>  
> @@ -295,6 +296,7 @@ void dma_resv_fini(struct dma_resv *obj)
>  	 */
>  	dma_resv_fences_fini(&obj->writers);
>  	dma_resv_fences_fini(&obj->readers);
> +	dma_resv_fences_fini(&obj->others);
>  	ww_mutex_destroy(&obj->lock);
>  }
>  EXPORT_SYMBOL(dma_resv_fini);
> @@ -334,6 +336,10 @@ void dma_resv_prune_fences(struct dma_resv *obj)
>  	fence = dma_resv_fences_deref(obj, &obj->readers);
>  	if (dma_fence_is_signaled(fence))
>  		dma_resv_fences_set(obj, &obj->readers, NULL);
> +
> +	fence = dma_resv_fences_deref(obj, &obj->others);
> +	if (dma_fence_is_signaled(fence))
> +		dma_resv_fences_set(obj, &obj->others, NULL);
>  }
>  EXPORT_SYMBOL(dma_resv_prune_fences);
>  
> @@ -346,17 +352,19 @@ EXPORT_SYMBOL(dma_resv_prune_fences);
>  */
>  int dma_resv_copy_fences(struct dma_resv *dst, struct dma_resv *src)
>  {
> -	struct dma_fence *writers, *readers;
> +	struct dma_fence *writers, *readers, *others;
>  
>  	dma_resv_assert_held(dst);
>  
>  	rcu_read_lock();
>  	writers = dma_resv_fences_get_rcu(&src->writers);
>  	readers = dma_resv_fences_get_rcu(&src->readers);
> +	others = dma_resv_fences_get_rcu(&src->others);
>  	rcu_read_unlock();
>  
>  	dma_resv_fences_set(dst, &dst->writers, writers);
>  	dma_resv_fences_set(dst, &dst->readers, readers);
> +	dma_resv_fences_set(dst, &dst->readers, others);
                                       ^^^^^^^

others?


-- 
Ville Syrjälä
Intel


More information about the dri-devel mailing list