public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 01/22] dma-fence: Serialise signal enabling (dma_fence_enable_sw_signaling)
Date: Thu, 3 Oct 2019 14:18:17 +0100	[thread overview]
Message-ID: <54c10307-35f4-0c7e-0090-0bada2bbe656@linux.intel.com> (raw)
In-Reply-To: <157010818568.2173.17563179133662647600@skylake-alporthouse-com>


On 03/10/2019 14:09, Chris Wilson wrote:
> Quoting Chris Wilson (2019-10-03 10:36:18)
>> 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,
>>                                &fence->flags) &&
>> -           !test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags) &&
> 
> Staring at this in discussion with Tvrtko, we can't drop this check
> either. After which this looks almost identical with the other
> enable_signaling callers.

Ah yes true, DMA_FENCE_FLAG_SIGNALED_BIT has to be reliably checked 
before the enable_signalling callback. I retract my previous r-b. :)

Regards,

Tvrtko


>>              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);
>>   
>> -- 
>> 2.23.0
>>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-10-03 13:18 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03  9:36 struct_mutex batch Chris Wilson
2019-10-03  9:36 ` [PATCH 01/22] dma-fence: Serialise signal enabling (dma_fence_enable_sw_signaling) Chris Wilson
2019-10-03 13:09   ` Chris Wilson
2019-10-03 13:18     ` Tvrtko Ursulin [this message]
2019-10-03 13:19   ` [PATCH v2] " Chris Wilson
2019-10-03 13:22     ` Chris Wilson
2019-10-03 13:24   ` [PATCH v3] " Chris Wilson
2019-10-03 14:12     ` [Intel-gfx] " Ruhl, Michael J
2019-10-03 14:18       ` Chris Wilson
2019-10-03 14:42         ` Ruhl, Michael J
2019-10-03 14:43         ` [Intel-gfx] " Tvrtko Ursulin
2019-10-03  9:36 ` [PATCH 02/22] drm/mm: Pack allocated/scanned boolean into a bitfield Chris Wilson
2019-10-03  9:36 ` [PATCH 03/22] drm/i915: Only track bound elements of the GTT Chris Wilson
2019-10-03  9:36 ` [PATCH 04/22] drm/i915: Mark up address spaces that may need to allocate Chris Wilson
2019-10-03  9:36 ` [PATCH 05/22] drm/i915: Pull i915_vma_pin under the vm->mutex Chris Wilson
2019-10-03  9:36 ` [PATCH 06/22] drm/i915: Push the i915_active.retire into a worker Chris Wilson
2019-10-03  9:36 ` [PATCH 07/22] drm/i915: Coordinate i915_active with its own mutex Chris Wilson
2019-10-03  9:36 ` [PATCH 08/22] drm/i915: Move idle barrier cleanup into engine-pm Chris Wilson
2019-10-03  9:36 ` [PATCH 09/22] drm/i915: Drop struct_mutex from around i915_retire_requests() Chris Wilson
2019-10-03  9:36 ` [PATCH 10/22] drm/i915: Remove the GEM idle worker Chris Wilson
2019-10-03  9:36 ` [PATCH 11/22] drm/i915: Merge wait_for_timelines with retire_request Chris Wilson
2019-10-03  9:36 ` [PATCH 12/22] drm/i915/gem: Retire directly for mmap-offset shrinking Chris Wilson
2019-10-03  9:36 ` [PATCH 13/22] drm/i915: Move request runtime management onto gt Chris Wilson
2019-10-03  9:36 ` [PATCH 14/22] drm/i915: Move global activity tracking from GEM to GT Chris Wilson
2019-10-03  9:36 ` [PATCH 15/22] drm/i915: Remove logical HW ID Chris Wilson
2019-10-03  9:36 ` [PATCH 16/22] drm/i915: Move context management under GEM Chris Wilson
2019-10-03 11:53   ` [PATCH] " Chris Wilson
2019-10-03 11:58   ` Chris Wilson
2019-10-03 12:04   ` Chris Wilson
2019-10-03 13:35   ` Chris Wilson
2019-10-03 14:08   ` Chris Wilson
2019-10-03 14:20   ` Chris Wilson
2019-10-04 10:27     ` Tvrtko Ursulin
2019-10-03  9:36 ` [PATCH 17/22] drm/i915/overlay: Drop struct_mutex guard Chris Wilson
2019-10-03  9:36 ` [PATCH 18/22] drm/i915: Drop struct_mutex guard from debugfs/framebuffer_info Chris Wilson
2019-10-03  9:36 ` [PATCH 19/22] drm/i915: Remove struct_mutex guard for debugfs/opregion Chris Wilson
2019-10-03  9:36 ` [PATCH 20/22] drm/i915: Drop struct_mutex from suspend state save/restore Chris Wilson
2019-10-03  9:36 ` [PATCH 21/22] drm/i915/selftests: Drop vestigal struct_mutex guards Chris Wilson
2019-10-03  9:36 ` [PATCH 22/22] drm/i915: Drop struct_mutex from around GEM initialisation Chris Wilson
2019-10-03 11:22 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/22] dma-fence: Serialise signal enabling (dma_fence_enable_sw_signaling) Patchwork
2019-10-03 11:45 ` ✗ Fi.CI.BAT: failure " Patchwork
2019-10-03 12:40 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/22] dma-fence: Serialise signal enabling (dma_fence_enable_sw_signaling) (rev4) Patchwork
2019-10-03 13:02 ` ✗ Fi.CI.BAT: failure " Patchwork
2019-10-03 16:38 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [v3] dma-fence: Serialise signal enabling (dma_fence_enable_sw_signaling) (rev9) Patchwork
2019-10-03 17:04 ` ✓ Fi.CI.BAT: success " Patchwork
2019-10-04  2:13 ` ✓ Fi.CI.IGT: " Patchwork

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=54c10307-35f4-0c7e-0090-0bada2bbe656@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --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