Re: [PATCH net-next] xsk: introduce xsk_dma_ops

2023-04-16 Thread Xuan Zhuo
On Mon, 17 Apr 2023 02:43:32 -0400, "Michael S. Tsirkin" wrote: > On Mon, Apr 17, 2023 at 11:27:50AM +0800, Xuan Zhuo wrote: > > @@ -532,9 +545,9 @@ struct xdp_buff *xp_alloc(struct xsk_buff_pool *pool) > > xskb->xdp.data_meta = xskb->xdp.data; > > > > if (pool->dma_need_sync) { > > -

Re: [PATCH net-next] xsk: introduce xsk_dma_ops

2023-04-16 Thread kernel test robot
%40linux.alibaba.com patch subject: [PATCH net-next] xsk: introduce xsk_dma_ops config: mips-randconfig-r021-20230416 (https://download.01.org/0day-ci/archive/20230417/202304171441.ezrwcnsh-...@intel.com/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project

Re: [PATCH net] virtio-net: reject small vring sizes

2023-04-16 Thread Alvaro Karsz
> > Check vring size and fail probe if a transmit/receive vring size is > > smaller than MAX_SKB_FRAGS + 2. > > > > At the moment, any vring size is accepted. This is problematic because > > it may result in attempting to transmit a packet with more fragments > > than there are descriptors in the r

Re: [PATCH net] virtio-net: reject small vring sizes

2023-04-16 Thread Xuan Zhuo
On Mon, 17 Apr 2023 06:38:43 +, Alvaro Karsz wrote: > > Actually, I think that all you need to do is disable NETIF_F_SG, > > and things will work, no? > > I think that this is not so simple, if I understand correctly, by disabling > NETIF_F_SG we will never receive a chained skbs to transmit

Re: [PATCH net-next] xsk: introduce xsk_dma_ops

2023-04-16 Thread Michael S. Tsirkin
On Mon, Apr 17, 2023 at 11:27:50AM +0800, Xuan Zhuo wrote: > @@ -532,9 +545,9 @@ struct xdp_buff *xp_alloc(struct xsk_buff_pool *pool) > xskb->xdp.data_meta = xskb->xdp.data; > > if (pool->dma_need_sync) { > - dma_sync_single_range_for_device(pool->dev, xskb->dma, 0, > -

Re: [PATCH net] virtio-net: reject small vring sizes

2023-04-16 Thread Alvaro Karsz
> > +static int virtnet_validate_vqs(struct virtnet_info *vi) > > +{ > > + u32 i, min_size = roundup_pow_of_two(MAX_SKB_FRAGS + 2); > > why power of two? The ring size is always a power of 2, so checking against MAX_SKB_FRAGS + 2 or against roundup_pow_of_two will result in the same, and I t

Re: [PATCH net] virtio-net: reject small vring sizes

2023-04-16 Thread Michael S. Tsirkin
On Mon, Apr 17, 2023 at 06:38:43AM +, Alvaro Karsz wrote: > > Actually, I think that all you need to do is disable NETIF_F_SG, > > and things will work, no? > > I think that this is not so simple, if I understand correctly, by disabling > NETIF_F_SG we will never receive a chained skbs to tra

Re: [PATCH net] virtio-net: reject small vring sizes

2023-04-16 Thread Alvaro Karsz
> Actually, I think that all you need to do is disable NETIF_F_SG, > and things will work, no? I think that this is not so simple, if I understand correctly, by disabling NETIF_F_SG we will never receive a chained skbs to transmit, but we still have more functionality to address, for example: *

Re: [PATCH net-next] xsk: introduce xsk_dma_ops

2023-04-16 Thread kernel test robot
Hi Xuan, kernel test robot noticed the following build errors: [auto build test ERROR on net-next/main] url: https://github.com/intel-lab-lkp/linux/commits/Xuan-Zhuo/xsk-introduce-xsk_dma_ops/20230417-112903 patch link: https://lore.kernel.org/r/20230417032750.7086-1-xuanzhuo%40linux.ali

Re: [PATCH net] virtio-net: reject small vring sizes

2023-04-16 Thread Michael S. Tsirkin
On Mon, Apr 17, 2023 at 11:24:16AM +0800, Jason Wang wrote: > On Mon, Apr 17, 2023 at 4:45 AM Michael S. Tsirkin wrote: > > > > On Sun, Apr 16, 2023 at 04:54:57PM +, Alvaro Karsz wrote: > > > After further consideration, other virtio drivers need a minimum limit to > > > the vring size too. >

Re: [PATCH net-next] xsk: introduce xsk_dma_ops

2023-04-16 Thread Xuan Zhuo
On Sun, 16 Apr 2023 21:24:32 -0700, Christoph Hellwig wrote: > On Mon, Apr 17, 2023 at 11:27:50AM +0800, Xuan Zhuo wrote: > > The purpose of this patch is to allow driver pass the own dma_ops to > > xsk. > > Drivers have no business passing around dma_ops, or even knowing about > them. May misu

Re: [PATCH net-next] xsk: introduce xsk_dma_ops

2023-04-16 Thread Christoph Hellwig
On Mon, Apr 17, 2023 at 11:27:50AM +0800, Xuan Zhuo wrote: > The purpose of this patch is to allow driver pass the own dma_ops to > xsk. Drivers have no business passing around dma_ops, or even knowing about them. ___ Virtualization mailing list Virtuali

Re: [PATCH net-next V2 1/2] virtio-net: convert rx mode setting to use workqueue

2023-04-16 Thread Jason Wang
On Fri, Apr 14, 2023 at 3:21 PM Michael S. Tsirkin wrote: > > On Fri, Apr 14, 2023 at 01:04:15PM +0800, Jason Wang wrote: > > Forget to cc netdev, adding. > > > > On Fri, Apr 14, 2023 at 12:25 AM Michael S. Tsirkin wrote: > > > > > > On Thu, Apr 13, 2023 at 02:40:26PM +0800, Jason Wang wrote: > >

Re: [PATCH net] virtio-net: reject small vring sizes

2023-04-16 Thread Xuan Zhuo
On Sun, 16 Apr 2023 10:46:07 +0300, Alvaro Karsz wrote: > Check vring size and fail probe if a transmit/receive vring size is > smaller than MAX_SKB_FRAGS + 2. > > At the moment, any vring size is accepted. This is problematic because > it may result in attempting to transmit a packet with more f

Re: [PATCH v2] vhost_vdpa: fix unmap process in no-batch mode

2023-04-16 Thread Jason Wang
On Sat, Apr 15, 2023 at 10:20 AM Cindy Lu wrote: > > While using the no-batch mode with vIOMMU enabled > Qemu will call a large memory to unmap. Much larger than the memory > mapped to the kernel. The iotlb is NULL in the kernel and will return fail. This patch looks good but I don't understand t

[PATCH net-next] xsk: introduce xsk_dma_ops

2023-04-16 Thread Xuan Zhuo
The purpose of this patch is to allow driver pass the own dma_ops to xsk. This is to cope with the scene of virtio-net. If virtio does not have VIRTIO_F_ACCESS_PLATFORM, then virtio cannot use DMA API. In this case, XSK cannot use DMA API directly to achieve DMA address. Based on this scene, we mu

Re: [PATCH net] virtio-net: reject small vring sizes

2023-04-16 Thread Jason Wang
On Mon, Apr 17, 2023 at 4:45 AM Michael S. Tsirkin wrote: > > On Sun, Apr 16, 2023 at 04:54:57PM +, Alvaro Karsz wrote: > > After further consideration, other virtio drivers need a minimum limit to > > the vring size too. > > > > Maybe this can be more general, for example a new virtio_driver

[PATCH v3 RESEND 2/2] tools/virtio: fix build caused by virtio_ring changes

2023-04-16 Thread Shunsuke Mie
Fix the build dependency for virtio_test. The virtio_ring that is used from the test requires container_of_const(). Change to use container_of.h kernel header directly and adapt related codes. Signed-off-by: Shunsuke Mie --- Changes from v2: https://lore.kernel.org/virtualization/20230410112845.

[PATCH v3 RESEND 1/2] virtio_ring: add a struct device forward declaration

2023-04-16 Thread Shunsuke Mie
The virtio_ring header file uses the struct device without a forward declaration. Signed-off-by: Shunsuke Mie --- Changes from v2: https://lore.kernel.org/virtualization/20230410074929-mutt-send-email-...@kernel.org/ - Fix a typo of commit title include/linux/virtio_ring.h | 1 + 1 file chang

Re: [EXT] [RFC PATCH 0/3] Introduce a PCIe endpoint virtio console

2023-04-16 Thread Shunsuke Mie
On 2023/04/14 23:39, Frank Li wrote: -Original Message- From: Shunsuke Mie Sent: Friday, April 14, 2023 7:39 AM To: Lorenzo Pieralisi Cc: Krzysztof Wilczyński ; Manivannan Sadhasivam ; Kishon Vijay Abraham I ; Bjorn Helgaas ; Michael S. Tsirkin ; Jason Wang ; Shunsuke Mie ; Frank Li

Re: [PATCH net] virtio-net: reject small vring sizes

2023-04-16 Thread Xuan Zhuo
On Sun, 16 Apr 2023 10:46:07 +0300, Alvaro Karsz wrote: > Check vring size and fail probe if a transmit/receive vring size is > smaller than MAX_SKB_FRAGS + 2. > > At the moment, any vring size is accepted. This is problematic because > it may result in attempting to transmit a packet with more f

Re: [PATCH net] virtio-net: reject small vring sizes

2023-04-16 Thread Michael S. Tsirkin
On Sun, Apr 16, 2023 at 04:54:57PM +, Alvaro Karsz wrote: > After further consideration, other virtio drivers need a minimum limit to the > vring size too. > > Maybe this can be more general, for example a new virtio_driver callback that > is called (if implemented) during virtio_dev_probe,

Re: [PATCH net] virtio-net: reject small vring sizes

2023-04-16 Thread Michael S. Tsirkin
On Sun, Apr 16, 2023 at 10:46:07AM +0300, Alvaro Karsz wrote: > Check vring size and fail probe if a transmit/receive vring size is > smaller than MAX_SKB_FRAGS + 2. > > At the moment, any vring size is accepted. This is problematic because > it may result in attempting to transmit a packet with m

Re: [PATCH net] virtio-net: reject small vring sizes

2023-04-16 Thread Alvaro Karsz
After further consideration, other virtio drivers need a minimum limit to the vring size too. Maybe this can be more general, for example a new virtio_driver callback that is called (if implemented) during virtio_dev_probe, before drv->probe. What do you think? Thanks, Alvaro _

[PATCH net] virtio-net: reject small vring sizes

2023-04-16 Thread Alvaro Karsz
Check vring size and fail probe if a transmit/receive vring size is smaller than MAX_SKB_FRAGS + 2. At the moment, any vring size is accepted. This is problematic because it may result in attempting to transmit a packet with more fragments than there are descriptors in the ring. Furthermore, it l