答复: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-10 Thread Zengtao (B)
; Horn ; Max Gurtovoy ; > k...@vger.kernel.org; linux-kernel@vger.kernel.org; Linuxarm > > 主题: Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant > > On Tue, 9 Mar 2021 19:41:27 -0400 > Jason Gunthorpe wrote: > > > On Tue, Mar 09, 2021 at 12:26:07PM -0700, Alex

Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-09 Thread Alex Williamson
On Tue, 9 Mar 2021 19:45:03 -0400 Jason Gunthorpe wrote: > On Tue, Mar 09, 2021 at 12:56:39PM -0700, Alex Williamson wrote: > > > And I think this is what we end up with for the current code base: > > Yeah, that looks Ok > > > diff --git a/drivers/vfio/pci/vfio_pci.c

Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-09 Thread Alex Williamson
On Tue, 9 Mar 2021 19:41:27 -0400 Jason Gunthorpe wrote: > On Tue, Mar 09, 2021 at 12:26:07PM -0700, Alex Williamson wrote: > > > In the new series, I think the fault handler becomes (untested): > > > > static vm_fault_t vfio_pci_mmap_fault(struct vm_fault *vmf) > > { > > struct

Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-09 Thread Jason Gunthorpe
On Tue, Mar 09, 2021 at 12:56:39PM -0700, Alex Williamson wrote: > And I think this is what we end up with for the current code base: Yeah, that looks Ok > diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c > index 65e7e6b44578..2f247ab18c66 100644 > +++

Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-09 Thread Jason Gunthorpe
On Tue, Mar 09, 2021 at 12:26:07PM -0700, Alex Williamson wrote: > In the new series, I think the fault handler becomes (untested): > > static vm_fault_t vfio_pci_mmap_fault(struct vm_fault *vmf) > { > struct vm_area_struct *vma = vmf->vma; > struct vfio_pci_device *vdev =

Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-09 Thread Alex Williamson
On Tue, 9 Mar 2021 16:00:36 -0500 Peter Xu wrote: > On Tue, Mar 09, 2021 at 01:11:04PM -0700, Alex Williamson wrote: > > > It's just that the initial MMIO access delay would be spread to the 1st > > > access > > > of each mmio page access rather than using the previous pre-fault scheme. > > >

Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-09 Thread Peter Xu
On Tue, Mar 09, 2021 at 01:11:04PM -0700, Alex Williamson wrote: > > It's just that the initial MMIO access delay would be spread to the 1st > > access > > of each mmio page access rather than using the previous pre-fault scheme. I > > think an userspace cares the delay enough should pre-fault

Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-09 Thread Alex Williamson
On Tue, 9 Mar 2021 14:48:24 -0500 Peter Xu wrote: > On Tue, Mar 09, 2021 at 12:26:07PM -0700, Alex Williamson wrote: > > On Tue, 9 Mar 2021 13:47:39 -0500 > > Peter Xu wrote: > > > > > On Tue, Mar 09, 2021 at 12:40:04PM -0400, Jason Gunthorpe wrote: > > > > On Tue, Mar 09, 2021 at

Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-09 Thread Alex Williamson
On Tue, 9 Mar 2021 12:26:07 -0700 Alex Williamson wrote: > On Tue, 9 Mar 2021 13:47:39 -0500 > Peter Xu wrote: > > > On Tue, Mar 09, 2021 at 12:40:04PM -0400, Jason Gunthorpe wrote: > > > On Tue, Mar 09, 2021 at 08:29:51AM -0700, Alex Williamson wrote: > > > > On Tue, 9 Mar 2021 08:46:09

Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-09 Thread Peter Xu
On Tue, Mar 09, 2021 at 12:26:07PM -0700, Alex Williamson wrote: > On Tue, 9 Mar 2021 13:47:39 -0500 > Peter Xu wrote: > > > On Tue, Mar 09, 2021 at 12:40:04PM -0400, Jason Gunthorpe wrote: > > > On Tue, Mar 09, 2021 at 08:29:51AM -0700, Alex Williamson wrote: > > > > On Tue, 9 Mar 2021

Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-09 Thread Alex Williamson
On Tue, 9 Mar 2021 13:47:39 -0500 Peter Xu wrote: > On Tue, Mar 09, 2021 at 12:40:04PM -0400, Jason Gunthorpe wrote: > > On Tue, Mar 09, 2021 at 08:29:51AM -0700, Alex Williamson wrote: > > > On Tue, 9 Mar 2021 08:46:09 -0400 > > > Jason Gunthorpe wrote: > > > > > > > On Tue, Mar 09, 2021

Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-09 Thread Peter Xu
On Tue, Mar 09, 2021 at 12:40:04PM -0400, Jason Gunthorpe wrote: > On Tue, Mar 09, 2021 at 08:29:51AM -0700, Alex Williamson wrote: > > On Tue, 9 Mar 2021 08:46:09 -0400 > > Jason Gunthorpe wrote: > > > > > On Tue, Mar 09, 2021 at 03:49:09AM +, Zengtao (B) wrote: > > > > Hi guys: > > > > >

Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-09 Thread Jason Gunthorpe
On Tue, Mar 09, 2021 at 08:29:51AM -0700, Alex Williamson wrote: > On Tue, 9 Mar 2021 08:46:09 -0400 > Jason Gunthorpe wrote: > > > On Tue, Mar 09, 2021 at 03:49:09AM +, Zengtao (B) wrote: > > > Hi guys: > > > > > > Thanks for the helpful comments, after rethinking the issue, I have > > >

Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-09 Thread Alex Williamson
On Tue, 9 Mar 2021 08:46:09 -0400 Jason Gunthorpe wrote: > On Tue, Mar 09, 2021 at 03:49:09AM +, Zengtao (B) wrote: > > Hi guys: > > > > Thanks for the helpful comments, after rethinking the issue, I have proposed > > the following change: > > 1. follow_pte instead of follow_pfn. > >

Re: 答复: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-09 Thread Jason Gunthorpe
On Tue, Mar 09, 2021 at 03:49:09AM +, Zengtao (B) wrote: > Hi guys: > > Thanks for the helpful comments, after rethinking the issue, I have proposed > the following change: > 1. follow_pte instead of follow_pfn. Still no on follow_pfn, you don't need it once you use vmf_insert_pfn > 2.

答复: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-08 Thread Zengtao (B)
Huck ; Kevin Tian ; Andrew > Morton ; Giovanni Cabiddu > ; Michel Lespinasse ; Jann > Horn ; Max Gurtovoy ; > k...@vger.kernel.org; linux-kernel@vger.kernel.org; Jason Gunthorpe > > 主题: Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant > > On Mon, Mar 08, 2021

Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-08 Thread Jason Gunthorpe
On Mon, Mar 08, 2021 at 01:21:06PM -0700, Alex Williamson wrote: > > diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c > > index 65e7e6b..6928c37 100644 > > +++ b/drivers/vfio/pci/vfio_pci.c > > @@ -1613,6 +1613,7 @@ static vm_fault_t vfio_pci_mmap_fault(struct vm_fault > >

Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-08 Thread Peter Xu
On Mon, Mar 08, 2021 at 01:21:06PM -0700, Alex Williamson wrote: > On Mon, 8 Mar 2021 19:11:26 +0800 > Zeng Tao wrote: > > > We have met the following error when test with DPDK testpmd: > > [ 1591.733256] kernel BUG at mm/memory.c:2177! > > [ 1591.739515] Internal error: Oops - BUG: 0 [#1]

Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-08 Thread Alex Williamson
On Mon, 8 Mar 2021 19:11:26 +0800 Zeng Tao wrote: > We have met the following error when test with DPDK testpmd: > [ 1591.733256] kernel BUG at mm/memory.c:2177! > [ 1591.739515] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP > [ 1591.747381] Modules linked in: vfio_iommu_type1 vfio_pci

[PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant

2021-03-08 Thread Zeng Tao
We have met the following error when test with DPDK testpmd: [ 1591.733256] kernel BUG at mm/memory.c:2177! [ 1591.739515] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP [ 1591.747381] Modules linked in: vfio_iommu_type1 vfio_pci vfio_virqfd vfio pv680_mii(O) [ 1591.760536] CPU: 2 PID: 227 Comm: