Re: [Qemu-devel] [RFC 0/3] VirtIO RDMA

2019-05-07 Thread Jason Gunthorpe
On Tue, Apr 30, 2019 at 08:13:54PM +0300, Yuval Shaia wrote: > On Mon, Apr 22, 2019 at 01:45:27PM -0300, Jason Gunthorpe wrote: > > On Fri, Apr 19, 2019 at 01:16:06PM +0200, Hannes Reinecke wrote: > > > On 4/15/19 12:35 PM, Yuval Shaia wrote: > > > > On Thu, Ap

Re: [RFC 0/3] VirtIO RDMA

2019-04-19 Thread Jason Gunthorpe
On Thu, Apr 11, 2019 at 07:02:15PM +0200, Cornelia Huck wrote: > On Thu, 11 Apr 2019 14:01:54 +0300 > Yuval Shaia wrote: > > > Data center backends use more and more RDMA or RoCE devices and more and > > more software runs in virtualized environment. > > There is a need for a standard to enable

Re: [RFC 0/3] VirtIO RDMA

2019-04-19 Thread Jason Gunthorpe
On Thu, Apr 11, 2019 at 08:34:20PM +0300, Yuval Shaia wrote: > On Thu, Apr 11, 2019 at 05:24:08PM +0000, Jason Gunthorpe wrote: > > On Thu, Apr 11, 2019 at 07:02:15PM +0200, Cornelia Huck wrote: > > > On Thu, 11 Apr 2019 14:01:54 +0300 > > > Yuval Shaia wrote: > >

Re: [Qemu-devel] [RFC 0/3] VirtIO RDMA

2019-04-22 Thread Jason Gunthorpe
On Fri, Apr 19, 2019 at 01:16:06PM +0200, Hannes Reinecke wrote: > On 4/15/19 12:35 PM, Yuval Shaia wrote: > > On Thu, Apr 11, 2019 at 07:02:15PM +0200, Cornelia Huck wrote: > > > On Thu, 11 Apr 2019 14:01:54 +0300 > > > Yuval Shaia wrote: > > > > > > > Data center backends use more and more

Re: [PATCH V5 0/9] Fixes for vhost metadata acceleration

2019-08-12 Thread Jason Gunthorpe
On Mon, Aug 12, 2019 at 05:49:08AM -0400, Michael S. Tsirkin wrote: > On Mon, Aug 12, 2019 at 10:44:51AM +0800, Jason Wang wrote: > > > > On 2019/8/11 上午1:52, Michael S. Tsirkin wrote: > > > On Fri, Aug 09, 2019 at 01:48:42AM -0400, Jason Wang wrote: > > > > Hi all: > > > > > > > > This series

