[Intel-gfx] [PATCH] drm/i915/userptr: detect un-GUP-able pages early

Jinoh Kang jinoh.kang.kr at gmail.com
Fri Jan 15 17:03:18 UTC 2021


On 1/15/21 4:56 PM, Chris Wilson wrote:
> Quoting Jinoh Kang (2021-01-15 16:23:31)
>> If GUP-ineligible pages are passed to a GEM userptr object, -EFAULT is
>> returned only when the object is actually bound.
>>
>> The xf86-video-intel userspace driver cannot differentiate this
>> condition, and marks the GPU as wedged.
> 
> The idea was to call gem_set_domain on the object to validate the pages
> after creation. I only did that for read-only... I did however make mesa
> use set-domain for validation.

Thanks for the info!

> 
> As a question how are you getting to call userptr on something that
> wasn't passed by SHM ipc?

Basically XShmAttachFd, which is not exposed on libX11.

> 
>> This not only disables graphics
>> acceleration but may also cripple other functions such as VT switch.
> 
> That should be a non-sequitur; certainly VT switch works without ever
> using the GPU.

Not that VT switch doesn't work; rather, there's some heavy graphic
artifacts such as blank rectangles or part of window going completely
transparent.  I suppose that's another issue.

> 
>> Solve this by "prefaulting" user pages on GEM object creation, testing
>> whether all pages are eligible for get_user_pages() in the process.
>> On failure, return -EFAULT so that userspace can fallback to software
>> blitting.
> 
> See https://patchwork.freedesktop.org/series/33449/ for adding PROBE |
> POPULATE flags.
> 
> But we can just use set-domain.

So this patch was unnecessary.  Thanks for the pointer as to how to
patch the userspace.

> -Chris
> 

-- 
Sincerely,
Jinoh Kang


More information about the Intel-gfx mailing list