drm_read() to paged-out memory area

Chris Wilson chris at chris-wilson.co.uk
Wed Nov 25 03:24:08 PST 2015


On Tue, Nov 24, 2015 at 10:14:20PM +0000, Chris Wilson wrote:
> On Tue, Nov 24, 2015 at 09:49:58PM +0100, Thomas Hellstrom wrote:
> > Hi, Chris,
> > 
> > With your new (well sort of) implementation of drm_read() it looks to me
> > like a drm_read() to a paged out
> > memory area will always fail with -EFAULT. From what I can tell, there's
> > nothing there to generate a page-fault to get the destination paged back
> > into memory?
> 
> True. Whoops.

Ok, I've added a test case (igt/drm_read/fault-buffer) that forces a
pagefault here by using a dumb bo as the destination buffer. (At least
on i915, we do not do any prefaulting inside the mmap routine.)

That demonstrates that __copy_to_user_inatomic() itself does not disable
pagefaults (i.e. it does not call pagefault_disable) and hence why we
don't always immediately generate EFAULT.

That leaves us with the issue that the fault handler may still deadlock
on the dev->event_lock, so it still needs to be fixed.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the dri-devel mailing list