AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel-/w4YWyX8dFk@public.gmane.org>
To: christian.koenig-5C7GfCeVMHo@public.gmane.org
Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	Daniel Vetter <daniel-/w4YWyX8dFk@public.gmane.org>
Subject: Re: Improve reservation object shared slot function
Date: Mon, 24 Sep 2018 17:43:19 +0200	[thread overview]
Message-ID: <20180924154319.GW11082@phenom.ffwll.local> (raw)
In-Reply-To: <b84dbae6-12ce-5632-d80f-567cb7fe678b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Mon, Sep 24, 2018 at 05:16:50PM +0200, Christian König wrote:
> Am 24.09.2018 um 17:03 schrieb Daniel Vetter:
> > On Mon, Sep 24, 2018 at 01:58:12PM +0200, Christian König wrote:
> > > The reservation object shared slot function only allowed to reserve one slot at a time.
> > > 
> > > Improve that and allow to reserve multiple slots to support atomically submission to multiple engines.
> > I think you can do this already, just don't drop the ww_mutex lock. And I
> > also think that invariant still holds, if you drop the ww_mutex lock your
> > fence slot reservation evaporates. Your new code is just a bit more
> > convenient.
> 
> The problem is that allocating a slot could in theory fail with -ENOMEM.
> 
> And at the point we add the fence the hardware is already using the memory,
> so failure is not on option.
> 
> Key feature is that we are getting submissions to multiple engines which
> either needs to be submitted together or not at all.
> 
> > Could we check/enforce this somehow when WW_MUTEX debugging is enabled?
> > E.g. store the ww_mutex ctx in the reservation (we can dig it out from
> > under the lock), and then check that the lock holder/ctx hasn't changed
> > when adding all the fences? I think with multiple fences getting added
> > atomically some more debug checks here would be good.
> 
> Yeah, I was already thinking about something similar.
> 
> We wouldn't need to remember the context or anything, but rather just set
> shared_max=shared_count in reservation_object_unlock().
> 
> > Another one: Do we want to insist that you either add all the fences, or
> > none, to make this fully atomic? We could check this when unlocking the
> > reservation. Kinda hard to guess what your exact use-case here is.
> 
> No, some fence (like VM updates) are perfectly optional.

Ah right, vm moves might already be underway (even if you end up throwing
all the actual CS stuff from userspace away), or might not happen.

> > All this would ofc be compiled out for !WW_MUTEX_DEBUG kernels.
> 
> Those extra checks sounds like a good idea to me, going to add that.

Yeah that'd be great, just figured "this has lots of potential for nasty
to debug bugs". The patches themselves look good to me, at least from
skimming.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

      parent reply	other threads:[~2018-09-24 15:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-24 11:58 Improve reservation object shared slot function Christian König
     [not found] ` <20180924115819.2116-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-09-24 11:58   ` [PATCH 1/7] dma-buf: remove shared fence staging in reservation object Christian König
2018-09-24 11:58   ` [PATCH 2/7] dma-buf: allow reserving more than one shared fence slot Christian König
2018-09-24 11:58   ` [PATCH 3/7] drm/ttm: allow reserve more than one shared slot Christian König
2018-09-24 14:11     ` Michel Dänzer
2018-09-24 11:58   ` [PATCH 4/7] drm/amdgpu: fix using shared fence for exported BOs Christian König
2018-09-24 11:58   ` [PATCH 6/7] drm/amdgpu: always reserve one more shared slot for pipelines BO moves Christian König
2018-09-24 11:58   ` [PATCH 7/7] drm/ttm: drop the extra reservation " Christian König
2018-09-24 11:58 ` [PATCH 5/7] drm/amdgpu: always reserve two slots for the VM Christian König
     [not found]   ` <20180924115819.2116-6-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-09-24 14:14     ` Michel Dänzer
2018-09-24 15:03 ` Improve reservation object shared slot function Daniel Vetter
     [not found]   ` <20180924150319.GV11082-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2018-09-24 15:16     ` Christian König
     [not found]       ` <b84dbae6-12ce-5632-d80f-567cb7fe678b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-09-24 15:43         ` Daniel Vetter [this message]

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=20180924154319.GW11082@phenom.ffwll.local \
    --to=daniel-/w4ywyx8dfk@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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