Skip to contentSkip to conversation

vdpa/mlx5: Make VIRTIO_NET_F_MRG_RXBUF off by default

PATCH Michael S. Tsirkin 2 participants 12 messages Mar 12, 2023 – Mar 15, 2023 10 messages not in the archive virtio core

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

Michael S. Tsirkin

author maintainer
#2 lore raw
Quoted 7 lines · Eli Cohen

One can still enable it when creating the vdpa device using vdpa tool by providing features that include it.

For example:

$ vdpa dev add name vdpa0 mgmtdev pci/0000:86:00.2 device_features 0x300cb982b

What's the reason to turn it off by default? It's generally a performance win isn't it?

Quoted 19 lines
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/vdpa/mlx5/net/mlx5_vnet.c +2 -0
index 4abc3a4ee515..3858ba1e8975 100644
@@ -3154,6 +3154,8 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
 			return -EINVAL;
 		}
 		device_features &= add_config->device_features;
+	} else {
+		device_features &= ~BIT_ULL(VIRTIO_NET_F_MRG_RXBUF);
 	}
 	if (!(device_features & BIT_ULL(VIRTIO_F_VERSION_1) &&
 	      device_features & BIT_ULL(VIRTIO_F_ACCESS_PLATFORM))) {
Signature · 1 line
2.38.1

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

A message that is not in the archive (sent off-list or not yet received): [email protected]

author maintainer
#4 lore raw
Quoted 6 lines · Eli Cohen
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Eli Cohen

One can still enable it when creating the vdpa device using vdpa tool by providing features that include it.

Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

For example:

$ vdpa dev add name vdpa0 mgmtdev pci/0000:86:00.2 device_features 0x300cb982b

What's the reason to turn it off by default? It's generally a performance win isn't it?

It has negative impact on packet rate so we want to keep it off by default.

Interesting. I feel this would benefit from a bit more analysis. Packet rate with dpdk? With linux? Is there a chance this will regress some workloads?
VIRTIO_NET_F_MRG_RXBUF was designed to save memory, which is good for small tcp buffers.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
---
  drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 ++
  1 file changed, 2 insertions(+)
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -0
index 4abc3a4ee515..3858ba1e8975 100644
@@ -3154,6 +3154,8 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
  			return -EINVAL;
  		}
Quoted 8 lines
Quoted 8 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +2 -0
  		device_features &= add_config->device_features;
