On Wed, Jul 12, 2023 at 07:49:53PM +0100, Matthew Wilcox wrote: > @@ -964,9 +966,12 @@ vm_fault_t gru_fault(struct vm_fault *vmf) > } > gru_load_context(gts); > paddr = gseg_physical_address(gts->ts_gru, gts->ts_ctxnum); > - remap_pfn_range(vma, vaddr & ~(GRU_GSEG_PAGESIZE - 1), > - paddr >> PAGE_SHIFT, GRU_GSEG_PAGESIZE, > - vma->vm_page_prot); > + > + pte = pfn_pte(paddr / PAGE_SIZE, vma->vm_page_prot); > + ptep = vmf->pte - (vaddr % GRU_GSEG_PAGESIZE) / PAGE_SIZE; > + set_ptes(vma->vm_mm, vaddr & ~(GRU_GSEG_PAGESIZE - 1), > + ptep, pte_mkspecial(pte), > + GRU_GSEG_PAGESIZE / PAGE_SIZE); > } Argh, no, this is wrong. The page table isn't mapped at this point. What we want is a cross between vmf_insert_pfn() and vm_insert_pages(). Let me add that ...