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

2023-04-30 Thread Christoph Hellwig
On Thu, Apr 20, 2023 at 06:42:17PM +0200, Alexander Lobakin wrote: > When there's no recycling of pages, then yes. And since recycling is > done asynchronously, sometimes new allocations happen either way. > Anyways, that was roughly a couple years ago right when you introduced >

Re: [PATCH vhost v7 01/11] virtio_ring: split: separate dma codes

2023-04-30 Thread Christoph Hellwig
> +static dma_addr_t vring_sg_address(struct scatterlist *sg) > +{ > + if (sg->dma_address) > + return sg->dma_address; 0 is a perfectly valid DMA address. So I have no idea how this is even supposed to work. ___ Virtualization mailing

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

2023-04-30 Thread Christoph Hellwig
On Tue, Apr 25, 2023 at 04:12:05AM -0400, Michael S. Tsirkin wrote: > In theory, absolutely. In practice modern virtio devices are ok, > the reason we are stuck supporting old legacy ones is because legacy > devices are needed to run old guests. And then people turn > around and run a new guest on

Re: [RFC PATCH net 2/3] virtio-net: allow usage of vrings smaller than MAX_SKB_FRAGS + 2

2023-04-30 Thread Alvaro Karsz
> > At the moment, if a network device uses vrings with less than > > MAX_SKB_FRAGS + 2 entries, the device won't be functional. > > > > The following condition vq->num_free >= 2 + MAX_SKB_FRAGS will always > > evaluate to false, leading to TX timeouts. > > > > This patch introduces a new

Re: [RFC PATCH net 1/3] virtio: re-negotiate features if probe fails and features are blocked

2023-04-30 Thread Alvaro Karsz
> > +void virtio_block_feature(struct virtio_device *dev, unsigned int f) > > +{ > > + BUG_ON(f >= 64); > > + dev->blocked_features |= (1ULL << f); > > +} > > +EXPORT_SYMBOL_GPL(virtio_block_feature); > > + > > Let's add documentation please. Also pls call it __virtio_block_feature >

Re: [RFC PATCH net 0/3] virtio-net: allow usage of small vrings

2023-04-30 Thread Alvaro Karsz
> > This patchset follows a discussion in the mailing list [1]. > > > > This fixes only part of the bug, rings with less than 4 entries won't > > work. > > Why the difference? > Because the RING_SIZE < 4 case requires much more adjustments. * We may need to squeeze the virtio header into the

Re: [RFC PATCH net 0/3] virtio-net: allow usage of small vrings

2023-04-30 Thread Michael S. Tsirkin
On Sun, Apr 30, 2023 at 04:15:15PM +0300, Alvaro Karsz wrote: > At the moment, if a virtio network device uses vrings with less than > MAX_SKB_FRAGS + 2 entries, the device won't be functional. > > The following condition vq->num_free >= 2 + MAX_SKB_FRAGS will always > evaluate to false, leading

Re: [RFC PATCH net 2/3] virtio-net: allow usage of vrings smaller than MAX_SKB_FRAGS + 2

2023-04-30 Thread Michael S. Tsirkin
On Sun, Apr 30, 2023 at 04:15:17PM +0300, Alvaro Karsz wrote: > At the moment, if a network device uses vrings with less than > MAX_SKB_FRAGS + 2 entries, the device won't be functional. > > The following condition vq->num_free >= 2 + MAX_SKB_FRAGS will always > evaluate to false, leading to TX

Re: [RFC PATCH net 1/3] virtio: re-negotiate features if probe fails and features are blocked

2023-04-30 Thread Michael S. Tsirkin
On Sun, Apr 30, 2023 at 04:15:16PM +0300, Alvaro Karsz wrote: > This patch exports a new virtio core function: virtio_block_feature. > The function should be called during a virtio driver probe. > > If a virtio driver blocks features during probe and fails probe, virtio > core will reset the

[RFC PATCH net 3/3] virtio-net: block ethtool from converting a ring to a small ring

2023-04-30 Thread Alvaro Karsz
Stop ethtool from resizing a TX/RX ring to size less than MAX_SKB_FRAGS + 2, if the ring was initialized with a bigger size. We cannot convert a "normal" ring to a "small" ring in runtime. Signed-off-by: Alvaro Karsz --- drivers/net/virtio_net.c | 12 1 file changed, 12

[RFC PATCH net 2/3] virtio-net: allow usage of vrings smaller than MAX_SKB_FRAGS + 2

2023-04-30 Thread Alvaro Karsz
At the moment, if a network device uses vrings with less than MAX_SKB_FRAGS + 2 entries, the device won't be functional. The following condition vq->num_free >= 2 + MAX_SKB_FRAGS will always evaluate to false, leading to TX timeouts. This patch introduces a new variable, single_pkt_max_descs,

[RFC PATCH net 1/3] virtio: re-negotiate features if probe fails and features are blocked

2023-04-30 Thread Alvaro Karsz
This patch exports a new virtio core function: virtio_block_feature. The function should be called during a virtio driver probe. If a virtio driver blocks features during probe and fails probe, virtio core will reset the device, try to re-negotiate the new features and probe again.

[RFC PATCH net 0/3] virtio-net: allow usage of small vrings

2023-04-30 Thread Alvaro Karsz
At the moment, if a virtio network device uses vrings with less than MAX_SKB_FRAGS + 2 entries, the device won't be functional. The following condition vq->num_free >= 2 + MAX_SKB_FRAGS will always evaluate to false, leading to TX timeouts. This patchset attempts this fix this bug, and to allow