Re: [PATCH 1/5] iova: Move fast alloc size roundup into alloc_iova_fast()

2021-10-10 Thread Jason Wang
On Fri, Sep 24, 2021 at 6:07 PM John Garry wrote: > > It really is a property of the IOVA rcache code that we need to alloc a > power-of-2 size, so relocate the functionality to resize into > alloc_iova_fast(), rather than the callsites. > > Signed-off-by: John Garry Ac

Re: [PATCH v13 02/13] eventfd: Export eventfd_wake_count to modules

2021-08-31 Thread Jason Wang
. If * it returns true, the eventfd_signal() call should be deferred to a * safe context. */ So: Acked-by: Jason Wang --- fs/eventfd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/eventfd.c b/fs/eventfd.c index e265b6dd4f34..1b3130b8d6c1 100644 --- a/fs

Re: [PATCH v11 12/12] Documentation: Add documentation for VDUSE

2021-08-23 Thread Jason Wang
在 2021/8/18 下午8:06, Xie Yongji 写道: VDUSE (vDPA Device in Userspace) is a framework to support implementing software-emulated vDPA devices in userspace. This document is intended to clarify the VDUSE design and usage. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- Documentation

Re: [PATCH v11 12/12] Documentation: Add documentation for VDUSE

2021-08-23 Thread Jason Wang
在 2021/8/18 下午8:06, Xie Yongji 写道: VDUSE (vDPA Device in Userspace) is a framework to support implementing software-emulated vDPA devices in userspace. This document is intended to clarify the VDUSE design and usage. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- Documentation

Re: [PATCH v11 11/12] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-08-23 Thread Jason Wang
. For more details on VDUSE design and usage, please see the follow-on Documentation commit. Signed-off-by: Xie Yongji Acked-by: Jason Wang ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v11 05/12] vhost-vdpa: Handle the failure of vdpa_reset()

2021-08-23 Thread Jason Wang
在 2021/8/18 下午8:06, Xie Yongji 写道: The vdpa_reset() may fail now. This adds check to its return value and fail the vhost_vdpa_open(). Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/vdpa.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git

Re: [PATCH v11 04/12] vdpa: Add reset callback in vdpa_config_ops

2021-08-23 Thread Jason Wang
在 2021/8/18 下午8:06, Xie Yongji 写道: This adds a new callback to support device specific reset behavior. The vdpa bus driver will call the reset function instead of setting status to zero during resetting if device driver supports the new callback. Signed-off-by: Xie Yongji ---

Re: [PATCH v11 03/12] vdpa: Fix some coding style issues

2021-08-23 Thread Jason Wang
Yongji Acked-by: Jason Wang --- include/linux/vdpa.h | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h index 954b340f6c2f..8a645f8f4476 100644 --- a/include/linux/vdpa.h +++ b/include/linux

Re: [PATCH v11 01/12] iova: Export alloc_iova_fast() and free_iova_fast()

