[2/2] net/vhost: support mrg-rxbuf disabling

Message ID 1560924825-220648-3-git-send-email-noae@mellanox.com (mailing list archive)
State Rejected, archived
Delegated to: Maxime Coquelin
Headers
Series support tso and mrg-rxbuf disabling |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation fail Compilation issues

Commit Message

Noa Ezra June 19, 2019, 6:13 a.m. UTC
  Rx mergeable buffers is a virtio feature that allows chaining of
multiple virtio descriptors to handle large packet size.
This behavior is supported and enabled by default, however in case
the user knows that rx mergeable buffers are not needed, he can disable
the feature.
The user should also set mrg_rxbuf=off in virtual machine's xml.

Signed-off-by: Noa Ezra <noae@mellanox.com>
Reviewed-by: Matan Azrad <matan@mellanox.com>
---
 doc/guides/nics/vhost.rst         |  5 +++++
 drivers/net/vhost/rte_eth_vhost.c | 17 ++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)
  

Comments

Maxime Coquelin June 19, 2019, 9:10 a.m. UTC | #1
Hi Noa,

On 6/19/19 8:13 AM, Noa Ezra wrote:
> Rx mergeable buffers is a virtio feature that allows chaining of
> multiple virtio descriptors to handle large packet size.
> This behavior is supported and enabled by default, however in case
> the user knows that rx mergeable buffers are not needed, he can disable
> the feature.
> The user should also set mrg_rxbuf=off in virtual machine's xml.

I'm not sure to understand why it is needed, as the vhost-user library
supports the feature, it's better to let it being advertised.

As you say, it is up to the user to disable it in the VM's XML.
Done this way, the feature won't be negotiated.

Moreover, the proposal deadline for v19.08 is over by more than 2 weeks.

Maxime