+	} else {
+		device_features &= ~BIT_ULL(VIRTIO_NET_F_MRG_RXBUF);
  	}
  	if (!(device_features & BIT_ULL(VIRTIO_F_VERSION_1) &&
  	      device_features & BIT_ULL(VIRTIO_F_ACCESS_PLATFORM))) {
Signature · 1 line
2.38.1

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

A message that is not in the archive (sent off-list or not yet received): PH0PR12MB54816C24BAA322567BED21A0DCB89@PH0PR12MB5481.namprd12.prod.outlook.com

author maintainer
#6 lore raw
Quoted 30 lines · Parav Pandit
Quoted 21 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Sunday, March 12, 2023 6:25 AM

Quoted 14 lines · Eli Cohen
Quoted 11 lines · Michael S. Tsirkin
Quoted 8 lines · Eli Cohen

One can still enable it when creating the vdpa device using vdpa tool by providing features that include it.

For example:

$ vdpa dev add name vdpa0 mgmtdev pci/0000:86:00.2 device_features
0x300cb982b

What's the reason to turn it off by default? It's generally a performance win isn't it?

It has negative impact on packet rate so we want to keep it off by default.

The performance characteristics is very workload specific.
It is less of interest given the primary reason is backward compatibility, more below.

Quoted 5 lines

Interesting. I feel this would benefit from a bit more analysis. Packet rate with dpdk? With linux? Is there a chance this will regress some workloads?
VIRTIO_NET_F_MRG_RXBUF was designed to save memory, which is good for small tcp buffers.

Quoted 7 lines

Eli,
Please update the commit message.
This change is to avoid regression in existing systems.
The device previously didn't report MRG_RXBUF cap and it was not in use.
Lately, certain devices are reporting this feature bit and it is breaking the backward compatibility. So the driver keeps it disabled by default.
User should enable it when user prefers to.

OK. And which commit changes that?

Signature · 6 lines
MST

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

A message that is not in the archive (sent off-list or not yet received): PH0PR12MB548140734E1A0A8A2FD2CE30DCB99@PH0PR12MB5481.namprd12.prod.outlook.com

author maintainer
#8 lore raw
Quoted 43 lines · Parav Pandit
Quoted 43 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Sunday, March 12, 2023 12:24 PM

Quoted 16 lines · Parav Pandit
Quoted 16 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Sunday, March 12, 2023 6:25 AM

Quoted 10 lines · Eli Cohen
Quoted 8 lines · Michael S. Tsirkin
Quoted 7 lines · Eli Cohen

One can still enable it when creating the vdpa device using vdpa tool by providing features that include it.

For example:

$ vdpa dev add name vdpa0 mgmtdev pci/0000:86:00.2
device_features 0x300cb982b
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

What's the reason to turn it off by default? It's generally a performance win isn't it?

It has negative impact on packet rate so we want to keep it off by default.

The performance characteristics is very workload specific.
It is less of interest given the primary reason is backward compatibility, more

below.

Quoted 7 lines
Quoted 6 lines

Interesting. I feel this would benefit from a bit more analysis. Packet rate with dpdk? With linux? Is there a chance this will regress some workloads?
VIRTIO_NET_F_MRG_RXBUF was designed to save memory, which is good for small tcp buffers.

Quoted 5 lines

Eli,
Please update the commit message.
This change is to avoid regression in existing systems.
The device previously didn't report MRG_RXBUF cap and it was not in use. Lately, certain devices are reporting this feature bit and it is breaking the

backward compatibility.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

So the driver keeps it disabled by default.
User should enable it when user prefers to.

OK. And which commit changes that?

vdpa dev add command [1] has the ability to set the desired features. The commit log of this patch has an example too.

[1] https://elixir.bootlin.com/linux/v6.3-rc2/C/ident/vdpa_nl_cmd_dev_add_set_doit

I mean if this is claiming to fix a performance regression it should have a Fixes: tag with the commit that introduced the regression.

Signature · 6 lines
MST

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
#9 lore raw
Quoted 40 lines · Michael S. Tsirkin
Quoted 39 lines · Parav Pandit
Quoted 39 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Sunday, March 12, 2023 12:24 PM

Quoted 14 lines · Parav Pandit
Quoted 14 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Sunday, March 12, 2023 6:25 AM

Quoted 9 lines · Eli Cohen
Quoted 8 lines · Michael S. Tsirkin
Quoted 7 lines · Eli Cohen

One can still enable it when creating the vdpa device using vdpa tool by providing features that include it.

For example:

$ vdpa dev add name vdpa0 mgmtdev pci/0000:86:00.2
device_features 0x300cb982b
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

What's the reason to turn it off by default? It's generally a performance win isn't it?

It has negative impact on packet rate so we want to keep it off by default.

The performance characteristics is very workload specific.
It is less of interest given the primary reason is backward compatibility, more

below.

Quoted 10 lines
Quoted 5 lines

Interesting. I feel this would benefit from a bit more analysis. Packet rate with dpdk? With linux? Is there a chance this will regress some workloads?
VIRTIO_NET_F_MRG_RXBUF was designed to save memory, which is good for small tcp buffers.

Eli,
Please update the commit message.
This change is to avoid regression in existing systems.
The device previously didn't report MRG_RXBUF cap and it was not in use. Lately, certain devices are reporting this feature bit and it is breaking the

backward compatibility.

Quoted 2 lines

So the driver keeps it disabled by default.
User should enable it when user prefers to.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

OK. And which commit changes that?

vdpa dev add command [1] has the ability to set the desired features. The commit log of this patch has an example too.

[1] https://elixir.bootlin.com/linux/v6.3-rc2/C/ident/vdpa_nl_cmd_dev_add_set_doit

I mean if this is claiming to fix a performance regression it should have a Fixes: tag with the commit that introduced the regression.

I guess Eli and Parav may refer to the case where the hardware/firmware is going to offer VIRTIO_NET_F_MRG_RXBUF feature which has sort of performance impact to certain type of workload, while they want to keep the performance promise for the default vdap dev creation without having to mask the corresponding feature bit by explicitly specifying device_features. I don't think Fixes: tag is applicable here, right?

-Siwei

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

A message that is not in the archive (sent off-list or not yet received): PH0PR12MB5481766116A2C074EDA7B3CCDCB99@PH0PR12MB5481.namprd12.prod.outlook.com

author maintainer
#11 lore raw
Quoted 7 lines · Parav Pandit
Quoted 6 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, March 13, 2023 5:24 PM
I mean if this is claiming to fix a performance regression it should have a Fixes:
tag with the commit that introduced the regression.

Quoted 6 lines

The fixes tag should be,

Fixes deeacf35c922d ("vdpa/mlx5: support device features provisioning")

Eli,
Please add.

Hmm okay so to make sure, before this commit device by default is created without mrg buffers? With the commit it's created with and what the change does it revert the default back to what it was?

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

A message that is not in the archive (sent off-list or not yet received): PH0PR12MB5481FBB83AF401E598448736DCBE9@PH0PR12MB5481.namprd12.prod.outlook.com

author maintainer
#13 lore raw
Quoted 18 lines · Parav Pandit
Quoted 18 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, March 13, 2023 5:45 PM

Quoted 12 lines · Parav Pandit
Quoted 6 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, March 13, 2023 5:24 PM I mean if this is claiming to fix a performance regression it should have a Fixes:
tag with the commit that introduced the regression.

The fixes tag should be,

Fixes deeacf35c922d ("vdpa/mlx5: support device features

provisioning")

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Eli,
Please add.

Hmm okay so to make sure, before this commit device by default is created without mrg buffers? With the commit it's created with and what the change does it revert the default back to what it was?

Yes.

So IIUC currently default comes from device. Which makes sense at some level, we can say device knows best maybe?
However in this case, we decided to override the default because changing this improves some things and regresses others. Which is ok at some level but then how does user know what are the device defaults?

Signature · 6 lines
MST

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
#14 lore raw
In reply to a message not in the archive
Quoted 14 lines · Parav Pandit
Quoted 14 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Sunday, March 12, 2023 6:25 AM

Quoted 9 lines · Eli Cohen
Quoted 8 lines · Michael S. Tsirkin
Quoted 7 lines · Eli Cohen

One can still enable it when creating the vdpa device using vdpa tool by providing features that include it.

For example:

$ vdpa dev add name vdpa0 mgmtdev pci/0000:86:00.2 device_features
0x300cb982b
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

What's the reason to turn it off by default? It's generally a performance win isn't it?

It has negative impact on packet rate so we want to keep it off by default.

The performance characteristics is very workload specific.
It is less of interest given the primary reason is backward compatibility, more below.

Actually there's no such burden or requirement to maintain backward compatibility for the default 'vdpa dev add' behavior if dedicated device_features is not specified. Historically the default vdpa creation on mlx5 ever got changed from single queue to 8 queue pairs when VIRTIO_NET_F_MQ feature was first introduced to mlx5_vdpa, then the default switched back to 1 data queue pair again when max_vqp attribute was added to the vdpa tool. Essentially, every addition of new feature to mlx5_vdpa, e.g. CTRL_VQ, CTRL_VLAN, and et al, effectively changed the default "vdpa dev add" behavior not just only once: the backward compatibility guarantee is simply just not there and ever.

-Siwei

Quoted 6 lines
Quoted 6 lines

Interesting. I feel this would benefit from a bit more analysis. Packet rate with dpdk? With linux? Is there a chance this will regress some workloads?
VIRTIO_NET_F_MRG_RXBUF was designed to save memory, which is good for small tcp buffers.

Quoted 8 lines

Eli,
Please update the commit message.
This change is to avoid regression in existing systems.
The device previously didn't report MRG_RXBUF cap and it was not in use.
Lately, certain devices are reporting this feature bit and it is breaking the backward compatibility. So the driver keeps it disabled by default.
User should enable it when user prefers to.

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

A message that is not in the archive (sent off-list or not yet received): PH0PR12MB5481A0629C479A030C8A8EDEDCBE9@PH0PR12MB5481.namprd12.prod.outlook.com

author maintainer
#16 lore raw
Quoted 14 lines · Parav Pandit
Quoted 4 lines

From: Si-Wei Liu <[email protected]>
Sent: Monday, March 13, 2023 6:19 PM

Quoted 10 lines

Actually there's no such burden or requirement to maintain backward compatibility for the default 'vdpa dev add' behavior if dedicated device_features is not specified. Historically the default vdpa creation on mlx5 ever got changed from single queue to 8 queue pairs when VIRTIO_NET_F_MQ feature was first introduced to mlx5_vdpa, then the default switched back to 1 data queue pair again when max_vqp attribute was added to the vdpa tool. Essentially, every addition of new feature to mlx5_vdpa, e.g. CTRL_VQ, CTRL_VLAN, and et al, effectively changed the default "vdpa dev add" behavior not just only once: the backward compatibility guarantee is simply just not there and ever.

Quoted 5 lines

This requires that every change in the device attributes will change the behavior for vdpa dev add. The OR operation of the user supplied feature bits with device defaults feature bit doesn’t look good to me. It brings uncertain behavior.

The right behavior should be, if user supplied the feature bits, it should supply all desired bits.

I think u mean all that device also supports.

Quoted 2 lines

If user doesn’t supply feature bits, use the device defaults. But not to mix both feature bits.

Can't say I understand what this means. What does "both" mean here?

Signature · 6 lines
MST

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

A message that is not in the archive (sent off-list or not yet received): PH0PR12MB54816DE6E7A0594D38019305DCBE9@PH0PR12MB5481.namprd12.prod.outlook.com

author maintainer
#18 lore raw
Quoted 40 lines · Parav Pandit
Quoted 22 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, March 13, 2023 11:38 PM

Quoted 10 lines · Parav Pandit
Quoted 10 lines

From: Si-Wei Liu <[email protected]>
Sent: Monday, March 13, 2023 6:19 PM

Actually there's no such burden or requirement to maintain backward compatibility for the default 'vdpa dev add' behavior if dedicated device_features is not specified. Historically the default vdpa creation on mlx5 ever got changed from single queue to 8 queue pairs when VIRTIO_NET_F_MQ feature was first introduced to mlx5_vdpa, then the default switched back to 1 data queue pair again when max_vqp

attribute was added to the vdpa tool.

Quoted 5 lines
Quoted 4 lines

Essentially, every addition of new feature to mlx5_vdpa, e.g. CTRL_VQ, CTRL_VLAN, and et al, effectively changed the default "vdpa dev add" behavior not just only once: the backward compatibility guarantee is simply just not there and ever.

This requires that every change in the device attributes will change the

behavior for vdpa dev add.

Quoted 9 lines
Quoted 1 line

The OR operation of the user supplied feature bits with device defaults

feature bit doesn’t look good to me.

Quoted 3 lines

It brings uncertain behavior.

The right behavior should be, if user supplied the feature bits, it should

supply all desired bits.

I think u mean all that device also supports.

If user supplied feature bits and device doesn’t support some of the feature bits -> add command fails.
If user supplied feature bits, than use only the feature bits. Do not OR user supplied feature bits with device supported feature bits. For example,
User asked to set,
F_CONFIG_MTU
F_CONFIG_MAC
F_PACKED
In that device should only use above 3 features. (because user is the master).

Quoted 6 lines

It should not OR user supplied feature bits with device defaults feature bits.

Quoted 1 line
Quoted 1 line

If user doesn’t supply feature bits, use the device defaults.

If user doesn’t supply any feature fits, that means user wants to run with some device defaults. In that case its fine to run with device defaults.

But this is not what this patch does?

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

But not to mix both feature bits.

Can't say I understand what this means. What does "both" mean here?

Mix Both means, to perform OR operation on user supplied feature bits with device defaults.

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#19 lore raw
In reply to a message not in the archive
Quoted 23 lines · Parav Pandit
Quoted 23 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Monday, March 13, 2023 11:38 PM

Quoted 8 lines · Parav Pandit
Quoted 8 lines

From: Si-Wei Liu <[email protected]>
Sent: Monday, March 13, 2023 6:19 PM
Actually there's no such burden or requirement to maintain backward compatibility for the default 'vdpa dev add' behavior if dedicated device_features is not specified. Historically the default vdpa creation on mlx5 ever got changed from single queue to 8 queue pairs when VIRTIO_NET_F_MQ feature was first introduced to mlx5_vdpa, then the default switched back to 1 data queue pair again when max_vqp

attribute was added to the vdpa tool.

Quoted 5 lines
Quoted 4 lines

Essentially, every addition of new feature to mlx5_vdpa, e.g. CTRL_VQ, CTRL_VLAN, and et al, effectively changed the default "vdpa dev add" behavior not just only once: the backward compatibility guarantee is simply just not there and ever.

This requires that every change in the device attributes will change the

behavior for vdpa dev add.

Quoted 1 line

The OR operation of the user supplied feature bits with device defaults

feature bit doesn’t look good to me.

Quoted 2 lines

It brings uncertain behavior.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

The right behavior should be, if user supplied the feature bits, it should

supply all desired bits.

I think u mean all that device also supports.

If user supplied feature bits and device doesn’t support some of the feature bits -> add command fails.
If user supplied feature bits, than use only the feature bits. Do not OR user supplied feature bits with device supported feature bits.

I think that is the not the current behavior for mlx5_vdpa? As far as I can see it would AND user supplied device_features bits with the device supported feature bits (find the common part of both feature bits) then proceed. I am not sure I follow what is the problem?

Quoted 7 lines

For example,
User asked to set,
F_CONFIG_MTU
F_CONFIG_MAC
F_PACKED
In that device should only use above 3 features. (because user is the master).

Quoted 5 lines

It should not OR user supplied feature bits with device defaults feature bits.

Quoted 1 line
Quoted 1 line

If user doesn’t supply feature bits, use the device defaults.

If user doesn’t supply any feature fits, that means user wants to run with some device defaults. In that case its fine to run with device defaults.

Noted, we don't have this device defaults exposed to users yet other than what's shown in the parent mgmtdev (dev_features). And the current and the only safe behavior for mlx5_vdpa is to inherit all device supported features from parent mgmtdev, otherwise user can't know in advance what default features the device might come up with implicitly underneath. Basically it would need to add new CLI interface to achieve what you want.

Thanks,
-Siwei

Quoted 4 lines
Quoted 3 lines
Quoted 2 lines

But not to mix both feature bits.

Can't say I understand what this means. What does "both" mean here?

Mix Both means, to perform OR operation on user supplied feature bits with device defaults.

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

A message that is not in the archive (sent off-list or not yet received): PH0PR12MB5481F776D35247E6BF3F115EDCBF9@PH0PR12MB5481.namprd12.prod.outlook.com

#21 lore raw
Quoted 11 lines · Parav Pandit
Quoted 9 lines

From: Si-Wei Liu <[email protected]>
Sent: Tuesday, March 14, 2023 3:29 PM

Quoted 1 line

If user supplied feature bits and device doesn’t support some of the feature

bits -> add command fails.

Quoted 1 line

If user supplied feature bits, than use only the feature bits. Do not OR user

supplied feature bits with device supported feature bits.
I think that is the not the current behavior for mlx5_vdpa? As far as I can see it would AND user supplied device_features bits with the device supported feature bits (find the common part of both feature bits) then proceed.

Right.
It is not a problem. It is AND operation. My bad.

Thanks for confirming it.

Quoted 2 lines

When the user didn’t supply the feature bits, this patch avoids MRG_RXBUF being on as default.

This should be fine, the driver should have the freedom to define its own set of default features when user didn't explicitly provision them through the device_features attribute. But better to expose a read-only filed, e.g. "default_features" to the "vdpa mgmtdev show" command output, otherwise users have no way to infer why MRG_RXBUF disappears mysteriously by just telling it from the current "dev_features" field. By definition, parent mgmtdev can have different default value between different devices.

Quoted 2 lines

This is because certain devices support it and certain device don’t.
So this patch keeps it backward compatible to be always off by default, which the device couldn’t do.

As previously discussed with Jason and I myself also agreed, it's never a requirement for driver to keep backward compatibility for the default feature bits when device_features is not supplied. The only way forward to keep backward compatibility is to perform explicit provisioning through device_features. But I think your point is to keep the performance promise for packet rate for the default device creation, that is another story and it has nothing to do with backward compatibility.

Thanks,
-Siwei

Quoted 8 lines
Quoted 6 lines

Noted, we don't have this device defaults exposed to users yet other than what's shown in the parent mgmtdev (dev_features). And the current and the only safe behavior for mlx5_vdpa is to inherit all device supported features from parent mgmtdev, otherwise user can't know in advance what default features the device might come up with implicitly underneath.

Right. This is fine.
For mlx5_vdpa MRG_RXBUF as default off is optimal as before that maintains the backward compatibility.

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization