Skip to content

Commit 0823dc6

Browse files
jasowangmstsirkin
authored andcommitted
vhost-vdpa: switch to use vmf_insert_pfn() in the fault handler
remap_pfn_page() should not be called in the fault handler as it may change the vma->flags which may trigger lockdep warning since the vma write lock is not held. Actually there's no need to modify the vma->flags as it has been set in the mmap(). So this patch switches to use vmf_insert_pfn() instead. Reported-by: Dragos Tatulea <dtatulea@nvidia.com> Tested-by: Dragos Tatulea <dtatulea@nvidia.com> Fixes: ddd89d0 ("vhost_vdpa: support doorbell mapping via mmap") Cc: stable@vger.kernel.org Signed-off-by: Jason Wang <jasowang@redhat.com> Message-Id: <20240701033159.18133-1-jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
1 parent 6d83469 commit 0823dc6

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

drivers/vhost/vdpa.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,13 +1483,7 @@ static vm_fault_t vhost_vdpa_fault(struct vm_fault *vmf)
14831483

14841484
notify = ops->get_vq_notification(vdpa, index);
14851485

1486-
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1487-
if (remap_pfn_range(vma, vmf->address & PAGE_MASK,
1488-
PFN_DOWN(notify.addr), PAGE_SIZE,
1489-
vma->vm_page_prot))
1490-
return VM_FAULT_SIGBUS;
1491-
1492-
return VM_FAULT_NOPAGE;
1486+
return vmf_insert_pfn(vma, vmf->address & PAGE_MASK, PFN_DOWN(notify.addr));
14931487
}
14941488

14951489
static const struct vm_operations_struct vhost_vdpa_vm_ops = {

0 commit comments

Comments
 (0)