[Intel-gfx] [PATCH 2/2] drm/i915: Serialise userptr gup with mmu-notifier

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Thu Jul 10 14:30:20 CEST 2014


On 07/10/2014 10:21 AM, Chris Wilson wrote:
> Jerome Glisse pointed out that get_user_pages() does not synchronize
> with concurrent invalidations of the VMA. As such if the backing vma is
> changed whilst the pages for the object are being grabbed for use by the
> GPU, we may end up with a random mixture of page references being held.
> Worse still as the mmu-notifier will believe that the VMA invalidation
> was complete and the old page references dropped.
>
> In order to serialise gup with mmu-notifier, we use a seqlock to detect
> when an invalidation has occurred in parallel to our gup and if so cancel
> the gup. The detection is a little coarse, but hopefully we never see
> contention here!

Looks good to me, but as we discussed on IRC all get_user_pages users 
have this "problem" and I don't understand why it matters to us? How 
would someone hit/exploit the race? By one thread manically modifying 
mappings while another is creating userptr objects? Is there some other 
legitimate way of it happening?

Tvrtko



More information about the Intel-gfx mailing list