lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160523114925.GH28975@nuc-i3427.alporthouse.com>
Date:	Mon, 23 May 2016 12:49:25 +0100
From:	Chris Wilson <chris@...is-wilson.co.uk>
To:	Christian König <deathsimple@...afone.de>
Cc:	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
	daniel@...ll.ch, gustavo@...ovan.org
Subject: Re: [PATCH 3/3] dma-buf/fence: add signal_on_any to the fence array

On Mon, May 23, 2016 at 01:25:22PM +0200, Christian König wrote:
> From: Christian König <christian.koenig@....com>
> 
> If @signal_on_any is true the fence array signals if any fence in the array
> signals, otherwise it signals when all fences in the array signal.
> 
> Signed-off-by: Christian König <christian.koenig@....com>
> ---
>  drivers/dma-buf/fence-array.c | 23 ++++++++++++++++-------
>  include/linux/fence-array.h   |  3 ++-
>  2 files changed, 18 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/dma-buf/fence-array.c b/drivers/dma-buf/fence-array.c
> index bbcf79f..726e840 100644
> --- a/drivers/dma-buf/fence-array.c
> +++ b/drivers/dma-buf/fence-array.c
> @@ -41,6 +41,7 @@ static void fence_array_cb_func(struct fence *f, struct fence_cb *cb)
>  
>  	if (atomic_dec_and_test(&array->num_pending))
>  		fence_signal(&array->base);
> +	fence_put(&array->base);
>  }
>  
>  static bool fence_array_enable_signaling(struct fence *fence)
> @@ -51,10 +52,13 @@ static bool fence_array_enable_signaling(struct fence *fence)
>  
>  	for (i = 0; i < array->num_fences; ++i) {
>  		cb[i].array = array;
> +		fence_get(&array->base);
>  		if (!fence_add_callback(array->fences[i], &cb[i].cb,
> -					fence_array_cb_func))
> +					fence_array_cb_func)) {
> +			fence_put(&array->base);

Ok, yes, that is an artifact of reporting signaled before all cb are
complete.

/* As we may report that the fence is signaled before all callbacks are
 * complete, we need to take an additional reference count on the array
 * so that we do not free it too early. The core fence handling will
 * only hold the reference until we signal the array as complete (but
 * that is now insufficient).
 */

fence_array_signaled() should now be
	return atomic_read(&array->num_pending) <= 0;
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