[Intel-gfx] [PATCH v2] drm/i915: Reorder context-close to avoid calling i915_vma_close() under RCU

Chris Wilson chris at chris-wilson.co.uk
Thu Nov 9 10:16:22 UTC 2017


Quoting Tvrtko Ursulin (2017-11-09 10:00:27)
> 
> On 09/11/2017 09:32, Tvrtko Ursulin wrote:
> > 
> > On 09/11/2017 08:55, Chris Wilson wrote:
> >> When we close the VMA, we unbind it from the ppgtt and tear down the
> >> page directory pointing at it. That may trigger us to return WC pages
> >> back to the system, requiring conversion back to WB which itself may
> >> sleep. That makes i915_vma_close() unsuitable for use inside the RCU
> >> read lock, which we need to hold to iterate the radixtree.
> 
> Would it be worth adding might_sleep to i915_vma_close? Or at a lower layer?

vm_free_page() would be my first choice. i915_vma_close() is also a good
candidate, but I'm worrying if that's too disconnected with the reason
why it might_sleep(). Most of the work within (unbind if not active)
could be atomic as it is just poking at our pagetables. It's just that
changing the PAT is not lazy and uses a stop_machine to change the view
on all CPUs at once. For our purposes we could do with an arch/x86 WC
allocator. Fortunately (or unfortunately depending on pov) we don't need
them in enough bulk to justify pursuing a global scheme, though if one
turned up we would happily make use of it.
-Chris


More information about the Intel-gfx mailing list