2021-08-23 Thread Jason Wang
在 2021/8/18 下午8:06, Xie Yongji 写道: Export alloc_iova_fast() and free_iova_fast() so that some modules can make use of the per-CPU cache to get rid of rbtree spinlock in alloc_iova() and free_iova() during IOVA allocation. Signed-off-by: Xie Yongji Acked-by: Jason Wang (If we need respin

Re: [PATCH v10 01/17] iova: Export alloc_iova_fast() and free_iova_fast()

2021-08-09 Thread Jason Wang
在 2021/8/9 下午1:56, Yongji Xie 写道: On Thu, Aug 5, 2021 at 9:31 PM Jason Wang wrote: 在 2021/8/5 下午8:34, Yongji Xie 写道: My main point, though, is that if you've already got something else keeping track of the actual addresses, then the way you're using an iova_domain appears to be something

Re: [PATCH v10 01/17] iova: Export alloc_iova_fast() and free_iova_fast()

2021-08-05 Thread Jason Wang
在 2021/8/5 下午8:34, Yongji Xie 写道: My main point, though, is that if you've already got something else keeping track of the actual addresses, then the way you're using an iova_domain appears to be something you could do with a trivial bitmap allocator. That's why I don't buy the efficiency

Re: [PATCH v10 10/17] virtio: Handle device reset failure in register_virtio_device()

2021-08-05 Thread Jason Wang
在 2021/8/4 下午5:07, Yongji Xie 写道: On Wed, Aug 4, 2021 at 4:54 PM Jason Wang wrote: 在 2021/8/4 下午4:50, Yongji Xie 写道: On Wed, Aug 4, 2021 at 4:32 PM Jason Wang wrote: 在 2021/8/3 下午5:38, Yongji Xie 写道: On Tue, Aug 3, 2021 at 4:09 PM Jason Wang wrote: 在 2021/7/29 下午3:34, Xie Yongji 写道

Re: [PATCH v10 10/17] virtio: Handle device reset failure in register_virtio_device()

2021-08-04 Thread Jason Wang
在 2021/8/4 下午4:50, Yongji Xie 写道: On Wed, Aug 4, 2021 at 4:32 PM Jason Wang wrote: 在 2021/8/3 下午5:38, Yongji Xie 写道: On Tue, Aug 3, 2021 at 4:09 PM Jason Wang wrote: 在 2021/7/29 下午3:34, Xie Yongji 写道: The device reset may fail in virtio-vdpa case now, so add checks to its return value

Re: [PATCH v10 05/17] vhost-vdpa: Fail the vhost_vdpa_set_status() on reset failure

2021-08-04 Thread Jason Wang
在 2021/8/3 下午5:50, Yongji Xie 写道: On Tue, Aug 3, 2021 at 4:10 PM Jason Wang wrote: 在 2021/7/29 下午3:34, Xie Yongji 写道: Re-read the device status to ensure it's set to zero during resetting. Otherwise, fail the vhost_vdpa_set_status() after timeout. Signed-off-by: Xie Yongji --- drivers

Re: [PATCH v10 10/17] virtio: Handle device reset failure in register_virtio_device()

2021-08-04 Thread Jason Wang
在 2021/8/3 下午5:38, Yongji Xie 写道: On Tue, Aug 3, 2021 at 4:09 PM Jason Wang wrote: 在 2021/7/29 下午3:34, Xie Yongji 写道: The device reset may fail in virtio-vdpa case now, so add checks to its return value and fail the register_virtio_device(). So the reset() would be called by the driver

Re: [PATCH v10 04/17] vdpa: Fail the vdpa_reset() if fail to set device status to zero

2021-08-04 Thread Jason Wang
在 2021/8/3 下午5:31, Yongji Xie 写道: On Tue, Aug 3, 2021 at 3:58 PM Jason Wang wrote: 在 2021/7/29 下午3:34, Xie Yongji 写道: Re-read the device status to ensure it's set to zero during resetting. Otherwise, fail the vdpa_reset() after timeout. Signed-off-by: Xie Yongji --- include/linux

Re: [PATCH v10 02/17] file: Export receive_fd() to modules

2021-08-04 Thread Jason Wang
在 2021/8/3 下午5:01, Yongji Xie 写道: On Tue, Aug 3, 2021 at 3:46 PM Jason Wang wrote: 在 2021/7/29 下午3:34, Xie Yongji 写道: Export receive_fd() so that some modules can use it to pass file descriptor between processes without missing any security stuffs. Signed-off-by: Xie Yongji --- fs

Re: [PATCH v10 05/17] vhost-vdpa: Fail the vhost_vdpa_set_status() on reset failure

2021-08-03 Thread Jason Wang
在 2021/7/29 下午3:34, Xie Yongji 写道: Re-read the device status to ensure it's set to zero during resetting. Otherwise, fail the vhost_vdpa_set_status() after timeout. Signed-off-by: Xie Yongji --- drivers/vhost/vdpa.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff

Re: [PATCH v10 10/17] virtio: Handle device reset failure in register_virtio_device()

2021-08-03 Thread Jason Wang
在 2021/7/29 下午3:34, Xie Yongji 写道: The device reset may fail in virtio-vdpa case now, so add checks to its return value and fail the register_virtio_device(). So the reset() would be called by the driver during remove as well, or is it sufficient to deal only with the reset during probe?

Re: [PATCH v10 07/17] virtio: Don't set FAILED status bit on device index allocation failure

2021-08-03 Thread Jason Wang
在 2021/7/29 下午3:34, Xie Yongji 写道: We don't need to set FAILED status bit on device index allocation failure since the device initialization hasn't been started yet. This doesn't affect runtime, found in code review. Signed-off-by: Xie Yongji Does it really harm? Thanks ---

Re: [PATCH v10 04/17] vdpa: Fail the vdpa_reset() if fail to set device status to zero

2021-08-03 Thread Jason Wang
在 2021/7/29 下午3:34, Xie Yongji 写道: Re-read the device status to ensure it's set to zero during resetting. Otherwise, fail the vdpa_reset() after timeout. Signed-off-by: Xie Yongji --- include/linux/vdpa.h | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git

Re: [PATCH v10 03/17] vdpa: Fix code indentation

2021-08-03 Thread Jason Wang
在 2021/7/29 下午3:34, Xie Yongji 写道: Use tabs to indent the code instead of spaces. Signed-off-by: Xie Yongji --- include/linux/vdpa.h | 29 ++--- 1 file changed, 14 insertions(+), 15 deletions(-) It looks to me not all the warnings are addressed. Or did you

Re: [PATCH v10 02/17] file: Export receive_fd() to modules

2021-08-03 Thread Jason Wang
在 2021/7/29 下午3:34, Xie Yongji 写道: Export receive_fd() so that some modules can use it to pass file descriptor between processes without missing any security stuffs. Signed-off-by: Xie Yongji --- fs/file.c| 6 ++ include/linux/file.h | 7 +++ 2 files changed, 9

Re: [PATCH v10 01/17] iova: Export alloc_iova_fast() and free_iova_fast()

2021-08-03 Thread Jason Wang
在 2021/7/29 下午3:34, Xie Yongji 写道: Export alloc_iova_fast() and free_iova_fast() so that some modules can use it to improve iova allocation efficiency. It's better to explain why alloc_iova() is not sufficient here. Thanks Signed-off-by: Xie Yongji --- drivers/iommu/iova.c | 2 ++ 1

Re: [PATCH v10 01/17] iova: Export alloc_iova_fast() and free_iova_fast()

2021-08-03 Thread Jason Wang
在 2021/7/29 下午3:34, Xie Yongji 写道: Export alloc_iova_fast() and free_iova_fast() so that some modules can use it to improve iova allocation efficiency. It's better to explain which alloc_iova() is not sufficient here. Thanks Signed-off-by: Xie Yongji --- drivers/iommu/iova.c | 2 ++

Re: [PATCH v10 17/17] Documentation: Add documentation for VDUSE

2021-08-03 Thread Jason Wang
在 2021/7/29 下午3:35, Xie Yongji 写道: VDUSE (vDPA Device in Userspace) is a framework to support implementing software-emulated vDPA devices in userspace. This document is intended to clarify the VDUSE design and usage. Signed-off-by: Xie Yongji --- Documentation/userspace-api/index.rst | 1

Re: [PATCH v10 16/17] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-08-03 Thread Jason Wang
在 2021/7/29 下午3:35, Xie Yongji 写道: This VDUSE driver enables implementing software-emulated vDPA devices in userspace. The vDPA device is created by ioctl(VDUSE_CREATE_DEV) on /dev/vduse/control. Then a char device interface (/dev/vduse/$NAME) is exported to userspace for device emulation. In

Re: [PATCH v9 17/17] Documentation: Add documentation for VDUSE

2021-07-14 Thread Jason Wang
在 2021/7/13 下午4:46, Xie Yongji 写道: VDUSE (vDPA Device in Userspace) is a framework to support implementing software-emulated vDPA devices in userspace. This document is intended to clarify the VDUSE design and usage. Signed-off-by: Xie Yongji --- Documentation/userspace-api/index.rst | 1

Re: [PATCH v9 16/17] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-07-14 Thread Jason Wang
在 2021/7/15 下午12:03, Yongji Xie 写道: Which ioctl can be used for this? I mean we can introduce a new ioctl for that in the future. Ok, I see. I wonder if it's better to do something similar to ccw: 1) requires the userspace to update the status bit in the response 2) update the

Re: [PATCH v9 13/17] vdpa: factor out vhost_vdpa_pa_map() and vhost_vdpa_pa_unmap()

2021-07-14 Thread Jason Wang
在 2021/7/14 下午5:57, Dan Carpenter 写道: On Wed, Jul 14, 2021 at 05:41:54PM +0800, Jason Wang wrote: 在 2021/7/14 下午4:05, Dan Carpenter 写道: On Wed, Jul 14, 2021 at 10:14:32AM +0800, Jason Wang wrote: 在 2021/7/13 下午7:31, Dan Carpenter 写道: On Tue, Jul 13, 2021 at 04:46:52PM +0800, Xie Yongji

Re: [PATCH v9 13/17] vdpa: factor out vhost_vdpa_pa_map() and vhost_vdpa_pa_unmap()

2021-07-14 Thread Jason Wang
在 2021/7/14 下午4:05, Dan Carpenter 写道: On Wed, Jul 14, 2021 at 10:14:32AM +0800, Jason Wang wrote: 在 2021/7/13 下午7:31, Dan Carpenter 写道: On Tue, Jul 13, 2021 at 04:46:52PM +0800, Xie Yongji wrote: @@ -613,37 +618,28 @@ static void vhost_vdpa_unmap(struct vhost_vdpa *v, u64 iova, u64 size

Re: [PATCH v9 16/17] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-07-14 Thread Jason Wang
在 2021/7/14 下午2:49, Yongji Xie 写道: On Wed, Jul 14, 2021 at 1:45 PM Jason Wang wrote: 在 2021/7/13 下午4:46, Xie Yongji 写道: This VDUSE driver enables implementing software-emulated vDPA devices in userspace. The vDPA device is created by ioctl(VDUSE_CREATE_DEV) on /dev/vduse/control

Re: [PATCH v9 16/17] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-07-14 Thread Jason Wang
在 2021/7/14 下午2:47, Greg KH 写道: On Wed, Jul 14, 2021 at 02:02:50PM +0800, Jason Wang wrote: 在 2021/7/14 下午1:54, Michael S. Tsirkin 写道: On Wed, Jul 14, 2021 at 01:45:39PM +0800, Jason Wang wrote: +static int vduse_dev_msg_sync(struct vduse_dev *dev, + struct

Re: [PATCH v9 16/17] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-07-14 Thread Jason Wang
在 2021/7/14 下午1:54, Michael S. Tsirkin 写道: On Wed, Jul 14, 2021 at 01:45:39PM +0800, Jason Wang wrote: +static int vduse_dev_msg_sync(struct vduse_dev *dev, + struct vduse_dev_msg *msg) +{ + int ret; + + init_waitqueue_head(>waitq); + spin_l

Re: [PATCH v9 16/17] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-07-13 Thread Jason Wang
在 2021/7/13 下午4:46, Xie Yongji 写道: This VDUSE driver enables implementing software-emulated vDPA devices in userspace. The vDPA device is created by ioctl(VDUSE_CREATE_DEV) on /dev/vduse/control. Then a char device interface (/dev/vduse/$NAME) is exported to userspace for device emulation. In

Re: [PATCH v9 16/17] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-07-13 Thread Jason Wang
在 2021/7/13 下午9:27, Dan Carpenter 写道: On Tue, Jul 13, 2021 at 04:46:55PM +0800, Xie Yongji wrote: +static int vduse_dev_init_vdpa(struct vduse_dev *dev, const char *name) +{ + struct vduse_vdpa *vdev; + int ret; + + if (dev->vdev) + return -EEXIST; + +

Re: [PATCH v9 13/17] vdpa: factor out vhost_vdpa_pa_map() and vhost_vdpa_pa_unmap()

2021-07-13 Thread Jason Wang
在 2021/7/13 下午7:31, Dan Carpenter 写道: On Tue, Jul 13, 2021 at 04:46:52PM +0800, Xie Yongji wrote: @@ -613,37 +618,28 @@ static void vhost_vdpa_unmap(struct vhost_vdpa *v, u64 iova, u64 size) } } -static int vhost_vdpa_process_iotlb_update(struct vhost_vdpa *v, -

Re: [PATCH v8 10/10] Documentation: Add documentation for VDUSE

2021-07-07 Thread Jason Wang
在 2021/7/7 下午11:54, Stefan Hajnoczi 写道: On Wed, Jul 07, 2021 at 05:24:08PM +0800, Jason Wang wrote: 在 2021/7/7 下午4:55, Stefan Hajnoczi 写道: On Wed, Jul 07, 2021 at 11:43:28AM +0800, Jason Wang wrote: 在 2021/7/7 上午1:11, Stefan Hajnoczi 写道: On Tue, Jul 06, 2021 at 09:08:26PM +0800, Jason Wang

Re: [PATCH v8 10/10] Documentation: Add documentation for VDUSE

2021-07-07 Thread Jason Wang
在 2021/7/7 下午4:55, Stefan Hajnoczi 写道: On Wed, Jul 07, 2021 at 11:43:28AM +0800, Jason Wang wrote: 在 2021/7/7 上午1:11, Stefan Hajnoczi 写道: On Tue, Jul 06, 2021 at 09:08:26PM +0800, Jason Wang wrote: On Tue, Jul 6, 2021 at 6:15 PM Stefan Hajnoczi wrote: On Tue, Jul 06, 2021 at 10:34:33AM

Re: [PATCH v8 10/10] Documentation: Add documentation for VDUSE

2021-07-05 Thread Jason Wang
在 2021/7/5 下午8:49, Stefan Hajnoczi 写道: On Mon, Jul 05, 2021 at 11:36:15AM +0800, Jason Wang wrote: 在 2021/7/4 下午5:49, Yongji Xie 写道: OK, I get you now. Since the VIRTIO specification says "Device configuration space is generally used for rarely-changing or initialization-time parameter

Re: [PATCH v8 10/10] Documentation: Add documentation for VDUSE

2021-07-04 Thread Jason Wang
在 2021/7/4 下午5:49, Yongji Xie 写道: OK, I get you now. Since the VIRTIO specification says "Device configuration space is generally used for rarely-changing or initialization-time parameters". I assume the VDUSE_DEV_SET_CONFIG ioctl should not be called frequently. The spec uses MUST and other

Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-07-01 Thread Jason Wang
在 2021/7/1 下午6:26, Yongji Xie 写道: On Thu, Jul 1, 2021 at 3:55 PM Jason Wang wrote: 在 2021/7/1 下午2:50, Yongji Xie 写道: On Wed, Jun 30, 2021 at 5:51 PM Stefan Hajnoczi wrote: On Tue, Jun 29, 2021 at 10:59:51AM +0800, Yongji Xie wrote: On Mon, Jun 28, 2021 at 9:02 PM Stefan Hajnoczi wrote

Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-07-01 Thread Jason Wang
在 2021/7/1 下午2:50, Yongji Xie 写道: On Wed, Jun 30, 2021 at 5:51 PM Stefan Hajnoczi wrote: On Tue, Jun 29, 2021 at 10:59:51AM +0800, Yongji Xie wrote: On Mon, Jun 28, 2021 at 9:02 PM Stefan Hajnoczi wrote: On Tue, Jun 15, 2021 at 10:13:30PM +0800, Xie Yongji wrote: +/* ioctls */ + +struct

Re: [PATCH v8 00/10] Introduce VDUSE - vDPA Device in Userspace

2021-06-29 Thread Jason Wang
在 2021/6/29 下午2:40, Yongji Xie 写道: On Tue, Jun 29, 2021 at 12:13 PM Jason Wang wrote: 在 2021/6/28 下午6:32, Yongji Xie 写道: The large barrier is bounce-buffer mapping: SPDK requires hugepages for NVMe over PCIe and RDMA, so take some preallcoated hugepages to map as bounce buffer is necessary

Re: [PATCH v8 00/10] Introduce VDUSE - vDPA Device in Userspace

2021-06-28 Thread Jason Wang
在 2021/6/28 下午6:32, Yongji Xie 写道: The large barrier is bounce-buffer mapping: SPDK requires hugepages for NVMe over PCIe and RDMA, so take some preallcoated hugepages to map as bounce buffer is necessary. Or it's hard to avoid an extra memcpy from bounce-buffer to hugepage. If you can add an

Re: [PATCH v8 00/10] Introduce VDUSE - vDPA Device in Userspace

2021-06-28 Thread Jason Wang
在 2021/6/28 下午1:54, Liu, Xiaodong 写道: Several issues: - VDUSE needs to limit the total size of the bounce buffers (64M if I was not wrong). Does it work for SPDK? Yes, Jason. It is enough and works for SPDK. Since it's a kind of bounce buffer mainly for in-flight IO, so limited size like

Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-06-28 Thread Jason Wang
在 2021/6/29 上午11:56, Yongji Xie 写道: On Tue, Jun 29, 2021 at 11:29 AM Jason Wang wrote: 在 2021/6/29 上午10:26, Yongji Xie 写道: On Mon, Jun 28, 2021 at 12:40 PM Jason Wang wrote: 在 2021/6/25 下午12:19, Yongji Xie 写道: 2b) for set_status(): simply relay the message to userspace, reply

Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-06-28 Thread Jason Wang
在 2021/6/29 上午10:26, Yongji Xie 写道: On Mon, Jun 28, 2021 at 12:40 PM Jason Wang wrote: 在 2021/6/25 下午12:19, Yongji Xie 写道: 2b) for set_status(): simply relay the message to userspace, reply is no needed. Userspace will use a command to update the status when the datapath is stop

Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-06-27 Thread Jason Wang
在 2021/6/25 下午12:19, Yongji Xie 写道: 2b) for set_status(): simply relay the message to userspace, reply is no needed. Userspace will use a command to update the status when the datapath is stop. The the status could be fetched via get_stats(). 2b looks more spec complaint. Looks good to me.

Re: [PATCH v8 00/10] Introduce VDUSE - vDPA Device in Userspace

2021-06-27 Thread Jason Wang
在 2021/6/28 下午6:33, Liu Xiaodong 写道: On Tue, Jun 15, 2021 at 10:13:21PM +0800, Xie Yongji wrote: This series introduces a framework that makes it possible to implement software-emulated vDPA devices in userspace. And to make it simple, the emulated vDPA device's control path is handled in the

Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-06-24 Thread Jason Wang
在 2021/6/24 下午5:16, Yongji Xie 写道: On Thu, Jun 24, 2021 at 4:14 PM Jason Wang wrote: 在 2021/6/24 下午12:46, Yongji Xie 写道: So we need to deal with both FEATURES_OK and reset, but probably not DRIVER_OK. OK, I see. Thanks for the explanation. One more question is how about clearing

Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-06-24 Thread Jason Wang
在 2021/6/24 下午12:46, Yongji Xie 写道: So we need to deal with both FEATURES_OK and reset, but probably not DRIVER_OK. OK, I see. Thanks for the explanation. One more question is how about clearing the corresponding status bit in get_status() rather than making set_status() fail. Since the spec

Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-06-23 Thread Jason Wang
在 2021/6/23 下午1:50, Yongji Xie 写道: On Wed, Jun 23, 2021 at 11:31 AM Jason Wang wrote: 在 2021/6/22 下午4:14, Yongji Xie 写道: On Tue, Jun 22, 2021 at 3:50 PM Jason Wang wrote: 在 2021/6/22 下午3:22, Yongji Xie 写道: We need fix a way to propagate the error to the userspace. E.g if we want to stop

Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-06-22 Thread Jason Wang
在 2021/6/22 下午4:14, Yongji Xie 写道: On Tue, Jun 22, 2021 at 3:50 PM Jason Wang wrote: 在 2021/6/22 下午3:22, Yongji Xie 写道: We need fix a way to propagate the error to the userspace. E.g if we want to stop the deivce, we will delay the status reset until we get respose from the userspace? I

Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-06-22 Thread Jason Wang
在 2021/6/22 下午3:22, Yongji Xie 写道: We need fix a way to propagate the error to the userspace. E.g if we want to stop the deivce, we will delay the status reset until we get respose from the userspace? I didn't get how to delay the status reset. And should it be a DoS that we want to fix if

Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-06-21 Thread Jason Wang
在 2021/6/21 下午6:41, Yongji Xie 写道: On Mon, Jun 21, 2021 at 5:14 PM Jason Wang wrote: 在 2021/6/15 下午10:13, Xie Yongji 写道: This VDUSE driver enables implementing vDPA devices in userspace. The vDPA device's control path is handled in kernel and the data path is handled in userspace

Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-06-21 Thread Jason Wang
在 2021/6/15 下午10:13, Xie Yongji 写道: This VDUSE driver enables implementing vDPA devices in userspace. The vDPA device's control path is handled in kernel and the data path is handled in userspace. A message mechnism is used by VDUSE driver to forward some control messages such as

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-10 Thread Jason Wang
在 2021/6/10 下午7:47, Jason Gunthorpe 写道: On Thu, Jun 10, 2021 at 10:00:01AM +0800, Jason Wang wrote: 在 2021/6/8 下午9:20, Jason Gunthorpe 写道: On Tue, Jun 08, 2021 at 09:10:42AM +0800, Jason Wang wrote: Well, this sounds like a re-invention of io_uring which has already worked for multifds

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-09 Thread Jason Wang
在 2021/6/10 上午10:00, Jason Wang 写道: 在 2021/6/8 下午9:20, Jason Gunthorpe 写道: On Tue, Jun 08, 2021 at 09:10:42AM +0800, Jason Wang wrote: Well, this sounds like a re-invention of io_uring which has already worked for multifds. How so? io_uring is about sending work to the kernel, not getting

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-09 Thread Jason Wang
在 2021/6/8 下午6:45, Enrico Weigelt, metux IT consult 写道: On 07.06.21 20:01, Jason Gunthorpe wrote: it is what it is, select has a fixed size bitmap of FD #s and a hard upper bound on that size as part of the glibc ABI - can't be fixed. in glibc ABI ? Uuuuh! Note that dealing with select()

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-09 Thread Jason Wang
在 2021/6/8 下午9:20, Jason Gunthorpe 写道: On Tue, Jun 08, 2021 at 09:10:42AM +0800, Jason Wang wrote: Well, this sounds like a re-invention of io_uring which has already worked for multifds. How so? io_uring is about sending work to the kernel, not getting structued events back? Actually

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-07 Thread Jason Wang
在 2021/6/8 上午3:41, Alex Williamson 写道: On Mon, 7 Jun 2021 16:08:02 -0300 Jason Gunthorpe wrote: On Mon, Jun 07, 2021 at 12:59:46PM -0600, Alex Williamson wrote: It is up to qemu if it wants to proceed or not. There is no issue with allowing the use of no-snoop and blocking wbinvd, other

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-07 Thread Jason Wang
在 2021/6/3 上午1:21, Jason Gunthorpe 写道: On Wed, Jun 02, 2021 at 04:54:26PM +0800, Jason Wang wrote: 在 2021/6/2 上午1:31, Jason Gunthorpe 写道: On Tue, Jun 01, 2021 at 04:47:15PM +0800, Jason Wang wrote: We can open up to ~0U file descriptors, I don't see why we need to restrict it in uAPI

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-07 Thread Jason Wang
在 2021/6/7 下午10:14, Jason Gunthorpe 写道: On Mon, Jun 07, 2021 at 11:18:33AM +0800, Jason Wang wrote: Note that no drivers call these things doesn't meant it was not supported by the spec. Of course it does. If the spec doesn't define exactly when the driver should call the cache flushes

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-06 Thread Jason Wang
在 2021/6/4 下午7:58, Jason Gunthorpe 写道: On Fri, Jun 04, 2021 at 09:11:03AM +0800, Jason Wang wrote: nor do any virtio drivers implement the required platform specific cache flushing to make no-snoop TLPs work. I don't get why virtio drivers needs to do that. I think DMA API should hide those

Re: [PATCH v1 1/8] virtio: Force only split mode with protected guest

2021-06-03 Thread Jason Wang
在 2021/6/3 下午9:55, Andi Kleen 写道: Ok, but what I meant is this, if we don't read from the descriptor ring, and validate all the other metadata supplied by the device (used id and len). Then there should be no way for the device to suppress the dma flags to write to the indirect descriptor

Re: [PATCH v1 1/8] virtio: Force only split mode with protected guest

2021-06-03 Thread Jason Wang
在 2021/6/4 上午1:33, Andy Lutomirski 写道: On 6/2/21 5:41 PM, Andi Kleen wrote: Only allow split mode when in a protected guest. Followon patches harden the split mode code paths, and we don't want an malicious host to force anything else. Also disallow indirect mode for similar reasons. I read

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-03 Thread Jason Wang
在 2021/6/4 上午2:19, Jacob Pan 写道: Hi Shenming, On Wed, 2 Jun 2021 12:50:26 +0800, Shenming Lu wrote: On 2021/6/2 1:33, Jason Gunthorpe wrote: On Tue, Jun 01, 2021 at 08:30:35PM +0800, Lu Baolu wrote: The drivers register per page table fault handlers to /dev/ioasid which will then

Re: [PATCH v1 1/8] virtio: Force only split mode with protected guest

2021-06-03 Thread Jason Wang
在 2021/6/4 上午2:00, Andi Kleen 写道: On 6/3/2021 10:33 AM, Andy Lutomirski wrote: On 6/2/21 5:41 PM, Andi Kleen wrote: Only allow split mode when in a protected guest. Followon patches harden the split mode code paths, and we don't want an malicious host to force anything else. Also disallow

Re: [PATCH v1 1/8] virtio: Force only split mode with protected guest

2021-06-03 Thread Jason Wang
在 2021/6/4 上午3:31, Andy Lutomirski 写道: On Thu, Jun 3, 2021, at 11:00 AM, Andi Kleen wrote: On 6/3/2021 10:33 AM, Andy Lutomirski wrote: On 6/2/21 5:41 PM, Andi Kleen wrote: Only allow split mode when in a protected guest. Followon patches harden the split mode code paths, and we don't want

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-03 Thread Jason Wang
在 2021/6/3 下午9:09, Jason Gunthorpe 写道: On Thu, Jun 03, 2021 at 10:52:51AM +0800, Jason Wang wrote: Basically, we don't want to bother with pseudo KVM device like what VFIO did. So for simplicity, we rules out the IOMMU that can't enforce coherency in vhost-vDPA if the parent purely depends

Re: [PATCH v1 1/8] virtio: Force only split mode with protected guest

2021-06-02 Thread Jason Wang
在 2021/6/3 上午10:56, Andi Kleen 写道: I agree, but I want to know why indirect descriptor needs to be disabled. The table can't be wrote by the device since it's not coherent swiotlb mapping. I had all kinds of problems with uninitialized entries in the indirect table. So I gave up on it

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-02 Thread Jason Wang
在 2021/6/3 上午4:37, Alex Williamson 写道: On Wed, 2 Jun 2021 16:54:04 -0300 Jason Gunthorpe wrote: On Wed, Jun 02, 2021 at 01:00:53PM -0600, Alex Williamson wrote: Right, the device can generate the no-snoop transactions, but it's the IOMMU that essentially determines whether those

Re: [PATCH v1 2/8] virtio: Add boundary checks to virtio ring

2021-06-02 Thread Jason Wang
在 2021/6/3 上午10:18, Andi Kleen 写道: It looks to me all the evils came from the fact that we depends on the descriptor ring. So the checks in this patch could is unnecessary if we don't even read from the descriptor ring which could be manipulated by the device. This is what my series

Re: [PATCH v1 1/8] virtio: Force only split mode with protected guest

2021-06-02 Thread Jason Wang
在 2021/6/3 上午9:48, Andi Kleen 写道: So we will see huge performance regression without indirect descriptor. We need to consider to address this. A regression would be when some existing case would be slower. That's not the case because the behavior for the existing cases does not change.

Re: [PATCH v1 3/8] virtio: Harden split buffer detachment

2021-06-02 Thread Jason Wang
在 2021/6/3 上午8:41, Andi Kleen 写道: Harden the split buffer detachment path by adding boundary checking. Note that when this fails we may fail to unmap some swiotlb mapping, which could result in a leak and a DOS. But that's acceptable because an malicious host can DOS us anyways. Signed-off-by:

Re: [PATCH v1 2/8] virtio: Add boundary checks to virtio ring

2021-06-02 Thread Jason Wang
在 2021/6/3 上午8:41, Andi Kleen 写道: In protected guest mode we don't trust the host. This means we need to make sure the host cannot subvert us through virtio communication. In general it can corrupt our virtio data and cause a DOS, but it should not be able to access any data that is not

Re: [PATCH v1 1/8] virtio: Force only split mode with protected guest

2021-06-02 Thread Jason Wang
在 2021/6/3 上午8:41, Andi Kleen 写道: When running under TDX the virtio host is untrusted. The bulk of the kernel memory is encrypted and protected, but the virtio ring is in special shared memory that is shared with the untrusted host. This means virtio needs to be hardened against any attacks

Re: Virtio hardening for TDX

2021-06-02 Thread Jason Wang
在 2021/6/3 上午8:41, Andi Kleen 写道: [v1: Initial post] With confidential computing like TDX the guest doesn't trust the host anymore. The host is allowed to DOS of course, but it is not allowed to read or write any guest memory not explicitely shared with it. This has implication for virtio.

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-02 Thread Jason Wang
在 2021/6/2 上午1:29, Jason Gunthorpe 写道: On Tue, Jun 01, 2021 at 02:07:05PM +0800, Jason Wang wrote: For the case of 1M, I would like to know what's the use case for a single process to handle 1M+ address spaces? For some scenarios every guest PASID will require a IOASID ID # so

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-02 Thread Jason Wang
在 2021/6/2 上午1:31, Jason Gunthorpe 写道: On Tue, Jun 01, 2021 at 04:47:15PM +0800, Jason Wang wrote: We can open up to ~0U file descriptors, I don't see why we need to restrict it in uAPI. There are significant problems with such large file descriptor tables. High FD numbers man things like

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-02 Thread Jason Wang
在 2021/6/2 上午4:28, Jason Gunthorpe 写道: I summarized five opens here, about: 1) Finalizing the name to replace /dev/ioasid; 2) Whether one device is allowed to bind to multiple IOASID fd's; 3) Carry device information in invalidation/fault reporting uAPI; 4) What should/could be specified

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-01 Thread Jason Wang
在 2021/6/1 下午2:16, Tian, Kevin 写道: From: Jason Wang Sent: Tuesday, June 1, 2021 2:07 PM 在 2021/6/1 下午1:42, Tian, Kevin 写道: From: Jason Wang Sent: Tuesday, June 1, 2021 1:30 PM 在 2021/6/1 下午1:23, Lu Baolu 写道: Hi Jason W, On 6/1/21 1:08 PM, Jason Wang wrote: 2) If yes, what's the reason

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-01 Thread Jason Wang
在 2021/6/1 下午1:42, Tian, Kevin 写道: From: Jason Wang Sent: Tuesday, June 1, 2021 1:30 PM 在 2021/6/1 下午1:23, Lu Baolu 写道: Hi Jason W, On 6/1/21 1:08 PM, Jason Wang wrote: 2) If yes, what's the reason for not simply use the fd opened from /dev/ioas. (This is the question that is not answered

