From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] dma-fence: Serialise signal enabling (dma_fence_enable_sw_signaling)
Date: Thu, 3 Oct 2019 14:16:03 +0100 [thread overview]
Message-ID: <306bc53e-741e-1a23-c37d-b83400c38794@linux.intel.com> (raw)
In-Reply-To: <20190915184539.16724-1-chris@chris-wilson.co.uk>
On 15/09/2019 19:45, Chris Wilson wrote:
> Make dma_fence_enable_sw_signaling() behave like its
> dma_fence_add_callback() and dma_fence_default_wait() counterparts and
> perform the test to enable signaling under the fence->lock, along with
> the action to do so. This ensure that should an implementation be trying
> to flush the cb_list (by signaling) on retirement before freeing the
> fence, it can do so in a race-free manner.
>
> See also 0fc89b6802ba ("dma-fence: Simply wrap dma_fence_signal_locked
> with dma_fence_signal").
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/dma-buf/dma-fence.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
> index 2c136aee3e79..587727089134 100644
> --- a/drivers/dma-buf/dma-fence.c
> +++ b/drivers/dma-buf/dma-fence.c
> @@ -285,19 +285,18 @@ void dma_fence_enable_sw_signaling(struct dma_fence *fence)
> {
> unsigned long flags;
>
> + if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
> + return;
> +
> + spin_lock_irqsave(fence->lock, flags);
> if (!test_and_set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
I dare not to ask if this couldn't be the non-atomic version, but I have
empirically proven to myself things are not that straightforward around
here.
> &fence->flags) &&
> - !test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags) &&
> fence->ops->enable_signaling) {
> trace_dma_fence_enable_signal(fence);
> -
> - spin_lock_irqsave(fence->lock, flags);
> -
> if (!fence->ops->enable_signaling(fence))
> dma_fence_signal_locked(fence);
> -
> - spin_unlock_irqrestore(fence->lock, flags);
> }
> + spin_unlock_irqrestore(fence->lock, flags);
> }
> EXPORT_SYMBOL(dma_fence_enable_sw_signaling);
>
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2019-10-03 13:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-15 18:45 [PATCH 1/2] dma-fence: Serialise signal enabling (dma_fence_enable_sw_signaling) Chris Wilson
2019-09-15 18:45 ` [PATCH 2/2] drm/mm: Pack allocated/scanned boolean into a bitfield Chris Wilson
2019-09-16 19:45 ` Ruhl, Michael J
2019-10-03 7:07 ` Chris Wilson
2019-10-03 14:02 ` Ruhl, Michael J
2019-10-03 13:42 ` Tvrtko Ursulin
2019-09-15 19:12 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/2] dma-fence: Serialise signal enabling (dma_fence_enable_sw_signaling) Patchwork
2019-09-15 19:34 ` ✓ Fi.CI.BAT: success " Patchwork
2019-09-16 8:51 ` ✓ Fi.CI.IGT: " Patchwork
2019-10-03 13:16 ` Tvrtko Ursulin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=306bc53e-741e-1a23-c37d-b83400c38794@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox