[Intel-gfx] [PATCH] drm/i915: Introduce mapping of user pages into video memory (userptr) ioctl

Chris Wilson chris at chris-wilson.co.uk
Thu Feb 14 00:20:53 CET 2013


On Wed, Feb 13, 2013 at 10:24:59PM +0000, Reese, Armin C wrote:
> Thanks for the patch, Chris.
> 
> This is exactly what we were looking for to replace the VMAP feature you submitted a couple of years ago.  We need a method to quickly move data from user mode allocations into video memory (by mapping backing pages into the GTT).
> 
> The Interface appears simple enough, yet fulfills our needs.
> 
> I have one question ... what exactly does the I915_USERPTR_UNSYNCHRONIZED flag do?

Not so loud, Daniel might notice. It is a flag for the user to ask for a
get_user_pages mapping that ignored the synchronization issues
associated with cloning vma. That is the caller fully understood that to
fork and share those pages would require userspace synchronization and
that the caller was also responsible for ensuring that the mapping
was destroyed first before the vma was release - or else the vma could be
reused by the process/shared-memory whilst it was stil active.

The intention was to workaround the limitations and lack-of mmu-notifier
in many cases. I made it a privileged flag because normal users aren't
really meant to be able to cause so much interprocess havoc. Though
really having the GPU also access that memory is not so much more
dangerous than sharing that memory with another process, so I am open to
the suggestion that maybe we should allow normal users to shoot
themselves in the foot as well.

Also note that the current interface prohibits GTT mmaping of userptr bo
on LLC machines if the pointer is not page-aligned. I still think I can
lift that restriction, but my initial attempts were futile, so I'm
ignoring that corner case unless there is a use-case.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list