public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v5 1/6] drm/i915: Call i915_gem_evict_vm in vm_fault_gtt to prevent new ENOSPC errors, v2.
Date: Thu, 13 Jan 2022 14:30:59 +0100	[thread overview]
Message-ID: <45f75559-6367-d0ff-bd45-3efca11656a9@linux.intel.com> (raw)
In-Reply-To: <20220113114500.2039439-2-maarten.lankhorst@linux.intel.com>


On 1/13/22 12:44, Maarten Lankhorst wrote:
> Now that we cannot unbind kill the currently locked object directly
> because we're removing short term pinning, we may have to unbind the
> object from gtt manually, using a i915_gem_evict_vm() call.
>
> Changes since v1:
> - Remove -ENOSPC warning, can still happen with concurrent mmaps
>    where we can't unbind the other mmap because of the lock held.
>    This  fixes the gem_mmap_gtt@cpuset tests.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>


> ---
>   drivers/gpu/drm/i915/gem/i915_gem_mman.c | 18 ++++++++++++++++--
>   1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> index 5ac2506f4ee8..fafd158e5313 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> @@ -21,6 +21,7 @@
>   #include "i915_trace.h"
>   #include "i915_user_extensions.h"
>   #include "i915_gem_ttm.h"
> +#include "i915_gem_evict.h"
>   #include "i915_vma.h"
>   
>   static inline bool
> @@ -358,8 +359,21 @@ static vm_fault_t vm_fault_gtt(struct vm_fault *vmf)
>   			vma = i915_gem_object_ggtt_pin_ww(obj, &ww, &view, 0, 0, flags);
>   		}
>   
> -		/* The entire mappable GGTT is pinned? Unexpected! */
> -		GEM_BUG_ON(vma == ERR_PTR(-ENOSPC));
> +		/*
> +		 * The entire mappable GGTT is pinned? Unexpected!
> +		 * Try to evict the object we locked too, as normally we skip it
> +		 * due to lack of short term pinning inside execbuf.
> +		 */
> +		if (vma == ERR_PTR(-ENOSPC)) {
> +			ret = mutex_lock_interruptible(&ggtt->vm.mutex);
> +			if (!ret) {
> +				ret = i915_gem_evict_vm(&ggtt->vm);
> +				mutex_unlock(&ggtt->vm.mutex);
> +			}
> +			if (ret)
> +				goto err_reset;
> +			vma = i915_gem_object_ggtt_pin_ww(obj, &ww, &view, 0, 0, flags);
> +		}
>   	}
>   	if (IS_ERR(vma)) {
>   		ret = PTR_ERR(vma);

  reply	other threads:[~2022-01-13 13:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13 11:44 [Intel-gfx] [PATCH v5 0/6] drm/i915: Remove short term pins from execbuf by requiring lock to unbind Maarten Lankhorst
2022-01-13 11:44 ` [Intel-gfx] [PATCH v5 1/6] drm/i915: Call i915_gem_evict_vm in vm_fault_gtt to prevent new ENOSPC errors, v2 Maarten Lankhorst
2022-01-13 13:30   ` Thomas Hellström [this message]
2022-01-13 11:44 ` [Intel-gfx] [PATCH v5 2/6] drm/i915: Add locking to i915_gem_evict_vm() Maarten Lankhorst
2022-01-13 14:33   ` Thomas Hellström (Intel)
2022-01-13 14:37     ` Maarten Lankhorst
2022-01-13 11:44 ` [Intel-gfx] [PATCH v5 3/6] drm/i915: Add object locking to i915_gem_evict_for_node and i915_gem_evict_something, v2 Maarten Lankhorst
2022-01-13 14:43   ` Thomas Hellström
2022-01-13 11:44 ` [Intel-gfx] [PATCH v5 4/6] drm/i915: Add i915_vma_unbind_unlocked, and take obj lock for i915_vma_unbind, v2 Maarten Lankhorst
2022-01-13 14:53   ` Thomas Hellström
2022-01-13 11:44 ` [Intel-gfx] [PATCH v5 5/6] drm/i915: Remove support for unlocked i915_vma unbind Maarten Lankhorst
2022-01-13 15:01   ` Thomas Hellström
2022-01-13 11:45 ` [Intel-gfx] [PATCH v5 6/6] drm/i915: Remove short-term pins from execbuf, v6 Maarten Lankhorst
2022-01-13 12:48 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Remove short term pins from execbuf by requiring lock to unbind Patchwork
2022-01-13 12:50 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-01-13 12:53 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2022-01-13 13:27 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-01-13 14:35 ` [Intel-gfx] ✗ Fi.CI.IGT: 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=45f75559-6367-d0ff-bd45-3efca11656a9@linux.intel.com \
    --to=thomas.hellstrom@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.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