[Intel-gfx] [PATCH 11/66] drm/i915: Preallocate stashes for vma page-directories

Chris Wilson chris at chris-wilson.co.uk
Tue Jul 28 14:42:45 UTC 2020


Quoting Thomas Hellström (Intel) (2020-07-23 15:33:20)
> 
> On 2020-07-15 13:50, Chris Wilson wrote:
> > We need to make the DMA allocations used for page directories to be
> > performed up front so that we can include those allocations in our
> > memory reservation pass. The downside is that we have to assume the
> > worst case, even before we know the final layout, and always allocate
> > enough page directories for this object, even when there will be overlap.
> > This unfortunately can be quite expensive, especially as we have to
> > clear/reset the page directories and DMA pages, but it should only be
> > required during early phases of a workload when new objects are being
> > discovered, or after memory/eviction pressure when we need to rebind.
> > Once we reach steady state, the objects should not be moved and we no
> > longer need to preallocating the pages tables.
> >
> > It should be noted that the lifetime for the page directories DMA is
> > more or less decoupled from individual fences as they will be shared
> > across objects across timelines.
> >
> > v2: Only allocate enough PD space for the PTE we may use, we do not need
> > to allocate PD that will be left as scratch.
> > v3: Store the shift unto the first PD level to encapsulate the different
> > PTE counts for gen6/gen8.
> >
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Matthew Auld <matthew.auld at intel.com>
> > ---
> >   .../gpu/drm/i915/gem/i915_gem_client_blt.c    | 11 +--
> >   drivers/gpu/drm/i915/gt/gen6_ppgtt.c          | 40 ++++-----
> >   drivers/gpu/drm/i915/gt/gen8_ppgtt.c          | 78 +++++------------
> >   drivers/gpu/drm/i915/gt/intel_ggtt.c          | 60 ++++++--------
> >   drivers/gpu/drm/i915/gt/intel_gtt.h           | 46 ++++++----
> >   drivers/gpu/drm/i915/gt/intel_ppgtt.c         | 83 ++++++++++++++++---
> >   drivers/gpu/drm/i915/i915_vma.c               | 27 +++---
> >   drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 60 ++++++++------
> >   drivers/gpu/drm/i915/selftests/mock_gtt.c     | 22 ++---
> >   9 files changed, 237 insertions(+), 190 deletions(-)
> 
> Hi, Chris,
> 
> Overall looks good, but a question: Why can't we perform page-table 
> memory allocation on demand when needed?

We need to allocate device memory for the page tables. The intention
here is gather up all the resource requirements for an operation and
reserve them in a single pass.
 
> Are we then under a mutex that we also take during reclaim?

Yes, the vm->mutex is used during the shrinker to revoke the GPU
bindings before returning memory to the system.
-Chris


More information about the Intel-gfx mailing list