All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 4/4] drm/i915: Fix i915_gem_evict_for_vma (soft-pinning)
Date: Fri, 18 Nov 2016 10:14:26 +0000	[thread overview]
Message-ID: <20161118101426.GF16779@nuc-i3427.alporthouse.com> (raw)
In-Reply-To: <1479460689.3594.10.camel@linux.intel.com>

On Fri, Nov 18, 2016 at 11:18:09AM +0200, Joonas Lahtinen wrote:
> On to, 2016-11-17 at 12:08 +0000, Chris Wilson wrote: 
> > +		if (flags & PIN_NONBLOCK &&
> > +		    (i915_vma_is_pinned(vma) || i915_vma_is_active(vma))) {
> > +			ret = -ENOSPC;
> > +			break;
> > +		}
> 
> i915_vma_is_pinned() being true will exit this loop with -ENOSPC with
> or without NOBLOCK, just skipping the exec_entry test without it. I
> would clarify that. Now it's bit odd.

It's a necessary test for use by execbuf. The interface is that it tests
a location first with NONBLOCK before deciding on whether it is a good
final location. (With various other hints as to whether any eviction is
a good idea, vs whether it mandatory to use this location.)

> > -			return -ENOSPC;
> > +		/* Overlap of objects in the same batch? */
> > +		if (i915_vma_is_pinned(vma)) {
> > +			ret = -ENOSPC;
> > +			if (vma->exec_entry &&
> > +			    vma->exec_entry->flags & EXEC_OBJECT_PINNED)
> > +				ret = -EINVAL;
> > +			break;
> >  		}
> >  
> > -		ret = i915_vma_unbind(vma);
> > -		if (ret)
> > -			return ret;
> > +		__i915_vma_pin(vma);
> 
> I don't quite see why? Are you expecting the iteration to hit same vma
> twice? Or somebody moving it while we iterate.

The unbind may causes a free of any member on this list, so the pinning
prevents other vma from being unbound whilst waiting on this one. It
used to be a big deal, but since the various reworking the deferred free
hides the oops.
 
> > +		list_add(&vma->exec_list, &eviction_list);
> 
> I'd prefer an union instead of brutally reusing member for other
> purposes.

There have been patches to add evict_link :-p
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-11-18 10:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-17 12:08 [PATCH v2 1/4] drm: Define drm_mm_for_each_node_in_range() Chris Wilson
2016-11-17 12:08 ` [PATCH v2 2/4] drm: Check against color expansion in drm_mm_reserve_node() Chris Wilson
2016-11-17 13:20   ` Joonas Lahtinen
2016-11-17 12:08 ` [PATCH v2 3/4] drm/i915: Mark all non-vma being inserted into the address spaces Chris Wilson
2016-11-17 13:31   ` Joonas Lahtinen
2016-11-17 14:12     ` Chris Wilson
2016-11-18  9:05       ` Chris Wilson
2016-11-18  9:55         ` Joonas Lahtinen
2016-11-17 12:08 ` [PATCH v2 4/4] drm/i915: Fix i915_gem_evict_for_vma (soft-pinning) Chris Wilson
2016-11-18  9:18   ` Joonas Lahtinen
2016-11-18 10:14     ` Chris Wilson [this message]
2016-11-18 11:31       ` Joonas Lahtinen
2016-11-18 12:06         ` Chris Wilson
2016-11-18 12:14         ` Chris Wilson
2016-11-17 12:46 ` ✓ Fi.CI.BAT: success for series starting with [v2,1/4] drm: Define drm_mm_for_each_node_in_range() Patchwork
2016-11-17 13:56 ` [PATCH v2 1/4] " Joonas Lahtinen
2016-11-17 14:49   ` [PATCH] " Chris Wilson
2016-11-18  8:43     ` Joonas Lahtinen
2016-11-17 16:53 ` ✗ Fi.CI.BAT: failure for series starting with drm: Define drm_mm_for_each_node_in_range() (rev2) 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=20161118101426.GF16779@nuc-i3427.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=joonas.lahtinen@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.