Re: [PATCH] vfio/pci: Handle concurrent vma faults

From: Jason Gunthorpe
Date: Fri Mar 12 2021 - 19:03:51 EST


On Fri, Mar 12, 2021 at 01:58:44PM -0700, Alex Williamson wrote:

> Yeah, we can indeed use memalloc_nofs_save/restore(). It seems we're
> trying to allocate something for pfnmap tracking and that enables lots
> of lockdep specific tests. Is it valid to wrap io_remap_pfn_range()
> around clearing this flag or am I just masking a bug? Thanks,

Yes, I think it is fine. Those functions are ment to be used in a
no-fs kind of region exactly like this.

no-fs is telling the allocator not to do reclaim which is forbidden
under the locks here (as reclaim will also attempt to get these locks)

I would defer to Michal Hocko though, maybe cc him on the final patch
series version.

Jason