Re: [PATCH V2 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-02 Thread Jason Gunthorpe
On Fri, Aug 02, 2019 at 10:27:21AM -0400, Michael S. Tsirkin wrote: > On Fri, Aug 02, 2019 at 09:46:13AM -0300, Jason Gunthorpe wrote: > > On Fri, Aug 02, 2019 at 05:40:07PM +0800, Jason Wang wrote: > > > > This must be a proper barrier, like a spinlock, mutex, or &g

Re: [PATCH V2 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-03 Thread Jason Gunthorpe
On Sat, Aug 03, 2019 at 05:36:13PM -0400, Michael S. Tsirkin wrote: > On Fri, Aug 02, 2019 at 02:24:18PM -0300, Jason Gunthorpe wrote: > > On Fri, Aug 02, 2019 at 10:27:21AM -0400, Michael S. Tsirkin wrote: > > > On Fri, Aug 02, 2019 at 09:46:13AM -0300, Jason Gunthorpe wrote: &

Re: DANGER WILL ROBINSON, DANGER

2019-08-16 Thread Jason Gunthorpe
On Thu, Aug 15, 2019 at 04:16:30PM -0400, Jerome Glisse wrote: > On Thu, Aug 15, 2019 at 03:19:29PM -0400, Jerome Glisse wrote: > > On Tue, Aug 13, 2019 at 02:01:35PM +0300, Adalbert Lazăr wrote: > > > On Fri, 9 Aug 2019 09:24:44 -0700, Matthew Wilcox > > > wrote: > > > > On Fri, Aug 09, 2019 at

Re: [PATCH V5 0/9] Fixes for vhost metadata acceleration

2019-08-15 Thread Jason Gunthorpe
On Thu, Aug 15, 2019 at 11:26:46AM +0800, Jason Wang wrote: > > On 2019/8/13 下午7:57, Jason Gunthorpe wrote: > > On Tue, Aug 13, 2019 at 04:31:07PM +0800, Jason Wang wrote: > > > > > What kind of issues do you see? Spinlock is to synchronize GUP with MMU > > >

Re: [PATCH V5 0/9] Fixes for vhost metadata acceleration

2019-08-13 Thread Jason Gunthorpe
On Tue, Aug 13, 2019 at 04:31:07PM +0800, Jason Wang wrote: > What kind of issues do you see? Spinlock is to synchronize GUP with MMU > notifier in this series. A GUP that can't sleep can't pagefault which makes it a really weird pattern > Btw, back to the original question. May I know why

Re: [PATCH 0/2] Revert and rework on the metadata accelreation

2019-09-05 Thread Jason Gunthorpe
On Thu, Sep 05, 2019 at 08:27:34PM +0800, Jason Wang wrote: > Hi: > > Per request from Michael and Jason, the metadata accelreation is > reverted in this version and rework in next version. > > Please review. > > Thanks > > Jason Wang (2): > Revert "vhost: access vq metadata through kernel

Re: [PATCH 0/2] Revert and rework on the metadata accelreation

2019-09-07 Thread Jason Gunthorpe
On Fri, Sep 06, 2019 at 06:02:35PM +0800, Jason Wang wrote: > > On 2019/9/5 下午9:59, Jason Gunthorpe wrote: > > On Thu, Sep 05, 2019 at 08:27:34PM +0800, Jason Wang wrote: > > > Hi: > > > > > > Per request from Michael and Jason, the metadata accelre

Re: [PATCH V4 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-07 Thread Jason Gunthorpe
On Wed, Aug 07, 2019 at 03:06:15AM -0400, Jason Wang wrote: > We used to use RCU to synchronize MMU notifier with worker. This leads > calling synchronize_rcu() in invalidate_range_start(). But on a busy > system, there would be many factors that may slow down the > synchronize_rcu() which makes

Re: [PATCH V2 4/9] vhost: reset invalidate_count in vhost_set_vring_num_addr()

2019-07-31 Thread Jason Gunthorpe
On Wed, Jul 31, 2019 at 09:29:28PM +0800, Jason Wang wrote: > > On 2019/7/31 下午8:41, Jason Gunthorpe wrote: > > On Wed, Jul 31, 2019 at 04:46:50AM -0400, Jason Wang wrote: > > > The vhost_set_vring_num_addr() could be called in the middle of > > > invalidate_range_st

Re: [PATCH V2 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-07-31 Thread Jason Gunthorpe
On Wed, Jul 31, 2019 at 09:28:20PM +0800, Jason Wang wrote: > > On 2019/7/31 下午8:39, Jason Gunthorpe wrote: > > On Wed, Jul 31, 2019 at 04:46:53AM -0400, Jason Wang wrote: > > > We used to use RCU to synchronize MMU notifier with worker. This leads > >

Re: [PATCH V2 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-02 Thread Jason Gunthorpe
On Fri, Aug 02, 2019 at 05:40:07PM +0800, Jason Wang wrote: > > This must be a proper barrier, like a spinlock, mutex, or > > synchronize_rcu. > > > I start with synchronize_rcu() but both you and Michael raise some > concern. I've also idly wondered if calling synchronize_rcu() under the

Re: [PATCH V2 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-06 Thread Jason Gunthorpe
On Tue, Aug 06, 2019 at 09:36:58AM -0400, Michael S. Tsirkin wrote: > On Tue, Aug 06, 2019 at 08:53:17AM -0300, Jason Gunthorpe wrote: > > On Sun, Aug 04, 2019 at 04:07:17AM -0400, Michael S. Tsirkin wrote: > > > > > > Also, why can't this just permanently GU

Re: [PATCH V2 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-01 Thread Jason Gunthorpe
On Thu, Aug 01, 2019 at 01:02:18PM +0800, Jason Wang wrote: > > On 2019/8/1 上午3:30, Jason Gunthorpe wrote: > > On Wed, Jul 31, 2019 at 09:28:20PM +0800, Jason Wang wrote: > > > On 2019/7/31 下午8:39, Jason Gunthorpe wrote: > > > > On Wed, Jul 31, 2019 at 0

Re: [PATCH V2 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-07-31 Thread Jason Gunthorpe
On Wed, Jul 31, 2019 at 04:46:53AM -0400, Jason Wang wrote: > We used to use RCU to synchronize MMU notifier with worker. This leads > calling synchronize_rcu() in invalidate_range_start(). But on a busy > system, there would be many factors that may slow down the > synchronize_rcu() which makes

Re: [PATCH V2 4/9] vhost: reset invalidate_count in vhost_set_vring_num_addr()

2019-07-31 Thread Jason Gunthorpe
On Wed, Jul 31, 2019 at 04:46:50AM -0400, Jason Wang wrote: > The vhost_set_vring_num_addr() could be called in the middle of > invalidate_range_start() and invalidate_range_end(). If we don't reset > invalidate_count after the un-registering of MMU notifier, the > invalidate_cont will run out of

Re: [PATCH V2 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-06 Thread Jason Gunthorpe
On Sun, Aug 04, 2019 at 04:07:17AM -0400, Michael S. Tsirkin wrote: > > > > Also, why can't this just permanently GUP the pages? In fact, where > > > > does it put_page them anyhow? Worrying that 7f466 adds a get_user page > > > > but does not add a put_page?? > > > > You didn't answer this.. Why

Re: [PATCH V2 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-06 Thread Jason Gunthorpe
On Mon, Aug 05, 2019 at 12:20:45PM +0800, Jason Wang wrote: > > On 2019/8/2 下午8:46, Jason Gunthorpe wrote: > > On Fri, Aug 02, 2019 at 05:40:07PM +0800, Jason Wang wrote: > > > > This must be a proper barrier, like a spinlock, mutex, or > > > > s

Re: [PATCH V4 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-08 Thread Jason Gunthorpe
On Thu, Aug 08, 2019 at 08:54:54PM +0800, Jason Wang wrote: > I don't have any objection to convert  to spinlock() but just want to > know if any case that the above smp_mb() + counter looks good to you? This email is horribly mangled, but I don't think mixing smb_mb() and smp_load_acquire()

Re: [PATCH V2 3/5] vDPA: introduce vDPA bus

2020-02-13 Thread Jason Gunthorpe
On Thu, Feb 13, 2020 at 11:34:10AM +0800, Jason Wang wrote: > > You have dev, type or > > class to choose from. Type is rarely used and doesn't seem to be used > > by vdpa, so class seems the right choice > > > > Jason > > Yes, but my understanding is class and bus are mutually exclusive. So

Re: [PATCH V2 3/5] vDPA: introduce vDPA bus

2020-02-13 Thread Jason Gunthorpe
On Thu, Feb 13, 2020 at 10:59:34AM -0500, Michael S. Tsirkin wrote: > On Thu, Feb 13, 2020 at 11:51:54AM -0400, Jason Gunthorpe wrote: > > The 'class' is supposed to provide all the library functions to remove > > this duplication. Instead of plugging the HW driver in via some bus &

Re: [PATCH V2 3/5] vDPA: introduce vDPA bus

2020-02-13 Thread Jason Gunthorpe
On Thu, Feb 13, 2020 at 10:41:06AM -0500, Michael S. Tsirkin wrote: > On Thu, Feb 13, 2020 at 11:05:42AM -0400, Jason Gunthorpe wrote: > > On Thu, Feb 13, 2020 at 10:58:44PM +0800, Jason Wang wrote: > > > > > > On 2020/2/13 下午9:41, Jason Gunthorpe wrote: > > >

Re: [PATCH V2 3/5] vDPA: introduce vDPA bus

2020-02-13 Thread Jason Gunthorpe
On Thu, Feb 13, 2020 at 10:56:00AM -0500, Michael S. Tsirkin wrote: > On Thu, Feb 13, 2020 at 11:51:54AM -0400, Jason Gunthorpe wrote: > > > That bus is exactly what Greg KH proposed. There are other ways > > > to solve this I guess but this bikeshedding is getting tiring. >

Re: [PATCH V2 3/5] vDPA: introduce vDPA bus

2020-02-13 Thread Jason Gunthorpe
On Thu, Feb 13, 2020 at 10:58:44PM +0800, Jason Wang wrote: > > On 2020/2/13 下午9:41, Jason Gunthorpe wrote: > > On Thu, Feb 13, 2020 at 11:34:10AM +0800, Jason Wang wrote: > > > > > >You have dev, type or > > > > class to choose from. Type

Re: [PATCH V2 3/5] vDPA: introduce vDPA bus

2020-02-12 Thread Jason Gunthorpe
On Wed, Feb 12, 2020 at 03:55:31PM +0800, Jason Wang wrote: > > The ida_simple_remove should probably be part of the class release > > function to make everything work right > > It looks to me bus instead of class is the correct abstraction here since > the devices share a set of programming

Re: [PATCH 3/5] vDPA: introduce vDPA bus

2020-01-21 Thread Jason Gunthorpe
On Tue, Jan 21, 2020 at 03:15:43AM -0500, Michael S. Tsirkin wrote: > > This sounds more flexible e.g driver may choose to implement static mapping > > one through commit. But a question here, it looks to me this still requires > > the DMA to be synced with at least commit here. Otherwise device

Re: [PATCH 3/5] vDPA: introduce vDPA bus

2020-01-21 Thread Jason Gunthorpe
On Mon, Jan 20, 2020 at 04:25:23PM -0500, Michael S. Tsirkin wrote: > On Mon, Jan 20, 2020 at 08:51:43PM +, Shahaf Shuler wrote: > > Monday, January 20, 2020 7:50 PM, Jason Gunthorpe: > > > Subject: Re: [PATCH 3/5] vDPA: introduce vDPA bus > > > > > > On M

Re: [PATCH 3/5] vDPA: introduce vDPA bus

2020-01-21 Thread Jason Gunthorpe
On Mon, Jan 20, 2020 at 04:56:06PM -0500, Michael S. Tsirkin wrote: > > For vfio? vfio is the only thing I am aware doing > > that, and this is not vfio.. > > vfio is not doing anything. anyone can use a combination > of unbind and driver_override to attach a driver to a device. > > It's not a

Re: [PATCH 3/5] vDPA: introduce vDPA bus

2020-01-21 Thread Jason Gunthorpe
On Tue, Jan 21, 2020 at 09:15:14AM -0500, Michael S. Tsirkin wrote: > On Tue, Jan 21, 2020 at 02:12:05PM +0000, Jason Gunthorpe wrote: > > On Mon, Jan 20, 2020 at 04:56:06PM -0500, Michael S. Tsirkin wrote: > > > > For vfio? vfio is the only t

Re: [PATCH V5 3/5] vDPA: introduce vDPA bus

2020-03-04 Thread Jason Gunthorpe
On Wed, Feb 26, 2020 at 02:04:54PM +0800, Jason Wang wrote: > +struct vdpa_device *vdpa_alloc_device(struct device *parent, > + struct device *dma_dev, > + const struct vdpa_config_ops *config) > +{ > + struct vdpa_device

Re: [PATCH V4 5/5] vdpasim: vDPA device simulator

2020-02-26 Thread Jason Gunthorpe
On Wed, Feb 26, 2020 at 02:12:26PM +0800, Jason Wang wrote: > > > It is a bit weird to be creating this dummy parent, couldn't this be > > > done by just passing a NULL parent to vdpa_alloc_device, doing > > > set_dma_ops() on the vdpasim->vdpa->dev and setting dma_device to > > >

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 5/5] vdpasim: vDPA device simulator

2020-02-04 Thread Jason Gunthorpe
On Tue, Feb 04, 2020 at 04:28:27PM +0800, Jason Wang wrote: > > On 2020/2/4 下午4:21, Zhu Lingshan wrote: > > > +static const struct dma_map_ops vdpasim_dma_ops = { > > > +    .map_page = vdpasim_map_page, > > > +    .unmap_page = vdpasim_unmap_page, > > > +    .alloc = vdpasim_alloc_coherent, > >

Re: [PATCH V2 3/5] vDPA: introduce vDPA bus

2020-02-14 Thread Jason Gunthorpe
On Fri, Feb 14, 2020 at 11:23:27AM +0800, Jason Wang wrote: > > > Though all vDPA devices have the same programming interface, but the > > > semantic is different. So it looks to me that use bus complies what > > > class.rst said: > > > > > > " > > > > > > Each device class defines a set of

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(_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-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(_vdpa.idr); > > > + mutex_init(_vdpa.mutex); > > > + init_waitqueue_head(_vdpa.release_q); > > > + > > > + /*

Re: [PATCH V2 3/5] vDPA: introduce vDPA bus

2020-02-19 Thread Jason Gunthorpe
On Wed, Feb 19, 2020 at 01:35:25PM +0800, Jason Wang wrote: > > But it is > > open coded and duplicated because .. vdpa? > > > I'm not sure I get here, vhost module is reused for vhost-vdpa and all > current vhost device (e.g net) uses their own char device. I mean there shouldn't be two fops

Re: [PATCH V4 5/5] vdpasim: vDPA device simulator

2020-02-20 Thread Jason Gunthorpe
On Thu, Feb 20, 2020 at 02:11:41PM +0800, Jason Wang wrote: > +static void vdpasim_device_release(struct device *dev) > +{ > + struct vdpasim *vdpasim = dev_to_sim(dev); > + > + cancel_work_sync(>work); > + kfree(vdpasim->buffer); > + vhost_iotlb_free(vdpasim->iommu); > +

Re: [PATCH V4 3/5] vDPA: introduce vDPA bus

2020-02-20 Thread Jason Gunthorpe
On Thu, Feb 20, 2020 at 02:11:39PM +0800, Jason Wang wrote: > vDPA device is a device that uses a datapath which complies with the > virtio specifications with vendor specific control path. vDPA devices > can be both physically located on the hardware or emulated by > software. vDPA hardware

Re: [PATCH V4 4/5] virtio: introduce a vDPA based transport

2020-02-20 Thread Jason Gunthorpe
On Thu, Feb 20, 2020 at 02:11:40PM +0800, Jason Wang wrote: > +static int virtio_vdpa_probe(struct vdpa_device *vdpa) > +{ > + const struct vdpa_config_ops *ops = vdpa->config; > + struct virtio_vdpa_device *vd_dev; > + int ret = -EINVAL; > + > + vd_dev = kzalloc(sizeof(*vd_dev),

Re: [PATCH V2 3/5] vDPA: introduce vDPA bus

2020-02-11 Thread Jason Gunthorpe
On Mon, Feb 10, 2020 at 11:56:06AM +0800, Jason Wang wrote: > +/** > + * vdpa_register_device - register a vDPA device > + * Callers must have a succeed call of vdpa_init_device() before. > + * @vdev: the vdpa device to be registered to vDPA bus > + * > + * Returns an error when fail to add to

Re: [PATCH V2 5/5] vdpasim: vDPA device simulator

2020-02-11 Thread Jason Gunthorpe
On Mon, Feb 10, 2020 at 11:56:08AM +0800, Jason Wang wrote: > + > +static struct vdpasim *vdpasim_create(void) > +{ > + struct vdpasim *vdpasim; > + struct virtio_net_config *config; > + struct vdpa_device *vdpa; > + struct device *dev; > + int ret = -ENOMEM; > + > +

Re: [PATCH V2 4/5] virtio: introduce a vDPA based transport

2020-02-10 Thread Jason Gunthorpe
On Mon, Feb 10, 2020 at 11:56:07AM +0800, Jason Wang wrote: > This patch introduces a vDPA transport for virtio. This is used to > use kernel virtio driver to drive the mediated device that is capable > of populating virtqueue directly. Is this comment still right? Is there a mediated device

Re: [PATCH V2 3/5] vDPA: introduce vDPA bus

2020-02-14 Thread Jason Gunthorpe
On Fri, Feb 14, 2020 at 12:05:32PM +0800, Jason Wang wrote: > > The standard driver model is a 'bus' driver provides the HW access > > (think PCI level things), and a 'hw driver' attaches to the bus > > device, > > This is not true, kernel had already had plenty virtual bus where virtual >

Re: [PATCH V2 3/5] vDPA: introduce vDPA bus

2020-02-18 Thread Jason Gunthorpe
On Mon, Feb 17, 2020 at 02:08:03PM +0800, Jason Wang wrote: > I thought you were copied in the patch [1], maybe we can move vhost related > discussion there to avoid confusion. > > [1] https://lwn.net/Articles/811210/ Wow, that is .. confusing. So this is supposed to duplicate the uAPI of

Re: [PATCH 5/5] vdpasim: vDPA device simulator

2020-01-16 Thread Jason Gunthorpe
On Thu, Jan 16, 2020 at 08:42:31PM +0800, Jason Wang wrote: > This patch implements a software vDPA networking device. The datapath > is implemented through vringh and workqueue. The device has an on-chip > IOMMU which translates IOVA to PA. For kernel virtio drivers, vDPA > simulator driver

Re: [PATCH 3/5] vDPA: introduce vDPA bus

2020-01-16 Thread Jason Gunthorpe
On Thu, Jan 16, 2020 at 08:42:29PM +0800, Jason Wang wrote: > vDPA device is a device that uses a datapath which complies with the > virtio specifications with vendor specific control path. vDPA devices > can be both physically located on the hardware or emulated by > software. vDPA hardware

Re: [PATCH 4/5] virtio: introduce a vDPA based transport

2020-01-16 Thread Jason Gunthorpe
On Thu, Jan 16, 2020 at 08:42:30PM +0800, Jason Wang wrote: > diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c > new file mode 100644 > index ..86936e5e7ec3 > +++ b/drivers/virtio/virtio_vdpa.c > @@ -0,0 +1,400 @@ > +// SPDX-License-Identifier: GPL-2.0-only >

Re: [PATCH 4/5] virtio: introduce a vDPA based transport

2020-01-17 Thread Jason Gunthorpe
On Fri, Jan 17, 2020 at 05:32:35PM +0800, Jason Wang wrote: > > > > > + const struct vdpa_config_ops *ops = vdpa->config; > > > + struct virtio_vdpa_device *vd_dev; > > > + int rc; > > > + > > > + vd_dev = devm_kzalloc(dev, sizeof(*vd_dev), GFP_KERNEL); > > > + if (!vd_dev) > > > + return

Re: [PATCH 5/5] vdpasim: vDPA device simulator

2020-01-17 Thread Jason Gunthorpe
On Fri, Jan 17, 2020 at 05:32:39PM +0800, Jason Wang wrote: > > On 2020/1/16 下午11:47, Jason Gunthorpe wrote: > > On Thu, Jan 16, 2020 at 08:42:31PM +0800, Jason Wang wrote: > > > This patch implements a software vDPA networking device. The datapath > > >

Re: [PATCH 3/5] vDPA: introduce vDPA bus

2020-01-17 Thread Jason Gunthorpe
On Fri, Jan 17, 2020 at 11:03:12AM +0800, Jason Wang wrote: > > On 2020/1/16 下午11:22, Jason Gunthorpe wrote: > > On Thu, Jan 16, 2020 at 08:42:29PM +0800, Jason Wang wrote: > > > vDPA device is a device that uses a datapath which complies with the > > > virtio speci

Re: [PATCH 3/5] vDPA: introduce vDPA bus

2020-01-20 Thread Jason Gunthorpe
On Mon, Jan 20, 2020 at 04:43:53PM +0800, Jason Wang wrote: > This is similar to the design of platform IOMMU part of vhost-vdpa. We > decide to send diffs to platform IOMMU there. If it's ok to do that in > driver, we can replace set_map with incremental API like map()/unmap(). > > Then driver

Re: [PATCH 3/5] vDPA: introduce vDPA bus

2020-01-20 Thread Jason Gunthorpe
On Mon, Jan 20, 2020 at 07:17:26AM -0500, Michael S. Tsirkin wrote: > On Fri, Jan 17, 2020 at 01:54:42PM +0000, Jason Gunthorpe wrote: > > > 1) "virtio" vs "vhost", I implemented matching method for this in mdev > > > series, but it looks unneces

Re: [PATCH V8 5/9] vDPA: introduce vDPA bus

2020-03-25 Thread Jason Gunthorpe
On Wed, Mar 25, 2020 at 04:27:07PM +0800, Jason Wang wrote: > +struct vdpa_device *__vdpa_alloc_device(struct device *parent, > + const struct vdpa_config_ops *config, > + size_t size); > + > +#define

Re: [PATCH V8 9/9] virtio: Intel IFC VF driver for VDPA

2020-03-25 Thread Jason Gunthorpe
On Wed, Mar 25, 2020 at 04:27:11PM +0800, Jason Wang wrote: > +static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id) > +{ > + struct device *dev = >dev; > + struct ifcvf_adapter *adapter; > + struct ifcvf_hw *vf; > + int ret, i; > + > + ret =

Re: [PATCH V8 9/9] virtio: Intel IFC VF driver for VDPA

2020-03-26 Thread Jason Gunthorpe
On Thu, Mar 26, 2020 at 01:50:53PM +0800, Jason Wang wrote: > > > + adapter->vdpa.dma_dev = dev; > > > + ret = vdpa_register_device(>vdpa); > > > + if (ret) { > > > + IFCVF_ERR(adapter->dev, "Failed to register ifcvf to vdpa bus"); > > > + goto err_msix; > > > + } > > > + > > > +

Re: [PATCH V6 8/8] virtio: Intel IFC VF driver for VDPA

2020-03-18 Thread Jason Gunthorpe
On Wed, Mar 18, 2020 at 04:03:27PM +0800, Jason Wang wrote: > From: Zhu Lingshan > + > +static int ifcvf_vdpa_attach(struct ifcvf_adapter *adapter) > +{ > + int ret; > + > + adapter->vdpa_dev = vdpa_alloc_device(adapter->dev, adapter->dev, > +

Re: [PATCH V6 8/8] virtio: Intel IFC VF driver for VDPA

2020-03-19 Thread Jason Gunthorpe
On Thu, Mar 19, 2020 at 04:14:37PM +0800, Jason Wang wrote: > > On 2020/3/18 下午8:22, Jason Gunthorpe wrote: > > On Wed, Mar 18, 2020 at 04:03:27PM +0800, Jason Wang wrote: > > > From: Zhu Lingshan > > > + > > > +static int ifcvf_vdpa_attach(struct ifcvf_ada

Re: [RFC] treewide: cleanup unreachable breaks

2020-10-19 Thread Jason Gunthorpe
On Mon, Oct 19, 2020 at 12:42:15PM -0700, Nick Desaulniers wrote: > On Sat, Oct 17, 2020 at 10:43 PM Greg KH wrote: > > > > On Sat, Oct 17, 2020 at 09:09:28AM -0700, t...@redhat.com wrote: > > > From: Tom Rix > > > > > > This is a upcoming change to clean up a new warning treewide. > > > I am

Re: [PATCH V4 linux-next 00/12] VDPA support for Mellanox ConnectX devices

2020-08-05 Thread Jason Gunthorpe
On Wed, Aug 05, 2020 at 07:01:52PM +, Saeed Mahameed wrote: > On Wed, 2020-08-05 at 09:12 -0400, Michael S. Tsirkin wrote: > > On Wed, Aug 05, 2020 at 04:01:58PM +0300, Eli Cohen wrote: > > > On Wed, Aug 05, 2020 at 08:48:52AM -0400, Michael S. Tsirkin wrote: > > > > > Did you merge this?: > >

Re: [PATCH 00/17] spelling.txt: /decriptors/descriptors/

2020-06-15 Thread Jason Gunthorpe
On Tue, Jun 09, 2020 at 01:45:53PM +0100, Kieran Bingham wrote: > I wouldn't normally go through spelling fixes, but I caught sight of > this typo twice, and then foolishly grepped the tree for it, and saw how > pervasive it was. > > so here I am ... fixing a typo globally... but with an addition

Re: [PATCH mlx5-next v1 06/11] vdpa/mlx5: Connect mlx5_vdpa to auxiliary bus

2020-11-03 Thread Jason Gunthorpe
On Sun, Nov 01, 2020 at 10:15:37PM +0200, Leon Romanovsky wrote: > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c > b/drivers/vdpa/mlx5/net/mlx5_vnet.c > index 6c218b47b9f1..5316e51e72d4 100644 > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > @@ -1,18 +1,27 @@ > // SPDX-License-Identifier: GPL-2.0 OR

Re: [PATCH mlx5-next v1 06/11] vdpa/mlx5: Connect mlx5_vdpa to auxiliary bus

2020-11-05 Thread Jason Gunthorpe
On Thu, Nov 05, 2020 at 08:33:02AM +0100, gregkh wrote: > > Were there any additional changes you wanted to see happen? I'll go > > give the final set another once over, but David has been diligently > > fixing up all the declared major issues so I expect to find at most > > minor incremental

Re: [PATCH 0/4] driver_core: Auxiliary drvdata helper cleanup

2021-12-22 Thread Jason Gunthorpe
On Tue, Dec 21, 2021 at 04:48:17PM -0800, David E. Box wrote: > On Tue, 2021-12-21 at 20:09 -0400, Jason Gunthorpe wrote: > > On Tue, Dec 21, 2021 at 03:58:48PM -0800, David E. Box wrote: > > > Depends on "driver core: auxiliary bus: Add driver data helpers" pat

Re: [PATCH 0/4] driver_core: Auxiliary drvdata helper cleanup

2021-12-21 Thread Jason Gunthorpe
On Tue, Dec 21, 2021 at 03:58:48PM -0800, David E. Box wrote: > Depends on "driver core: auxiliary bus: Add driver data helpers" patch [1]. > Applies the helpers to all auxiliary device drivers using > dev_(get/set)_drvdata. Drivers were found using the following search: > > grep -lr "struct

Re: [PATCH v2 0/6] IOMMUFD: Deliver IO page faults to user space

2023-11-02 Thread Jason Gunthorpe
On Thu, Oct 26, 2023 at 10:49:24AM +0800, Lu Baolu wrote: > Hi folks, > > This series implements the functionality of delivering IO page faults to > user space through the IOMMUFD framework for nested translation. Nested > translation is a hardware feature that supports two-stage translation >

Re: [PATCH v2 0/6] IOMMUFD: Deliver IO page faults to user space

2023-11-07 Thread Jason Gunthorpe
On Tue, Nov 07, 2023 at 08:35:10AM +, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Thursday, November 2, 2023 8:48 PM > > > > On Thu, Oct 26, 2023 at 10:49:24AM +0800, Lu Baolu wrote: > > > Hi folks, > > > > > > This series implem

Re: [RFC PATCH 2/5] iommu/vt-d: Add generic IO page table support

2023-11-06 Thread Jason Gunthorpe
On Mon, Nov 06, 2023 at 02:12:23AM -0500, Tina Zhang wrote: > Add basic hook up code to implement generic IO page table framework. > > Signed-off-by: Tina Zhang > --- > drivers/iommu/intel/Kconfig | 1 + > drivers/iommu/intel/iommu.c | 94 + >

Re: [PATCH v2 1/2] iommu/virtio: Make use of ops->iotlb_sync_map

2023-09-22 Thread Jason Gunthorpe
On Fri, Sep 22, 2023 at 07:07:40PM +0100, Robin Murphy wrote: > virtio isn't setting ops->pgsize_bitmap for the sake of direct mappings > either; it sets it once it's discovered any instance, since apparently it's > assuming that all instances must support identical page sizes, and thus once >

Re: [PATCH v2 1/2] iommu/virtio: Make use of ops->iotlb_sync_map

2023-09-22 Thread Jason Gunthorpe
On Fri, Sep 22, 2023 at 02:13:18PM +0100, Robin Murphy wrote: > On 22/09/2023 1:41 pm, Jason Gunthorpe wrote: > > On Fri, Sep 22, 2023 at 08:57:19AM +0100, Jean-Philippe Brucker wrote: > > > > > They're not strictly equivalent: this check works around a te

Re: [PATCH v2 1/2] iommu/virtio: Make use of ops->iotlb_sync_map

2023-09-25 Thread Jason Gunthorpe
On Mon, Sep 25, 2023 at 02:07:50PM +0100, Robin Murphy wrote: > On 2023-09-23 00:33, Jason Gunthorpe wrote: > > On Fri, Sep 22, 2023 at 07:07:40PM +0100, Robin Murphy wrote: > > > > > virtio isn't setting ops->pgsize_bitmap for the sake of direct mappings > &g

Re: [PATCH v2 1/2] iommu/virtio: Make use of ops->iotlb_sync_map

2023-09-19 Thread Jason Gunthorpe
On Tue, Sep 19, 2023 at 09:15:19AM +0100, Jean-Philippe Brucker wrote: > On Mon, Sep 18, 2023 at 05:37:47PM +0100, Robin Murphy wrote: > > > diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c > > > index 17dcd826f5c2..3649586f0e5c 100644 > > > ---

Re: [PATCH v2 1/2] iommu/virtio: Make use of ops->iotlb_sync_map

2023-09-22 Thread Jason Gunthorpe
On Fri, Sep 22, 2023 at 08:57:19AM +0100, Jean-Philippe Brucker wrote: > > > They're not strictly equivalent: this check works around a temporary issue > > > with the IOMMU core, which calls map/unmap before the domain is > > > finalized. > > > > Where? The above points to

Re: [PATCH v2 1/2] iommu/virtio: Make use of ops->iotlb_sync_map

2023-09-25 Thread Jason Gunthorpe
On Mon, Sep 25, 2023 at 10:48:21AM +0800, Baolu Lu wrote: > On 9/23/23 7:33 AM, Jason Gunthorpe wrote: > > On Fri, Sep 22, 2023 at 07:07:40PM +0100, Robin Murphy wrote: > > > > > virtio isn't setting ops->pgsize_bitmap for the sake of direct mappings > > > eit

Re: [PATCH RFC 00/17] Solve iommu probe races around iommu_fwspec

2023-11-08 Thread Jason Gunthorpe
On Wed, Nov 08, 2023 at 06:34:58PM +, André Draszik wrote: > For me, it's working fine so far on master, and I've also done my own back > port > to 6.1 and am currently testing both. An official back port once finalised > could be useful, though :-) Great, I'll post a non-RFC version next

Re: [RFC PATCH 2/5] iommu/vt-d: Add generic IO page table support

2023-11-08 Thread Jason Gunthorpe
On Thu, Nov 09, 2023 at 12:10:59AM +, Zhang, Tina wrote: > > If this is going to happen can we also convert vt-d to actually use the io > > page > > table stuff directly and shuffle the code around so it is structured like > > the rest of > > the io page table implementations? > Converting

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-27 Thread Jason Gunthorpe
On Mon, Jun 27, 2022 at 08:27:37PM +0200, Daniel Borkmann wrote: > On 6/27/22 8:04 PM, Gustavo A. R. Silva wrote: > > There is a regular need in the kernel to provide a way to declare > > having a dynamically sized set of trailing elements in a structure. > > Kernel code should always use

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Jason Gunthorpe
On Tue, Jun 28, 2022 at 04:21:29AM +0200, Gustavo A. R. Silva wrote: > > > Though maybe we could just switch off > > > -Wgnu-variable-sized-type-not-at-end during configuration ? > We need to think in a different strategy. I think we will need to switch off the warning in userspace - this is

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Jason Gunthorpe
On Tue, Jun 28, 2022 at 10:54:58AM -0700, Kees Cook wrote: > which must also be assuming it's a header. So probably better to just > drop the driver_data field? I don't see anything using it (that I can > find) besides as a sanity-check that the field exists and is at the end > of the struct.

Re: [PATCH v6 10/21] RDMA/umem: Prepare to dynamic dma-buf locking specification

2022-10-10 Thread Jason Gunthorpe
> > - dma_buf_unmap_attachment(umem_dmabuf->attach, umem_dmabuf->sgt, > > -DMA_BIDIRECTIONAL); > > + dma_buf_unmap_attachment_unlocked(umem_dmabuf->attach, umem_dmabuf->sgt, > > +

Re: [PATCH 0/2] eventfd: simplify signal helpers

2023-07-17 Thread Jason Gunthorpe
On Mon, Jul 17, 2023 at 01:08:31PM -0600, Alex Williamson wrote: > What would that mechanism be? We've been iterating on getting the > serialization and buffering correct, but I don't know of another means > that combines the notification with a value, so we'd likely end up with > an eventfd

Re: [PATCH 0/2] eventfd: simplify signal helpers

2023-07-18 Thread Jason Gunthorpe
On Mon, Jul 17, 2023 at 04:52:03PM -0600, Alex Williamson wrote: > On Mon, 17 Jul 2023 19:12:16 -0300 > Jason Gunthorpe wrote: > > > On Mon, Jul 17, 2023 at 01:08:31PM -0600, Alex Williamson wrote: > > > > > What would that mechanism be? We've been iterating on g

Re: [PATCH 0/2] eventfd: simplify signal helpers

2023-07-14 Thread Jason Gunthorpe
On Fri, Jul 14, 2023 at 09:05:21AM +0200, Christian Brauner wrote: > I have no skin in the game aside from having to drop this conversion > which I'm fine to do if there are actually users for this btu really, > that looks a lot like abusing an api that really wasn't designed for > this. Yeah, I

Re: [RFC PATCHES 00/17] IOMMUFD: Deliver IO page faults to user space

2023-05-30 Thread Jason Gunthorpe
On Tue, May 30, 2023 at 01:37:07PM +0800, Lu Baolu wrote: > Hi folks, > > This series implements the functionality of delivering IO page faults to > user space through the IOMMUFD framework. The use case is nested > translation, where modern IOMMU hardware supports two-stage translation > tables.

Re: [RFC] iommu/virtio: Use single flush queue (EXPERIMENTAL)

2023-08-02 Thread Jason Gunthorpe
On Wed, Aug 02, 2023 at 01:36:12PM +0100, Jean-Philippe Brucker wrote: > automatically get plugged into a VM without user intervention. Here I > guess the devices we don't trust will be virtual devices implemented by > other VMs. We don't have any method to identify them yet, so > iommu.strict=1

Re: [RFC PATCHES 00/17] IOMMUFD: Deliver IO page faults to user space

2023-06-23 Thread Jason Gunthorpe
On Fri, Jun 23, 2023 at 02:18:38PM +0800, Baolu Lu wrote: > struct io_uring ring; > > io_uring_setup(IOPF_ENTRIES, ); > > while (1) { > struct io_uring_prep_read read; > struct io_uring_cqe *cqe; > > read.fd = iopf_fd; >

Re: [RFC PATCHES 00/17] IOMMUFD: Deliver IO page faults to user space

2023-06-19 Thread Jason Gunthorpe
On Fri, Jun 16, 2023 at 12:32:32PM +0100, Jean-Philippe Brucker wrote: > We might need to revisit supporting stop markers: request that each device > driver declares whether their device uses stop markers on unbind() ("This > mechanism must indicate that a Stop Marker Message will be generated."

Re: [RFC PATCHES 00/17] IOMMUFD: Deliver IO page faults to user space

2023-06-26 Thread Jason Gunthorpe
On Sun, Jun 25, 2023 at 02:30:46PM +0800, Baolu Lu wrote: > Agreed. We should avoid workqueue in sva iopf framework. Perhaps we > could go ahead with below code? It will be registered to device with > iommu_register_device_fault_handler() in IOMMU_DEV_FEAT_IOPF enabling > path. Un-registering in

Re: [RFC PATCHES 00/17] IOMMUFD: Deliver IO page faults to user space

2023-06-28 Thread Jason Gunthorpe
On Wed, Jun 28, 2023 at 10:00:56AM +0800, Baolu Lu wrote: > > If the driver created a SVA domain then the op should point to some > > generic 'handle sva fault' function. There shouldn't be weird SVA > > stuff in the core code. > > > > The weird SVA stuff is really just a generic per-device

Re: [PATCH RFC 10/17] acpi: Do not use dev->iommu within acpi_iommu_configure()

2023-11-13 Thread Jason Gunthorpe
On Sun, Nov 12, 2023 at 09:44:18AM -0800, Moritz Fischer wrote: > On Fri, Nov 03, 2023 at 01:44:55PM -0300, Jason Gunthorpe wrote: > > This call chain is using dev->iommu->fwspec to pass around the fwspec > > between the three parts (acpi_iommu_configure(), a

Re: [PATCH v3 5/8] iommufd: Associate fault object with iommufd_hw_pgtable

2024-03-06 Thread Jason Gunthorpe
On Wed, Mar 06, 2024 at 11:15:50PM +0800, Zhangfei Gao wrote: > > Double checked, this does not send flags, 0 is OK, > Only domain_alloc_user in iommufd_hwpt_paging_alloc requires flags. > > In my debug, I need this patch, otherwise NULL pointer errors happen > since SVA is not set. This is

Re: [PATCH v3 4/8] iommufd: Add iommufd fault object

2024-03-08 Thread Jason Gunthorpe
On Mon, Jan 22, 2024 at 03:38:59PM +0800, Lu Baolu wrote: > --- /dev/null > +++ b/drivers/iommu/iommufd/fault.c > @@ -0,0 +1,255 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +/* Copyright (C) 2024 Intel Corporation > + */ > +#define pr_fmt(fmt) "iommufd: " fmt > + > +#include > +#include >

Re: [PATCH v3 2/8] iommu/sva: Use iopf domain attach/detach interface

2024-03-08 Thread Jason Gunthorpe
On Mon, Jan 22, 2024 at 03:38:57PM +0800, Lu Baolu wrote: > @@ -215,7 +202,23 @@ static struct iopf_group *iopf_group_alloc(struct > iommu_fault_param *iopf_param, > group = abort_group; > } > > + cookie = iopf_pasid_cookie_get(iopf_param->dev, pasid); > + if

Re: [PATCH v3 3/8] iommufd: Add fault and response message definitions

2024-03-08 Thread Jason Gunthorpe
On Mon, Jan 22, 2024 at 03:38:58PM +0800, Lu Baolu wrote: > +/** > + * enum iommu_hwpt_pgfault_flags - flags for struct iommu_hwpt_pgfault > + * @IOMMU_PGFAULT_FLAGS_PASID_VALID: The pasid field of the fault data is > + * valid. > + *

Re: [PATCH v3 5/8] iommufd: Associate fault object with iommufd_hw_pgtable

2024-03-08 Thread Jason Gunthorpe
On Mon, Jan 22, 2024 at 03:39:00PM +0800, Lu Baolu wrote: > @@ -411,6 +414,8 @@ enum iommu_hwpt_data_type { > * @__reserved: Must be 0 > * @data_type: One of enum iommu_hwpt_data_type > * @data_len: Length of the type specific data > + * @fault_id: The ID of IOMMUFD_FAULT object. Valid only

Re: [PATCH v3 4/8] iommufd: Add iommufd fault object

2024-03-22 Thread Jason Gunthorpe
On Wed, Mar 20, 2024 at 04:18:05PM +, Shameerali Kolothum Thodi wrote: > > What I have noticed is that, > -read interface works fine and I can receive struct tiommu_hwpt_pgfault data. > -But once Guest handles the page faults and returns the page response, > the write to fault fd never

  1   2   >