DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost: disable host TSO for linear buffers without extbuf
@ 2019-10-17 15:00 Ilya Maximets
  2019-10-24  9:38 ` Maxime Coquelin
  0 siblings, 1 reply; 3+ messages in thread
From: Ilya Maximets @ 2019-10-17 15:00 UTC (permalink / raw)
  To: dev, Maxime Coquelin
  Cc: Flavio Leitner, David Marchand, Tiwei Bie, Ilya Maximets

If linear buffers requested and external buffers are not, vhost
will not be able to receive any buffer that doesn't fit in a
single mbuf.  Moreover, if such a buffer will appear in a vring
it will never be dequeued and the whole vring will become dead
breaking the network connection.

Disable segmentation offloading from the host side to avoid
having such a big buffers.

Cc: Flavio Leitner <fbl@sysclose.org>

Fixes: 5005bcda7123 ("vhost: add support for large buffers")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---

There is still an assumption that users are sane enough to have
MTU sized mbufs in a memory pool and that guest will not change
MTU to higher values.

We, probably, still need to have a check on dequeue path and
drop oversized buffers in case of linear buffers to avoid stuck
of the virtqueue.  Or simply drop support of '+linear -extbuf'
case.

Note: Only compile tested due to lack of HW.

 lib/librte_vhost/socket.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
index 2d3d20804..1036eaad4 100644
--- a/lib/librte_vhost/socket.c
+++ b/lib/librte_vhost/socket.c
@@ -933,6 +933,24 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
 			~(1ULL << VHOST_USER_PROTOCOL_F_PAGEFAULT);
 	}
 
+	/*
+	 * We'll not be able to receive a buffer from guest in linear mode
+	 * without external buffer if it will not fit in a single mbuf, which is
+	 * likely if segmentation offloading enabled.
+	 */
+	if (vsocket->linearbuf && !vsocket->extbuf) {
+		uint64_t seg_offload_features =
+				(1ULL << VIRTIO_NET_F_HOST_TSO4) |
+				(1ULL << VIRTIO_NET_F_HOST_TSO6) |
+				(1ULL << VIRTIO_NET_F_HOST_UFO);
+
+		RTE_LOG(INFO, VHOST_CONFIG,
+			"Linear buffers requested without external buffers, "
+			"disabling host segmentation offloading support\n");
+		vsocket->supported_features &= ~seg_offload_features;
+		vsocket->features &= ~seg_offload_features;
+	}
+
 	if (!(flags & RTE_VHOST_USER_IOMMU_SUPPORT)) {
 		vsocket->supported_features &= ~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
 		vsocket->features &= ~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: disable host TSO for linear buffers without extbuf
  2019-10-17 15:00 [dpdk-dev] [PATCH] vhost: disable host TSO for linear buffers without extbuf Ilya Maximets
@ 2019-10-24  9:38 ` Maxime Coquelin
  2019-10-24 10:18   ` Maxime Coquelin
  0 siblings, 1 reply; 3+ messages in thread
From: Maxime Coquelin @ 2019-10-24  9:38 UTC (permalink / raw)
  To: Ilya Maximets, dev; +Cc: Flavio Leitner, David Marchand, Tiwei Bie



On 10/17/19 5:00 PM, Ilya Maximets wrote:
> If linear buffers requested and external buffers are not, vhost
> will not be able to receive any buffer that doesn't fit in a
> single mbuf.  Moreover, if such a buffer will appear in a vring
> it will never be dequeued and the whole vring will become dead
> breaking the network connection.
> 
> Disable segmentation offloading from the host side to avoid
> having such a big buffers.
> 
> Cc: Flavio Leitner <fbl@sysclose.org>
> 
> Fixes: 5005bcda7123 ("vhost: add support for large buffers")
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> ---
> 
> There is still an assumption that users are sane enough to have
> MTU sized mbufs in a memory pool and that guest will not change
> MTU to higher values.
> 
> We, probably, still need to have a check on dequeue path and
> drop oversized buffers in case of linear buffers to avoid stuck
> of the virtqueue.  Or simply drop support of '+linear -extbuf'
> case.
> 
> Note: Only compile tested due to lack of HW.
> 
>  lib/librte_vhost/socket.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 


Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: disable host TSO for linear buffers without extbuf
  2019-10-24  9:38 ` Maxime Coquelin
@ 2019-10-24 10:18   ` Maxime Coquelin
  0 siblings, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2019-10-24 10:18 UTC (permalink / raw)
  To: Ilya Maximets, dev; +Cc: Flavio Leitner, David Marchand, Tiwei Bie



On 10/24/19 11:38 AM, Maxime Coquelin wrote:
> 
> 
> On 10/17/19 5:00 PM, Ilya Maximets wrote:
>> If linear buffers requested and external buffers are not, vhost
>> will not be able to receive any buffer that doesn't fit in a
>> single mbuf.  Moreover, if such a buffer will appear in a vring
>> it will never be dequeued and the whole vring will become dead
>> breaking the network connection.
>>
>> Disable segmentation offloading from the host side to avoid
>> having such a big buffers.
>>
>> Cc: Flavio Leitner <fbl@sysclose.org>
>>
>> Fixes: 5005bcda7123 ("vhost: add support for large buffers")
>> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
>> ---
>>
>> There is still an assumption that users are sane enough to have
>> MTU sized mbufs in a memory pool and that guest will not change
>> MTU to higher values.
>>
>> We, probably, still need to have a check on dequeue path and
>> drop oversized buffers in case of linear buffers to avoid stuck
>> of the virtqueue.  Or simply drop support of '+linear -extbuf'
>> case.
>>
>> Note: Only compile tested due to lack of HW.
>>
>>  lib/librte_vhost/socket.c | 18 ++++++++++++++++++
>>  1 file changed, 18 insertions(+)
>>
> 
> 
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> 
> Thanks,
> Maxime
> 


Applied to dpdk-next-virtio/master.

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-24 10:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-17 15:00 [dpdk-dev] [PATCH] vhost: disable host TSO for linear buffers without extbuf Ilya Maximets
2019-10-24  9:38 ` Maxime Coquelin
2019-10-24 10:18   ` Maxime Coquelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).