lkml.org 
[lkml]   [2019]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 05/18] mm/gup: introduce pin_user_pages*() and FOLL_PIN
From
Date
On 11/4/19 1:15 PM, Jason Gunthorpe wrote:
...
>> Right, and I thought about this when converting, and realized that the above
>> code is working around the current gup.c limitations, which are "cannot support
>> gup remote with FOLL_LONGTERM".
>
> But AFAICT it doesn't have a problem, the protection test is just too
> strict, and I guess the control flow needs a bit of fixing..
>
> The issue is this:
>
> static __always_inline long __get_user_pages_locked():
> {
> if (locked) {
> /* if VM_FAULT_RETRY can be returned, vmas become invalid */
> BUG_ON(vmas);
> /* check caller initialized locked */
> BUG_ON(*locked != 1);
> }
>
>
> so remote could be written as:
>
> if (gup_flags & FOLL_LONGTERM) {
> if (WARN_ON_ONCE(locked))
> return -EINVAL;
> return __gup_longterm_locked(...)
> }
>
> return __get_user_pages_locked(...)
>
> ??

Yes, that loosens it up just enough for the vfio case (which doesn't set
"locked") to get through, great! OK, I'll put that (the above plus
corresponding vfio fix) in a separate patch first.

This should clear things up nicely.


thanks,
--
John Hubbard
NVIDIA

\
 
 \ /
  Last update: 2019-11-04 22:34    [W:0.083 / U:0.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site