Re: [RFC] /dev/ioasid uAPI proposal

2021-05-31 Thread Jason Wang
在 2021/6/1 下午1:23, Lu Baolu 写道: Hi Jason W, On 6/1/21 1:08 PM, Jason Wang wrote: 2) If yes, what's the reason for not simply use the fd opened from /dev/ioas. (This is the question that is not answered) and what happens if we call GET_INFO for the ioasid_fd? 3) If not, how GET_INFO work

Re: [RFC] /dev/ioasid uAPI proposal

2021-05-31 Thread Jason Wang
在 2021/6/1 下午12:27, Shenming Lu 写道: On 2021/6/1 10:36, Jason Wang wrote: 在 2021/5/31 下å�ˆ4:41, Liu Yi L 写é�“: I guess VFIO_ATTACH_IOASID will fail if the underlayer doesn't support hardware nesting. Or is there way to detect the capability before? I think it could fail

Re: [RFC] /dev/ioasid uAPI proposal

2021-05-31 Thread Jason Wang
在 2021/6/1 上午11:31, Liu Yi L 写道: On Tue, 1 Jun 2021 10:36:36 +0800, Jason Wang wrote: 在 2021/5/31 下午4:41, Liu Yi L 写道: I guess VFIO_ATTACH_IOASID will fail if the underlayer doesn't support hardware nesting. Or is there way to detect the capability before? I think it could fail

