On 11.06.22 00:35, Alex Williamson wrote: > The commit referenced below subtly and inadvertently changed the logic > to disallow pinning of zero pfns. This breaks device assignment with > vfio and potentially various other users of gup. Exclude the zero page > test from the negation. I wonder which setups can reliably work with a long-term pin on a shared zeropage. In a MAP_PRIVATE mapping, any write access via the page tables will end up replacing the shared zeropage with an anonymous page. Something similar should apply in MAP_SHARED mappings, when lazily allocating disk blocks. In the future, we might trigger unsharing when taking a R/O pin for the shared zeropage, just like we do as of now upstream for shared anonymous pages (!PageAnonExclusive). And something similar could then be done when finding a !anon page in a MAP_SHARED mapping. > > Fixes: 1c563432588d ("mm: fix is_pinnable_page against a cma page") Having that said, it indeed looks like that was an unintended change. Acked-by: David Hildenbrand <david@xxxxxxxxxx> > Signed-off-by: Alex Williamson <alex.williamson@xxxxxxxxxx> > --- > > At least I assume this was inadvertent... If there's a better fix, > please run with it as I'm out of the office the 1st half of next > week and would like to see this fixed ASAP. Thanks! > > include/linux/mm.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index bc8f326be0ce..781fae17177d 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -1600,7 +1600,7 @@ static inline bool is_pinnable_page(struct page *page) > if (mt == MIGRATE_CMA || mt == MIGRATE_ISOLATE) > return false; > #endif > - return !(is_zone_movable_page(page) || is_zero_pfn(page_to_pfn(page))); > + return !is_zone_movable_page(page) || is_zero_pfn(page_to_pfn(page)); > } > #else > static inline bool is_pinnable_page(struct page *page) > > -- Thanks, David / dhildenb