Re: Re: PING: [PATCH] virtio-blk: fix implicit overflow on virtio_max_dma_size

2023-10-19 Thread zhenwei pi via Virtualization
Cc Paolo, Stefan, Xuan and linux-block. On 10/19/23 17:52, Michael S. Tsirkin wrote: On Thu, Oct 19, 2023 at 05:43:55PM +0800, zhenwei pi wrote: Hi Michael, This seems to have been ignored as you suggested. LINK: https://www.spinics.net/lists/linux-virtualization/msg63015.html Pls Cc more w

PING: [PATCH] virtio-blk: fix implicit overflow on virtio_max_dma_size

2023-10-19 Thread zhenwei pi via Virtualization
Hi Michael, This seems to have been ignored as you suggested. LINK: https://www.spinics.net/lists/linux-virtualization/msg63015.html On 9/4/23 14:10, zhenwei pi wrote: The following codes have an implicit conversion from size_t to u32: (u32)max_size = (size_t)virtio_max_dma_size(vdev); This m

Re: Re: [PATCH] crypto: virtio-crypto: call finalize with bh disabled

2023-09-27 Thread zhenwei pi via Virtualization
Hi Michael & Lei, I volunteer to fix this by workqueue. I also notice that device drivers use workqueue to handle config-changed again and again, what about re-implement __virtio_config_changed() by kicking workqueue instead? By the way, balloon dirvers uses spin_lock_irqsave/spin_unlock_ir

[PATCH] virtio-blk: fix implicit overflow on virtio_max_dma_size

2023-09-03 Thread zhenwei pi via Virtualization
The following codes have an implicit conversion from size_t to u32: (u32)max_size = (size_t)virtio_max_dma_size(vdev); This may lead overflow, Ex (size_t)4G -> (u32)0. Once virtio_max_dma_size() has a larger size than U32_MAX, use U32_MAX instead. Signed-off-by: zhenwei pi --- drivers/block/vir

Re: Re: [PATCH] virtio_ring: use u32 for virtio_max_dma_size

2023-07-04 Thread zhenwei pi via Virtualization
On 7/4/23 14:21, Michael S. Tsirkin wrote: On Wed, May 10, 2023 at 10:54:37AM +0800, zhenwei pi wrote: Both split ring and packed ring use 32bits to describe the length of a descriptor: see struct vring_desc and struct vring_packed_desc. This means the max segment size supported by virtio is

PING Re: [PATCH] virtio_ring: use u32 for virtio_max_dma_size

2023-07-03 Thread zhenwei pi via Virtualization
Hi Michael, This seems to be ignored... On 5/10/23 12:06, Michael S. Tsirkin wrote: On Wed, May 10, 2023 at 12:04:50PM +0800, Jason Wang wrote: On Wed, May 10, 2023 at 11:44 AM Michael S. Tsirkin wrote: On Wed, May 10, 2023 at 11:26:54AM +0800, Xuan Zhuo wrote: On Wed, 10 May 2023 10:54:37

Re: Re: Re: Re: [PATCH v2 1/2] virtio: abstract virtqueue related methods

2023-05-18 Thread zhenwei pi via Virtualization
On 5/18/23 18:09, Michael S. Tsirkin wrote: On Thu, May 18, 2023 at 08:47:22AM +0800, zhenwei pi wrote: On 5/17/23 18:39, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 04:35:55PM +0800, zhenwei pi wrote: On 5/17/23 15:46, Christoph Hellwig wrote: On Wed, May 17, 2023 at 03:43:03PM +0

Re: Re: Re: [PATCH v2 1/2] virtio: abstract virtqueue related methods

2023-05-17 Thread zhenwei pi via Virtualization
On 5/17/23 18:39, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 04:35:55PM +0800, zhenwei pi wrote: On 5/17/23 15:46, Christoph Hellwig wrote: On Wed, May 17, 2023 at 03:43:03PM +0800, zhenwei pi wrote: I have a plan to introduce 'Virtio Over Fabrics'(TCP&RDMA) as Virtio transport, as me

Re: Re: [PATCH v2 1/2] virtio: abstract virtqueue related methods

2023-05-17 Thread zhenwei pi via Virtualization
On 5/17/23 15:46, Christoph Hellwig wrote: On Wed, May 17, 2023 at 03:43:03PM +0800, zhenwei pi wrote: I have a plan to introduce 'Virtio Over Fabrics'(TCP&RDMA) as Virtio transport, as mentioned in cover letter of this series: 3 weeks ago, I posted a proposal 'Virtio Over Fabrics': https://l

Re: Re: [PATCH v2 1/2] virtio: abstract virtqueue related methods

2023-05-17 Thread zhenwei pi via Virtualization
On 5/17/23 15:39, Christoph Hellwig wrote: On Wed, May 17, 2023 at 10:54:23AM +0800, zhenwei pi wrote: All the vring based virtqueue methods could be abstratct in theory, MST suggested that add/get bufs and kick functions are quite perfmance sensitive, so export these functions from virtio_ri

Re: Re: Re: Re: [PATCH v2 0/2] virtio: abstract virtqueue related methods

2023-05-16 Thread zhenwei pi via Virtualization
On 5/17/23 14:10, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 12:58:10PM +0800, zhenwei pi wrote: On 5/17/23 11:57, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 11:51:03AM +0800, zhenwei pi wrote: On 5/17/23 11:46, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 10:54:22AM +080

Re: Re: Re: [PATCH v2 0/2] virtio: abstract virtqueue related methods

