All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 12/21] drm/i915: Mark up address spaces that may need to allocate
Date: Wed, 25 Sep 2019 16:59:26 +0100	[thread overview]
Message-ID: <cd7a61f5-a18f-63fa-1857-5ebd723f37df@linux.intel.com> (raw)
In-Reply-To: <156939979494.4979.4044550468298995712@skylake-alporthouse-com>


On 25/09/2019 09:23, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2019-09-23 09:10:26)
>>
>> On 20/09/2019 17:35, Chris Wilson wrote:
>>> Quoting Tvrtko Ursulin (2019-09-20 17:22:42)
>>>>
>>>> On 02/09/2019 05:02, Chris Wilson wrote:
>>>>> Since we cannot allocate underneath the vm->mutex (it is used in the
>>>>> direct-reclaim paths), we need to shift the allocations off into a
>>>>> mutexless worker with fence recursion prevention. To know when we need
>>>>> this protection, we mark up the address spaces that do allocate before
>>>>> insertion.
>>>>>
>>>>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>>>>> ---
>>>>>     drivers/gpu/drm/i915/i915_gem_gtt.c | 3 +++
>>>>>     drivers/gpu/drm/i915/i915_gem_gtt.h | 2 ++
>>>>>     2 files changed, 5 insertions(+)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
>>>>> index 9095f017162e..56d27cf09a3d 100644
>>>>> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
>>>>> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
>>>>> @@ -1500,6 +1500,7 @@ static struct i915_ppgtt *gen8_ppgtt_create(struct drm_i915_private *i915)
>>>>>                         goto err_free_pd;
>>>>>         }
>>>>>     
>>>>> +     ppgtt->vm.bind_alloc = I915_VMA_LOCAL_BIND;
>>>>
>>>> So this is re-using I915_VMA_LOCAL_BIND as a trick? Is it clear how that
>>>> works from these call sites? Should it be called bind_alloc*s*?
>>>> bind_allocates? Or be a boolean which is converted to a trick flag in
>>>> i915_vma_bind where a comment can be put explaining the trick?
>>>
>>> Is it a trick? We need to differentiate between requests for LOCAL_BIND,
>>> GLOBAL_BIND, LOCAL_BIND | GLOBAL_BIND, for different types of vm. Then I
>>> have a plan on using the worker for GLOBAL_BIND on bsw/bxt to defer the
>>> stop_machine().
>>
>> What's the connection between "mark up the address spaces that do
>> allocate before insertion" and I915_VMA_LOCAL_BIND?
> 
> Full-ppgtt is only accessible by PIN_USER.
> 
> Aliasing-ppgtt is accessible from global-gtt as PIN_USER. Only if we
> have an aliasing-gtt behind ggtt do we want to allocate for ggtt for
> local binds.
> 
> global-gtt by itself never allocates and is expected to be synchronous.
> However, we do use stop_machine() for bxt/bsw and that unfortunately is
> marked as an allocating mutex so one idea I had for avoiding that
> lockdep splat was to make bxt/bsw PIN_GLOBAL async.

I think we are not understanding each other from the very start.

My point was that "vm.bind_alloc = I915_VMA_LOCAL_BIND", at least my 
understanding, effectively means "use the worker when pinning/binding 
PIN_USER/I915_VMA_LOCAL_BIND". And that is I think non-obvious. Where 
you have in the code:

	if (flags & vma->vm->bind_alloc)

It is a shorter hacky way of saying:

	if (*flags & I915_VMA_LOCAL_BIND) &&
	    vma->vm->bind_allocates)

