Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Cc: paulo.r.zanoni@intel.com, jani.nikula@intel.com,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	thomas.hellstrom@intel.com, daniel.vetter@intel.com,
	christian.koenig@amd.com
Subject: Re: [Intel-gfx] [PATCH v4 13/17] drm/i915/vm_bind: Update i915_vma_verify_bind_complete()
Date: Thu, 20 Oct 2022 10:16:06 +0100	[thread overview]
Message-ID: <f4c92d7f-8ac8-72df-85bb-a1b00f29cf92@intel.com> (raw)
In-Reply-To: <Y1BB5vMCMCKgi2Ar@nvishwa1-DESK>

On 19/10/2022 19:28, Niranjana Vishwanathapura wrote:
> On Wed, Oct 19, 2022 at 05:07:31PM +0100, Matthew Auld wrote:
>> On 18/10/2022 08:16, Niranjana Vishwanathapura wrote:
>>> Ensure i915_vma_verify_bind_complete() handles case where bind
>>> is not initiated. Also make it non static, add documentation
>>> and move it out of CONFIG_DRM_I915_DEBUG_GEM.
>>>
>>> Signed-off-by: Niranjana Vishwanathapura 
>>> <niranjana.vishwanathapura@intel.com>
>>> Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
>>> ---
>>>  drivers/gpu/drm/i915/i915_vma.c | 16 +++++++++++-----
>>>  drivers/gpu/drm/i915/i915_vma.h |  1 +
>>>  2 files changed, 12 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/i915_vma.c 
>>> b/drivers/gpu/drm/i915/i915_vma.c
>>> index eaa13e9ba966..4975fc662c86 100644
>>> --- a/drivers/gpu/drm/i915/i915_vma.c
>>> +++ b/drivers/gpu/drm/i915/i915_vma.c
>>> @@ -439,12 +439,21 @@ int i915_vma_sync(struct i915_vma *vma)
>>>      return i915_vm_sync(vma->vm);
>>>  }
>>> -#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)
>>> -static int i915_vma_verify_bind_complete(struct i915_vma *vma)
>>> +/**
>>> + * i915_vma_verify_bind_complete() - Check for the bind completion 
>>> of the vma
>>> + * @vma: vma to check for bind completion
>>
>> Maybe mention the locking since this is now more than just DEBUG_GEM 
>> stuff. I assume we need the object lock or otherwise some guarantee 
>> that the vma is pinned?
>>
>> Reviewed-by: Matthew Auld <matthew.auld@intel.com>
>>
> 
> I think they are not needed. The fence reference is obtained under rcu
> lock anyhow (will add this to documentation). Only thing required is
> that vma is not released, but that caller must ensure for all i915_vma
> apis anyhow.

I was thinking more about how this potentially behaves with concurrent 
bind/unbind, and what it might return in such cases. I'm assuming most 
normal users will want to have an active pin and/or be holding the 
object lock when calling this.

> 
> Thanks,
> Niranjana
> 
>>> + *
>>> + * Returns: 0 if the vma bind is completed. Error code otherwise.
>>> + */
>>> +int i915_vma_verify_bind_complete(struct i915_vma *vma)
>>>  {
>>>      struct dma_fence *fence = i915_active_fence_get(&vma->active.excl);
>>>      int err;
>>> +    /* Ensure vma bind is initiated */
>>> +    if (!i915_vma_is_bound(vma, I915_VMA_BIND_MASK))

Just realised that this leaks the fence. I guess we have yet to hit this 
in testing.

>>> +        return -EINVAL;
>>> +
>>>      if (!fence)
>>>          return 0;
>>> @@ -457,9 +466,6 @@ static int i915_vma_verify_bind_complete(struct 
>>> i915_vma *vma)
>>>      return err;
>>>  }
>>> -#else
>>> -#define i915_vma_verify_bind_complete(_vma) 0
>>> -#endif
>>>  I915_SELFTEST_EXPORT void
>>>  i915_vma_resource_init_from_vma(struct i915_vma_resource *vma_res,
>>> diff --git a/drivers/gpu/drm/i915/i915_vma.h 
>>> b/drivers/gpu/drm/i915/i915_vma.h
>>> index 1cadbf8fdedf..04770f8ba815 100644
>>> --- a/drivers/gpu/drm/i915/i915_vma.h
>>> +++ b/drivers/gpu/drm/i915/i915_vma.h
>>> @@ -440,6 +440,7 @@ void i915_vma_make_purgeable(struct i915_vma *vma);
>>>  int i915_vma_wait_for_bind(struct i915_vma *vma);
>>>  int i915_vma_sync(struct i915_vma *vma);
>>> +int i915_vma_verify_bind_complete(struct i915_vma *vma);
>>>  /**
>>>   * i915_vma_get_current_resource - Get the current resource of the vma

  reply	other threads:[~2022-10-20  9:16 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18  7:16 [Intel-gfx] [PATCH v4 00/17] drm/i915/vm_bind: Add VM_BIND functionality Niranjana Vishwanathapura
2022-10-18  7:16 ` [Intel-gfx] [PATCH v4 01/17] drm/i915/vm_bind: Expose vm lookup function Niranjana Vishwanathapura
2022-10-18  7:16 ` [Intel-gfx] [PATCH v4 02/17] drm/i915/vm_bind: Add __i915_sw_fence_await_reservation() Niranjana Vishwanathapura
2022-10-18  7:16 ` [Intel-gfx] [PATCH v4 03/17] drm/i915/vm_bind: Expose i915_gem_object_max_page_size() Niranjana Vishwanathapura
2022-10-18  7:16 ` [Intel-gfx] [PATCH v4 04/17] drm/i915/vm_bind: Add support to create persistent vma Niranjana Vishwanathapura
2022-10-18  7:16 ` [Intel-gfx] [PATCH v4 05/17] drm/i915/vm_bind: Implement bind and unbind of object Niranjana Vishwanathapura
2022-10-18  7:16 ` [Intel-gfx] [PATCH v4 06/17] drm/i915/vm_bind: Support for VM private BOs Niranjana Vishwanathapura
2022-10-18  7:16 ` [Intel-gfx] [PATCH v4 07/17] drm/i915/vm_bind: Add support to handle object evictions Niranjana Vishwanathapura
2022-10-18  7:16 ` [Intel-gfx] [PATCH v4 08/17] drm/i915/vm_bind: Support persistent vma activeness tracking Niranjana Vishwanathapura
2022-10-18  7:16 ` [Intel-gfx] [PATCH v4 09/17] drm/i915/vm_bind: Add out fence support Niranjana Vishwanathapura
2022-10-18 15:28   ` Matthew Auld
2022-10-19  2:43     ` Niranjana Vishwanathapura
2022-10-19 14:24       ` Matthew Auld
2022-10-18  7:16 ` [Intel-gfx] [PATCH v4 10/17] drm/i915/vm_bind: Abstract out common execbuf functions Niranjana Vishwanathapura
2022-10-18  7:16 ` [Intel-gfx] [PATCH v4 11/17] drm/i915/vm_bind: Use common execbuf functions in execbuf path Niranjana Vishwanathapura
2022-10-18  7:16 ` [Intel-gfx] [PATCH v4 12/17] drm/i915/vm_bind: Implement I915_GEM_EXECBUFFER3 ioctl Niranjana Vishwanathapura
2022-10-18 17:30   ` Matthew Auld
2022-10-19  4:10     ` Niranjana Vishwanathapura
2022-10-19 15:20   ` Matthew Auld
2022-10-19 19:03     ` Niranjana Vishwanathapura
2022-10-18  7:16 ` [Intel-gfx] [PATCH v4 13/17] drm/i915/vm_bind: Update i915_vma_verify_bind_complete() Niranjana Vishwanathapura
2022-10-19 16:07   ` Matthew Auld
2022-10-19 18:28     ` Niranjana Vishwanathapura
2022-10-20  9:16       ` Matthew Auld [this message]
2022-10-20 16:51         ` Niranjana Vishwanathapura
2022-10-20 17:06           ` Matthew Auld
2022-10-18  7:16 ` [Intel-gfx] [PATCH v4 14/17] drm/i915/vm_bind: Expose i915_request_await_bind() Niranjana Vishwanathapura
2022-10-19 16:09   ` Matthew Auld
2022-10-19 18:04     ` Niranjana Vishwanathapura
2022-10-18  7:16 ` [Intel-gfx] [PATCH v4 15/17] drm/i915/vm_bind: Handle persistent vmas in execbuf3 Niranjana Vishwanathapura
2022-10-18 18:01   ` Matthew Auld
2022-10-18 20:20     ` Niranjana Vishwanathapura
2022-10-19  5:17       ` Niranjana Vishwanathapura
2022-10-20 16:33   ` Matthew Auld
2022-10-20 16:39   ` Matthew Auld
2022-10-20 17:06     ` Niranjana Vishwanathapura
2022-10-18  7:16 ` [Intel-gfx] [PATCH v4 16/17] drm/i915/vm_bind: userptr dma-resv changes Niranjana Vishwanathapura
2022-10-20 14:27   ` Andi Shyti
2022-10-20 19:05     ` Niranjana Vishwanathapura
2022-10-20 21:20       ` Niranjana Vishwanathapura
2022-10-20 16:29   ` Matthew Auld
2022-10-20 16:39     ` Niranjana Vishwanathapura
2022-10-18  7:16 ` [Intel-gfx] [PATCH v4 17/17] drm/i915/vm_bind: Add uapi for user to enable vm_bind_mode Niranjana Vishwanathapura
2022-10-18 16:03   ` Matthew Auld
2022-10-18 16:48     ` Niranjana Vishwanathapura
2022-10-18  7:55 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/vm_bind: Add VM_BIND functionality (rev7) Patchwork
2022-10-18  7:55 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-10-18  8:06 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-10-19  1:25 ` [Intel-gfx] ✓ 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=f4c92d7f-8ac8-72df-85bb-a1b00f29cf92@intel.com \
    --to=matthew.auld@intel.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=niranjana.vishwanathapura@intel.com \
    --cc=paulo.r.zanoni@intel.com \
    --cc=thomas.hellstrom@intel.com \
    /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