Re: [RFC] /dev/ioasid uAPI proposal

2021-05-31 Thread Jason Wang
在 2021/5/31 下午4:41, Liu Yi L 写道: I guess VFIO_ATTACH_IOASID will fail if the underlayer doesn't support hardware nesting. Or is there way to detect the capability before? I think it could fail in the IOASID_CREATE_NESTING. If the gpa_ioasid is not able to support nesting, then should fail it.

Re: [PATCH v7 11/12] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-05-30 Thread Jason Wang
在 2021/5/31 下午12:27, Yongji Xie 写道: On Fri, May 28, 2021 at 10:31 AM Jason Wang wrote: 在 2021/5/27 下午9:17, Yongji Xie 写道: On Thu, May 27, 2021 at 4:41 PM Jason Wang wrote: 在 2021/5/27 下午3:34, Yongji Xie 写道: On Thu, May 27, 2021 at 1:40 PM Jason Wang wrote: 在 2021/5/27 下午1:08, Yongji

Re: [PATCH v7 11/12] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-05-28 Thread Jason Wang
在 2021/5/28 上午11:54, Yongji Xie 写道: On Fri, May 28, 2021 at 9:33 AM Jason Wang wrote: 在 2021/5/27 下午6:14, Yongji Xie 写道: On Thu, May 27, 2021 at 4:43 PM Jason Wang wrote: 在 2021/5/27 下午4:41, Jason Wang 写道: 在 2021/5/27 下午3:34, Yongji Xie 写道: On Thu, May 27, 2021 at 1:40 PM Jason Wang

