On 5/18/21 3:23 PM, Christoph Hellwig wrote:
On Mon, May 17, 2021 at 11:46:35PM +0200, Thomas Hellström wrote:
Apart from the caching aliasing Mattew brought up, doesn't the
remap_pfn_range_xxx() family require the mmap_sem held in write mode since
it modifies the vma structure? remap_io_sg() is called from the fault
handler with the mmap_sem held in read mode only.
Only for vma->vm_flags, and remap_sg already asserts all the interesting
flags are set, although it does not assert VM_IO.
We could move the assignment out of remap_pfn_range_notrack and
into remap_pfn_range and just assert that the proper flags are set,
though.
That to me sounds like a way forward. It sound like in general a gpu
prefaulting helper that in the long run also supports faulting huge ptes
is desired also by TTM. Although it looks like that BUG_ON() I pointed
out was hit anyway....
/Thomas