public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: paulo.r.zanoni@intel.com, thomas.hellstrom@intel.com,
	matthew.auld@intel.com, daniel.vetter@intel.com,
	christian.koenig@amd.com
Subject: Re: [Intel-gfx] [RFC v4 02/14] drm/i915/vm_bind: Add __i915_sw_fence_await_reservation()
Date: Thu, 22 Sep 2022 12:26:02 +0300	[thread overview]
Message-ID: <87fsgj7ob9.fsf@intel.com> (raw)
In-Reply-To: <20220921070945.27764-3-niranjana.vishwanathapura@intel.com>

On Wed, 21 Sep 2022, Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com> wrote:
> Add function __i915_sw_fence_await_reservation() for
> asynchronous wait on a dma-resv object with specified
> dma_resv_usage. This is required for async vma unbind
> with vm_bind.
>
> Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_sw_fence.c | 25 ++++++++++++++++++-------
>  drivers/gpu/drm/i915/i915_sw_fence.h |  7 ++++++-
>  2 files changed, 24 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_sw_fence.c b/drivers/gpu/drm/i915/i915_sw_fence.c
> index 6fc0d1b89690..0ce8f4efc1ed 100644
> --- a/drivers/gpu/drm/i915/i915_sw_fence.c
> +++ b/drivers/gpu/drm/i915/i915_sw_fence.c
> @@ -569,12 +569,11 @@ int __i915_sw_fence_await_dma_fence(struct i915_sw_fence *fence,
>  	return ret;
>  }
>  
> -int i915_sw_fence_await_reservation(struct i915_sw_fence *fence,
> -				    struct dma_resv *resv,
> -				    const struct dma_fence_ops *exclude,
> -				    bool write,
> -				    unsigned long timeout,
> -				    gfp_t gfp)
> +int __i915_sw_fence_await_reservation(struct i915_sw_fence *fence,
> +				      struct dma_resv *resv,
> +				      enum dma_resv_usage usage,
> +				      unsigned long timeout,
> +				      gfp_t gfp)
>  {
>  	struct dma_resv_iter cursor;
>  	struct dma_fence *f;
> @@ -583,7 +582,7 @@ int i915_sw_fence_await_reservation(struct i915_sw_fence *fence,
>  	debug_fence_assert(fence);
>  	might_sleep_if(gfpflags_allow_blocking(gfp));
>  
> -	dma_resv_iter_begin(&cursor, resv, dma_resv_usage_rw(write));
> +	dma_resv_iter_begin(&cursor, resv, usage);
>  	dma_resv_for_each_fence_unlocked(&cursor, f) {
>  		pending = i915_sw_fence_await_dma_fence(fence, f, timeout,
>  							gfp);
> @@ -598,6 +597,18 @@ int i915_sw_fence_await_reservation(struct i915_sw_fence *fence,
>  	return ret;
>  }
>  
> +int i915_sw_fence_await_reservation(struct i915_sw_fence *fence,
> +				    struct dma_resv *resv,
> +				    const struct dma_fence_ops *exclude,
> +				    bool write,
> +				    unsigned long timeout,
> +				    gfp_t gfp)
> +{
> +	return __i915_sw_fence_await_reservation(fence, resv,
> +						 dma_resv_usage_rw(write),
> +						 timeout, gfp);
> +}
> +
>  #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
>  #include "selftests/lib_sw_fence.c"
>  #include "selftests/i915_sw_fence.c"
> diff --git a/drivers/gpu/drm/i915/i915_sw_fence.h b/drivers/gpu/drm/i915/i915_sw_fence.h
> index 619fc5a22f0c..3cf4b6e16f35 100644
> --- a/drivers/gpu/drm/i915/i915_sw_fence.h
> +++ b/drivers/gpu/drm/i915/i915_sw_fence.h
> @@ -10,13 +10,13 @@
>  #define _I915_SW_FENCE_H_
>  
>  #include <linux/dma-fence.h>
> +#include <linux/dma-resv.h>

As a GCC extension you can drop this and forward declare enum
dma_resv_usage. We use it extensively.

>  #include <linux/gfp.h>
>  #include <linux/kref.h>
>  #include <linux/notifier.h> /* for NOTIFY_DONE */
>  #include <linux/wait.h>
>  
>  struct completion;
> -struct dma_resv;
>  struct i915_sw_fence;
>  
>  enum i915_sw_fence_notify {
> @@ -89,6 +89,11 @@ int i915_sw_fence_await_dma_fence(struct i915_sw_fence *fence,
>  				  unsigned long timeout,
>  				  gfp_t gfp);
>  
> +int __i915_sw_fence_await_reservation(struct i915_sw_fence *fence,
> +				      struct dma_resv *resv,
> +				      enum dma_resv_usage usage,
> +				      unsigned long timeout,
> +				      gfp_t gfp);
>  int i915_sw_fence_await_reservation(struct i915_sw_fence *fence,
>  				    struct dma_resv *resv,
>  				    const struct dma_fence_ops *exclude,

-- 
Jani Nikula, Intel Open Source Graphics Center

  parent reply	other threads:[~2022-09-22  9:26 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21  7:09 [Intel-gfx] [RFC v4 00/14] drm/i915/vm_bind: Add VM_BIND functionality Niranjana Vishwanathapura
2022-09-21  7:09 ` [Intel-gfx] [RFC v4 01/14] drm/i915/vm_bind: Expose vm lookup function Niranjana Vishwanathapura
2022-09-21  7:09 ` [Intel-gfx] [RFC v4 02/14] drm/i915/vm_bind: Add __i915_sw_fence_await_reservation() Niranjana Vishwanathapura
2022-09-21  9:06   ` Tvrtko Ursulin
2022-09-21 17:47     ` Niranjana Vishwanathapura
2022-09-22  9:26   ` Jani Nikula [this message]
2022-09-21  7:09 ` [Intel-gfx] [RFC v4 03/14] drm/i915/vm_bind: Expose i915_gem_object_max_page_size() Niranjana Vishwanathapura
2022-09-21  9:13   ` Tvrtko Ursulin
2022-09-21 18:00     ` Niranjana Vishwanathapura
2022-09-22  8:09       ` Tvrtko Ursulin
2022-09-22 16:18         ` Matthew Auld
2022-09-22 16:46           ` Niranjana Vishwanathapura
2022-09-23  7:45           ` Tvrtko Ursulin
2022-09-21  7:09 ` [Intel-gfx] [RFC v4 04/14] drm/i915/vm_bind: Implement bind and unbind of object Niranjana Vishwanathapura
2022-09-22  9:29   ` Jani Nikula
2022-09-21  7:09 ` [Intel-gfx] [RFC v4 05/14] drm/i915/vm_bind: Support for VM private BOs Niranjana Vishwanathapura
2022-09-21  7:09 ` [Intel-gfx] [RFC v4 06/14] drm/i915/vm_bind: Handle persistent vmas Niranjana Vishwanathapura
2022-09-27  2:36   ` Zeng, Oak
2022-09-27  5:45     ` Niranjana Vishwanathapura
2022-09-21  7:09 ` [Intel-gfx] [RFC v4 07/14] drm/i915/vm_bind: Add out fence support Niranjana Vishwanathapura
2022-09-22  9:31   ` Jani Nikula
2022-09-21  7:09 ` [Intel-gfx] [RFC v4 08/14] drm/i915/vm_bind: Abstract out common execbuf functions Niranjana Vishwanathapura
2022-09-21 10:18   ` Tvrtko Ursulin
2022-09-21 18:17     ` Niranjana Vishwanathapura
2022-09-22  9:05       ` Tvrtko Ursulin
2022-09-22 14:12         ` Niranjana Vishwanathapura
2022-09-22  9:54   ` Jani Nikula
2022-09-24  4:22     ` Niranjana Vishwanathapura
2022-09-21  7:09 ` [Intel-gfx] [RFC v4 09/14] drm/i915/vm_bind: Implement I915_GEM_EXECBUFFER3 ioctl Niranjana Vishwanathapura
2022-09-21  7:09 ` [Intel-gfx] [RFC v4 10/14] drm/i915/vm_bind: Update i915_vma_verify_bind_complete() Niranjana Vishwanathapura
2022-09-21  7:09 ` [Intel-gfx] [RFC v4 11/14] drm/i915/vm_bind: Handle persistent vmas in execbuf3 Niranjana Vishwanathapura
2022-09-21  7:09 ` [Intel-gfx] [RFC v4 12/14] drm/i915/vm_bind: userptr dma-resv changes Niranjana Vishwanathapura
2022-09-21  7:09 ` [Intel-gfx] [RFC v4 13/14] drm/i915/vm_bind: Skip vma_lookup for persistent vmas Niranjana Vishwanathapura
2022-09-23  8:40   ` Tvrtko Ursulin
2022-09-24  4:30     ` Niranjana Vishwanathapura
2022-09-26 16:26       ` Tvrtko Ursulin
2022-09-26 17:09         ` Niranjana Vishwanathapura
2022-09-27  9:28           ` Tvrtko Ursulin
2022-09-27 15:37             ` Niranjana Vishwanathapura
2022-09-21  7:09 ` [Intel-gfx] [RFC v4 14/14] drm/i915/vm_bind: Add uapi for user to enable vm_bind_mode Niranjana Vishwanathapura
2022-09-21  8:33 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/vm_bind: Add VM_BIND functionality (rev3) Patchwork
2022-09-21  8:55 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " 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=87fsgj7ob9.fsf@intel.com \
    --to=jani.nikula@linux.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=matthew.auld@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