[Intel-gfx] [PATCH] drm/i915: Fix eviction when the GGTT is idle but full

Chris Wilson chris at chris-wilson.co.uk
Mon Oct 9 16:04:15 UTC 2017


Quoting Chris Wilson (2017-10-09 15:57:28)
> @@ -190,19 +191,33 @@ i915_gem_evict_something(struct i915_address_space *vm,
>         if (!i915_is_ggtt(vm) || flags & PIN_NONBLOCK)
>                 return -ENOSPC;
>  
> +       /*
> +        * Not everything in the GGTT is tracked via VMA using
> +        * i915_vma_move_to_active(), otherwise we could evict as required
> +        * with minimal stalling. Instead we are forced to idle the GPU and
> +        * explicitly retire outstanding requests which will then remove
> +        * the pinning for active objects such as contexts and ring,
> +        * enabling us to evict them on the next iteration.
> +        *
> +        * To ensure that all user contexts are evictable, we perform
> +        * a switch to the perma-pinned kernel context. This all also gives
> +        * us a termination condition, when the last retired context is
> +        * the kernel's there is no more we can evict.
> +        */
>         if (ggtt_is_idle(dev_priv)) {

Would help if I inverted the test when swapping over the branches.

I have an idea on how to test this, but it requires us to be able to
fill the GGTT within 10s. Which is going to be hard (under debug
conditions everywhere). Hmm. If fault in a 256k object, mark it
DONTNEED, when it gets evicted the next access is a sigbus. Combine that
with the knowledge that we prefer freespace over eviction, detecting
when we have evicted the mmap will tell us when we are close to a
totally full GGTT -- and then we setup the eviction test using the MRU
contexts.

Crazy. It would seem more sensible to hook a check for context eviction
into kselftests.
-Chris


More information about the Intel-gfx mailing list