Re: [PATCH v7 11/12] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-05-27 Thread Jason Wang
在 2021/5/27 下午9:17, Yongji Xie 写道: On Thu, May 27, 2021 at 4:41 PM Jason Wang wrote: 在 2021/5/27 下午3:34, Yongji Xie 写道: On Thu, May 27, 2021 at 1:40 PM Jason Wang wrote: 在 2021/5/27 下午1:08, Yongji Xie 写道: On Thu, May 27, 2021 at 1:00 PM Jason Wang wrote: 在 2021/5/27 下午12:57, Yongji Xie

Re: [RFC] /dev/ioasid uAPI proposal

2021-05-27 Thread Jason Wang
在 2021/5/27 下午3:58, Tian, Kevin 写道: /dev/ioasid provides an unified interface for managing I/O page tables for devices assigned to userspace. Device passthrough frameworks (VFIO, vDPA, etc.) are expected to use this interface instead of creating their own logic to isolate untrusted device DMAs

Re: [PATCH v7 11/12] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-05-27 Thread Jason Wang
在 2021/5/27 下午6:14, Yongji Xie 写道: On Thu, May 27, 2021 at 4:43 PM Jason Wang wrote: 在 2021/5/27 下午4:41, Jason Wang 写道: 在 2021/5/27 下午3:34, Yongji Xie 写道: On Thu, May 27, 2021 at 1:40 PM Jason Wang wrote: 在 2021/5/27 下午1:08, Yongji Xie 写道: On Thu, May 27, 2021 at 1:00 PM Jason Wang