> Signed-off-by: Noa Ezra <noae@mellanox.com>
> Reviewed-by: Matan Azrad <matan@mellanox.com>
> ---
>   doc/guides/nics/vhost.rst         |  5 +++++
>   drivers/net/vhost/rte_eth_vhost.c | 17 ++++++++++++++++-
>   2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/guides/nics/vhost.rst b/doc/guides/nics/vhost.rst
> index 8cfda4d..2a455b5 100644
> --- a/doc/guides/nics/vhost.rst
> +++ b/doc/guides/nics/vhost.rst
> @@ -81,6 +81,11 @@ The user can specify below arguments in `--vdev` option.
>       It is used to disable tso support in vhost library.
>       (Default: 1 (enabled))
>   
> +#.  ``mrg-rxbuf``:
> +
> +    It is used to disable mrg rxbuf support in vhost library.
> +    (Default: 1 (enabled))
> +
>   Vhost PMD event handling
>   ------------------------
>   
> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> index a38c235..9a54020 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -32,6 +32,7 @@
>   #define ETH_VHOST_IOMMU_SUPPORT		"iommu-support"
>   #define ETH_VHOST_POSTCOPY_SUPPORT	"postcopy-support"
>   #define ETH_VHOST_VIRTIO_NET_F_HOST_TSO "tso"
> +#define ETH_VHOST_VIRTIO_NET_F_MRG_RXBUF "mrg-rxbuf"
>   #define VHOST_MAX_PKT_BURST 32
>   
>   static const char *valid_arguments[] = {
> @@ -42,6 +43,7 @@
>   	ETH_VHOST_IOMMU_SUPPORT,
>   	ETH_VHOST_POSTCOPY_SUPPORT,
>   	ETH_VHOST_VIRTIO_NET_F_HOST_TSO,
> +	ETH_VHOST_VIRTIO_NET_F_MRG_RXBUF,
>   	NULL
>   };
>   
> @@ -1348,6 +1350,7 @@ struct vhost_xstats_name_off {
>   	int iommu_support = 0;
>   	int postcopy_support = 0;
>   	int tso = 1;
> +	int mrg_rxbuf = 1;
>   	struct rte_eth_dev *eth_dev;
>   	const char *name = rte_vdev_device_name(dev);
>   
> @@ -1442,6 +1445,17 @@ struct vhost_xstats_name_off {
>   		}
>   	}
>   
> +	if (rte_kvargs_count(kvlist, ETH_VHOST_VIRTIO_NET_F_MRG_RXBUF) == 1) {
> +		ret = rte_kvargs_process(kvlist,
> +				ETH_VHOST_VIRTIO_NET_F_MRG_RXBUF,
> +				&open_int, &mrg_rxbuf);
> +		if (ret < 0)
> +			goto out_free;
> +
> + 		if (mrg_rxbuf == 0)
> +			disable_flags |= (1ULL << VIRTIO_NET_F_MRG_RXBUF);
> +	}
> +
>   	if (dev->device.numa_node == SOCKET_ID_ANY)
>   		dev->device.numa_node = rte_socket_id();
>   
> @@ -1494,7 +1508,8 @@ struct vhost_xstats_name_off {
>   	"dequeue-zero-copy=<0|1> "
>   	"iommu-support=<0|1> "
>   	"postcopy-support=<0|1> "
> -	"tso=<0|1>");
> +	"tso=<0|1> "
> +	"mrg-rxbuf=<0|1>");
>   
>   RTE_INIT(vhost_init_log)
>   {
>
  
Noa Ezra June 20, 2019, 5:57 a.m. UTC | #2
Hi Maxime,
Thanks for your comment, please see below.

> -----Original Message-----
> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
> Sent: Wednesday, June 19, 2019 12:10 PM
> To: Noa Ezra <noae@mellanox.com>
> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
> Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
> 
> Hi Noa,
> 
> On 6/19/19 8:13 AM, Noa Ezra wrote:
> > Rx mergeable buffers is a virtio feature that allows chaining of
> > multiple virtio descriptors to handle large packet size.
> > This behavior is supported and enabled by default, however in case the
> > user knows that rx mergeable buffers are not needed, he can disable
> > the feature.
> > The user should also set mrg_rxbuf=off in virtual machine's xml.
> 
> I'm not sure to understand why it is needed, as the vhost-user library
> supports the feature, it's better to let it being advertised.
> 
> As you say, it is up to the user to disable it in the VM's XML.
> Done this way, the feature won't be negotiated.
> 
I agree with you, I'll remove this patch from the series.

> Moreover, the proposal deadline for v19.08 is over by more than 2 weeks.
I'm sorry, the mail was sent  a long time but didn't get to the mailing list.
In any case, I'll prepare a new patch with only TSO (the first patch) and send it to the next release.
 
> Maxime
> 
> > Signed-off-by: Noa Ezra <noae@mellanox.com>
> > Reviewed-by: Matan Azrad <matan@mellanox.com>
> > ---
> >   doc/guides/nics/vhost.rst         |  5 +++++
> >   drivers/net/vhost/rte_eth_vhost.c | 17 ++++++++++++++++-
> >   2 files changed, 21 insertions(+), 1 deletion(-)
> >
> > diff --git a/doc/guides/nics/vhost.rst b/doc/guides/nics/vhost.rst
> > index 8cfda4d..2a455b5 100644
> > --- a/doc/guides/nics/vhost.rst
> > +++ b/doc/guides/nics/vhost.rst
> > @@ -81,6 +81,11 @@ The user can specify below arguments in `--vdev`
> option.
> >       It is used to disable tso support in vhost library.
> >       (Default: 1 (enabled))
> >
> > +#.  ``mrg-rxbuf``:
> > +
> > +    It is used to disable mrg rxbuf support in vhost library.
> > +    (Default: 1 (enabled))
> > +
> >   Vhost PMD event handling
> >   ------------------------
> >
> > diff --git a/drivers/net/vhost/rte_eth_vhost.c
> > b/drivers/net/vhost/rte_eth_vhost.c
> > index a38c235..9a54020 100644
> > --- a/drivers/net/vhost/rte_eth_vhost.c
> > +++ b/drivers/net/vhost/rte_eth_vhost.c
> > @@ -32,6 +32,7 @@
> >   #define ETH_VHOST_IOMMU_SUPPORT		"iommu-support"
> >   #define ETH_VHOST_POSTCOPY_SUPPORT	"postcopy-support"
> >   #define ETH_VHOST_VIRTIO_NET_F_HOST_TSO "tso"
> > +#define ETH_VHOST_VIRTIO_NET_F_MRG_RXBUF "mrg-rxbuf"
> >   #define VHOST_MAX_PKT_BURST 32
> >
> >   static const char *valid_arguments[] = { @@ -42,6 +43,7 @@
> >   	ETH_VHOST_IOMMU_SUPPORT,
> >   	ETH_VHOST_POSTCOPY_SUPPORT,
> >   	ETH_VHOST_VIRTIO_NET_F_HOST_TSO,
> > +	ETH_VHOST_VIRTIO_NET_F_MRG_RXBUF,
> >   	NULL
> >   };
> >
> > @@ -1348,6 +1350,7 @@ struct vhost_xstats_name_off {
> >   	int iommu_support = 0;
> >   	int postcopy_support = 0;
> >   	int tso = 1;
> > +	int mrg_rxbuf = 1;
> >   	struct rte_eth_dev *eth_dev;
> >   	const char *name = rte_vdev_device_name(dev);
> >
> > @@ -1442,6 +1445,17 @@ struct vhost_xstats_name_off {
> >   		}
> >   	}
> >
> > +	if (rte_kvargs_count(kvlist,
> ETH_VHOST_VIRTIO_NET_F_MRG_RXBUF) == 1) {
> > +		ret = rte_kvargs_process(kvlist,
> > +				ETH_VHOST_VIRTIO_NET_F_MRG_RXBUF,
> > +				&open_int, &mrg_rxbuf);
> > +		if (ret < 0)
> > +			goto out_free;
> > +
> > + 		if (mrg_rxbuf == 0)
> > +			disable_flags |= (1ULL <<
> VIRTIO_NET_F_MRG_RXBUF);
> > +	}
> > +
> >   	if (dev->device.numa_node == SOCKET_ID_ANY)
> >   		dev->device.numa_node = rte_socket_id();
> >
> > @@ -1494,7 +1508,8 @@ struct vhost_xstats_name_off {
> >   	"dequeue-zero-copy=<0|1> "
> >   	"iommu-support=<0|1> "
> >   	"postcopy-support=<0|1> "
> > -	"tso=<0|1>");
> > +	"tso=<0|1> "
> > +	"mrg-rxbuf=<0|1>");
> >
> >   RTE_INIT(vhost_init_log)
> >   {
> >
  
Matan Azrad June 20, 2019, 6:52 a.m. UTC | #3
Hi all

> -----Original Message-----
> From: Noa Ezra
> Sent: Thursday, June 20, 2019 8:58 AM
> To: Maxime Coquelin <maxime.coquelin@redhat.com>
> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
> Subject: RE: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
> 
> Hi Maxime,
> Thanks for your comment, please see below.
> 
> > -----Original Message-----
> > From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
> > Sent: Wednesday, June 19, 2019 12:10 PM
> > To: Noa Ezra <noae@mellanox.com>
> > Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
> > Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
> >
> > Hi Noa,
> >
> > On 6/19/19 8:13 AM, Noa Ezra wrote:
> > > Rx mergeable buffers is a virtio feature that allows chaining of
> > > multiple virtio descriptors to handle large packet size.
> > > This behavior is supported and enabled by default, however in case
> > > the user knows that rx mergeable buffers are not needed, he can
> > > disable the feature.
> > > The user should also set mrg_rxbuf=off in virtual machine's xml.
> >
> > I'm not sure to understand why it is needed, as the vhost-user library
> > supports the feature, it's better to let it being advertised.
> >
> > As you say, it is up to the user to disable it in the VM's XML.
> > Done this way, the feature won't be negotiated.
> >
> I agree with you, I'll remove this patch from the series.

Are you sure that no performance impact exists for redundant merg-rx-buf configuration here?
What if the second side want it and the current side no?
It may be that the vhost PMD user may want to disable it to save performance from some reasons, no?
  
Maxime Coquelin June 20, 2019, 7:19 a.m. UTC | #4
On 6/20/19 8:52 AM, Matan Azrad wrote:
> Hi all
> 
>> -----Original Message-----
>> From: Noa Ezra
>> Sent: Thursday, June 20, 2019 8:58 AM
>> To: Maxime Coquelin <maxime.coquelin@redhat.com>
>> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
>> Subject: RE: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
>>
>> Hi Maxime,
>> Thanks for your comment, please see below.
>>
>>> -----Original Message-----
>>> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
>>> Sent: Wednesday, June 19, 2019 12:10 PM
>>> To: Noa Ezra <noae@mellanox.com>
>>> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
>>> Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
>>>
>>> Hi Noa,
>>>
>>> On 6/19/19 8:13 AM, Noa Ezra wrote:
>>>> Rx mergeable buffers is a virtio feature that allows chaining of
>>>> multiple virtio descriptors to handle large packet size.
>>>> This behavior is supported and enabled by default, however in case
>>>> the user knows that rx mergeable buffers are not needed, he can
>>>> disable the feature.
>>>> The user should also set mrg_rxbuf=off in virtual machine's xml.
>>>
>>> I'm not sure to understand why it is needed, as the vhost-user library
>>> supports the feature, it's better to let it being advertised.
>>>
>>> As you say, it is up to the user to disable it in the VM's XML.
>>> Done this way, the feature won't be negotiated.
>>>
>> I agree with you, I'll remove this patch from the series.
> 
> Are you sure that no performance impact exists for redundant merg-rx-buf configuration here?

I'm not sure to understand what you mean, could you please elaborate?

> What if the second side want it and the current side no?

The feature won't be negotiated, assuming it has been disabled in QEMU
cmdline (or via libvirt).

> It may be that the vhost PMD user may want to disable it to save performance from some reasons, no?
> 

Then this user should disable it at QEMU level.

Regards,
Maxime
  
Maxime Coquelin June 20, 2019, 7:27 a.m. UTC | #5
On 6/20/19 7:57 AM, Noa Ezra wrote:
> Hi Maxime,
> Thanks for your comment, please see below.
> 
>> -----Original Message-----
>> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
>> Sent: Wednesday, June 19, 2019 12:10 PM
>> To: Noa Ezra <noae@mellanox.com>
>> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
>> Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
>>
>> Hi Noa,
>>
>> On 6/19/19 8:13 AM, Noa Ezra wrote:
>>> Rx mergeable buffers is a virtio feature that allows chaining of
>>> multiple virtio descriptors to handle large packet size.
>>> This behavior is supported and enabled by default, however in case the
>>> user knows that rx mergeable buffers are not needed, he can disable
>>> the feature.
>>> The user should also set mrg_rxbuf=off in virtual machine's xml.
>>
>> I'm not sure to understand why it is needed, as the vhost-user library
>> supports the feature, it's better to let it being advertised.
>>
>> As you say, it is up to the user to disable it in the VM's XML.
>> Done this way, the feature won't be negotiated.
>>
> I agree with you, I'll remove this patch from the series.
> 
>> Moreover, the proposal deadline for v19.08 is over by more than 2 weeks.
> I'm sorry, the mail was sent  a long time but didn't get to the mailing list.

No problem, I just wanted to make you aware I could not take it anyway
in v19.08.

> In any case, I'll prepare a new patch with only TSO (the first patch) and send it to the next release.

As I replied to Matan, could you add the notice for the TSO disabled by
default in the release not for this release?

Thanks,
Maxime
>> Maxime
>>
>>> Signed-off-by: Noa Ezra <noae@mellanox.com>
>>> Reviewed-by: Matan Azrad <matan@mellanox.com>
>>> ---
>>>    doc/guides/nics/vhost.rst         |  5 +++++
>>>    drivers/net/vhost/rte_eth_vhost.c | 17 ++++++++++++++++-
>>>    2 files changed, 21 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/doc/guides/nics/vhost.rst b/doc/guides/nics/vhost.rst
>>> index 8cfda4d..2a455b5 100644
>>> --- a/doc/guides/nics/vhost.rst
>>> +++ b/doc/guides/nics/vhost.rst
>>> @@ -81,6 +81,11 @@ The user can specify below arguments in `--vdev`
>> option.
>>>        It is used to disable tso support in vhost library.
>>>        (Default: 1 (enabled))
>>>
>>> +#.  ``mrg-rxbuf``:
>>> +
>>> +    It is used to disable mrg rxbuf support in vhost library.
>>> +    (Default: 1 (enabled))
>>> +
>>>    Vhost PMD event handling
>>>    ------------------------
>>>
>>> diff --git a/drivers/net/vhost/rte_eth_vhost.c
>>> b/drivers/net/vhost/rte_eth_vhost.c
>>> index a38c235..9a54020 100644
>>> --- a/drivers/net/vhost/rte_eth_vhost.c
>>> +++ b/drivers/net/vhost/rte_eth_vhost.c
>>> @@ -32,6 +32,7 @@
>>>    #define ETH_VHOST_IOMMU_SUPPORT		"iommu-support"
>>>    #define ETH_VHOST_POSTCOPY_SUPPORT	"postcopy-support"
>>>    #define ETH_VHOST_VIRTIO_NET_F_HOST_TSO "tso"
>>> +#define ETH_VHOST_VIRTIO_NET_F_MRG_RXBUF "mrg-rxbuf"
>>>    #define VHOST_MAX_PKT_BURST 32
>>>
>>>    static const char *valid_arguments[] = { @@ -42,6 +43,7 @@
>>>    	ETH_VHOST_IOMMU_SUPPORT,
>>>    	ETH_VHOST_POSTCOPY_SUPPORT,
>>>    	ETH_VHOST_VIRTIO_NET_F_HOST_TSO,
>>> +	ETH_VHOST_VIRTIO_NET_F_MRG_RXBUF,
>>>    	NULL
>>>    };
>>>
>>> @@ -1348,6 +1350,7 @@ struct vhost_xstats_name_off {
>>>    	int iommu_support = 0;
>>>    	int postcopy_support = 0;
>>>    	int tso = 1;
>>> +	int mrg_rxbuf = 1;
>>>    	struct rte_eth_dev *eth_dev;
>>>    	const char *name = rte_vdev_device_name(dev);
>>>
>>> @@ -1442,6 +1445,17 @@ struct vhost_xstats_name_off {
>>>    		}
>>>    	}
>>>
>>> +	if (rte_kvargs_count(kvlist,
>> ETH_VHOST_VIRTIO_NET_F_MRG_RXBUF) == 1) {
>>> +		ret = rte_kvargs_process(kvlist,
>>> +				ETH_VHOST_VIRTIO_NET_F_MRG_RXBUF,
>>> +				&open_int, &mrg_rxbuf);
>>> +		if (ret < 0)
>>> +			goto out_free;
>>> +
>>> + 		if (mrg_rxbuf == 0)
>>> +			disable_flags |= (1ULL <<
>> VIRTIO_NET_F_MRG_RXBUF);
>>> +	}
>>> +
>>>    	if (dev->device.numa_node == SOCKET_ID_ANY)
>>>    		dev->device.numa_node = rte_socket_id();
>>>
>>> @@ -1494,7 +1508,8 @@ struct vhost_xstats_name_off {
>>>    	"dequeue-zero-copy=<0|1> "
>>>    	"iommu-support=<0|1> "
>>>    	"postcopy-support=<0|1> "
>>> -	"tso=<0|1>");
>>> +	"tso=<0|1> "
>>> +	"mrg-rxbuf=<0|1>");
>>>
>>>    RTE_INIT(vhost_init_log)
>>>    {
>>>
  
Matan Azrad June 20, 2019, 7:55 a.m. UTC | #6
From: Maxime Coquelin
> Sent: Thursday, June 20, 2019 10:19 AM
> To: Matan Azrad <matan@mellanox.com>; Noa Ezra <noae@mellanox.com>
> Cc: dev@dpdk.org
> Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
> 
> 
> 
> On 6/20/19 8:52 AM, Matan Azrad wrote:
> > Hi all
> >
> >> -----Original Message-----
> >> From: Noa Ezra
> >> Sent: Thursday, June 20, 2019 8:58 AM
> >> To: Maxime Coquelin <maxime.coquelin@redhat.com>
> >> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
> >> Subject: RE: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
> >>
> >> Hi Maxime,
> >> Thanks for your comment, please see below.
> >>
> >>> -----Original Message-----
> >>> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
> >>> Sent: Wednesday, June 19, 2019 12:10 PM
> >>> To: Noa Ezra <noae@mellanox.com>
> >>> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
> >>> Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
> >>>
> >>> Hi Noa,
> >>>
> >>> On 6/19/19 8:13 AM, Noa Ezra wrote:
> >>>> Rx mergeable buffers is a virtio feature that allows chaining of
> >>>> multiple virtio descriptors to handle large packet size.
> >>>> This behavior is supported and enabled by default, however in case
> >>>> the user knows that rx mergeable buffers are not needed, he can
> >>>> disable the feature.
> >>>> The user should also set mrg_rxbuf=off in virtual machine's xml.
> >>>
> >>> I'm not sure to understand why it is needed, as the vhost-user
> >>> library supports the feature, it's better to let it being advertised.
> >>>
> >>> As you say, it is up to the user to disable it in the VM's XML.
> >>> Done this way, the feature won't be negotiated.
> >>>
> >> I agree with you, I'll remove this patch from the series.
> >
> > Are you sure that no performance impact exists for redundant merg-rx-buf
> configuration here?
> 
> I'm not sure to understand what you mean, could you please elaborate?
> 
I guess that if this feature is enabled and the feature actually are not used (no packets are scattered or merged) it will hurt the performance. 

So if one of the sides doesn't want to use it because of performance, it may want to disable it.

> > What if the second side want it and the current side no?
> 
> The feature won't be negotiated, assuming it has been disabled in QEMU
> cmdline (or via libvirt).
> > It may be that the vhost PMD user may want to disable it to save
> performance from some reasons, no?
> >
> 
> Then this user should disable it at QEMU level.
>
So the vhost PMD is not one of the sides to decide?
If so, why do we need the APIs to configure the features?

Looks like also the qemu is configured with the feature the VM\host sides may decide in some cases to disable it.


> Regards,
> Maxime
  
Matan Azrad June 26, 2019, 7:50 a.m. UTC | #7
Hi Maxim

Any response here? 

Besides that,

Regarding the TSO and this patch:
I think we shouldn't be so strict to not take them for this version:
1. The later time was a technical issue with the mailer - a mistake.
2. The patches don't change any default and makes sense - will not hurt anyone.

So I think we can do it beyond the letter of the law.

 From: Maxime Coquelin
 > Sent: Thursday, June 20, 2019 10:19 AM
 > To: Matan Azrad <matan@mellanox.com>; Noa Ezra
 <noae@mellanox.com>
 > Cc: dev@dpdk.org
 > Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
 >
 >
 >
 > On 6/20/19 8:52 AM, Matan Azrad wrote:
 > > Hi all
 > >
 > >> -----Original Message-----
 > >> From: Noa Ezra
 > >> Sent: Thursday, June 20, 2019 8:58 AM
 > >> To: Maxime Coquelin <maxime.coquelin@redhat.com>
 > >> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
 > >> Subject: RE: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
 > >>
 > >> Hi Maxime,
 > >> Thanks for your comment, please see below.
 > >>
 > >>> -----Original Message-----
 > >>> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
 > >>> Sent: Wednesday, June 19, 2019 12:10 PM
 > >>> To: Noa Ezra <noae@mellanox.com>
 > >>> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
 > >>> Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
 > >>>
 > >>> Hi Noa,
 > >>>
 > >>> On 6/19/19 8:13 AM, Noa Ezra wrote:
 > >>>> Rx mergeable buffers is a virtio feature that allows chaining of
 > >>>> multiple virtio descriptors to handle large packet size.
 > >>>> This behavior is supported and enabled by default, however in
 > >>>> case the user knows that rx mergeable buffers are not needed, he
 > >>>> can disable the feature.
 > >>>> The user should also set mrg_rxbuf=off in virtual machine's xml.
 > >>>
 > >>> I'm not sure to understand why it is needed, as the vhost-user
 > >>> library supports the feature, it's better to let it being advertised.
 > >>>
 > >>> As you say, it is up to the user to disable it in the VM's XML.
 > >>> Done this way, the feature won't be negotiated.
 > >>>
 > >> I agree with you, I'll remove this patch from the series.
 > >
 > > Are you sure that no performance impact exists for redundant
 > > merg-rx-buf
 > configuration here?
 >
 > I'm not sure to understand what you mean, could you please elaborate?
 >
 I guess that if this feature is enabled and the feature actually are not used
 (no packets are scattered or merged) it will hurt the performance.
 
 So if one of the sides doesn't want to use it because of performance, it may
 want to disable it.
 
 > > What if the second side want it and the current side no?
 >
 > The feature won't be negotiated, assuming it has been disabled in QEMU
 > cmdline (or via libvirt).
 > > It may be that the vhost PMD user may want to disable it to save
 > performance from some reasons, no?
 > >
 >
 > Then this user should disable it at QEMU level.
 >
 So the vhost PMD is not one of the sides to decide?
 If so, why do we need the APIs to configure the features?
 
 Looks like also the qemu is configured with the feature the VM\host sides
 may decide in some cases to disable it.
 
 
 > Regards,
 > Maxime
  
Maxime Coquelin June 26, 2019, 10:27 a.m. UTC | #8
On 6/26/19 9:50 AM, Matan Azrad wrote:
> Hi Maxim
> 
> Any response here?
> 
> Besides that,
> 
> Regarding the TSO and this patch:
> I think we shouldn't be so strict to not take them for this version:
> 1. The later time was a technical issue with the mailer - a mistake.
> 2. The patches don't change any default and makes sense - will not hurt anyone.
> 
> So I think we can do it beyond the letter of the law.
> 
>   From: Maxime Coquelin
>   > Sent: Thursday, June 20, 2019 10:19 AM
>   > To: Matan Azrad <matan@mellanox.com>; Noa Ezra
>   <noae@mellanox.com>
>   > Cc: dev@dpdk.org
>   > Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
>   >
>   >
>   >
>   > On 6/20/19 8:52 AM, Matan Azrad wrote:
>   > > Hi all
>   > >
>   > >> -----Original Message-----
>   > >> From: Noa Ezra
>   > >> Sent: Thursday, June 20, 2019 8:58 AM
>   > >> To: Maxime Coquelin <maxime.coquelin@redhat.com>
>   > >> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
>   > >> Subject: RE: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
>   > >>
>   > >> Hi Maxime,
>   > >> Thanks for your comment, please see below.
>   > >>
>   > >>> -----Original Message-----
>   > >>> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
>   > >>> Sent: Wednesday, June 19, 2019 12:10 PM
>   > >>> To: Noa Ezra <noae@mellanox.com>
>   > >>> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
>   > >>> Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
>   > >>>
>   > >>> Hi Noa,
>   > >>>
>   > >>> On 6/19/19 8:13 AM, Noa Ezra wrote:
>   > >>>> Rx mergeable buffers is a virtio feature that allows chaining of
>   > >>>> multiple virtio descriptors to handle large packet size.
>   > >>>> This behavior is supported and enabled by default, however in
>   > >>>> case the user knows that rx mergeable buffers are not needed, he
>   > >>>> can disable the feature.
>   > >>>> The user should also set mrg_rxbuf=off in virtual machine's xml.
>   > >>>
>   > >>> I'm not sure to understand why it is needed, as the vhost-user
>   > >>> library supports the feature, it's better to let it being advertised.
>   > >>>
>   > >>> As you say, it is up to the user to disable it in the VM's XML.
>   > >>> Done this way, the feature won't be negotiated.
>   > >>>
>   > >> I agree with you, I'll remove this patch from the series.
>   > >
>   > > Are you sure that no performance impact exists for redundant
>   > > merg-rx-buf
>   > configuration here?
>   >
>   > I'm not sure to understand what you mean, could you please elaborate?
>   >
>   I guess that if this feature is enabled and the feature actually are not used
>   (no packets are scattered or merged) it will hurt the performance.

Well, latest performance measurements does not show a big impact now on 
enabling mergeable buffers feature unconditionaly.


>   So if one of the sides doesn't want to use it because of performance, it may
>   want to disable it.

And even if there is an impact, the way to disable it is through
Libvirt/Qemu.

>   > > What if the second side want it and the current side no?
>   >
>   > The feature won't be negotiated, assuming it has been disabled in QEMU
>   > cmdline (or via libvirt).
>   > > It may be that the vhost PMD user may want to disable it to save
>   > performance from some reasons, no?
>   > >
>   >
>   > Then this user should disable it at QEMU level.
>   >
>   So the vhost PMD is not one of the sides to decide?
>   If so, why do we need the APIs to configure the features?

Are you talking about the rte_vhost_driver_set_features() and related
APIs?

This is used for example by the external backends that support features
specific to the backend type (e.g. crypto), or also used by OVS-DPDK, to
disable TSO. So these usages are for functional reasons, not tuning.

>   Looks like also the qemu is configured with the feature the VM\host sides
>   may decide in some cases to disable it.

For functional reasons, I agree. So I that's why I agree with your tso
patch as the application has to support it, but that's not the case of
the mergeable buffers features.

Tiwei, what's your opinion on this?

>   > Regards,
>   > Maxime
>
  
Matan Azrad June 26, 2019, 11:18 a.m. UTC | #9
From: Maxime Coquelin
> On 6/26/19 9:50 AM, Matan Azrad wrote:
> > Hi Maxim
> >
> > Any response here?
> >
> > Besides that,
> >
> > Regarding the TSO and this patch:
> > I think we shouldn't be so strict to not take them for this version:
> > 1. The later time was a technical issue with the mailer - a mistake.
> > 2. The patches don't change any default and makes sense - will not hurt
> anyone.
> >
> > So I think we can do it beyond the letter of the law.
> >
> >   From: Maxime Coquelin
> >   > Sent: Thursday, June 20, 2019 10:19 AM
> >   > To: Matan Azrad <matan@mellanox.com>; Noa Ezra
> >   <noae@mellanox.com>
> >   > Cc: dev@dpdk.org
> >   > Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
> >   >
> >   >
> >   >
> >   > On 6/20/19 8:52 AM, Matan Azrad wrote:
> >   > > Hi all
> >   > >
> >   > >> -----Original Message-----
> >   > >> From: Noa Ezra
> >   > >> Sent: Thursday, June 20, 2019 8:58 AM
> >   > >> To: Maxime Coquelin <maxime.coquelin@redhat.com>
> >   > >> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
> >   > >> Subject: RE: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
> >   > >>
> >   > >> Hi Maxime,
> >   > >> Thanks for your comment, please see below.
> >   > >>
> >   > >>> -----Original Message-----
> >   > >>> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
> >   > >>> Sent: Wednesday, June 19, 2019 12:10 PM
> >   > >>> To: Noa Ezra <noae@mellanox.com>
> >   > >>> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
> >   > >>> Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
> >   > >>>
> >   > >>> Hi Noa,
> >   > >>>
> >   > >>> On 6/19/19 8:13 AM, Noa Ezra wrote:
> >   > >>>> Rx mergeable buffers is a virtio feature that allows chaining of
> >   > >>>> multiple virtio descriptors to handle large packet size.
> >   > >>>> This behavior is supported and enabled by default, however in
> >   > >>>> case the user knows that rx mergeable buffers are not needed, he
> >   > >>>> can disable the feature.
> >   > >>>> The user should also set mrg_rxbuf=off in virtual machine's xml.
> >   > >>>
> >   > >>> I'm not sure to understand why it is needed, as the vhost-user
> >   > >>> library supports the feature, it's better to let it being advertised.
> >   > >>>
> >   > >>> As you say, it is up to the user to disable it in the VM's XML.
> >   > >>> Done this way, the feature won't be negotiated.
> >   > >>>
> >   > >> I agree with you, I'll remove this patch from the series.
> >   > >
> >   > > Are you sure that no performance impact exists for redundant
> >   > > merg-rx-buf
> >   > configuration here?
> >   >
> >   > I'm not sure to understand what you mean, could you please elaborate?
> >   >
> >   I guess that if this feature is enabled and the feature actually are not used
> >   (no packets are scattered or merged) it will hurt the performance.
> 
> Well, latest performance measurements does not show a big impact now on
> enabling mergeable buffers feature unconditionaly.
 
Did you test small packets \ big?

> >   So if one of the sides doesn't want to use it because of performance, it
> may
> >   want to disable it.
> 
> And even if there is an impact, the way to disable it is through
> Libvirt/Qemu.

Not sure, as TSO application may decide to not do it in spite of it is configured in Qemu. 
 
> >   > > What if the second side want it and the current side no?
> >   >
> >   > The feature won't be negotiated, assuming it has been disabled in
> QEMU
> >   > cmdline (or via libvirt).
> >   > > It may be that the vhost PMD user may want to disable it to save
> >   > performance from some reasons, no?
> >   > >
> >   >
> >   > Then this user should disable it at QEMU level.
> >   >
> >   So the vhost PMD is not one of the sides to decide?
> >   If so, why do we need the APIs to configure the features?
> 
> Are you talking about the rte_vhost_driver_set_features() and related
> APIs?
 
Yes

> This is used for example by the external backends that support features
> specific to the backend type (e.g. crypto), or also used by OVS-DPDK, to
> disable TSO. So these usages are for functional reasons, not tuning.

Exactly, applications (like OVS) may decide to disable features because a lot of reasons. 

> >   Looks like also the qemu is configured with the feature the VM\host sides
> >   may decide in some cases to disable it.
> 
> For functional reasons, I agree. So I that's why I agree with your tso
> patch as the application has to support it, but that's not the case of
> the mergeable buffers features.

Performance reasons are not good enough?

> Tiwei, what's your opinion on this?
> 
> >   > Regards,
> >   > Maxime
> >
  
Maxime Coquelin June 26, 2019, 12:05 p.m. UTC | #10
On 6/26/19 1:18 PM, Matan Azrad wrote:
> 
> 
> From: Maxime Coquelin
>> On 6/26/19 9:50 AM, Matan Azrad wrote:
>>> Hi Maxim
>>>
>>> Any response here?
>>>
>>> Besides that,
>>>
>>> Regarding the TSO and this patch:
>>> I think we shouldn't be so strict to not take them for this version:
>>> 1. The later time was a technical issue with the mailer - a mistake.
>>> 2. The patches don't change any default and makes sense - will not hurt
>> anyone.
>>>
>>> So I think we can do it beyond the letter of the law.
>>>
>>>    From: Maxime Coquelin
>>>    > Sent: Thursday, June 20, 2019 10:19 AM
>>>    > To: Matan Azrad <matan@mellanox.com>; Noa Ezra
>>>    <noae@mellanox.com>
>>>    > Cc: dev@dpdk.org
>>>    > Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
>>>    >
>>>    >
>>>    >
>>>    > On 6/20/19 8:52 AM, Matan Azrad wrote:
>>>    > > Hi all
>>>    > >
>>>    > >> -----Original Message-----
>>>    > >> From: Noa Ezra
>>>    > >> Sent: Thursday, June 20, 2019 8:58 AM
>>>    > >> To: Maxime Coquelin <maxime.coquelin@redhat.com>
>>>    > >> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
>>>    > >> Subject: RE: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
>>>    > >>
>>>    > >> Hi Maxime,
>>>    > >> Thanks for your comment, please see below.
>>>    > >>
>>>    > >>> -----Original Message-----
>>>    > >>> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
>>>    > >>> Sent: Wednesday, June 19, 2019 12:10 PM
>>>    > >>> To: Noa Ezra <noae@mellanox.com>
>>>    > >>> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
>>>    > >>> Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
>>>    > >>>
>>>    > >>> Hi Noa,
>>>    > >>>
>>>    > >>> On 6/19/19 8:13 AM, Noa Ezra wrote:
>>>    > >>>> Rx mergeable buffers is a virtio feature that allows chaining of
>>>    > >>>> multiple virtio descriptors to handle large packet size.
>>>    > >>>> This behavior is supported and enabled by default, however in
>>>    > >>>> case the user knows that rx mergeable buffers are not needed, he
>>>    > >>>> can disable the feature.
>>>    > >>>> The user should also set mrg_rxbuf=off in virtual machine's xml.
>>>    > >>>
>>>    > >>> I'm not sure to understand why it is needed, as the vhost-user
>>>    > >>> library supports the feature, it's better to let it being advertised.
>>>    > >>>
>>>    > >>> As you say, it is up to the user to disable it in the VM's XML.
>>>    > >>> Done this way, the feature won't be negotiated.
>>>    > >>>
>>>    > >> I agree with you, I'll remove this patch from the series.
>>>    > >
>>>    > > Are you sure that no performance impact exists for redundant
>>>    > > merg-rx-buf
>>>    > configuration here?
>>>    >
>>>    > I'm not sure to understand what you mean, could you please elaborate?
>>>    >
>>>    I guess that if this feature is enabled and the feature actually are not used
>>>    (no packets are scattered or merged) it will hurt the performance.
>>
>> Well, latest performance measurements does not show a big impact now on
>> enabling mergeable buffers feature unconditionaly.
>   
> Did you test small packets \ big?

64B packets, in non-vector mode on Virtio PMD side.

> 
>>>    So if one of the sides doesn't want to use it because of performance, it
>> may
>>>    want to disable it.
>>
>> And even if there is an impact, the way to disable it is through
>> Libvirt/Qemu.
> 
> Not sure, as TSO application may decide to not do it in spite of it is configured in Qemu.
>   
>>>    > > What if the second side want it and the current side no?
>>>    >
>>>    > The feature won't be negotiated, assuming it has been disabled in
>> QEMU
>>>    > cmdline (or via libvirt).
>>>    > > It may be that the vhost PMD user may want to disable it to save
>>>    > performance from some reasons, no?
>>>    > >
>>>    >
>>>    > Then this user should disable it at QEMU level.
>>>    >
>>>    So the vhost PMD is not one of the sides to decide?
>>>    If so, why do we need the APIs to configure the features?
>>
>> Are you talking about the rte_vhost_driver_set_features() and related
>> APIs?
>   
> Yes
> 
>> This is used for example by the external backends that support features
>> specific to the backend type (e.g. crypto), or also used by OVS-DPDK, to
>> disable TSO. So these usages are for functional reasons, not tuning.
> 
> Exactly, applications (like OVS) may decide to disable features because a lot of reasons.
> 
>>>    Looks like also the qemu is configured with the feature the VM\host sides
>>>    may decide in some cases to disable it.
>>
>> For functional reasons, I agree. So I that's why I agree with your tso
>> patch as the application has to support it, but that's not the case of
>> the mergeable buffers features.
> 
> Performance reasons are not good enough?

No, that's not what I mean.
I mean that the application should be able to disable a feature when it
does not meet the functional requirement.

For performance tuning, the qemu way is available, and enough.

> 
>> Tiwei, what's your opinion on this?
>>
>>>    > Regards,
>>>    > Maxime
>>>
  
Matan Azrad June 26, 2019, 1:24 p.m. UTC | #11
> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Wednesday, June 26, 2019 3:06 PM
> To: Matan Azrad <matan@mellanox.com>; Noa Ezra <noae@mellanox.com>
> Cc: dev@dpdk.org; Tiwei Bie <tiwei.bie@intel.com>
> Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
> 
> 
> 
> On 6/26/19 1:18 PM, Matan Azrad wrote:
> >
> >
> > From: Maxime Coquelin
> >> On 6/26/19 9:50 AM, Matan Azrad wrote:
> >>> Hi Maxim
> >>>
> >>> Any response here?
> >>>
> >>> Besides that,
> >>>
> >>> Regarding the TSO and this patch:
> >>> I think we shouldn't be so strict to not take them for this version:
> >>> 1. The later time was a technical issue with the mailer - a mistake.
> >>> 2. The patches don't change any default and makes sense - will not
> >>> hurt
> >> anyone.
> >>>
> >>> So I think we can do it beyond the letter of the law.
> >>>
> >>>    From: Maxime Coquelin
> >>>    > Sent: Thursday, June 20, 2019 10:19 AM
> >>>    > To: Matan Azrad <matan@mellanox.com>; Noa Ezra
> >>>    <noae@mellanox.com>
> >>>    > Cc: dev@dpdk.org
> >>>    > Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
> >>>    >
> >>>    >
> >>>    >
> >>>    > On 6/20/19 8:52 AM, Matan Azrad wrote:
> >>>    > > Hi all
> >>>    > >
> >>>    > >> -----Original Message-----
> >>>    > >> From: Noa Ezra
> >>>    > >> Sent: Thursday, June 20, 2019 8:58 AM
> >>>    > >> To: Maxime Coquelin <maxime.coquelin@redhat.com>
> >>>    > >> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
> >>>    > >> Subject: RE: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
> >>>    > >>
> >>>    > >> Hi Maxime,
> >>>    > >> Thanks for your comment, please see below.
> >>>    > >>
> >>>    > >>> -----Original Message-----
> >>>    > >>> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
> >>>    > >>> Sent: Wednesday, June 19, 2019 12:10 PM
> >>>    > >>> To: Noa Ezra <noae@mellanox.com>
> >>>    > >>> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
> >>>    > >>> Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
> >>>    > >>>
> >>>    > >>> Hi Noa,
> >>>    > >>>
> >>>    > >>> On 6/19/19 8:13 AM, Noa Ezra wrote:
> >>>    > >>>> Rx mergeable buffers is a virtio feature that allows chaining of
> >>>    > >>>> multiple virtio descriptors to handle large packet size.
> >>>    > >>>> This behavior is supported and enabled by default, however in
> >>>    > >>>> case the user knows that rx mergeable buffers are not needed,
> he
> >>>    > >>>> can disable the feature.
> >>>    > >>>> The user should also set mrg_rxbuf=off in virtual machine's xml.
> >>>    > >>>
> >>>    > >>> I'm not sure to understand why it is needed, as the vhost-user
> >>>    > >>> library supports the feature, it's better to let it being advertised.
> >>>    > >>>
> >>>    > >>> As you say, it is up to the user to disable it in the VM's XML.
> >>>    > >>> Done this way, the feature won't be negotiated.
> >>>    > >>>
> >>>    > >> I agree with you, I'll remove this patch from the series.
> >>>    > >
> >>>    > > Are you sure that no performance impact exists for redundant
> >>>    > > merg-rx-buf
> >>>    > configuration here?
> >>>    >
> >>>    > I'm not sure to understand what you mean, could you please
> elaborate?
> >>>    >
> >>>    I guess that if this feature is enabled and the feature actually are not
> used
> >>>    (no packets are scattered or merged) it will hurt the performance.
> >>
> >> Well, latest performance measurements does not show a big impact now
> >> on enabling mergeable buffers feature unconditionaly.
> >
> > Did you test small packets \ big?
> 
> 64B packets, in non-vector mode on Virtio PMD side.
> 
> >
> >>>    So if one of the sides doesn't want to use it because of
> >>> performance, it
> >> may
> >>>    want to disable it.
> >>
> >> And even if there is an impact, the way to disable it is through
> >> Libvirt/Qemu.
> >
> > Not sure, as TSO application may decide to not do it in spite of it is
> configured in Qemu.
> >
> >>>    > > What if the second side want it and the current side no?
> >>>    >
> >>>    > The feature won't be negotiated, assuming it has been disabled
> >>> in
> >> QEMU
> >>>    > cmdline (or via libvirt).
> >>>    > > It may be that the vhost PMD user may want to disable it to save
> >>>    > performance from some reasons, no?
> >>>    > >
> >>>    >
> >>>    > Then this user should disable it at QEMU level.
> >>>    >
> >>>    So the vhost PMD is not one of the sides to decide?
> >>>    If so, why do we need the APIs to configure the features?
> >>
> >> Are you talking about the rte_vhost_driver_set_features() and related
> >> APIs?
> >
> > Yes
> >
> >> This is used for example by the external backends that support
> >> features specific to the backend type (e.g. crypto), or also used by
> >> OVS-DPDK, to disable TSO. So these usages are for functional reasons, not
> tuning.
> >
> > Exactly, applications (like OVS) may decide to disable features because a lot
> of reasons.
> >
> >>>    Looks like also the qemu is configured with the feature the VM\host
> sides
> >>>    may decide in some cases to disable it.
> >>
> >> For functional reasons, I agree. So I that's why I agree with your
> >> tso patch as the application has to support it, but that's not the
> >> case of the mergeable buffers features.
> >
> > Performance reasons are not good enough?
> 
> No, that's not what I mean.
> I mean that the application should be able to disable a feature when it does
> not meet the functional requirement.
> 
> For performance tuning, the qemu way is available, and enough.
> 

I think that this is the point we are not agree on.

I think that application may want to disable the feature in some cases because of performance reasons (maybe others too), 
And in some other cases to work with the feature.

So, it makes sense IMO to let the application to decide what it wants without any concern about the QEMU configuration.

Why to not allow to the PMD user to do it by the application (using prob parameters)?


> >
> >> Tiwei, what's your opinion on this?
> >>
> >>>    > Regards,
> >>>    > Maxime
> >>>
  
Maxime Coquelin June 26, 2019, 2:17 p.m. UTC | #12
On 6/26/19 3:24 PM, Matan Azrad wrote:
> 
> 
>> -----Original Message-----
>> From: Maxime Coquelin <maxime.coquelin@redhat.com>
>> Sent: Wednesday, June 26, 2019 3:06 PM
>> To: Matan Azrad <matan@mellanox.com>; Noa Ezra <noae@mellanox.com>
>> Cc: dev@dpdk.org; Tiwei Bie <tiwei.bie@intel.com>
>> Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
>>
>>
>>
>> On 6/26/19 1:18 PM, Matan Azrad wrote:
>>>
>>>
>>> From: Maxime Coquelin
>>>> On 6/26/19 9:50 AM, Matan Azrad wrote:
>>>>> Hi Maxim
>>>>>
>>>>> Any response here?
>>>>>
>>>>> Besides that,
>>>>>
>>>>> Regarding the TSO and this patch:
>>>>> I think we shouldn't be so strict to not take them for this version:
>>>>> 1. The later time was a technical issue with the mailer - a mistake.
>>>>> 2. The patches don't change any default and makes sense - will not
>>>>> hurt
>>>> anyone.
>>>>>
>>>>> So I think we can do it beyond the letter of the law.
>>>>>
>>>>>     From: Maxime Coquelin
>>>>>     > Sent: Thursday, June 20, 2019 10:19 AM
>>>>>     > To: Matan Azrad <matan@mellanox.com>; Noa Ezra
>>>>>     <noae@mellanox.com>
>>>>>     > Cc: dev@dpdk.org
>>>>>     > Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
>>>>>     >
>>>>>     >
>>>>>     >
>>>>>     > On 6/20/19 8:52 AM, Matan Azrad wrote:
>>>>>     > > Hi all
>>>>>     > >
>>>>>     > >> -----Original Message-----
>>>>>     > >> From: Noa Ezra
>>>>>     > >> Sent: Thursday, June 20, 2019 8:58 AM
>>>>>     > >> To: Maxime Coquelin <maxime.coquelin@redhat.com>
>>>>>     > >> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
>>>>>     > >> Subject: RE: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
>>>>>     > >>
>>>>>     > >> Hi Maxime,
>>>>>     > >> Thanks for your comment, please see below.
>>>>>     > >>
>>>>>     > >>> -----Original Message-----
>>>>>     > >>> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
>>>>>     > >>> Sent: Wednesday, June 19, 2019 12:10 PM
>>>>>     > >>> To: Noa Ezra <noae@mellanox.com>
>>>>>     > >>> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org
>>>>>     > >>> Subject: Re: [PATCH 2/2] net/vhost: support mrg-rxbuf disabling
>>>>>     > >>>
>>>>>     > >>> Hi Noa,
>>>>>     > >>>
>>>>>     > >>> On 6/19/19 8:13 AM, Noa Ezra wrote:
>>>>>     > >>>> Rx mergeable buffers is a virtio feature that allows chaining of
>>>>>     > >>>> multiple virtio descriptors to handle large packet size.
>>>>>     > >>>> This behavior is supported and enabled by default, however in
>>>>>     > >>>> case the user knows that rx mergeable buffers are not needed,
>> he
>>>>>     > >>>> can disable the feature.
>>>>>     > >>>> The user should also set mrg_rxbuf=off in virtual machine's xml.
>>>>>     > >>>
>>>>>     > >>> I'm not sure to understand why it is needed, as the vhost-user
>>>>>     > >>> library supports the feature, it's better to let it being advertised.
>>>>>     > >>>
>>>>>     > >>> As you say, it is up to the user to disable it in the VM's XML.
>>>>>     > >>> Done this way, the feature won't be negotiated.
>>>>>     > >>>
>>>>>     > >> I agree with you, I'll remove this patch from the series.
>>>>>     > >
>>>>>     > > Are you sure that no performance impact exists for redundant
>>>>>     > > merg-rx-buf
>>>>>     > configuration here?
>>>>>     >
>>>>>     > I'm not sure to understand what you mean, could you please
>> elaborate?
>>>>>     >
>>>>>     I guess that if this feature is enabled and the feature actually are not
>> used
>>>>>     (no packets are scattered or merged) it will hurt the performance.
>>>>
>>>> Well, latest performance measurements does not show a big impact now
>>>> on enabling mergeable buffers feature unconditionaly.
>>>
>>> Did you test small packets \ big?
>>
>> 64B packets, in non-vector mode on Virtio PMD side.
>>
>>>
>>>>>     So if one of the sides doesn't want to use it because of
>>>>> performance, it
>>>> may
>>>>>     want to disable it.
>>>>
>>>> And even if there is an impact, the way to disable it is through
>>>> Libvirt/Qemu.
>>>
>>> Not sure, as TSO application may decide to not do it in spite of it is
>> configured in Qemu.
>>>
>>>>>     > > What if the second side want it and the current side no?
>>>>>     >
>>>>>     > The feature won't be negotiated, assuming it has been disabled
>>>>> in
>>>> QEMU
>>>>>     > cmdline (or via libvirt).
>>>>>     > > It may be that the vhost PMD user may want to disable it to save
>>>>>     > performance from some reasons, no?
>>>>>     > >
>>>>>     >
>>>>>     > Then this user should disable it at QEMU level.
>>>>>     >
>>>>>     So the vhost PMD is not one of the sides to decide?
>>>>>     If so, why do we need the APIs to configure the features?
>>>>
>>>> Are you talking about the rte_vhost_driver_set_features() and related
>>>> APIs?
>>>
>>> Yes
>>>
>>>> This is used for example by the external backends that support
>>>> features specific to the backend type (e.g. crypto), or also used by
>>>> OVS-DPDK, to disable TSO. So these usages are for functional reasons, not
>> tuning.
>>>
>>> Exactly, applications (like OVS) may decide to disable features because a lot
>> of reasons.
>>>
>>>>>     Looks like also the qemu is configured with the feature the VM\host
>> sides
>>>>>     may decide in some cases to disable it.
>>>>
>>>> For functional reasons, I agree. So I that's why I agree with your
>>>> tso patch as the application has to support it, but that's not the
>>>> case of the mergeable buffers features.
>>>
>>> Performance reasons are not good enough?
>>
>> No, that's not what I mean.
>> I mean that the application should be able to disable a feature when it does
>> not meet the functional requirement.
>>
>> For performance tuning, the qemu way is available, and enough.
>>
> 
> I think that this is the point we are not agree on.
> 
> I think that application may want to disable the feature in some cases because of performance reasons (maybe others too),
> And in some other cases to work with the feature.
> 
> So, it makes sense IMO to let the application to decide what it wants without any concern about the QEMU configuration.
> 
> Why to not allow to the PMD user to do it by the application (using prob parameters)?

I think we should restrict the Virtio features from the Vhost PMD
parameter at as min as possible, only to ensure compatibility with the
application (iommu, postcopy, tso, ...). One problem I see with
providing the possibility to change any Virtio feature at runtime
is reconnection.

For example, you start your application with enabling mergeable buffers,
stop it and restart it without the feature enabled by the application.
As the negotiation with the driver is not done again at reconnect time,
Qemu will fail.

> 
> 
>>>
>>>> Tiwei, what's your opinion on this?
>>>>
>>>>>     > Regards,
>>>>>     > Maxime
>>>>>
  
Matan Azrad June 27, 2019, 5:04 a.m. UTC | #13
From: Maxime Coquelin 
> >>>> For functional reasons, I agree. So I that's why I agree with your
> >>>> tso patch as the application has to support it, but that's not the
> >>>> case of the mergeable buffers features.
> >>>
> >>> Performance reasons are not good enough?
> >>
> >> No, that's not what I mean.
> >> I mean that the application should be able to disable a feature when
> >> it does not meet the functional requirement.
> >>
> >> For performance tuning, the qemu way is available, and enough.
> >>
> >
> > I think that this is the point we are not agree on.
> >
> > I think that application may want to disable the feature in some cases
> > because of performance reasons (maybe others too), And in some other
> cases to work with the feature.
> >
> > So, it makes sense IMO to let the application to decide what it wants
> without any concern about the QEMU configuration.
> >
> > Why to not allow to the PMD user to do it by the application (using prob
> parameters)?
> 
> I think we should restrict the Virtio features from the Vhost PMD parameter
> at as min as possible, only to ensure compatibility with the application
> (iommu, postcopy, tso, ...). One problem I see with providing the possibility
> to change any Virtio feature at runtime is reconnection.
> 
> For example, you start your application with enabling mergeable buffers,
> stop it and restart it without the feature enabled by the application.
> As the negotiation with the driver is not done again at reconnect time, Qemu
> will fail.

Looks like you are describing a new issue in the vhost PMD, it must close the connection when the PMD is closed\removed.
So, every probe(hotplug add) it will start from scratch.
  
Maxime Coquelin Aug. 30, 2019, 8:48 a.m. UTC | #14
On 6/27/19 7:04 AM, Matan Azrad wrote:
> 
> 
> From: Maxime Coquelin 
>>>>>> For functional reasons, I agree. So I that's why I agree with your
>>>>>> tso patch as the application has to support it, but that's not the
>>>>>> case of the mergeable buffers features.
>>>>>
>>>>> Performance reasons are not good enough?
>>>>
>>>> No, that's not what I mean.
>>>> I mean that the application should be able to disable a feature when
>>>> it does not meet the functional requirement.
>>>>
>>>> For performance tuning, the qemu way is available, and enough.
>>>>
>>>
>>> I think that this is the point we are not agree on.
>>>
>>> I think that application may want to disable the feature in some cases
>>> because of performance reasons (maybe others too), And in some other
>> cases to work with the feature.
>>>
>>> So, it makes sense IMO to let the application to decide what it wants
>> without any concern about the QEMU configuration.
>>>
>>> Why to not allow to the PMD user to do it by the application (using prob
>> parameters)?
>>
>> I think we should restrict the Virtio features from the Vhost PMD parameter
>> at as min as possible, only to ensure compatibility with the application
>> (iommu, postcopy, tso, ...). One problem I see with providing the possibility
>> to change any Virtio feature at runtime is reconnection.
>>
>> For example, you start your application with enabling mergeable buffers,
>> stop it and restart it without the feature enabled by the application.
>> As the negotiation with the driver is not done again at reconnect time, Qemu
>> will fail.
> 
> Looks like you are describing a new issue in the vhost PMD, it must close the connection when the PMD is closed\removed.
> So, every probe(hotplug add) it will start from scratch.
> 

No, you can close the application and restart it for example without
having to restart the guest. In this case, the feature negotiation is
not done again.

So I remain convinced we should not provide the possibility to disable
any feature that is not dependent on the application.

Megeable buffers is not dependent on the application, as it is only
related to the ring implementation, and it is supported by the DPDK
Vhost library.

Regards,
Maxime
  
Maxime Coquelin Sept. 30, 2019, 9:04 a.m. UTC | #15
On 6/19/19 8:13 AM, Noa Ezra wrote:
> Rx mergeable buffers is a virtio feature that allows chaining of
> multiple virtio descriptors to handle large packet size.
> This behavior is supported and enabled by default, however in case
> the user knows that rx mergeable buffers are not needed, he can disable
> the feature.
> The user should also set mrg_rxbuf=off in virtual machine's xml.
> 
> Signed-off-by: Noa Ezra <noae@mellanox.com>
> Reviewed-by: Matan Azrad <matan@mellanox.com>
> ---
>  doc/guides/nics/vhost.rst         |  5 +++++
>  drivers/net/vhost/rte_eth_vhost.c | 17 ++++++++++++++++-
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 

As stated earlier, I will not apply this patch because feature disabling
should be done at Vhost-user master side.

The exception are for features that require specific support from the
application, such as TSO or postcopy.

Regards,
Maxime
  

Patch

diff --git a/doc/guides/nics/vhost.rst b/doc/guides/nics/vhost.rst
index 8cfda4d..2a455b5 100644
--- a/doc/guides/nics/vhost.rst
+++ b/doc/guides/nics/vhost.rst
@@ -81,6 +81,11 @@  The user can specify below arguments in `--vdev` option.
     It is used to disable tso support in vhost library.
     (Default: 1 (enabled))
 
+#.  ``mrg-rxbuf``:
+
+    It is used to disable mrg rxbuf support in vhost library.
+    (Default: 1 (enabled))
+
 Vhost PMD event handling
 ------------------------
 
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index a38c235..9a54020 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -32,6 +32,7 @@ 
 #define ETH_VHOST_IOMMU_SUPPORT		"iommu-support"
 #define ETH_VHOST_POSTCOPY_SUPPORT	"postcopy-support"
 #define ETH_VHOST_VIRTIO_NET_F_HOST_TSO "tso"
+#define ETH_VHOST_VIRTIO_NET_F_MRG_RXBUF "mrg-rxbuf"
 #define VHOST_MAX_PKT_BURST 32
 
 static const char *valid_arguments[] = {
@@ -42,6 +43,7 @@ 
 	ETH_VHOST_IOMMU_SUPPORT,
 	ETH_VHOST_POSTCOPY_SUPPORT,
 	ETH_VHOST_VIRTIO_NET_F_HOST_TSO,
+	ETH_VHOST_VIRTIO_NET_F_MRG_RXBUF,
 	NULL
 };
 
@@ -1348,6 +1350,7 @@  struct vhost_xstats_name_off {
 	int iommu_support = 0;
 	int postcopy_support = 0;
 	int tso = 1;
+	int mrg_rxbuf = 1;
 	struct rte_eth_dev *eth_dev;
 	const char *name = rte_vdev_device_name(dev);
 
@@ -1442,6 +1445,17 @@  struct vhost_xstats_name_off {
 		}
 	}
 
+	if (rte_kvargs_count(kvlist, ETH_VHOST_VIRTIO_NET_F_MRG_RXBUF) == 1) {
+		ret = rte_kvargs_process(kvlist,
+				ETH_VHOST_VIRTIO_NET_F_MRG_RXBUF,
+				&open_int, &mrg_rxbuf);
+		if (ret < 0)
+			goto out_free;
+
+ 		if (mrg_rxbuf == 0)
+			disable_flags |= (1ULL << VIRTIO_NET_F_MRG_RXBUF);
+	}
+
 	if (dev->device.numa_node == SOCKET_ID_ANY)
 		dev->device.numa_node = rte_socket_id();
 
@@ -1494,7 +1508,8 @@  struct vhost_xstats_name_off {
 	"dequeue-zero-copy=<0|1> "
 	"iommu-support=<0|1> "
 	"postcopy-support=<0|1> "
-	"tso=<0|1>");
+	"tso=<0|1> "
+	"mrg-rxbuf=<0|1>");
 
 RTE_INIT(vhost_init_log)
 {