2023-05-16 Thread zhenwei pi via Virtualization
On 5/17/23 11:57, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 11:51:03AM +0800, zhenwei pi wrote: On 5/17/23 11:46, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 10:54:22AM +0800, zhenwei pi wrote: v1 -> v2: - Suggested by MST, use fast path for vring based performance sensitive AP

Re: Re: [PATCH v2 0/2] virtio: abstract virtqueue related methods

2023-05-16 Thread zhenwei pi via Virtualization
On 5/17/23 11:46, Michael S. Tsirkin wrote: On Wed, May 17, 2023 at 10:54:22AM +0800, zhenwei pi wrote: v1 -> v2: - Suggested by MST, use fast path for vring based performance sensitive API. - Reduce changes in tools/virtio. Add test result(no obvious change): Before: time ./vringh_test --pa

[PATCH v2 0/2] virtio: abstract virtqueue related methods

2023-05-16 Thread zhenwei pi via Virtualization
v1 -> v2: - Suggested by MST, use fast path for vring based performance sensitive API. - Reduce changes in tools/virtio. Add test result(no obvious change): Before: time ./vringh_test --parallel Using CPUS 0 and 191 Guest: notified 10036893, pinged 68278 Host: notified 68278, pinged 3093532 real

[PATCH v2 1/2] virtio: abstract virtqueue related methods

2023-05-16 Thread zhenwei pi via Virtualization
There is already a virtqueue abstract structure in virtio subsystem (see struct virtqueue in include/linux/virtio.h), however the vring based virtqueue is used only in the past years, the virtqueue related methods mix much with vring(just look like the codes, virtqueue_xxx functions are implemented

[PATCH v2 2/2] tools/virtio: implement virtqueue in test

2023-05-16 Thread zhenwei pi via Virtualization
virtqueue related functions has been abstract since commit ("virtio: abstract virtqueue related methods"), add compatible for abstract API. Signed-off-by: zhenwei pi --- tools/virtio/linux/virtio.h | 355 1 file changed, 324 insertions(+), 31 deletions(-) di

Re: Re: Re: [PATCH 1/2] virtio: abstract virtqueue related methods

2023-05-12 Thread zhenwei pi via Virtualization
On 5/12/23 19:35, Michael S. Tsirkin wrote: On Fri, May 12, 2023 at 07:09:40PM +0800, zhenwei pi wrote: On 5/12/23 18:46, Michael S. Tsirkin wrote: On Fri, May 12, 2023 at 05:46:17PM +0800, zhenwei pi wrote: There is already a virtqueue abstract structure in virtio subsystem (see struct virtqu

Re: Re: [PATCH 1/2] virtio: abstract virtqueue related methods

2023-05-12 Thread zhenwei pi via Virtualization
On 5/12/23 18:46, Michael S. Tsirkin wrote: On Fri, May 12, 2023 at 05:46:17PM +0800, zhenwei pi wrote: There is already a virtqueue abstract structure in virtio subsystem (see struct virtqueue in include/linux/virtio.h), however the vring based virtqueue is used only in the past years, the virt

[PATCH 2/2] tools/virtio: implement virtqueue in test

2023-05-12 Thread zhenwei pi via Virtualization
virtqueue related functions has been removed from virtio_ring.c since commit("virtio: abstract virtqueue related methods"), rather than compiling with drivers/virtio/virtio.c, implement virtqueue functions here. Signed-off-by: zhenwei pi --- tools/virtio/Makefile | 4 +- tools/virtio/lin

[PATCH 1/2] virtio: abstract virtqueue related methods

2023-05-12 Thread zhenwei pi via Virtualization
There is already a virtqueue abstract structure in virtio subsystem (see struct virtqueue in include/linux/virtio.h), however the vring based virtqueue is used only in the past years, the virtqueue related methods mix much with vring(just look like the codes, virtqueue_xxx functions are implemented

[PATCH 0/2] virtio: abstract virtqueue related methods

2023-05-12 Thread zhenwei pi via Virtualization
Hi, 3 weeks ago, I posted a proposal 'Virtio Over Fabrics': https://lists.oasis-open.org/archives/virtio-comment/202304/msg00442.html Jason and Stefan pointed out that a non-vring based virtqueue has a chance to overwrite virtqueue instead of using vring virtqueue. Then I try to abstract virtque

Re: Re: [PATCH] virtio_ring: use u32 for virtio_max_dma_size

2023-05-10 Thread zhenwei pi via Virtualization
On 5/10/23 11:26, Xuan Zhuo wrote: On Wed, 10 May 2023 10:54:37 +0800, zhenwei pi wrote: Both split ring and packed ring use 32bits to describe the length of a descriptor: see struct vring_desc and struct vring_packed_desc. This means the max segment size supported by virtio is U32_MAX. An

Re: Re: [PATCH] virtio_ring: use u32 for virtio_max_dma_size

2023-05-09 Thread zhenwei pi via Virtualization
On 5/10/23 11:39, Michael S. Tsirkin wrote: On Wed, May 10, 2023 at 10:54:37AM +0800, zhenwei pi wrote: Both split ring and packed ring use 32bits to describe the length of a descriptor: see struct vring_desc and struct vring_packed_desc. This means the max segment size supported by virtio is

[PATCH] virtio_ring: use u32 for virtio_max_dma_size

2023-05-09 Thread zhenwei pi via Virtualization
Both split ring and packed ring use 32bits to describe the length of a descriptor: see struct vring_desc and struct vring_packed_desc. This means the max segment size supported by virtio is U32_MAX. An example of virtio_max_dma_size in virtio_blk.c: u32 v, max_size; max_size = virtio_max_dma_