Re: [PATCH v7 11/12] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-05-27 Thread Jason Wang
在 2021/5/27 下午4:41, Jason Wang 写道: 在 2021/5/27 下午3:34, Yongji Xie 写道: On Thu, May 27, 2021 at 1:40 PM Jason Wang wrote: 在 2021/5/27 下午1:08, Yongji Xie 写道: On Thu, May 27, 2021 at 1:00 PM Jason Wang wrote: 在 2021/5/27 下午12:57, Yongji Xie 写道: On Thu, May 27, 2021 at 12:13 PM Jason Wang

Re: [PATCH v7 11/12] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-05-27 Thread Jason Wang
在 2021/5/27 下午3:34, Yongji Xie 写道: On Thu, May 27, 2021 at 1:40 PM Jason Wang wrote: 在 2021/5/27 下午1:08, Yongji Xie 写道: On Thu, May 27, 2021 at 1:00 PM Jason Wang wrote: 在 2021/5/27 下午12:57, Yongji Xie 写道: On Thu, May 27, 2021 at 12:13 PM Jason Wang wrote: 在 2021/5/17 下午5:55, Xie

Re: [PATCH v7 11/12] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-05-26 Thread Jason Wang
在 2021/5/27 下午1:08, Yongji Xie 写道: On Thu, May 27, 2021 at 1:00 PM Jason Wang wrote: 在 2021/5/27 下午12:57, Yongji Xie 写道: On Thu, May 27, 2021 at 12:13 PM Jason Wang wrote: 在 2021/5/17 下午5:55, Xie Yongji 写道: + +static int vduse_dev_msg_sync(struct vduse_dev *dev

Re: [PATCH v7 11/12] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-05-26 Thread Jason Wang
在 2021/5/27 下午12:57, Yongji Xie 写道: On Thu, May 27, 2021 at 12:13 PM Jason Wang wrote: 在 2021/5/17 下午5:55, Xie Yongji 写道: + +static int vduse_dev_msg_sync(struct vduse_dev *dev, + struct vduse_dev_msg *msg) +{ + init_waitqueue_head(>waitq); + spin_l

Re: [PATCH v7 11/12] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-05-26 Thread Jason Wang
在 2021/5/17 下午5:55, Xie Yongji 写道: + +static int vduse_dev_msg_sync(struct vduse_dev *dev, + struct vduse_dev_msg *msg) +{ + init_waitqueue_head(>waitq); + spin_lock(>msg_lock); + vduse_enqueue_msg(>send_list, msg); + wake_up(>waitq); +

Re: [PATCH v7 05/12] virtio_scsi: Add validation for residual bytes from response

2021-05-25 Thread Jason Wang
scsi_cmnd *sc, u32 resid) { if (resid) - scsi_set_resid(sc, resid); + scsi_set_resid(sc, min(resid, scsi_bufflen(sc))); } /* Acked-by: Jason Wang ___ iommu mailing list iommu@lists.linux-foundation.org

Re: [PATCH v7 01/12] iova: Export alloc_iova_fast()

2021-05-25 Thread Jason Wang
在 2021/5/17 下午5:55, Xie Yongji 写道: Export alloc_iova_fast() so that some modules can use it to improve iova allocation efficiency. Signed-off-by: Xie Yongji --- drivers/iommu/iova.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index

  1   2   >