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

Matthew Auld matthew.william.auld at gmail.com
Mon Jul 6 18:15:27 UTC 2020


On Mon, 6 Jul 2020 at 07:19, Chris Wilson <chris at chris-wilson.co.uk> 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.
>
> 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.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

<snip>

> @@ -874,11 +873,21 @@ int i915_vma_pin(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)
>                 return err;
>
>         if (flags & vma->vm->bind_async_flags) {
> +               u64 max_size;
> +
>                 work = i915_vma_work();
>                 if (!work) {
>                         err = -ENOMEM;
>                         goto err_pages;
>                 }
> +
> +               work->vm = i915_vm_get(vma->vm);
> +
> +               /* Allocate enough page directories to cover worst case */
> +               max_size = max(size, vma->size);
> +               if (flags & PIN_MAPPABLE)
> +                       max_size = max_t(u64, max_size, vma->fence_size);
> +               i915_vm_alloc_pt_stash(vma->vm, &work->stash, max_size);

Why do we need to take into account size when allocating the page
directories, and not just vma->size/fence_size, since the difference
is only really padding? It could be gigantic thanks to pad_to_size.


More information about the Intel-gfx mailing list