public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Damien Lespiau <damien.lespiau@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	akash.goel@intel.com, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v3] intel: New libdrm interface to create unbound wc user mappings for objects
Date: Tue, 9 Dec 2014 16:53:01 +0000	[thread overview]
Message-ID: <20141209165301.GE11257@strange.ger.corp.intel.com> (raw)
In-Reply-To: <20141209105425.GA14956@nuc-i3427.alporthouse.com>

On Tue, Dec 09, 2014 at 10:54:25AM +0000, Chris Wilson wrote:
> On Wed, Dec 03, 2014 at 02:13:58PM +0000, Damien Lespiau wrote:
> > On Tue, Oct 28, 2014 at 06:39:27PM +0530, akash.goel@intel.com wrote:
> > > @@ -1126,6 +1136,8 @@ static void drm_intel_gem_bo_purge_vma_cache(drm_intel_bufmgr_gem *bufmgr_gem)
> > >  
> > >  	/* We may need to evict a few entries in order to create new mmaps */
> > >  	limit = bufmgr_gem->vma_max - 2*bufmgr_gem->vma_open;
> > > +	if (bufmgr_gem->has_ext_mmap)
> > > +		limit -= bufmgr_gem->vma_open;
> > >  	if (limit < 0)
> > >  		limit = 0;
> > >  
> > 
> > Aren't we being overly aggressive in purging the vma cache with this new
> > code? I guess it depends on the workload but I don't think the WC
> > mapping is likely to be used in addition to the other two often enough
> > to warrant a max - 3 * open;
> 
> And if they do, you've just exceeded their limit. And it conceivably
> that you will have bo with all 3 vma mappings, though I only expect 2 to
> be active in any single lifetime. The patch is correct regarding the code
> as it exists, you may want to argue for finer tracking of vma_open and
> vma_cached, but that would require a different approach.
>  
> > > +	/* Now move it to the GTT domain so that the GPU and CPU
> > > +	 * caches are flushed and the GPU isn't actively using the
> > > +	 * buffer.
> > > +	 *
> > > +	 * The domain change is done even for the objects which
> > > +	 * are not bounded. For them first the pages are acquired,
> > > +	 * before the domain change.
> > > +	 */
> > > +	VG_CLEAR(set_domain);
> > > +	set_domain.handle = bo_gem->gem_handle;
> > > +	set_domain.read_domains = I915_GEM_DOMAIN_GTT;
> > > +	set_domain.write_domain = I915_GEM_DOMAIN_GTT;
> > > +	ret = drmIoctl(bufmgr_gem->fd,
> > > +		       DRM_IOCTL_I915_GEM_SET_DOMAIN,
> > > +		       &set_domain);
> > > +	if (ret != 0) {
> > > +		DBG("%s:%d: Error setting domain %d: %s\n",
> > > +		    __FILE__, __LINE__, bo_gem->gem_handle,
> > > +		    strerror(errno));
> > > +	}
> > 
> > Why move the buffer to the GTT domain and not the CPU domain here?
> 
> There are 3 cache domains: GPU, CPU and NONE (aka GTT). The purpose of
> mmap(wc) is to be able to access the buffer without going through the CPU
> cache (and it should be out of the GPU cache to maintain coherency). The
> NONE cache domain is exactly what we want, or else you end up in clflush
> misery.

Right that leaves the last point in my answer to v3. With that addressed
this is:

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>

--
Damien
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2014-12-09 16:53 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-13 13:20 [PATCH] drm/i915: Broaden application of set-domain(GTT) Chris Wilson
2014-10-14 12:47 ` Chris Wilson
2014-10-23 10:33   ` [PATCH] drm/i915: Support to create uncached user mapping for a Gem object akash.goel
2014-10-23 10:37     ` [PATCH] intel: New libdrm interface to create uncached CPU mapping akash.goel
2014-10-23 10:54     ` [PATCH] drm/i915: Support to create uncached user mapping for a Gem object Chris Wilson
2014-10-23 11:03     ` Chris Wilson
2014-10-23 11:56     ` Chris Wilson
2014-10-23 13:23       ` Chris Wilson
2014-12-10  4:48         ` Chad Versace
2014-12-10  8:02           ` Chris Wilson
2014-10-23 16:55     ` [PATCH] drm/i915: Support creation of unbound wc user mappings for objects Chris Wilson
2014-10-23 19:05       ` [PATCH 1/3] igt/gem_evict_(alignment|everything): contend with GPU hangs Chris Wilson
2014-10-23 19:05         ` [PATCH 2/3] lib/core: Check for kernel error messages and WARN if any are found Chris Wilson
2014-10-23 19:05         ` [PATCH 3/3] reg-read-8 Chris Wilson
2014-10-23 19:12         ` [PATCH 1/3] igt/gem_evict_(alignment|everything): contend with GPU hangs Chris Wilson
2014-10-23 19:11       ` [PATCH 1/3] igt/gem_mmap_wc: Exercise mmap(wc) interface Chris Wilson
2014-10-23 19:11         ` [PATCH 2/3] igt/gem_gtt_speed: compare against WC mmaps Chris Wilson
2014-10-23 19:11         ` [PATCH 3/3] igt/gem_concurrent_blit: Exercise wc mappings Chris Wilson
2014-10-25 11:51       ` [PATCH] intel: New libdrm interface to create unbound wc user mappings for objects akash.goel
2014-10-25 12:45         ` Damien Lespiau
2014-10-26  8:36           ` Akash Goel
2014-10-26  8:41             ` Chris Wilson
2014-10-28 13:09         ` [PATCH v3] " akash.goel
2014-10-28 16:11           ` Damien Lespiau
2014-12-03 14:13           ` Damien Lespiau
2014-12-03 18:18             ` Chris Wilson
2014-12-09 10:54             ` Chris Wilson
2014-12-09 16:53               ` Damien Lespiau [this message]
2014-12-14  8:41                 ` [PATCH v4] " akash.goel
2016-03-09  9:09                   ` [PATCH v5] " akash.goel
2016-03-10  8:39                     ` Martin Peres
2016-03-14 16:51                       ` Martin Peres
2016-03-15  8:41                         ` Daniel Vetter
2015-03-03 14:20                 ` [PATCH v3] " Damien Lespiau
2015-03-03 17:05                   ` Chris Wilson
2015-03-03 17:11                     ` Damien Lespiau
2015-03-03 17:13                       ` Chris Wilson
2015-03-03 17:16                         ` Damien Lespiau
2014-11-05 12:48       ` [PATCH] drm/i915: Support creation of " Chris Wilson
2014-11-06 14:50         ` Daniel Vetter
2014-12-17 12:46       ` Tvrtko Ursulin
2014-12-17 12:52         ` Chris Wilson
2014-10-24  8:40     ` [PATCH] drm/i915: Support to create uncached user mapping for a Gem object Daniel Vetter
2014-10-24  9:23       ` Chris Wilson
2014-11-05 12:49   ` [PATCH] drm/i915: Broaden application of set-domain(GTT) Chris Wilson

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=20141209165301.GE11257@strange.ger.corp.intel.com \
    --to=damien.lespiau@intel.com \
    --cc=akash.goel@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