From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH] drm/i915: Fix up the vma aliasing ppgtt binding
Date: Mon, 4 May 2015 10:49:30 +0200 [thread overview]
Message-ID: <20150504084930.GO30184@phenom.ffwll.local> (raw)
In-Reply-To: <20150424115557.GE599@nuc-i3427.alporthouse.com>
On Fri, Apr 24, 2015 at 12:55:57PM +0100, Chris Wilson wrote:
> On Fri, Apr 24, 2015 at 12:14:17PM +0100, Chris Wilson wrote:
> > On Mon, Apr 20, 2015 at 09:04:05AM -0700, Daniel Vetter wrote:
> > > Currently we have the problem that the decision whether ptes need to
> > > be (re)written is splattered all over the codebase. Move all that into
> > > i915_vma_bind. This needs a few changes:
> > > - Just reuse the PIN_* flags for i915_vma_bind and do the conversion
> > > to vma->bound in there to avoid duplicating the conversion code all
> > > over.
> > > - We need to make binding for EXECBUF (i.e. pick aliasing ppgtt if
> > > around) explicit, add PIN_USER for that.
> > > - Two callers want to update ptes, give them a PIN_UPDATE for that.
> > >
> > > Of course we still want to avoid double-binding, but that should be
> > > taken care of:
> > > - A ppgtt vma will only ever see PIN_USER, so no issue with
> > > double-binding.
> > > - A ggtt vma with aliasing ppgtt needs both types of binding, and we
> > > track that properly now.
> > > - A ggtt vma without aliasing ppgtt could be bound twice. In the
> > > lower-level ->bind_vma functions hence unconditionally set
> > > GLOBAL_BIND when writing the ggtt ptes.
> > >
> > > There's still a bit room for cleanup, but that's for follow-up
> > > patches.
> > >
> > > v2: Fixup fumbles.
> > >
> > > v3: s/PIN_EXECBUF/PIN_USER/ for clearer meaning, suggested by Chris.
> > >
> > > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> >
> > I'm getting lots of GPU hangs from this patch...
Oops, I've considered the vma_unbind case but then totally forgot that a
vma can survive over execbuf. Can you please wrap this into a proper
commit message with sob?
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 91aade7..e3841f8 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -3066,8 +3066,8 @@ int i915_vma_unbind(struct i915_vma *vma)
> }
>
> trace_i915_vma_unbind(vma);
> -
> vma->vm->unbind_vma(vma);
> + vma->bound = 0;
>
> list_del_init(&vma->mm_list);
> if (i915_is_ggtt(vma->vm)) {
> @@ -3588,7 +3588,6 @@ search_free:
> if (ret)
> goto err_remove_node;
>
> - trace_i915_vma_bind(vma, flags);
> ret = i915_vma_bind(vma, obj->cache_level, flags);
> if (ret)
> goto err_finish_gtt;
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index cfdc8c6..45d74da 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -1563,9 +1563,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
> * be in ggtt still end up in the aliasing ppgtt. remove
> * this check when that is fixed.
> */
> - if (USES_FULL_PPGTT(dev))
> - dispatch_flags |= I915_DISPATCH_SECURE;
> -
> + dispatch_flags |= I915_DISPATCH_SECURE;
Unrelated hunk?
> exec_start = 0;
> }
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 9e06180..bbeb6c3 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -1949,8 +1949,6 @@ static void i915_ggtt_bind_vma(struct i915_vma *vma,
>
> BUG_ON(!i915_is_ggtt(vma->vm));
> intel_gtt_insert_sg_entries(vma->ggtt_view.pages, entry, flags);
> -
> - vma->bound |= GLOBAL_BIND;
Hm, why remove this? I added this to avoid double-binding on platforms
where one implies the other binding type. Maybe should have been a bit
more consistent with bound |= GLOBAL_BIND | LOCAL_BIND.
-Daniel
> }
>
> static void i915_ggtt_clear_range(struct i915_address_space *vm,
> @@ -2813,9 +2811,12 @@ i915_get_ggtt_vma_pages(struct i915_vma *vma)
> int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level,
> u32 flags)
> {
> - u32 bind_flags = 0;
> + u32 bind_flags;
> int ret;
>
> + if (WARN_ON(flags == 0))
> + return -EINVAL;
> +
> if (vma->vm->allocate_va_range) {
> trace_i915_va_alloc(vma->vm, vma->node.start,
> vma->node.size,
> @@ -2834,6 +2835,7 @@ int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level,
> return 0;
> }
>
> + bind_flags = 0;
> if (flags & PIN_GLOBAL)
> bind_flags |= GLOBAL_BIND;
> if (flags & PIN_USER)
> @@ -2844,10 +2846,11 @@ int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level,
> else
> bind_flags &= ~vma->bound;
>
> - if (bind_flags)
> + if (bind_flags) {
> + trace_i915_vma_bind(vma, bind_flags);
> vma->vm->bind_vma(vma, cache_level, bind_flags);
> -
> - vma->bound |= bind_flags;
> + vma->bound |= bind_flags;
> + }
>
> return 0;
> }
>
> --
> Chris Wilson, Intel Open Source Technology Centre
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-05-04 8:47 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-14 15:35 [PATCH 00/17] i915_gem_gtt.c polish Daniel Vetter
2015-04-14 15:35 ` [PATCH 01/17] drm/i915: Move gen8 clear_range vfunc setup into common code Daniel Vetter
2015-04-17 14:11 ` Mika Kuoppala
2015-04-14 15:35 ` [PATCH 02/17] drm/i915: Move vma vfuns to adddress_space Daniel Vetter
2015-04-14 16:09 ` Chris Wilson
2015-04-14 16:12 ` Chris Wilson
2015-04-14 17:08 ` Daniel Vetter
2015-04-14 17:23 ` Chris Wilson
2015-04-16 6:18 ` Mika Kuoppala
2015-04-16 7:39 ` Chris Wilson
2015-04-17 14:15 ` Mika Kuoppala
2015-04-14 15:35 ` [PATCH 03/17] drm/i915: Clean up aliasing ppgtt correctly on error paths Daniel Vetter
2015-04-17 14:34 ` Mika Kuoppala
2015-04-14 15:35 ` [PATCH 04/17] drm/i915: Unify aliasing ppgtt handling Daniel Vetter
2015-04-17 13:36 ` Mika Kuoppala
2015-04-17 16:21 ` Mika Kuoppala
2015-04-14 15:35 ` [PATCH 05/17] drm/i915: Move PTE_READ_ONLY to ->pte_encode vfunc Daniel Vetter
2015-04-17 16:22 ` Mika Kuoppala
2015-04-14 15:35 ` [PATCH 06/17] drm/i915: Dont clear PIN_GLOBAL in the execbuf pinning fallback Daniel Vetter
2015-04-14 15:53 ` Chris Wilson
2015-04-14 16:33 ` Chris Wilson
2015-04-14 17:01 ` [PATCH] " Daniel Vetter
2015-04-15 21:50 ` shuang.he
2015-04-14 15:35 ` [PATCH 07/17] drm/i915: Drop redundant GGTT rebinding Daniel Vetter
2015-04-14 16:03 ` Chris Wilson
2015-04-14 15:35 ` [PATCH 08/17] drm/i915: Don't look at pg_dirty_rings for aliasing ppgtt Daniel Vetter
2015-04-14 16:06 ` Chris Wilson
2015-04-14 17:11 ` Daniel Vetter
2015-04-14 17:53 ` Chris Wilson
2015-04-15 10:44 ` Daniel Vetter
2015-04-17 13:49 ` Mika Kuoppala
2015-04-20 16:02 ` Daniel Vetter
2015-04-20 16:08 ` Daniel Vetter
2015-04-21 8:18 ` Mika Kuoppala
2015-04-23 15:43 ` Chris Wilson
2015-04-23 18:56 ` Daniel Vetter
2015-04-23 19:52 ` Chris Wilson
2015-04-23 21:52 ` Chris Wilson
2015-07-31 16:26 ` Chris Wilson
2015-07-31 17:38 ` Chris Wilson
2015-04-14 15:35 ` [PATCH 09/17] drm/i915: Don't use atomics for pg_dirty_rings Daniel Vetter
2015-04-17 16:39 ` Mika Kuoppala
2015-04-14 15:35 ` [PATCH 10/17] drm/i915: Remove misleading comment around bind_to_vm Daniel Vetter
2015-04-17 18:09 ` Mika Kuoppala
2015-04-14 15:35 ` [PATCH 11/17] drm/i915: Fix up the vma aliasing ppgtt binding Daniel Vetter
2015-04-15 10:47 ` Chris Wilson
2015-04-16 8:01 ` Daniel Vetter
2015-04-16 8:07 ` Chris Wilson
2015-04-16 8:57 ` Daniel Vetter
2015-04-20 16:04 ` [PATCH] " Daniel Vetter
2015-04-21 13:29 ` Mika Kuoppala
2015-04-24 11:14 ` Chris Wilson
2015-04-24 11:55 ` Chris Wilson
2015-05-04 8:49 ` Daniel Vetter [this message]
2015-05-04 9:06 ` Chris Wilson
2015-05-04 9:20 ` Daniel Vetter
2015-04-14 15:35 ` [PATCH 12/17] drm/i915: Arm cmd parser with aliasng ppgtt only Daniel Vetter
2015-04-14 18:10 ` Chris Wilson
2015-04-15 9:43 ` Daniel Vetter
2015-04-15 10:07 ` Chris Wilson
2015-04-15 10:28 ` Daniel Vetter
2015-04-30 10:37 ` Jani Nikula
2015-04-24 12:57 ` Mika Kuoppala
2015-05-04 8:54 ` [PATCH] drm/i915: Simplify cmd-parser DISPATCH_SECURE check Daniel Vetter
2015-05-04 9:23 ` Daniel Vetter
2015-05-04 12:52 ` shuang.he
2015-04-14 15:35 ` [PATCH 13/17] drm/i915: move i915_gem_restore_gtt_mappings around Daniel Vetter
2015-04-14 15:35 ` [PATCH 14/17] drm/i915: Move ppgtt_bind/unbind around Daniel Vetter
2015-04-14 15:35 ` [PATCH 15/17] drm/i915: Unduplicate i915_ggtt_unbind/bind_vma Daniel Vetter
2015-04-14 15:35 ` [PATCH 16/17] drm/i915: Don't try to outsmart gcc in i915_gem_gtt.c Daniel Vetter
2015-04-14 15:35 ` [PATCH 17/17] drm/i915: Move i915_get_ggtt_vma_pages into ggtt_bind_vma Daniel Vetter
2015-04-21 13:36 ` Mika Kuoppala
2015-04-23 19:08 ` Daniel Vetter
2015-04-15 10:49 ` [PATCH 00/17] i915_gem_gtt.c polish 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=20150504084930.GO30184@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=chris@chris-wilson.co.uk \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel.vetter@intel.com \
--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