Re: [PATCH] vhost: introduce vDPA based backend

2020-02-19 Thread Tiwei Bie
On Wed, Feb 19, 2020 at 09:11:02AM -0400, Jason Gunthorpe wrote: > On Wed, Feb 19, 2020 at 10:52:38AM +0800, Tiwei Bie wrote: > > > > +static int __init vhost_vdpa_init(void) > > > > +{ > > > > + int r; > > > > + > > > > + idr_init(&vhost_vdpa.idr); > > > > + mutex_init(&vhost_vdp

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-19 Thread Jason Gunthorpe
On Wed, Feb 19, 2020 at 10:52:38AM +0800, Tiwei Bie wrote: > > > +static int __init vhost_vdpa_init(void) > > > +{ > > > + int r; > > > + > > > + idr_init(&vhost_vdpa.idr); > > > + mutex_init(&vhost_vdpa.mutex); > > > + init_waitqueue_head(&vhost_vdpa.release_q); > > > + > > > + /* /dev/vhost-vdpa/

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-18 Thread Tiwei Bie
On Tue, Feb 18, 2020 at 09:53:59AM -0400, Jason Gunthorpe wrote: > On Fri, Jan 31, 2020 at 11:36:51AM +0800, Tiwei Bie wrote: > > > +static int vhost_vdpa_alloc_minor(struct vhost_vdpa *v) > > +{ > > + return idr_alloc(&vhost_vdpa.idr, v, 0, MINORMASK + 1, > > +GFP_KERNEL); >

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-18 Thread Jason Gunthorpe
On Fri, Jan 31, 2020 at 11:36:51AM +0800, Tiwei Bie wrote: > +static int vhost_vdpa_alloc_minor(struct vhost_vdpa *v) > +{ > + return idr_alloc(&vhost_vdpa.idr, v, 0, MINORMASK + 1, > + GFP_KERNEL); > +} Please don't use idr in new code, use xarray directly > +static int

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-05 Thread Jason Wang
On 2020/2/5 下午9:14, Michael S. Tsirkin wrote: On Wed, Feb 05, 2020 at 08:56:48AM -0400, Jason Gunthorpe wrote: On Wed, Feb 05, 2020 at 03:50:14PM +0800, Jason Wang wrote: Would it be better for the map/umnap logic to happen inside each device ? Devices that needs the IOMMU will call iommu APIs

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-05 Thread Jason Wang
On 2020/2/5 下午6:33, Michael S. Tsirkin wrote: On Wed, Feb 05, 2020 at 09:30:14AM +, Shahaf Shuler wrote: Wednesday, February 5, 2020 9:50 AM, Jason Wang: Subject: Re: [PATCH] vhost: introduce vDPA based backend On 2020/2/5 下午3:15, Shahaf Shuler wrote: Wednesday, February 5, 2020 4:03 AM

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-05 Thread Jason Wang
On 2020/2/5 下午5:23, Michael S. Tsirkin wrote: On Wed, Feb 05, 2020 at 03:50:14PM +0800, Jason Wang wrote: On 2020/2/5 下午3:15, Shahaf Shuler wrote: Wednesday, February 5, 2020 4:03 AM, Tiwei Bie: Subject: Re: [PATCH] vhost: introduce vDPA based backend On Tue, Feb 04, 2020 at 11:30:11AM

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-05 Thread Jason Wang
On 2020/2/5 下午5:30, Shahaf Shuler wrote: Wednesday, February 5, 2020 9:50 AM, Jason Wang: Subject: Re: [PATCH] vhost: introduce vDPA based backend On 2020/2/5 下午3:15, Shahaf Shuler wrote: Wednesday, February 5, 2020 4:03 AM, Tiwei Bie: Subject: Re: [PATCH] vhost: introduce vDPA based backend

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-05 Thread Michael S. Tsirkin
On Wed, Feb 05, 2020 at 08:56:48AM -0400, Jason Gunthorpe wrote: > On Wed, Feb 05, 2020 at 03:50:14PM +0800, Jason Wang wrote: > > > Would it be better for the map/umnap logic to happen inside each device ? > > > Devices that needs the IOMMU will call iommu APIs from inside the driver > > > callba

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-05 Thread Jason Gunthorpe
On Wed, Feb 05, 2020 at 03:50:14PM +0800, Jason Wang wrote: > > Would it be better for the map/umnap logic to happen inside each device ? > > Devices that needs the IOMMU will call iommu APIs from inside the driver > > callback. > > Technically, this can work. But if it can be done by vhost-vpda

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-05 Thread Michael S. Tsirkin
On Wed, Feb 05, 2020 at 09:30:14AM +, Shahaf Shuler wrote: > Wednesday, February 5, 2020 9:50 AM, Jason Wang: > > Subject: Re: [PATCH] vhost: introduce vDPA based backend > > On 2020/2/5 下午3:15, Shahaf Shuler wrote: > > > Wednesday, February 5, 2020 4:03 AM, Tiwei

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-05 Thread Michael S. Tsirkin
On Wed, Feb 05, 2020 at 03:50:14PM +0800, Jason Wang wrote: > > On 2020/2/5 下午3:15, Shahaf Shuler wrote: > > Wednesday, February 5, 2020 4:03 AM, Tiwei Bie: > > > Subject: Re: [PATCH] vhost: introduce vDPA based backend > > > > > > On Tue, Feb 04, 202

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-05 Thread Michael S. Tsirkin
On Wed, Feb 05, 2020 at 03:42:18PM +0800, Jason Wang wrote: > > On 2020/2/5 下午3:16, Michael S. Tsirkin wrote: > > On Wed, Feb 05, 2020 at 02:49:31PM +0800, Jason Wang wrote: > > > On 2020/2/5 下午2:30, Michael S. Tsirkin wrote: > > > > On Wed, Feb 05, 2020 at 01:50:28PM +0800, Jason Wang wrote: > >

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-04 Thread Jason Wang
On 2020/2/5 下午3:15, Shahaf Shuler wrote: Wednesday, February 5, 2020 4:03 AM, Tiwei Bie: Subject: Re: [PATCH] vhost: introduce vDPA based backend On Tue, Feb 04, 2020 at 11:30:11AM +0800, Jason Wang wrote: On 2020/1/31 上午11:36, Tiwei Bie wrote: This patch introduces a vDPA based vhost

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-04 Thread Jason Wang
On 2020/2/5 下午3:16, Michael S. Tsirkin wrote: On Wed, Feb 05, 2020 at 02:49:31PM +0800, Jason Wang wrote: On 2020/2/5 下午2:30, Michael S. Tsirkin wrote: On Wed, Feb 05, 2020 at 01:50:28PM +0800, Jason Wang wrote: On 2020/2/5 下午1:31, Michael S. Tsirkin wrote: On Wed, Feb 05, 2020 at 11:12:21AM

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-04 Thread Michael S. Tsirkin
On Wed, Feb 05, 2020 at 02:49:31PM +0800, Jason Wang wrote: > > On 2020/2/5 下午2:30, Michael S. Tsirkin wrote: > > On Wed, Feb 05, 2020 at 01:50:28PM +0800, Jason Wang wrote: > > > On 2020/2/5 下午1:31, Michael S. Tsirkin wrote: > > > > On Wed, Feb 05, 2020 at 11:12:21AM +0800, Jason Wang wrote: > >

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-04 Thread Jason Wang
On 2020/2/5 下午2:30, Michael S. Tsirkin wrote: On Wed, Feb 05, 2020 at 01:50:28PM +0800, Jason Wang wrote: On 2020/2/5 下午1:31, Michael S. Tsirkin wrote: On Wed, Feb 05, 2020 at 11:12:21AM +0800, Jason Wang wrote: On 2020/2/5 上午10:05, Tiwei Bie wrote: On Tue, Feb 04, 2020 at 02:46:16PM +0800,

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-04 Thread Michael S. Tsirkin
On Wed, Feb 05, 2020 at 01:50:28PM +0800, Jason Wang wrote: > > On 2020/2/5 下午1:31, Michael S. Tsirkin wrote: > > On Wed, Feb 05, 2020 at 11:12:21AM +0800, Jason Wang wrote: > > > On 2020/2/5 上午10:05, Tiwei Bie wrote: > > > > On Tue, Feb 04, 2020 at 02:46:16PM +0800, Jason Wang wrote: > > > > > On

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-04 Thread Jason Wang
On 2020/2/5 下午1:31, Michael S. Tsirkin wrote: On Wed, Feb 05, 2020 at 11:12:21AM +0800, Jason Wang wrote: On 2020/2/5 上午10:05, Tiwei Bie wrote: On Tue, Feb 04, 2020 at 02:46:16PM +0800, Jason Wang wrote: On 2020/2/4 下午2:01, Michael S. Tsirkin wrote: On Tue, Feb 04, 2020 at 11:30:11AM +0800,

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-04 Thread Michael S. Tsirkin
On Wed, Feb 05, 2020 at 11:12:21AM +0800, Jason Wang wrote: > > On 2020/2/5 上午10:05, Tiwei Bie wrote: > > On Tue, Feb 04, 2020 at 02:46:16PM +0800, Jason Wang wrote: > > > On 2020/2/4 下午2:01, Michael S. Tsirkin wrote: > > > > On Tue, Feb 04, 2020 at 11:30:11AM +0800, Jason Wang wrote: > > > > > 5)

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-04 Thread Jason Wang
On 2020/2/5 上午10:05, Tiwei Bie wrote: On Tue, Feb 04, 2020 at 02:46:16PM +0800, Jason Wang wrote: On 2020/2/4 下午2:01, Michael S. Tsirkin wrote: On Tue, Feb 04, 2020 at 11:30:11AM +0800, Jason Wang wrote: 5) generate diffs of memory table and using IOMMU API to setup the dma mapping in this me

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-04 Thread Jason Wang
On 2020/2/5 上午10:02, Tiwei Bie wrote: Before trying to do this it looks to me we need the following during the probe 1) if set_map() is not supported by the vDPA device probe the IOMMU that is supported by the vDPA device 2) allocate IOMMU domain And then: 3) pin pages through GUP and do prop

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-04 Thread Tiwei Bie
On Tue, Feb 04, 2020 at 02:46:16PM +0800, Jason Wang wrote: > On 2020/2/4 下午2:01, Michael S. Tsirkin wrote: > > On Tue, Feb 04, 2020 at 11:30:11AM +0800, Jason Wang wrote: > > > 5) generate diffs of memory table and using IOMMU API to setup the dma > > > mapping in this method > > Frankly I think t

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-04 Thread Tiwei Bie
On Tue, Feb 04, 2020 at 11:30:11AM +0800, Jason Wang wrote: > On 2020/1/31 上午11:36, Tiwei Bie wrote: > > This patch introduces a vDPA based vhost backend. This > > backend is built on top of the same interface defined > > in virtio-vDPA and provides a generic vhost interface > > for userspace to ac

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-03 Thread Jason Wang
On 2020/2/4 下午2:01, Michael S. Tsirkin wrote: On Tue, Feb 04, 2020 at 11:30:11AM +0800, Jason Wang wrote: 5) generate diffs of memory table and using IOMMU API to setup the dma mapping in this method Frankly I think that's a bunch of work. Why not a MAP/UNMAP interface? Sure, so that basica

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-03 Thread Michael S. Tsirkin
On Tue, Feb 04, 2020 at 11:30:11AM +0800, Jason Wang wrote: > 5) generate diffs of memory table and using IOMMU API to setup the dma > mapping in this method Frankly I think that's a bunch of work. Why not a MAP/UNMAP interface? -- MST ___ Virtualizat

Re: [PATCH] vhost: introduce vDPA based backend

2020-02-03 Thread Jason Wang
On 2020/1/31 上午11:36, Tiwei Bie wrote: This patch introduces a vDPA based vhost backend. This backend is built on top of the same interface defined in virtio-vDPA and provides a generic vhost interface for userspace to accelerate the virtio devices in guest. This backend is implemented as a vDP

Re: [PATCH] vhost: introduce vDPA based backend

2020-01-30 Thread Tiwei Bie
On Thu, Jan 30, 2020 at 09:12:57PM -0800, Randy Dunlap wrote: > On 1/30/20 7:56 PM, Randy Dunlap wrote: > > Hi, > > > > On 1/30/20 7:36 PM, Tiwei Bie wrote: > >> diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig > >> index f21c45aa5e07..13e6a94d0243 100644 > >> --- a/drivers/vhost/Kconfig

Re: [PATCH] vhost: introduce vDPA based backend

2020-01-30 Thread Tiwei Bie
On Thu, Jan 30, 2020 at 07:56:43PM -0800, Randy Dunlap wrote: > Hi, > > On 1/30/20 7:36 PM, Tiwei Bie wrote: > > diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig > > index f21c45aa5e07..13e6a94d0243 100644 > > --- a/drivers/vhost/Kconfig > > +++ b/drivers/vhost/Kconfig > > @@ -34,6 +34,1

Re: [PATCH] vhost: introduce vDPA based backend

2020-01-30 Thread Randy Dunlap
On 1/30/20 7:56 PM, Randy Dunlap wrote: > Hi, > > On 1/30/20 7:36 PM, Tiwei Bie wrote: >> diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig >> index f21c45aa5e07..13e6a94d0243 100644 >> --- a/drivers/vhost/Kconfig >> +++ b/drivers/vhost/Kconfig >> @@ -34,6 +34,18 @@ config VHOST_VSOCK >>

Re: [PATCH] vhost: introduce vDPA based backend

2020-01-30 Thread Randy Dunlap
Hi, On 1/30/20 7:36 PM, Tiwei Bie wrote: > diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig > index f21c45aa5e07..13e6a94d0243 100644 > --- a/drivers/vhost/Kconfig > +++ b/drivers/vhost/Kconfig > @@ -34,6 +34,18 @@ config VHOST_VSOCK > To compile this driver as a module, choose M h

[PATCH] vhost: introduce vDPA based backend

2020-01-30 Thread Tiwei Bie
This patch introduces a vDPA based vhost backend. This backend is built on top of the same interface defined in virtio-vDPA and provides a generic vhost interface for userspace to accelerate the virtio devices in guest. This backend is implemented as a vDPA device driver on top of the same ops use