Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-29 Thread Jason Wang
On 2019/9/27 下午9:23, Michael S. Tsirkin wrote: On Fri, Sep 27, 2019 at 09:17:56PM +0800, Jason Wang wrote: On 2019/9/27 下午8:46, Michael S. Tsirkin wrote: On Fri, Sep 27, 2019 at 08:17:47PM +0800, Jason Wang wrote: On 2019/9/27 下午5:41, Michael S. Tsirkin wrote: On Fri, Sep 27, 2019 at

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Michael S. Tsirkin
On Fri, Sep 27, 2019 at 09:17:56PM +0800, Jason Wang wrote: > > On 2019/9/27 下午8:46, Michael S. Tsirkin wrote: > > On Fri, Sep 27, 2019 at 08:17:47PM +0800, Jason Wang wrote: > > > On 2019/9/27 下午5:41, Michael S. Tsirkin wrote: > > > > On Fri, Sep 27, 2019 at 11:27:12AM +0800, Jason Wang wrote: >

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Jason Wang
On 2019/9/27 下午8:46, Michael S. Tsirkin wrote: On Fri, Sep 27, 2019 at 08:17:47PM +0800, Jason Wang wrote: On 2019/9/27 下午5:41, Michael S. Tsirkin wrote: On Fri, Sep 27, 2019 at 11:27:12AM +0800, Jason Wang wrote: On 2019/9/26 下午9:14, Tiwei Bie wrote: On Thu, Sep 26, 2019 at 04:35:18AM

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Michael S. Tsirkin
On Fri, Sep 27, 2019 at 08:17:47PM +0800, Jason Wang wrote: > > On 2019/9/27 下午5:41, Michael S. Tsirkin wrote: > > On Fri, Sep 27, 2019 at 11:27:12AM +0800, Jason Wang wrote: > > > On 2019/9/26 下午9:14, Tiwei Bie wrote: > > > > On Thu, Sep 26, 2019 at 04:35:18AM -0400, Michael S. Tsirkin wrote: >

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Jason Wang
On 2019/9/27 下午5:41, Michael S. Tsirkin wrote: On Fri, Sep 27, 2019 at 11:27:12AM +0800, Jason Wang wrote: On 2019/9/26 下午9:14, Tiwei Bie wrote: On Thu, Sep 26, 2019 at 04:35:18AM -0400, Michael S. Tsirkin wrote: On Thu, Sep 26, 2019 at 12:54:27PM +0800, Tiwei Bie wrote: [...] diff --git

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Jason Wang
On 2019/9/27 下午5:38, Michael S. Tsirkin wrote: On Fri, Sep 27, 2019 at 04:47:43PM +0800, Jason Wang wrote: On 2019/9/27 下午12:54, Tiwei Bie wrote: On Fri, Sep 27, 2019 at 11:46:06AM +0800, Jason Wang wrote: On 2019/9/26 下午12:54, Tiwei Bie wrote: + +static long vhost_mdev_start(struct

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Michael S. Tsirkin
On Fri, Sep 27, 2019 at 11:27:12AM +0800, Jason Wang wrote: > > On 2019/9/26 下午9:14, Tiwei Bie wrote: > > On Thu, Sep 26, 2019 at 04:35:18AM -0400, Michael S. Tsirkin wrote: > > > On Thu, Sep 26, 2019 at 12:54:27PM +0800, Tiwei Bie wrote: > > [...] > > > > diff --git a/include/uapi/linux/vhost.h

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Michael S. Tsirkin
On Fri, Sep 27, 2019 at 04:47:43PM +0800, Jason Wang wrote: > > On 2019/9/27 下午12:54, Tiwei Bie wrote: > > On Fri, Sep 27, 2019 at 11:46:06AM +0800, Jason Wang wrote: > > > On 2019/9/26 下午12:54, Tiwei Bie wrote: > > > > + > > > > +static long vhost_mdev_start(struct vhost_mdev *m) > > > > +{ > >

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Jason Wang
On 2019/9/27 下午12:54, Tiwei Bie wrote: On Fri, Sep 27, 2019 at 11:46:06AM +0800, Jason Wang wrote: On 2019/9/26 下午12:54, Tiwei Bie wrote: + +static long vhost_mdev_start(struct vhost_mdev *m) +{ + struct mdev_device *mdev = m->mdev; + const struct virtio_mdev_device_ops *ops =

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Jason Wang
On 2019/9/27 下午4:04, Tiwei Bie wrote: On Fri, Sep 27, 2019 at 03:14:42PM +0800, Jason Wang wrote: On 2019/9/27 下午12:54, Tiwei Bie wrote: + + /* +* In vhost-mdev, userspace should pass ring addresses +* in guest physical addresses when IOMMU is

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Tiwei Bie
On Fri, Sep 27, 2019 at 03:14:42PM +0800, Jason Wang wrote: > On 2019/9/27 下午12:54, Tiwei Bie wrote: > > > > + > > > > + /* > > > > +* In vhost-mdev, userspace should pass ring addresses > > > > +* in guest physical addresses when IOMMU is disabled or

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Jason Wang
On 2019/9/27 下午12:54, Tiwei Bie wrote: The name could be confusing, get_queue_max() is to get the maximum number of entries for a virtqueue supported by this device. OK. It might be better to rename it to something like: get_vq_num_max() which is more consistent with the

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Jason Wang
On 2019/9/27 下午12:54, Tiwei Bie wrote: + + /* +* In vhost-mdev, userspace should pass ring addresses +* in guest physical addresses when IOMMU is disabled or +* IOVAs when IOMMU is enabled. +*/ A question here,

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-26 Thread Tiwei Bie
On Fri, Sep 27, 2019 at 11:46:06AM +0800, Jason Wang wrote: > On 2019/9/26 下午12:54, Tiwei Bie wrote: > > + > > +static long vhost_mdev_start(struct vhost_mdev *m) > > +{ > > + struct mdev_device *mdev = m->mdev; > > + const struct virtio_mdev_device_ops *ops = mdev_get_dev_ops(mdev); > > +

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-26 Thread Tiwei Bie
On Fri, Sep 27, 2019 at 11:51:35AM +0800, Jason Wang wrote: > On 2019/9/27 上午11:46, Jason Wang wrote: > > + > > +static struct mdev_class_id id_table[] = { > > +    { MDEV_ID_VHOST }, > > +    { 0 }, > > +}; > > + > > +static struct mdev_driver vhost_mdev_driver = { > > +    .name    =

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-26 Thread Jason Wang
On 2019/9/27 上午11:46, Jason Wang wrote: + +static struct mdev_class_id id_table[] = { +    { MDEV_ID_VHOST }, +    { 0 }, +}; + +static struct mdev_driver vhost_mdev_driver = { +    .name    = "vhost_mdev", +    .probe    = vhost_mdev_probe, +    .remove    = vhost_mdev_remove, +    .id_table

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-26 Thread Jason Wang
On 2019/9/26 下午12:54, Tiwei Bie wrote: This patch introduces a mdev based hardware vhost backend. This backend is built on top of the same abstraction used in virtio-mdev and provides a generic vhost interface for userspace to accelerate the virtio devices in guest. This backend is

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-26 Thread Jason Wang
On 2019/9/26 下午9:14, Tiwei Bie wrote: On Thu, Sep 26, 2019 at 04:35:18AM -0400, Michael S. Tsirkin wrote: On Thu, Sep 26, 2019 at 12:54:27PM +0800, Tiwei Bie wrote: [...] diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h index 40d028eed645..5afbc2f08fa3 100644 ---

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-26 Thread kbuild test robot
Hi Tiwei, Thank you for the patch! Yet something to improve: [auto build test ERROR on vhost/linux-next] [cannot apply to v5.3 next-20190925] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-26 Thread Tiwei Bie
On Thu, Sep 26, 2019 at 09:26:22AM -0400, Michael S. Tsirkin wrote: > On Thu, Sep 26, 2019 at 09:14:39PM +0800, Tiwei Bie wrote: > > > 4. Does device need to limit max ring size? > > > 5. Does device need to limit max number of queues? > > > > I think so. It's helpful to have ioctls to report the

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-26 Thread Michael S. Tsirkin
On Thu, Sep 26, 2019 at 09:14:39PM +0800, Tiwei Bie wrote: > > 4. Does device need to limit max ring size? > > 5. Does device need to limit max number of queues? > > I think so. It's helpful to have ioctls to report the max > ring size and max number of queues. Also, let's not repeat the vhost

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-26 Thread Tiwei Bie
On Thu, Sep 26, 2019 at 04:35:18AM -0400, Michael S. Tsirkin wrote: > On Thu, Sep 26, 2019 at 12:54:27PM +0800, Tiwei Bie wrote: [...] > > diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h > > index 40d028eed645..5afbc2f08fa3 100644 > > --- a/include/uapi/linux/vhost.h > > +++

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-26 Thread Michael S. Tsirkin
On Thu, Sep 26, 2019 at 12:54:27PM +0800, Tiwei Bie wrote: > This patch introduces a mdev based hardware vhost backend. > This backend is built on top of the same abstraction used > in virtio-mdev and provides a generic vhost interface for > userspace to accelerate the virtio devices in guest. >

[PATCH] vhost: introduce mdev based hardware backend

2019-09-25 Thread Tiwei Bie
This patch introduces a mdev based hardware vhost backend. This backend is built on top of the same abstraction used in virtio-mdev and provides a generic vhost interface for userspace to accelerate the virtio devices in guest. This backend is implemented as a mdev device driver on top of the