Or where you have:

	if (work && (bind_flags & ~vma_flags) & vma->vm->bind_alloc) {

This would be:

	if (work &&
	    vma->vm->bind_allocates &&
	    (bind_flags & I915_VMA_LOCAL_BIND) &&
	    !(vma_flags & I915_VMA_LOCAL_BIND)) {

But I think I see now what your code is actually saying, you are having 
vm->bind_alloc mean vm->bind_flags_which_allocate. Did I get your 
thinking right now? If so compromise with renaming to vm->bind_alloc_flags?

Regards,

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

  reply	other threads:[~2019-09-25 15:59 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-02  4:02 [PATCH 01/21] drm/i915: Restrict the aliasing-ppgtt to the size of the ggtt Chris Wilson
2019-09-02  4:02 ` [PATCH 02/21] drm/i915: Report aliasing ppgtt size as ggtt size Chris Wilson
2019-09-02  8:55   ` Matthew Auld
2019-09-02  4:02 ` [PATCH 03/21] drm/i915/execlists: Ignore lost completion events Chris Wilson
2019-09-02  4:02 ` [PATCH 04/21] drm/i915: Refresh the errno to vmf_fault translations Chris Wilson
2019-09-03 15:34   ` Abdiel Janulgue
2019-09-02  4:02 ` [PATCH 05/21] drm/i915: Replace obj->pin_global with obj->frontbuffer Chris Wilson
2019-09-02  4:02 ` [PATCH 06/21] dma-fence: Serialise signal enabling (dma_fence_enable_sw_signaling) Chris Wilson
2019-09-02  4:02 ` [PATCH 07/21] drm/mm: Pack allocated/scanned boolean into a bitfield Chris Wilson
2019-09-02  4:02 ` [PATCH 08/21] drm/i915: Make shrink/unshrink be atomic Chris Wilson
2019-09-10 19:54   ` Matthew Auld
2019-09-02  4:02 ` [PATCH 09/21] drm/i915: Only track bound elements of the GTT Chris Wilson
2019-09-02  4:02 ` [PATCH 10/21] drm/i915: Make i915_vma.flags atomic_t for mutex reduction Chris Wilson
2019-09-10 20:06   ` Matthew Auld
2019-09-02  4:02 ` [PATCH 11/21] drm/i915/gtt: Make sure the gen6 ppgtt is bound before first use Chris Wilson
2019-09-10 20:17   ` Matthew Auld
2019-09-02  4:02 ` [PATCH 12/21] drm/i915: Mark up address spaces that may need to allocate Chris Wilson
2019-09-20 16:22   ` Tvrtko Ursulin
2019-09-20 16:35     ` Chris Wilson
2019-09-23  8:10       ` Tvrtko Ursulin
2019-09-25  8:23         ` Chris Wilson
2019-09-25 15:59           ` Tvrtko Ursulin [this message]
2019-09-27 17:03             ` Chris Wilson
2019-09-02  4:02 ` [PATCH 13/21] drm/i915: Pull i915_vma_pin under the vm->mutex Chris Wilson
2019-09-16 10:13   ` Tvrtko Ursulin
2019-09-16 11:10     ` Chris Wilson
2019-09-17 12:37   ` Tvrtko Ursulin
2019-09-17 18:56     ` Chris Wilson
2019-09-19 13:37       ` Tvrtko Ursulin
2019-09-19 14:05         ` Chris Wilson
2019-09-02  4:02 ` [PATCH 14/21] drm/i915: Push the i915_active.retire into a worker Chris Wilson
2019-09-02  4:02 ` [PATCH 15/21] drm/i915: Coordinate i915_active with its own mutex Chris Wilson
2019-09-20 16:14   ` Tvrtko Ursulin
2019-09-20 16:32     ` Chris Wilson
2019-09-02  4:02 ` [PATCH 16/21] drm/i915: Move idle barrier cleanup into engine-pm Chris Wilson
2019-09-20 16:18   ` Tvrtko Ursulin
2019-09-02  4:02 ` [PATCH 17/21] drm/i915: Drop struct_mutex from around i915_retire_requests() Chris Wilson
2019-09-24 15:25   ` Tvrtko Ursulin
2019-09-25  8:43     ` Chris Wilson
2019-09-25  8:49       ` Tvrtko Ursulin
2019-09-02  4:03 ` [PATCH 18/21] drm/i915: Remove the GEM idle worker Chris Wilson
2019-09-24 15:26   ` Tvrtko Ursulin
2019-09-02  4:03 ` [PATCH 19/21] drm/i915: Merge wait_for_timelines with retire_request Chris Wilson
2019-09-24 15:57   ` Tvrtko Ursulin
2019-09-25  8:54     ` Chris Wilson
2019-09-02  4:03 ` [PATCH 20/21] drm/i915: Move request runtime management onto gt Chris Wilson
2019-09-02  4:03 ` [PATCH 21/21] drm/i915: Move global activity tracking from GEM to GT Chris Wilson
2019-09-25  9:55   ` Tvrtko Ursulin
2019-09-02  4:54 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/21] drm/i915: Restrict the aliasing-ppgtt to the size of the ggtt Patchwork
2019-09-02  5:20 ` ✓ Fi.CI.BAT: success " Patchwork
2019-09-02  8:00 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-09-02  8:52 ` [PATCH 01/21] " Matthew Auld
  -- strict thread matches above, loose matches on Subject: below --
2019-08-30  6:11 [PATCH 01/21] drm/i915/gtt: Downgrade Baytrail back to aliasing-ppgtt Chris Wilson
2019-08-30  6:11 ` [PATCH 12/21] drm/i915: Mark up address spaces that may need to allocate 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=cd7a61f5-a18f-63fa-1857-5ebd723f37df@linux.intel.com \
    --to=tvrtko.ursulin@linux.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 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.