ifcvf/vDPA: support query device config space through netlink
v3 cover ifcvf/vDPA: support query device config space through netlink
This series allows userspace to query device config space of vDPA devices and the management devices through netlink,
to get multi-queue, feature bits
This series has introduced a new netlink attr VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES, this should be used to query features of vDPA devices than the management device.
Please help review.
Thanks!
Zhu Lingshan
Changes from V2:
Add fixes tags(Parva)
Changes from V1:
(1) Use __virito16_to_cpu(true, xxx) for the le16 casting(Jason)
(2) Add a comment in ifcvf_get_config_size(), to explain
why we should return the minimum value ofsizeof(struct virtio_net_config) and the onboard
cap size(Jason)
(3) Introduced a new attr VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES
(4) Show the changes of iproute2 output before and after 5/6 patch(Jason)
(5) Fix cast warning in vdpa_fill_stats_rec()
Zhu Lingshan (6):
vDPA/ifcvf: get_config_size should return a value no greater than dev
implementation
vDPA/ifcvf: support userspace to query features and MQ of a management
device
vDPA: allow userspace to query features of a vDPA device
vDPA: !FEATURES_OK should not block querying device config space
vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ
== 0
vDPA: fix 'cast to restricted le16' warnings in vdpa.c
drivers/vdpa/ifcvf/ifcvf_base.c | 25 +++++++++++++++++++++++-- drivers/vdpa/ifcvf/ifcvf_base.h | 3 +++ drivers/vdpa/ifcvf/ifcvf_main.c | 3 +++ drivers/vdpa/vdpa.c | 32 +++++++++++++++----------------- include/uapi/linux/vdpa.h | 1 + 5 files changed, 45 insertions(+), 19 deletions(-)
Signature · 1 line
2.31.1
PATCH v3 1/6 vDPA/ifcvf: get_config_size should return a value no greater than dev implementation
ifcvf_get_config_size() should return a virtio device type specific value, however the ret_value should not be greater than the onboard size of the device implementation. E.g., for virtio_net, config_size should be the minimum value of sizeof(struct virtio_net_config) and the onboard cap size.
--- drivers/vdpa/ifcvf/ifcvf_base.c | 13 +++++++++++-- drivers/vdpa/ifcvf/ifcvf_base.h | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/vdpa/ifcvf/ifcvf_base.c +11 -2
@@ -128,6 +128,7 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, struct pci_dev *pdev)break ;case VIRTIO_PCI_CAP_DEVICE_CFG : hw->dev_cfg =get_cap_addr (hw, &cap); + hw->cap_dev_config_size =le32_to_cpu (cap.length);IFCVF_DBG (pdev,"hw->dev_cfg = %p\n" , hw->dev_cfg);break ; }
@@ -233,15 +234,23 @@ int ifcvf_verify_min_features(struct ifcvf_hw *hw, u64 features)u32 ifcvf_get_config_size (struct ifcvf_hw *hw) {struct ifcvf_adapter *adapter; +u32 net_config_size =sizeof (struct virtio_net_config ); +u32 blk_config_size =sizeof (struct virtio_blk_config ); +u32 cap_size = hw->cap_dev_config_size;u32 config_size; adapter =vf_to_adapter (hw); +/* If the onboard device config space size is greater than +* the size of struct virtio_net/blk_config, only the spec +* implementing contents size is returned, this is very +* unlikely, defensive programming. +*/ switch (hw->dev_type) {case VIRTIO_ID_NET : - config_size =sizeof (struct virtio_net_config ); + config_size = cap_size >= net_config_size ? net_config_size : cap_size;break ;case VIRTIO_ID_BLOCK : - config_size =sizeof (struct virtio_blk_config ); + config_size = cap_size >= blk_config_size ? blk_config_size : cap_size;break ;default : config_size =0 ;
drivers/vdpa/ifcvf/ifcvf_base.h +2 -0
@@ -87,6 +87,8 @@ struct ifcvf_hw {int config_irq;int vqs_reused_irq;u16 nr_vring; +/* VIRTIO_PCI_CAP_DEVICE_CFG size */ +u32 cap_dev_config_size; };struct ifcvf_adapter {
Signature · 1 line
2.31.1
Re: [PATCH V3 1/6] vDPA/ifcvf: get_config_size should return a value no greater than dev implementation
Quoted 6 lines · Zhu Lingshan
ifcvf_get_config_size()should return a virtio device type specific value, however theret_valueshould not be greater than the onboard size of the device implementation. E.g., forvirtio_net,config_sizeshould be the minimum value ofsizeof(struct virtio_net_config)and the onboard cap size.
Rethink of this, I wonder what's the value of exposing device implementation details to users? Anyhow the parent is in charge of "emulating" config space accessing.
If we do this, it's probably a blocker for cross vendor stuff.
Thanks
Quoted 61 lines
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/ifcvf/ifcvf_base.c | 13 +++++++++++-- drivers/vdpa/ifcvf/ifcvf_base.h | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-)drivers/vdpa/ifcvf/ifcvf_base.c +11
-2@@ -128,6 +128,7 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, struct pci_dev *pdev)break ;case VIRTIO_PCI_CAP_DEVICE_CFG : hw->dev_cfg =get_cap_addr (hw, &cap); + hw->cap_dev_config_size =le32_to_cpu (cap.length);IFCVF_DBG (pdev,"hw->dev_cfg = %p\n" , hw->dev_cfg);break ; }@@ -233,15 +234,23 @@ int ifcvf_verify_min_features(struct ifcvf_hw *hw, u64 features)u32 ifcvf_get_config_size (struct ifcvf_hw *hw) {struct ifcvf_adapter *adapter; +u32 net_config_size =sizeof (struct virtio_net_config ); +u32 blk_config_size =sizeof (struct virtio_blk_config ); +u32 cap_size = hw->cap_dev_config_size;u32 config_size; adapter =vf_to_adapter (hw); +/* If the onboard device config space size is greater than +* the size of struct virtio_net/blk_config, only the spec +* implementing contents size is returned, this is very +* unlikely, defensive programming. +*/ switch (hw->dev_type) {case VIRTIO_ID_NET : - config_size =sizeof (struct virtio_net_config ); + config_size = cap_size >= net_config_size ? net_config_size : cap_size;break ;case VIRTIO_ID_BLOCK : - config_size =sizeof (struct virtio_blk_config ); + config_size = cap_size >= blk_config_size ? blk_config_size : cap_size;break ;default : config_size =0 ;drivers/vdpa/ifcvf/ifcvf_base.h +2
-1@@ -87,6 +87,8 @@ struct ifcvf_hw {int config_irq;int vqs_reused_irq;u16 nr_vring; +/* VIRTIO_PCI_CAP_DEVICE_CFG size */ +u32 cap_dev_config_size; };struct ifcvf_adapter { --2.31.1
Re: [PATCH V3 1/6] vDPA/ifcvf: get_config_size should return a value no greater than dev implementation
Quoted 9 lines · Jason Wang
Quoted 5 lines · Zhu Lingshan
ifcvf_get_config_size()should return a virtio device type specific value, however theret_valueshould not be greater than the onboard size of the device implementation. E.g., forvirtio_net,config_sizeshould be the minimum value ofsizeof(struct virtio_net_config)and the onboard cap size.Rethink of this, I wonder what's the value of exposing device implementation details to users? Anyhow the parent is in charge of "emulating" config space accessing.
This will not be exposed to the users, it is a ifcvf internal helper, to get the actual device config space size.
For example, if ifcvf drives an Intel virtio-net device,
if the device config space size is greater than sizeof(struct virtio_net_cfg), this means the device has something more than the spec, some private fields, we don't want to expose these extra private fields to the users, so in this case, we only return what the spec defines.
If the device config space size is less than sizeof(struct virtio_net_cfg), means the device didn't implement all fields the spec defined, like no RSS. In such cases, we only return what the device implemented.
So these are defensive programming.
Quoted 65 lines
If we do this, it's probably a blocker for cross vendor stuff.
Thanks
Quoted 60 lines
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/ifcvf/ifcvf_base.c | 13 +++++++++++-- drivers/vdpa/ifcvf/ifcvf_base.h | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-)drivers/vdpa/ifcvf/ifcvf_base.c +11
-2@@ -128,6 +128,7 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, struct pci_dev *pdev)break ;case VIRTIO_PCI_CAP_DEVICE_CFG : hw->dev_cfg =get_cap_addr (hw, &cap); + hw->cap_dev_config_size =le32_to_cpu (cap.length);IFCVF_DBG (pdev,"hw->dev_cfg = %p\n" , hw->dev_cfg);break ; }@@ -233,15 +234,23 @@ int ifcvf_verify_min_features(struct ifcvf_hw *hw, u64 features)u32 ifcvf_get_config_size (struct ifcvf_hw *hw) {struct ifcvf_adapter *adapter; +u32 net_config_size =sizeof (struct virtio_net_config ); +u32 blk_config_size =sizeof (struct virtio_blk_config ); +u32 cap_size = hw->cap_dev_config_size;u32 config_size; adapter =vf_to_adapter (hw); +/* If the onboard device config space size is greater than +* the size of struct virtio_net/blk_config, only the spec +* implementing contents size is returned, this is very +* unlikely, defensive programming. +*/ switch (hw->dev_type) {case VIRTIO_ID_NET : - config_size =sizeof (struct virtio_net_config ); + config_size = cap_size >= net_config_size ? net_config_size : cap_size;break ;case VIRTIO_ID_BLOCK : - config_size =sizeof (struct virtio_blk_config ); + config_size = cap_size >= blk_config_size ? blk_config_size : cap_size;break ;default : config_size =0 ;drivers/vdpa/ifcvf/ifcvf_base.h +2
-1@@ -87,6 +87,8 @@ struct ifcvf_hw {int config_irq;int vqs_reused_irq;u16 nr_vring; +/* VIRTIO_PCI_CAP_DEVICE_CFG size */ +u32 cap_dev_config_size; };struct ifcvf_adapter { --2.31.1
Michael S. Tsirkin
maintainerRe: [PATCH V3 1/6] vDPA/ifcvf: get_config_size should return a value no greater than dev implementation
Quoted 15 lines · Lingshan
Quoted 9 lines · Jason Wang
Quoted 5 lines · Zhu Lingshan
ifcvf_get_config_size()should return a virtio device type specific value, however theret_valueshould not be greater than the onboard size of the device implementation. E.g., forvirtio_net,config_sizeshould be the minimum value ofsizeof(struct virtio_net_config)and the onboard cap size.Rethink of this, I wonder what's the value of exposing device implementation details to users? Anyhow the parent is in charge of "emulating" config space accessing.
This will not be exposed to the users, it is a ifcvf internal helper, to get the actual device config space size.
Quoted 7 lines
For example, if ifcvf drives an Intel virtio-net device,
if the device config space size is greater thansizeof(struct virtio_net_cfg),
this means the device has something more than the spec, some private fields, we don't want to expose these extra private fields to the users, so in this case,
we only return what the spec defines.
This is kind of already the case.
Quoted 4 lines
If the device config space size is less than
sizeof(struct virtio_net_cfg), means the device didn't implement all fields the spec defined, like no RSS. In such cases, we only return what the device implemented.
So these are defensive programming.
I think the issue you are describing is simply this.
Driver must not access BAR outside capability length. Current code does not verify that it does not. Not the case for the current devices but it's best to be safe against the case where device does not implement some of the capability.
From that POV I think the patch is good, just fix the log.
Quoted 65 lines
Quoted 65 lines
If we do this, it's probably a blocker for cross vendor stuff.
Thanks
Quoted 60 lines
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/ifcvf/ifcvf_base.c | 13 +++++++++++-- drivers/vdpa/ifcvf/ifcvf_base.h | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-)drivers/vdpa/ifcvf/ifcvf_base.c +11
-2@@ -128,6 +128,7 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, struct pci_dev *pdev)break ;case VIRTIO_PCI_CAP_DEVICE_CFG : hw->dev_cfg =get_cap_addr (hw, &cap); + hw->cap_dev_config_size =le32_to_cpu (cap.length);IFCVF_DBG (pdev,"hw->dev_cfg = %p\n" , hw->dev_cfg);break ; }@@ -233,15 +234,23 @@ int ifcvf_verify_min_features(struct ifcvf_hw *hw, u64 features)u32 ifcvf_get_config_size (struct ifcvf_hw *hw) {struct ifcvf_adapter *adapter; +u32 net_config_size =sizeof (struct virtio_net_config ); +u32 blk_config_size =sizeof (struct virtio_blk_config ); +u32 cap_size = hw->cap_dev_config_size;u32 config_size; adapter =vf_to_adapter (hw); +/* If the onboard device config space size is greater than +* the size of struct virtio_net/blk_config, only the spec +* implementing contents size is returned, this is very +* unlikely, defensive programming. +*/ switch (hw->dev_type) {case VIRTIO_ID_NET : - config_size =sizeof (struct virtio_net_config ); + config_size = cap_size >= net_config_size ? net_config_size : cap_size;break ;case VIRTIO_ID_BLOCK : - config_size =sizeof (struct virtio_blk_config ); + config_size = cap_size >= blk_config_size ? blk_config_size : cap_size;break ;default : config_size =0 ;drivers/vdpa/ifcvf/ifcvf_base.h +2
-1@@ -87,6 +87,8 @@ struct ifcvf_hw {int config_irq;int vqs_reused_irq;u16 nr_vring; +/* VIRTIO_PCI_CAP_DEVICE_CFG size */ +u32 cap_dev_config_size; };struct ifcvf_adapter { --2.31.1
Re: [PATCH V3 1/6] vDPA/ifcvf: get_config_size should return a value no greater than dev implementation
Quoted 31 lines · Michael S. Tsirkin
Quoted 14 lines · Lingshan
Quoted 9 lines · Jason Wang
Quoted 5 lines · Zhu Lingshan
ifcvf_get_config_size()should return a virtio device type specific value, however theret_valueshould not be greater than the onboard size of the device implementation. E.g., forvirtio_net,config_sizeshould be the minimum value ofsizeof(struct virtio_net_config)and the onboard cap size.Rethink of this, I wonder what's the value of exposing device implementation details to users? Anyhow the parent is in charge of "emulating" config space accessing.
This will not be exposed to the users, it is a ifcvf internal helper, to get the actual device config space size.
Quoted 7 lines
For example, if ifcvf drives an Intel virtio-net device,
if the device config space size is greater thansizeof(struct virtio_net_cfg),
this means the device has something more than the spec, some private fields, we don't want to expose these extra private fields to the users, so in this case,
we only return what the spec defines.This is kind of already the case.
Quoted 4 lines
If the device config space size is less than
sizeof(struct virtio_net_cfg), means the device didn't implement all fields the spec defined, like no RSS. In such cases, we only return what the device implemented.
So these are defensive programming.I think the issue you are describing is simply this.
Quoted 7 lines
Driver must not access BAR outside capability length. Current code does not verify that it does not. Not the case for the current devices but it's best to be safe against the case where device does not implement some of the capability.
From that POV I think the patch is good, just fix the log.
sure, I will do
Thanks,
Zhu Lingshan
Quoted 67 lines
Quoted 67 lines
Quoted 67 lines
If we do this, it's probably a blocker for cross vendor stuff.
Thanks
Quoted 60 lines
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/ifcvf/ifcvf_base.c | 13 +++++++++++-- drivers/vdpa/ifcvf/ifcvf_base.h | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-)drivers/vdpa/ifcvf/ifcvf_base.c +11
-2@@ -128,6 +128,7 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, struct pci_dev *pdev)break ;case VIRTIO_PCI_CAP_DEVICE_CFG : hw->dev_cfg =get_cap_addr (hw, &cap); + hw->cap_dev_config_size =le32_to_cpu (cap.length);IFCVF_DBG (pdev,"hw->dev_cfg = %p\n" , hw->dev_cfg);break ; }@@ -233,15 +234,23 @@ int ifcvf_verify_min_features(struct ifcvf_hw *hw, u64 features)u32 ifcvf_get_config_size (struct ifcvf_hw *hw) {struct ifcvf_adapter *adapter; +u32 net_config_size =sizeof (struct virtio_net_config ); +u32 blk_config_size =sizeof (struct virtio_blk_config ); +u32 cap_size = hw->cap_dev_config_size;u32 config_size; adapter =vf_to_adapter (hw); +/* If the onboard device config space size is greater than +* the size of struct virtio_net/blk_config, only the spec +* implementing contents size is returned, this is very +* unlikely, defensive programming. +*/ switch (hw->dev_type) {case VIRTIO_ID_NET : - config_size =sizeof (struct virtio_net_config ); + config_size = cap_size >= net_config_size ? net_config_size : cap_size;break ;case VIRTIO_ID_BLOCK : - config_size =sizeof (struct virtio_blk_config ); + config_size = cap_size >= blk_config_size ? blk_config_size : cap_size;break ;default : config_size =0 ;drivers/vdpa/ifcvf/ifcvf_base.h +2
-1@@ -87,6 +87,8 @@ struct ifcvf_hw {int config_irq;int vqs_reused_irq;u16 nr_vring; +/* VIRTIO_PCI_CAP_DEVICE_CFG size */ +u32 cap_dev_config_size; };struct ifcvf_adapter { --2.31.1
Michael S. Tsirkin
maintainerRe: [PATCH V3 1/6] vDPA/ifcvf: get_config_size should return a value no greater than dev implementation
In reply to Zhu LingshanQuoted 40 lines · Zhu Lingshan
ifcvf_get_config_size()should return a virtio device type specific value, however theret_valueshould not be greater than the onboard size of the device implementation. E.g., forvirtio_net,config_sizeshould be the minimum value ofsizeof(struct virtio_net_config)and the onboard cap size.Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/ifcvf/ifcvf_base.c | 13 +++++++++++-- drivers/vdpa/ifcvf/ifcvf_base.h | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-)drivers/vdpa/ifcvf/ifcvf_base.c +9
-0@@ -128,6 +128,7 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, struct pci_dev *pdev)break ;case VIRTIO_PCI_CAP_DEVICE_CFG : hw->dev_cfg =get_cap_addr (hw, &cap); + hw->cap_dev_config_size =le32_to_cpu (cap.length);IFCVF_DBG (pdev,"hw->dev_cfg = %p\n" , hw->dev_cfg);break ; }@@ -233,15 +234,23 @@ int ifcvf_verify_min_features(struct ifcvf_hw *hw, u64 features)u32 ifcvf_get_config_size (struct ifcvf_hw *hw) {struct ifcvf_adapter *adapter; +u32 net_config_size =sizeof (struct virtio_net_config ); +u32 blk_config_size =sizeof (struct virtio_blk_config ); +u32 cap_size = hw->cap_dev_config_size;u32 config_size; adapter =vf_to_adapter (hw); +/* If the onboard device config space size is greater than +* the size of struct virtio_net/blk_config, only the spec +* implementing contents size is returned, this is very +* unlikely, defensive programming. +*/ switch (hw->dev_type) {
drivers/vdpa/ifcvf/ifcvf_base.c int ifcvf_verify_min_features(struct ifcvf_hw *hw, u64 features) · line 256
Quoted 10 lines
drivers/vdpa/ifcvf/ifcvf_base.c +2
-2case VIRTIO_ID_NET : - config_size =sizeof (struct virtio_net_config ); + config_size = cap_size >= net_config_size ? net_config_size : cap_size;break ;case VIRTIO_ID_BLOCK : - config_size =sizeof (struct virtio_blk_config ); + config_size = cap_size >= blk_config_size ? blk_config_size : cap_size;break ;default : config_size =0 ;
There's a min macro for this.
Quoted 15 lines
drivers/vdpa/ifcvf/ifcvf_base.h +2
-0@@ -87,6 +87,8 @@ struct ifcvf_hw {int config_irq;int vqs_reused_irq;u16 nr_vring; +/* VIRTIO_PCI_CAP_DEVICE_CFG size */ +u32 cap_dev_config_size; };struct ifcvf_adapter {Signature · 1 line
2.31.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 1/6] vDPA/ifcvf: get_config_size should return a value no greater than dev implementation
Quoted 44 lines · Michael S. Tsirkin
Quoted 43 lines · Zhu Lingshan
ifcvf_get_config_size()should return a virtio device type specific value, however theret_valueshould not be greater than the onboard size of the device implementation. E.g., forvirtio_net,config_sizeshould be the minimum value ofsizeof(struct virtio_net_config)and the onboard cap size.Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/ifcvf/ifcvf_base.c | 13 +++++++++++-- drivers/vdpa/ifcvf/ifcvf_base.h | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-)drivers/vdpa/ifcvf/ifcvf_base.c +10
-1@@ -128,6 +128,7 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, struct pci_dev *pdev)break ;case VIRTIO_PCI_CAP_DEVICE_CFG : hw->dev_cfg =get_cap_addr (hw, &cap); + hw->cap_dev_config_size =le32_to_cpu (cap.length);IFCVF_DBG (pdev,"hw->dev_cfg = %p\n" , hw->dev_cfg);break ; }@@ -233,15 +234,23 @@ int ifcvf_verify_min_features(struct ifcvf_hw *hw, u64 features)u32 ifcvf_get_config_size (struct ifcvf_hw *hw) {struct ifcvf_adapter *adapter; +u32 net_config_size =sizeof (struct virtio_net_config ); +u32 blk_config_size =sizeof (struct virtio_blk_config ); +u32 cap_size = hw->cap_dev_config_size;u32 config_size; adapter =vf_to_adapter (hw); +/* If the onboard device config space size is greater than +* the size of struct virtio_net/blk_config, only the spec +* implementing contents size is returned, this is very +* unlikely, defensive programming. +*/ switch (hw->dev_type) {case VIRTIO_ID_NET : - config_size =sizeof (struct virtio_net_config ); + config_size = cap_size >= net_config_size ? net_config_size : cap_size;
Quoted 8 lines
drivers/vdpa/ifcvf/ifcvf_base.c int ifcvf_verify_min_features(struct ifcvf_hw *hw, u64 features) · line 256
Quoted 7 lines
drivers/vdpa/ifcvf/ifcvf_base.c +1
-1break ;case VIRTIO_ID_BLOCK : - config_size =sizeof (struct virtio_blk_config ); + config_size = cap_size >= blk_config_size ? blk_config_size : cap_size;break ;default : config_size =0 ;There's a min macro for this.
yes, a min macro is better.
Thanks,
Zhu Lingshan
Quoted 16 lines
Quoted 16 lines
drivers/vdpa/ifcvf/ifcvf_base.h +2
-0@@ -87,6 +87,8 @@ struct ifcvf_hw {int config_irq;int vqs_reused_irq;u16 nr_vring; +/* VIRTIO_PCI_CAP_DEVICE_CFG size */ +u32 cap_dev_config_size; };struct ifcvf_adapter {Signature · 1 line
2.31.1
PATCH v3 2/6 vDPA/ifcvf: support userspace to query features and MQ of a management device
In reply to Zhu LingshanAdapting to current netlink interfaces, this commit allows userspace to query feature bits and MQ capability of a management device.
--- drivers/vdpa/ifcvf/ifcvf_base.c | 12 ++++++++++++ drivers/vdpa/ifcvf/ifcvf_base.h | 1 + drivers/vdpa/ifcvf/ifcvf_main.c | 3 +++ 3 files changed, 16 insertions(+)
drivers/vdpa/ifcvf/ifcvf_base.c +12 -0
@@ -346,6 +346,18 @@ int ifcvf_set_vq_state(struct ifcvf_hw *hw, u16 qid, u16 num)return 0 ; } +u16 ifcvf_get_max_vq_pairs (struct ifcvf_hw *hw) +{ +struct virtio_net_config __iomem *config; +u16 val, mq; + + config = hw->dev_cfg; + val =vp_ioread16 ((__le16 __iomem *)&config->max_virtqueue_pairs); + mq =le16_to_cpu ((__force __le16 )val); + +return mq; +} +static int ifcvf_hw_enable (struct ifcvf_hw *hw) {struct virtio_pci_common_cfg __iomem *cfg;
drivers/vdpa/ifcvf/ifcvf_base.h +1 -0
@@ -130,6 +130,7 @@ u64 ifcvf_get_hw_features(struct ifcvf_hw *hw);int ifcvf_verify_min_features (struct ifcvf_hw *hw,u64 features);u16 ifcvf_get_vq_state (struct ifcvf_hw *hw,u16 qid);int ifcvf_set_vq_state (struct ifcvf_hw *hw,u16 qid,u16 num); +u16 ifcvf_get_max_vq_pairs (struct ifcvf_hw *hw);struct ifcvf_adapter *vf_to_adapter (struct ifcvf_hw *hw);int ifcvf_probed_virtio_net (struct ifcvf_hw *hw);u32 ifcvf_get_config_size (struct ifcvf_hw *hw);
drivers/vdpa/ifcvf/ifcvf_main.c +3 -0
@@ -791,6 +791,9 @@ static int ifcvf_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name, vf->hw_features =ifcvf_get_hw_features (vf); vf->config_size =ifcvf_get_config_size (vf); + ifcvf_mgmt_dev->mdev.max_supported_vqs =ifcvf_get_max_vq_pairs (vf); + ifcvf_mgmt_dev->mdev.supported_features = vf->hw_features; + adapter->vdpa.mdev = &ifcvf_mgmt_dev->mdev; ret =_vdpa_register_device (&adapter->vdpa, vf->nr_vring);if (ret) {
Signature · 1 line
2.31.1
Re: [PATCH V3 2/6] vDPA/ifcvf: support userspace to query features and MQ of a management device
Quoted 50 lines · Zhu Lingshan
Adapting to current netlink interfaces, this commit allows userspace to query feature bits and MQ capability of a management device.
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/ifcvf/ifcvf_base.c | 12 ++++++++++++ drivers/vdpa/ifcvf/ifcvf_base.h | 1 + drivers/vdpa/ifcvf/ifcvf_main.c | 3 +++ 3 files changed, 16 insertions(+)drivers/vdpa/ifcvf/ifcvf_base.c +12
-0@@ -346,6 +346,18 @@ int ifcvf_set_vq_state(struct ifcvf_hw *hw, u16 qid, u16 num)return 0 ; } +u16 ifcvf_get_max_vq_pairs (struct ifcvf_hw *hw) +{ +struct virtio_net_config __iomem *config; +u16 val, mq; + + config = hw->dev_cfg; + val =vp_ioread16 ((__le16 __iomem *)&config->max_virtqueue_pairs); + mq =le16_to_cpu ((__force __le16 )val); + +return mq; +} +static int ifcvf_hw_enable (struct ifcvf_hw *hw) {struct virtio_pci_common_cfg __iomem *cfg;drivers/vdpa/ifcvf/ifcvf_base.h +1
-0@@ -130,6 +130,7 @@ u64 ifcvf_get_hw_features(struct ifcvf_hw *hw);int ifcvf_verify_min_features (struct ifcvf_hw *hw,u64 features);u16 ifcvf_get_vq_state (struct ifcvf_hw *hw,u16 qid);int ifcvf_set_vq_state (struct ifcvf_hw *hw,u16 qid,u16 num); +u16 ifcvf_get_max_vq_pairs (struct ifcvf_hw *hw);struct ifcvf_adapter *vf_to_adapter (struct ifcvf_hw *hw);int ifcvf_probed_virtio_net (struct ifcvf_hw *hw);u32 ifcvf_get_config_size (struct ifcvf_hw *hw);drivers/vdpa/ifcvf/ifcvf_main.c +0
-0
drivers/vdpa/ifcvf/ifcvf_main.c static int ifcvf_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name, · line 794
Quoted 4 lines
drivers/vdpa/ifcvf/ifcvf_main.c +1
-0@@ -791,6 +791,9 @@ static int ifcvf_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name, vf->hw_features =ifcvf_get_hw_features (vf); vf->config_size =ifcvf_get_config_size (vf); + ifcvf_mgmt_dev->mdev.max_supported_vqs =ifcvf_get_max_vq_pairs (vf);
Do we want #qps or #queues?
FYI, vp_vdpa did:
drivers/vdpa/virtio_pci/vp_vdpa.c: mgtdev->max_supported_vqs = vp_modern_get_num_queues(mdev);
Thanks
Quoted 5 lines
drivers/vdpa/ifcvf/ifcvf_main.c +2
-0+ ifcvf_mgmt_dev->mdev.supported_features = vf->hw_features; + adapter->vdpa.mdev = &ifcvf_mgmt_dev->mdev; ret =_vdpa_register_device (&adapter->vdpa, vf->nr_vring);if (ret) {
Re: [PATCH V3 2/6] vDPA/ifcvf: support userspace to query features and MQ of a management device
Quoted 60 lines · Jason Wang
Quoted 50 lines · Zhu Lingshan
Adapting to current netlink interfaces, this commit allows userspace to query feature bits and MQ capability of a management device.
Signed-off-by Zhu Lingshan <[email protected]>---
drivers/vdpa/ifcvf/ifcvf_base.c | 12 ++++++++++++ drivers/vdpa/ifcvf/ifcvf_base.h | 1 + drivers/vdpa/ifcvf/ifcvf_main.c | 3 +++ 3 files changed, 16 insertions(+)drivers/vdpa/ifcvf/ifcvf_base.c +11
-0@@ -346,6 +346,18 @@ int ifcvf_set_vq_state(struct ifcvf_hw *hw, u16 qid, u16 num) return 0; } +u16 ifcvf_get_max_vq_pairs(struct ifcvf_hw *hw) +{ + struct virtio_net_config __iomem *config; + u16 val, mq; + + config = hw->dev_cfg; + val = vp_ioread16((__le16 __iomem *)&config->max_virtqueue_pairs); + mq = le16_to_cpu((__force __le16)val); + + return mq; +} + static int ifcvf_hw_enable(struct ifcvf_hw *hw) {struct
virtio_pci_common_cfg__iomem*cfg;drivers/vdpa/ifcvf/ifcvf_base.h +1
-0@@ -130,6 +130,7 @@ u64 ifcvf_get_hw_features(struct ifcvf_hw *hw); int ifcvf_verify_min_features(struct ifcvf_hw *hw, u64 features); u16 ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid); int ifcvf_set_vq_state(struct ifcvf_hw *hw, u16 qid, u16 num); +u16 ifcvf_get_max_vq_pairs (struct ifcvf_hw *hw); struct ifcvf_adapter *vf_to_adapter(struct ifcvf_hw *hw); int ifcvf_probed_virtio_net(struct ifcvf_hw *hw); u32 ifcvf_get_config_size(struct ifcvf_hw *hw);drivers/vdpa/ifcvf/ifcvf_main.c +0
-0drivers/vdpa/ifcvf/ifcvf_main.c static int ifcvf_vdpa_dev_add(struct · line 794
Quoted 4 lines
drivers/vdpa/ifcvf/ifcvf_main.c +0
-0@@ -791,6 +791,9 @@ static int ifcvf_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name, vf->hw_features = ifcvf_get_hw_features(vf); vf->config_size = ifcvf_get_config_size(vf); + ifcvf_mgmt_dev->mdev.max_supported_vqs = ifcvf_get_max_vq_pairs(vf);Do we want #qps or #queues?
Quoted 3 lines
FYI,
vp_vdpadid:
drivers/vdpa/virtio_pci/vp_vdpa.c:mgtdev->max_supported_vqs=vp_modern_get_num_queues(mdev);
Oh Yes, it should be the queues, will fix this
Thanks
Quoted 10 lines
Thanks
Quoted 5 lines
drivers/vdpa/ifcvf/ifcvf_main.c +2
-0+ ifcvf_mgmt_dev->mdev.supported_features = vf->hw_features; + adapter->vdpa.mdev = &ifcvf_mgmt_dev->mdev; ret = _vdpa_register_device(&adapter->vdpa, vf->nr_vring);if (ret) {
PATCH v3 3/6 vDPA: allow userspace to query features of a vDPA device
In reply to Zhu LingshanThis commit adds a new vDPA netlink attribution VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES. Userspace can query features of vDPA devices through this new attr.
--- drivers/vdpa/vdpa.c | 13 +++++++++---- include/uapi/linux/vdpa.h | 1 + 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/vdpa/vdpa.c +9 -4
@@ -815,7 +815,7 @@ static int vdpa_dev_net_mq_config_fill(struct vdpa_device *vdev,static int vdpa_dev_net_config_fill (struct vdpa_device *vdev,struct sk_buff *msg) {struct virtio_net_config config = {}; -u64 features; +u64 features_device, features_driver;u16 val_u16;vdpa_get_config_unlocked (vdev,0 , &config,sizeof (config));
@@ -832,12 +832,17 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *msif (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MTU , val_u16))return -EMSGSIZE ; - features = vdev->config->get_driver_features (vdev); -if (nla_put_u64_64bit (msg,VDPA_ATTR_DEV_NEGOTIATED_FEATURES , features, + features_driver = vdev->config->get_driver_features (vdev); +if (nla_put_u64_64bit (msg,VDPA_ATTR_DEV_NEGOTIATED_FEATURES , features_driver, +VDPA_ATTR_PAD )) +return -EMSGSIZE ; + + features_device = vdev->config->get_device_features (vdev); +if (nla_put_u64_64bit (msg,VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES , features_device,VDPA_ATTR_PAD ))return -EMSGSIZE ; -return vdpa_dev_net_mq_config_fill (vdev, msg, features, &config); +return vdpa_dev_net_mq_config_fill (vdev, msg, features_driver, &config); } static int
include/uapi/linux/vdpa.h +1 -0
@@ -47,6 +47,7 @@ enum vdpa_attr {VDPA_ATTR_DEV_NEGOTIATED_FEATURES ,/* u64 */ VDPA_ATTR_DEV_MGMTDEV_MAX_VQS ,/* u32 */ VDPA_ATTR_DEV_SUPPORTED_FEATURES ,/* u64 */ +VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES ,/* u64 */ VDPA_ATTR_DEV_QUEUE_INDEX ,/* u32 */ VDPA_ATTR_DEV_VENDOR_ATTR_NAME, /* string */
Signature · 1 line
2.31.1
RE: [PATCH V3 3/6] vDPA: allow userspace to query features of a vDPA device
Quoted 10 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AMThis commit adds a new vDPA netlink attribution
VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES. Userspace can query features of vDPA devices through this new attr.Fixes a64917bc2e9b vdpa: (Provide interface to read driver feature)
Missing the "" in the line.
I reviewed the patches again.
However, this is not the fix.
A fix cannot add a new UAPI.
Code is already considering negotiated driver features to return the device config space. Hence it is fine.
This patch intents to provide device features to user space.
First what vdpa device are capable of, are already returned by features attribute on the management device. This is done in commit [1].
The only reason to have it is, when one management device indicates that feature is supported, but device may end up not supporting this feature if such feature is shared with other devices on same physical device. For example all VFs may not be symmetric after large number of them are in use. In such case features bit of management device can differ (more features) than the vdpa device of this VF. Hence, showing on the device is useful.
As mentioned before in V2, commit [1] has wrongly named the attribute to VDPA_ATTR_DEV_SUPPORTED_FEATURES. It should have been, VDPA_ATTR_DEV_MGMTDEV_SUPPORTED_FEATURES.
Because it is in UAPI, and since we don't want to break compilation of iproute2,
It cannot be renamed anymore.
Given that, we do not want to start trend of naming device attributes with additional _VDPA_ to it as done in this patch. Error in commit [1] was exception.
Hence, please reuse VDPA_ATTR_DEV_SUPPORTED_FEATURES to return for device features too.
Secondly, you need output example for showing device features in the commit log.
3rd, please drop the fixes tag as new capability is not a fix.
[1] cd2629f6df1c ("vdpa: Support reporting max device capabilities ")
Quoted 60 lines
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 13 +++++++++---- include/uapi/linux/vdpa.h | 1 + 2 files changed, 10 insertions(+), 4 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
ebf2f363fbe7..9b0e39b2f022100644drivers/vdpa/vdpa.c +0
-0@@ -815,7 +815,7 @@ static int vdpa_dev_net_mq_config_fill(struct
vdpa_device*vdev, static intvdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *msg){drivers/vdpa/vdpa.c +1
-1struct virtio_net_config config = {}; -u64 features; +u64 features_device, features_driver;u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); @@ -832,12 +832,17 @@ static int vdpa_dev_net_config_fill(struct
vdpa_device*vdev, structsk_buff*msdrivers/vdpa/vdpa.c +0
-2if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MTU , val_u16))return -EMSGSIZE ; - features = vdev->config->get_driver_features (vdev); - if (nla_put_u64_64bit(msg,
VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features,drivers/vdpa/vdpa.c +2
-0+ features_driver = vdev->config->get_driver_features (vdev); + if (nla_put_u64_64bit(msg,
VDPA_ATTR_DEV_NEGOTIATED_FEATURES,features_driver,drivers/vdpa/vdpa.c +5
-0+ VDPA_ATTR_PAD)) +return -EMSGSIZE ; + + features_device = vdev->config->get_device_features (vdev); + if (nla_put_u64_64bit(msg,
VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES,drivers/vdpa/vdpa.c +3
-1+features_device, VDPA_ATTR_PAD))return -EMSGSIZE ; -return vdpa_dev_net_mq_config_fill (vdev, msg, features, &config); +return vdpa_dev_net_mq_config_fill (vdev, msg, features_driver, +&config); } static intinclude/uapi/linux/vdpa.h index renamed from include/uapi/linux/vdpa.h +0
-0
25c55cab3d7c..39f1c3d7c112100644include/uapi/linux/vdpa.h +1
-1@@ -47,6 +47,7 @@ enum vdpa_attr {VDPA_ATTR_DEV_NEGOTIATED_FEATURES ,/* u64 */ VDPA_ATTR_DEV_MGMTDEV_MAX_VQS ,/* u32 */ VDPA_ATTR_DEV_SUPPORTED_FEATURES ,/* u64 */ +VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES ,/* u64 */ VDPA_ATTR_DEV_QUEUE_INDEX ,/* u32 */ VDPA_ATTR_DEV_VENDOR_ATTR_NAME, /* string */ --2.31.1
Re: [PATCH V3 3/6] vDPA: allow userspace to query features of a vDPA device
Quoted 31 lines · Parav Pandit
Quoted 9 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AMThis commit adds a new vDPA netlink attribution
VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES. Userspace can query features of vDPA devices through this new attr.Fixes a64917bc2e9b vdpa: (Provide interface to read driver feature)Missing the "" in the line.
I reviewed the patches again.However, this is not the fix.
A fix cannot add a new UAPI.Code is already considering negotiated driver features to return the device config space. Hence it is fine.
This patch intents to provide device features to user space.
First what vdpa device are capable of, are already returned by features attribute on the management device. This is done in commit [1].The only reason to have it is, when one management device indicates that feature is supported, but device may end up not supporting this feature if such feature is shared with other devices on same physical device. For example all VFs may not be symmetric after large number of them are in use. In such case features bit of management device can differ (more features) than the vdpa device of this VF. Hence, showing on the device is useful.
As mentioned before in V2, commit [1] has wrongly named the attribute to
VDPA_ATTR_DEV_SUPPORTED_FEATURES. It should have been,VDPA_ATTR_DEV_MGMTDEV_SUPPORTED_FEATURES.
Because it is in UAPI, and since we don't want to break compilation of iproute2,
It cannot be renamed anymore.
Quoted 4 lines
Given that, we do not want to start trend of naming device attributes with additional _VDPA_ to it as done in this patch. Error in commit [1] was exception.
Hence, please reuse
VDPA_ATTR_DEV_SUPPORTED_FEATURESto return for device features too.
This will probably break or confuse the existing userspace?
Thanks
Quoted 67 lines
Secondly, you need output example for showing device features in the commit log.
3rd, please drop the fixes tag as new capability is not a fix.
[1]
cd2629f6df1c("vdpa: Support reporting max device capabilities ")Quoted 60 lines
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 13 +++++++++---- include/uapi/linux/vdpa.h | 1 + 2 files changed, 10 insertions(+), 4 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
ebf2f363fbe7..9b0e39b2f022100644drivers/vdpa/vdpa.c +0
-0@@ -815,7 +815,7 @@ static int vdpa_dev_net_mq_config_fill(struct
vdpa_device*vdev, static intvdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *msg){
structvirtio_net_configconfig = {};drivers/vdpa/vdpa.c +1
-1-u64 features; +u64 features_device, features_driver;u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); @@ -832,12 +832,17 @@ static int vdpa_dev_net_config_fill(struct
vdpa_device*vdev, structsk_buff*ms
if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16))
return-EMSGSIZE;drivers/vdpa/vdpa.c +0
-2- features = vdev->config->get_driver_features (vdev); - if (nla_put_u64_64bit(msg,
VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features,drivers/vdpa/vdpa.c +2
-0+ features_driver = vdev->config->get_driver_features (vdev); + if (nla_put_u64_64bit(msg,
VDPA_ATTR_DEV_NEGOTIATED_FEATURES,features_driver,drivers/vdpa/vdpa.c +5
-0+ VDPA_ATTR_PAD)) +return -EMSGSIZE ; + + features_device = vdev->config->get_device_features (vdev); + if (nla_put_u64_64bit(msg,
VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES,drivers/vdpa/vdpa.c +3
-1+features_device, VDPA_ATTR_PAD))return -EMSGSIZE ; -return vdpa_dev_net_mq_config_fill (vdev, msg, features, &config); +return vdpa_dev_net_mq_config_fill (vdev, msg, features_driver, +&config); } static intinclude/uapi/linux/vdpa.h index renamed from include/uapi/linux/vdpa.h +0
-0
25c55cab3d7c..39f1c3d7c112100644include/uapi/linux/vdpa.h +1
-1@@ -47,6 +47,7 @@ enum vdpa_attr {VDPA_ATTR_DEV_NEGOTIATED_FEATURES ,/* u64 */ VDPA_ATTR_DEV_MGMTDEV_MAX_VQS ,/* u32 */ VDPA_ATTR_DEV_SUPPORTED_FEATURES ,/* u64 */ +VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES ,/* u64 */ VDPA_ATTR_DEV_QUEUE_INDEX ,/* u32 */ VDPA_ATTR_DEV_VENDOR_ATTR_NAME, /* string */ --2.31.1
RE: [PATCH V3 3/6] vDPA: allow userspace to query features of a vDPA device
Quoted 47 lines
From: Jason Wang <[email protected]>
Sent: Monday, July 4, 2022 12:47 AMQuoted 6 lines · Parav Pandit
Quoted 6 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AMThis commit adds a new vDPA netlink attribution
VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES. Userspace can queryfeatures
Quoted 10 lines
Quoted 3 lines
of vDPA devices through this new attr.
Fixes a64917bc2e9b vdpa: (Provide interface to read driver feature)Missing the "" in the line.
I reviewed the patches again.However, this is not the fix.
A fix cannot add a new UAPI.Code is already considering negotiated driver features to return the device
config space.
Quoted 4 lines
Hence it is fine.
This patch intents to provide device features to user space. First what vdpa device are capable of, are already returned by features
attribute on the management device.
Quoted 3 lines
This is done in commit [1].
The only reason to have it is, when one management device indicates that
feature is supported, but device may end up not supporting this feature if such feature is shared with other devices on same physical device.
Quoted 1 line
For example all VFs may not be symmetric after large number of them are
in use. In such case features bit of management device can differ (more features) than the vdpa device of this VF.
Quoted 3 lines
Hence, showing on the device is useful.
As mentioned before in V2, commit [1] has wrongly named the attribute to
VDPA_ATTR_DEV_SUPPORTED_FEATURES.Quoted 1 line
It should have been,
VDPA_ATTR_DEV_MGMTDEV_SUPPORTED_FEATURES.Quoted 4 lines
Because it is in UAPI, and since we don't want to break compilation of iproute2, It cannot be renamed anymore.
Given that, we do not want to start trend of naming device attributes with
Quoted 9 lines
additional _VDPA_ to it as done in this patch.
Quoted 3 lines
Error in commit [1] was exception.
Hence, please reuse
VDPA_ATTR_DEV_SUPPORTED_FEATURESto returnfor device features too.
This will probably break or confuse the existing userspace?
It shouldn't break, because its new attribute on the device. All attributes are per command, so old one will not be confused either.
_______________________________________________
Virtualization mailing list [email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 3/6] vDPA: allow userspace to query features of a vDPA device
Quoted 48 lines · Parav Pandit
Quoted 48 lines
From: Jason Wang <[email protected]>
Sent: Monday, July 4, 2022 12:47 AMQuoted 5 lines · Parav Pandit
Quoted 5 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AMThis commit adds a new vDPA netlink attribution
VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES. Userspace can queryfeatures
Quoted 10 lines
Quoted 3 lines
of vDPA devices through this new attr.
Fixes a64917bc2e9b vdpa: (Provide interface to read driver feature)Missing the "" in the line.
I reviewed the patches again.However, this is not the fix.
A fix cannot add a new UAPI.Code is already considering negotiated driver features to return the device
config space.
Quoted 4 lines
Hence it is fine.
This patch intents to provide device features to user space. First what vdpa device are capable of, are already returned by features
attribute on the management device.
Quoted 3 lines
This is done in commit [1].
The only reason to have it is, when one management device indicates that
feature is supported, but device may end up not supporting this feature if such feature is shared with other devices on same physical device.
Quoted 1 line
For example all VFs may not be symmetric after large number of them are
in use. In such case features bit of management device can differ (more features) than the vdpa device of this VF.
Quoted 3 lines
Hence, showing on the device is useful.
As mentioned before in V2, commit [1] has wrongly named the attribute to
VDPA_ATTR_DEV_SUPPORTED_FEATURES.Quoted 1 line
It should have been,
VDPA_ATTR_DEV_MGMTDEV_SUPPORTED_FEATURES.Quoted 4 lines
Because it is in UAPI, and since we don't want to break compilation of iproute2, It cannot be renamed anymore.
Given that, we do not want to start trend of naming device attributes with
additional _VDPA_ to it as done in this patch.
Quoted 2 lines
Error in commit [1] was exception.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Hence, please reuse
VDPA_ATTR_DEV_SUPPORTED_FEATURESto returnfor device features too.
This will probably break or confuse the existing userspace?
It shouldn't break, because its new attribute on the device. All attributes are per command, so old one will not be confused either.
A netlink attr should has its own and unique purpose, that's why we don't need locks for the attrs, only one consumer and only one producer. I am afraid re-using (for both management device and the vDPA device) the attr VDPA_ATTR_DEV_SUPPORTED_FEATURES would lead to new race condition. E.g., There are possibilities of querying FEATURES of a management device and a vDPA device simultaneously, or can there be a syncing issue in a tick?
IMHO, I don't see any advantages of re-using this attr.
Thanks,
Zhu Lingshan
RE: [PATCH V3 3/6] vDPA: allow userspace to query features of a vDPA device
Quoted 68 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 5, 2022 3:59 AMQuoted 62 lines · Parav Pandit
Quoted 62 lines
From: Jason Wang <[email protected]>
Sent: Monday, July 4, 2022 12:47 AMQuoted 5 lines · Parav Pandit
Quoted 5 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AMThis commit adds a new vDPA netlink attribution
VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES. Userspace can queryfeatures
Quoted 4 lines
Quoted 4 lines
of vDPA devices through this new attr.
Fixes a64917bc2e9b vdpa: (Provide interface to read driverfeature)
Quoted 8 lines
Missing the "" in the line.
I reviewed the patches again.However, this is not the fix.
A fix cannot add a new UAPI.Code is already considering negotiated driver features to return the device
config space.
Quoted 5 lines
Hence it is fine.
This patch intents to provide device features to user space. First what vdpa device are capable of, are already returned by features
attribute on the management device.
Quoted 4 lines
This is done in commit [1].
The only reason to have it is, when one management device indicates that
feature is supported, but device may end up not supporting this feature if such feature is shared with other devices on same physical device.
Quoted 2 lines
For example all VFs may not be symmetric after large number of them are
in use. In such case features bit of management device can differ (more
features) than the vdpa device of this VF.Quoted 4 lines
Hence, showing on the device is useful.
As mentioned before in V2, commit [1] has wrongly named the attribute to
VDPA_ATTR_DEV_SUPPORTED_FEATURES.Quoted 1 line
It should have been,
VDPA_ATTR_DEV_MGMTDEV_SUPPORTED_FEATURES.Quoted 5 lines
Because it is in UAPI, and since we don't want to break compilation of iproute2, It cannot be renamed anymore.
Given that, we do not want to start trend of naming device attributes with
additional _VDPA_ to it as done in this patch.
Quoted 3 lines
Error in commit [1] was exception.
Hence, please reuse
VDPA_ATTR_DEV_SUPPORTED_FEATURESto returnfor device features too.
This will probably break or confuse the existing userspace?
Quoted 8 lines
Quoted 2 lines
It shouldn't break, because its new attribute on the device. All attributes are per command, so old one will not be confused either.
A netlink attr should has its own and unique purpose, that's why we don't need locks for the attrs, only one consumer and only one producer.
I am afraid re-using (for both management device and the vDPA device) the attrVDPA_ATTR_DEV_SUPPORTED_FEATURESwould lead to new race condition. E.g., There are possibilities of querying FEATURES of a management device and a vDPA device simultaneously, or can there be a syncing issue in a tick?
Both can be queried simultaneously. Each will return their own feature bits using same attribute. It wont lead to the race.
Quoted 2 lines
IMHO, I don't see any advantages of re-using this attr.
We don’t want to continue this mess of VDPA_DEV prefix for new attributes due to previous wrong naming.
Re: [PATCH V3 3/6] vDPA: allow userspace to query features of a vDPA device
Quoted 69 lines · Parav Pandit
Quoted 69 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 5, 2022 3:59 AMQuoted 64 lines · Parav Pandit
Quoted 53 lines
From: Jason Wang <[email protected]>
Sent: Monday, July 4, 2022 12:47 AMQuoted 5 lines · Parav Pandit
Quoted 5 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AMThis commit adds a new vDPA netlink attribution
VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES. Userspace can queryfeatures
Quoted 4 lines
Quoted 4 lines
of vDPA devices through this new attr.
Fixes a64917bc2e9b vdpa: (Provide interface to read driverfeature)
Quoted 8 lines
Missing the "" in the line.
I reviewed the patches again.However, this is not the fix.
A fix cannot add a new UAPI.Code is already considering negotiated driver features to return the device
config space.
Quoted 5 lines
Hence it is fine.
This patch intents to provide device features to user space. First what vdpa device are capable of, are already returned by features
attribute on the management device.
Quoted 4 lines
This is done in commit [1].
The only reason to have it is, when one management device indicates that
feature is supported, but device may end up not supporting this feature if such feature is shared with other devices on same physical device.
Quoted 2 lines
For example all VFs may not be symmetric after large number of them are
in use. In such case features bit of management device can differ (more
features) than the vdpa device of this VF.Quoted 4 lines
Hence, showing on the device is useful.
As mentioned before in V2, commit [1] has wrongly named the attribute to
VDPA_ATTR_DEV_SUPPORTED_FEATURES.Quoted 1 line
It should have been,
VDPA_ATTR_DEV_MGMTDEV_SUPPORTED_FEATURES.Quoted 5 lines
Because it is in UAPI, and since we don't want to break compilation of iproute2, It cannot be renamed anymore.
Given that, we do not want to start trend of naming device attributes with
Quoted 9 lines
additional _VDPA_ to it as done in this patch.
Quoted 3 lines
Error in commit [1] was exception.
Hence, please reuse
VDPA_ATTR_DEV_SUPPORTED_FEATURESto returnfor device features too.
This will probably break or confuse the existing userspace?
It shouldn't break, because its new attribute on the device. All attributes are per command, so old one will not be confused either.
Quoted 8 lines
Quoted 6 lines
A netlink attr should has its own and unique purpose, that's why we don't need locks for the attrs, only one consumer and only one producer.
I am afraid re-using (for both management device and the vDPA device) the attrVDPA_ATTR_DEV_SUPPORTED_FEATURESwould lead to new race condition. E.g., There are possibilities of querying FEATURES of a management device and a vDPA device simultaneously, or can there be a syncing issue in a tick?Both can be queried simultaneously. Each will return their own feature bits using same attribute. It wont lead to the race.
How? It is just a piece of memory, xxxx[attr], do you see locks in nla_put_u64_64bit()? It is a typical race condition, data accessed by multiple producers / consumers.
And re-use a netlink attr is really confusing.
Quoted 3 lines
Quoted 2 lines
IMHO, I don't see any advantages of re-using this attr.
We don’t want to continue this mess of
VDPA_DEVprefix for new attributes due to previous wrong naming.
as you point out before, is is a wrong naming, we can't re-nmme it because we don't want to break uAPI, so there needs a new attr, if you don't like the name VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES, it is more than welcome to suggest a new one
Thanks
RE: [PATCH V3 3/6] vDPA: allow userspace to query features of a vDPA device
Quoted 9 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 5, 2022 12:56 PMQuoted 1 line
Both can be queried simultaneously. Each will return their own feature bits
using same attribute.
Quoted 1 line
It wont lead to the race.
How? It is just a piece of memory, xxxx[attr], do you see locks in
nla_put_u64_64bit()? It is a typical race condition, data accessed by multiple producers / consumers.
No. There is no race condition in here. And new attribute enum by no means avoid any race.
Data put using nla_put cannot be accessed until they are transferred.
Quoted 1 line
And re-use a netlink attr is really confusing.
Please put comment for this variable explaining why it is shared for the exception.
Before that lets start, can you share a real world example of when this feature bitmap will have different value than the mgmt. device bitmap value?
Quoted 10 lines
Quoted 3 lines
Quoted 2 lines
IMHO, I don't see any advantages of re-using this attr.
We don’t want to continue this mess of
VDPA_DEVprefix for newattributes due to previous wrong naming.
as you point out before, is is a wrong naming, we can't re-nmme it because we don't want to break uAPI, so there needs a new attr, if you don't like the nameVDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES, it is more than welcome to suggest a new oneThanks
Re: [PATCH V3 3/6] vDPA: allow userspace to query features of a vDPA device
Quoted 4 lines · Parav Pandit
Quoted 4 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 5, 2022 12:56 PMQuoted 1 line
Both can be queried simultaneously. Each will return their own feature bits
using same attribute.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
It wont lead to the race.
How? It is just a piece of memory, xxxx[attr], do you see locks in
nla_put_u64_64bit()? It is a typical race condition, data accessed by multiple producers / consumers.No. There is no race condition in here. And new attribute enum by no means avoid any race.
Data put using
nla_putcannot be accessed until they are transferred.
How this is guaranteed? Do you see errors when calling nla_put_xxx() twice?
Quoted 5 lines
Quoted 2 lines
And re-use a netlink attr is really confusing.
Please put comment for this variable explaining why it is shared for the exception.
Before that lets start, can you share a real world example of when this feature bitmap will have different value than the mgmt. device bitmap value?
For example,
1. When migrate the VM to a node which has a more resourceful device. If the source side device does not have MQ, RSS or TSO feature, the vDPA device assigned to the VM does not have MQ, RSS or TSO as well. When migrating to a node which has a device with MQ, RSS or TSO, to provide a consistent network device to the guest, to be transparent to the guest, we need to mask out MQ, RSS or TSO in the vDPA device when provisioning. This is an example that management device may have different feature bits than the vDPA device.
2.SIOV, if a virtio device is capable of managing SIOV devices, and it exposes this capability by a feature bit(Like what I am doing in the "transport virtqueue"), we don't want the SIOV ADIs have SIOV features, so the ADIs don't have SIOV feature bit.
Thanks
Quoted 10 lines
Quoted 10 lines
Quoted 3 lines
Quoted 2 lines
IMHO, I don't see any advantages of re-using this attr.
We don’t want to continue this mess of
VDPA_DEVprefix for newattributes due to previous wrong naming.
as you point out before, is is a wrong naming, we can't re-nmme it because we don't want to break uAPI, so there needs a new attr, if you don't like the nameVDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES, it is more than welcome to suggest a new oneThanks
RE: [PATCH V3 3/6] vDPA: allow userspace to query features of a vDPA device
Quoted 11 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 5, 2022 10:25 PM
1. When migrate the VM to a node which has a more resourceful device. If the source side device does not have MQ, RSS or TSO feature, the vDPA device assigned to the VM does not have MQ, RSS or TSO as well. When migrating to a node which has a device with MQ, RSS or TSO, to provide a consistent network device to the guest, to be transparent to the guest, we need to mask out MQ, RSS or TSO in the vDPA device when provisioning. This is an example that management device may have different feature bits than the vDPA device.
Yes. Right.
Re: [PATCH V3 3/6] vDPA: allow userspace to query features of a vDPA device
In reply to Zhu, LingshanQuoted 8 lines · Lingshan
Quoted 5 lines · Parav Pandit
Quoted 5 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 5, 2022 12:56 PMQuoted 1 line
Both can be queried simultaneously. Each will return their own feature bits
using same attribute.
Quoted 1 line
It wont lead to the race.
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
How? It is just a piece of memory, xxxx[attr], do you see locks in
nla_put_u64_64bit()? It is a typical race condition, data accessed by multiple producers / consumers.No. There is no race condition in here. And new attribute enum by no means avoid any race.
Data put using
nla_putcannot be accessed until they are transferred.How this is guaranteed? Do you see errors when calling
nla_put_xxx()twice?
Parav, did you miss this?
Quoted 25 lines
Quoted 5 lines
Quoted 2 lines
And re-use a netlink attr is really confusing.
Please put comment for this variable explaining why it is shared for the exception.
Before that lets start, can you share a real world example of when this feature bitmap will have different value than the mgmt. device bitmap value?
For example,
1. When migrate the VM to a node which has a more resourceful device. If the source side device does not have MQ, RSS or TSO feature, the vDPA device assigned to the VM does not have MQ, RSS or TSO as well. When migrating to a node which has a device with MQ, RSS or TSO, to provide a consistent network device to the guest, to be transparent to the guest, we need to mask out MQ, RSS or TSO in the vDPA device when provisioning. This is an example that management device may have different feature bits than the vDPA device.2.SIOV, if a virtio device is capable of managing SIOV devices, and it exposes this capability by a feature
bit(Like what I am doing in the "transport virtqueue"), we don't want the SIOV ADIs have SIOV features, so the ADIs don't have SIOV feature bit.Thanks
Quoted 10 lines
Quoted 10 lines
Quoted 3 lines
Quoted 2 lines
IMHO, I don't see any advantages of re-using this attr.
We don’t want to continue this mess of
VDPA_DEVprefix for newattributes due to previous wrong naming.
as you point out before, is is a wrong naming, we can't re-nmme it because we don't want to break uAPI, so there needs a new attr, if you don't like the nameVDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES, it is more than welcome to suggest a new oneThanks
RE: [PATCH V3 3/6] vDPA: allow userspace to query features of a vDPA device
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Saturday, July 23, 2022 7:27 AMQuoted 12 lines · Lingshan
Quoted 9 lines · Parav Pandit
Quoted 9 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 5, 2022 12:56 PMQuoted 2 lines
Both can be queried simultaneously. Each will return their own feature bits
using same attribute.
Quoted 1 line
It wont lead to the race.
How? It is just a piece of memory, xxxx[attr], do you see locks in
nla_put_u64_64bit()? It is a typical race condition, data accessed by multiple producers / consumers.
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
No. There is no race condition in here. And new attribute enum by no means avoid any race.
Data put using
nla_putcannot be accessed until they are transferred.How this is guaranteed? Do you see errors when calling
nla_put_xxx()twice?Parav, did you miss this?
It is not called twice and reading attribute and packing in nla message is not race condition.
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 3/6] vDPA: allow userspace to query features of a vDPA device
In reply to Parav PanditQuoted 69 lines · Parav Pandit via Virtualization
Quoted 69 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 5, 2022 3:59 AMQuoted 64 lines · Parav Pandit
Quoted 53 lines
From: Jason Wang <[email protected]>
Sent: Monday, July 4, 2022 12:47 AMQuoted 5 lines · Parav Pandit
Quoted 5 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AMThis commit adds a new vDPA netlink attribution
VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES. Userspace can queryfeatures
Quoted 4 lines
Quoted 4 lines
of vDPA devices through this new attr.
Fixes a64917bc2e9b vdpa: (Provide interface to read driverfeature)
Quoted 8 lines
Missing the "" in the line.
I reviewed the patches again.However, this is not the fix.
A fix cannot add a new UAPI.Code is already considering negotiated driver features to return the device
config space.
Quoted 5 lines
Hence it is fine.
This patch intents to provide device features to user space. First what vdpa device are capable of, are already returned by features
attribute on the management device.
Quoted 4 lines
This is done in commit [1].
The only reason to have it is, when one management device indicates that
feature is supported, but device may end up not supporting this feature if such feature is shared with other devices on same physical device.
Quoted 2 lines
For example all VFs may not be symmetric after large number of them are
in use. In such case features bit of management device can differ (more
features) than the vdpa device of this VF.Quoted 4 lines
Hence, showing on the device is useful.
As mentioned before in V2, commit [1] has wrongly named the attribute to
VDPA_ATTR_DEV_SUPPORTED_FEATURES.Quoted 1 line
It should have been,
VDPA_ATTR_DEV_MGMTDEV_SUPPORTED_FEATURES.Quoted 5 lines
Because it is in UAPI, and since we don't want to break compilation of iproute2, It cannot be renamed anymore.
Given that, we do not want to start trend of naming device attributes with
Quoted 9 lines
additional _VDPA_ to it as done in this patch.
Quoted 3 lines
Error in commit [1] was exception.
Hence, please reuse
VDPA_ATTR_DEV_SUPPORTED_FEATURESto returnfor device features too.
This will probably break or confuse the existing userspace?
It shouldn't break, because its new attribute on the device. All attributes are per command, so old one will not be confused either.
Quoted 8 lines
Quoted 6 lines
A netlink attr should has its own and unique purpose, that's why we don't need locks for the attrs, only one consumer and only one producer.
I am afraid re-using (for both management device and the vDPA device) the attrVDPA_ATTR_DEV_SUPPORTED_FEATURESwould lead to new race condition. E.g., There are possibilities of querying FEATURES of a management device and a vDPA device simultaneously, or can there be a syncing issue in a tick?Both can be queried simultaneously. Each will return their own feature bits using same attribute. It wont lead to the race.
Agreed. Multiple userspace callers would do recv() calls on different netlink sockets. Looks to me shouldn't involve any race.
Quoted 3 lines
Quoted 2 lines
IMHO, I don't see any advantages of re-using this attr.
We don’t want to continue this mess of
VDPA_DEVprefix for new attributes due to previous wrong naming.
Well, you can say it's a mess but since the attr name can be reused for different command, I didn't care that much while reviewing this. Actually, it was initially named this way to show the device features in "vdpa dev config ..." output, but later on it had been moved to mgmtdev to show parent's capability.
-Siwei
Quoted 4 lines
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 3/6] vDPA: allow userspace to query features of a vDPA device
Quoted 78 lines · Si-Wei Liu
Quoted 75 lines · Parav Pandit via Virtualization
Quoted 75 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 5, 2022 3:59 AMQuoted 56 lines · Parav Pandit
Quoted 56 lines
From: Jason Wang <[email protected]>
Sent: Monday, July 4, 2022 12:47 AMQuoted 5 lines · Parav Pandit
Quoted 5 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AMThis commit adds a new vDPA netlink attribution
VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES. Userspace can queryfeatures
Quoted 4 lines
Quoted 4 lines
of vDPA devices through this new attr.
Fixes a64917bc2e9b vdpa: (Provide interface to read driverfeature)
Quoted 8 lines
Missing the "" in the line.
I reviewed the patches again.However, this is not the fix.
A fix cannot add a new UAPI.Code is already considering negotiated driver features to return the device
config space.
Quoted 5 lines
Hence it is fine.
This patch intents to provide device features to user space. First what vdpa device are capable of, are already returned by features
attribute on the management device.
Quoted 4 lines
This is done in commit [1].
The only reason to have it is, when one management device indicates that
feature is supported, but device may end up not supporting this feature if such feature is shared with other devices on same physical device.
Quoted 2 lines
For example all VFs may not be symmetric after large number of them are
in use. In such case features bit of management device can differ (more
features) than the vdpa device of this VF.Quoted 4 lines
Hence, showing on the device is useful.
As mentioned before in V2, commit [1] has wrongly named the attribute to
VDPA_ATTR_DEV_SUPPORTED_FEATURES.Quoted 1 line
It should have been,
VDPA_ATTR_DEV_MGMTDEV_SUPPORTED_FEATURES.Quoted 5 lines
Because it is in UAPI, and since we don't want to break compilation of iproute2, It cannot be renamed anymore.
Given that, we do not want to start trend of naming device attributes with
additional _VDPA_ to it as done in this patch.
Quoted 2 lines
Error in commit [1] was exception.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Hence, please reuse
VDPA_ATTR_DEV_SUPPORTED_FEATURESto returnfor device features too.
This will probably break or confuse the existing userspace?
It shouldn't break, because its new attribute on the device. All attributes are per command, so old one will not be confused either.
A netlink attr should has its own and unique purpose, that's why we don't need locks for the attrs, only one consumer and only one producer.
I am afraid re-using (for both management device and the vDPA device) the attrVDPA_ATTR_DEV_SUPPORTED_FEATURESwould lead to new race condition. E.g., There are possibilities of querying FEATURES of a management device and a vDPA device simultaneously, or can there be a syncing issue in a tick?
Quoted 3 lines
Quoted 2 lines
Both can be queried simultaneously. Each will return their own feature bits using same attribute. It wont lead to the race.
Agreed. Multiple userspace callers would do
recv()calls on different netlink sockets. Looks to me shouldn't involve any race.
oh yes, thanks for pointing this out, they are on different sockets belonging to different userspace programs.
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
IMHO, I don't see any advantages of re-using this attr.
We don’t want to continue this mess of
VDPA_DEVprefix for new attributes due to previous wrong naming.Well, you can say it's a mess but since the attr name can be reused for different command, I didn't care that much while reviewing this. Actually, it was initially named this way to show the device features in "vdpa dev config ..." output, but later on it had been moved to mgmtdev to show parent's capability.
yes there is a buggy commit, but we can not change it now, because we are not expected to break current uapi, so I think it is better to add a new attr, no benefits to reuse another attr.
Quoted 7 lines
-Siwei
Quoted 4 lines
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 3/6] vDPA: allow userspace to query features of a vDPA device
In reply to Parav PanditQuoted 10 lines · Parav Pandit
Quoted 9 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AMThis commit adds a new vDPA netlink attribution
VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES. Userspace can query features of vDPA devices through this new attr.Fixes a64917bc2e9b vdpa: (Provide interface to read driver feature)Missing the "" in the line.
will fix
Quoted 4 lines
I reviewed the patches again.
However, this is not the fix.
A fix cannot add a new UAPI.
I think we have discussed this, on why we can not re-name the existing wrong named attr, and why we can not re-use the attr. So are you suggesting remove this fixes tag?
And why a fix can not add a new uAPI?
Quoted 3 lines
Code is already considering negotiated driver features to return the device config space. Hence it is fine.
No, the spec says:
The device MUST allow reading of any device-specific configuration field before FEATURES_OK is set by the driver.
Quoted 4 lines
This patch intents to provide device features to user space.
First what vdpa device are capable of, are already returned by features attribute on the management device. This is done in commit [1].
we have discussed this in another thread, vDPA device feature bits can be different from the management device feature bits.
Quoted 9 lines
The only reason to have it is, when one management device indicates that feature is supported, but device may end up not supporting this feature if such feature is shared with other devices on same physical device. For example all VFs may not be symmetric after large number of them are in use. In such case features bit of management device can differ (more features) than the vdpa device of this VF. Hence, showing on the device is useful.
As mentioned before in V2, commit [1] has wrongly named the attribute to
VDPA_ATTR_DEV_SUPPORTED_FEATURES. It should have been,VDPA_ATTR_DEV_MGMTDEV_SUPPORTED_FEATURES.
Because it is in UAPI, and since we don't want to break compilation of iproute2,
It cannot be renamed anymore.
Yes, rename it will break current uAPI, so I can not rename it.
Quoted 72 lines
Given that, we do not want to start trend of naming device attributes with additional _VDPA_ to it as done in this patch. Error in commit [1] was exception.
Hence, please reuse
VDPA_ATTR_DEV_SUPPORTED_FEATURESto return for device features too.Secondly, you need output example for showing device features in the commit log.
3rd, please drop the fixes tag as new capability is not a fix.
[1]
cd2629f6df1c("vdpa: Support reporting max device capabilities ")Quoted 60 lines
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 13 +++++++++---- include/uapi/linux/vdpa.h | 1 + 2 files changed, 10 insertions(+), 4 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
ebf2f363fbe7..9b0e39b2f022100644drivers/vdpa/vdpa.c +0
-0@@ -815,7 +815,7 @@ static int vdpa_dev_net_mq_config_fill(struct
vdpa_device*vdev, static intvdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *msg){
structvirtio_net_configconfig = {};drivers/vdpa/vdpa.c +1
-1-u64 features; +u64 features_device, features_driver;u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); @@ -832,12 +832,17 @@ static int vdpa_dev_net_config_fill(struct
vdpa_device*vdev, structsk_buff*ms
if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16))
return-EMSGSIZE;drivers/vdpa/vdpa.c +0
-2- features = vdev->config->get_driver_features (vdev); - if (nla_put_u64_64bit(msg,
VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features,drivers/vdpa/vdpa.c +2
-0+ features_driver = vdev->config->get_driver_features (vdev); + if (nla_put_u64_64bit(msg,
VDPA_ATTR_DEV_NEGOTIATED_FEATURES,features_driver,drivers/vdpa/vdpa.c +5
-0+ VDPA_ATTR_PAD)) +return -EMSGSIZE ; + + features_device = vdev->config->get_device_features (vdev); + if (nla_put_u64_64bit(msg,
VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES,drivers/vdpa/vdpa.c +3
-1+features_device, VDPA_ATTR_PAD))return -EMSGSIZE ; -return vdpa_dev_net_mq_config_fill (vdev, msg, features, &config); +return vdpa_dev_net_mq_config_fill (vdev, msg, features_driver, +&config); } static intinclude/uapi/linux/vdpa.h index renamed from include/uapi/linux/vdpa.h +0
-0
25c55cab3d7c..39f1c3d7c112100644include/uapi/linux/vdpa.h +1
-1@@ -47,6 +47,7 @@ enum vdpa_attr {VDPA_ATTR_DEV_NEGOTIATED_FEATURES ,/* u64 */ VDPA_ATTR_DEV_MGMTDEV_MAX_VQS ,/* u32 */ VDPA_ATTR_DEV_SUPPORTED_FEATURES ,/* u64 */ +VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES ,/* u64 */ VDPA_ATTR_DEV_QUEUE_INDEX ,/* u32 */ VDPA_ATTR_DEV_VENDOR_ATTR_NAME, /* string */ --2.31.1
RE: [PATCH V3 3/6] vDPA: allow userspace to query features of a vDPA device
Quoted 18 lines
From: Zhu, Lingshan <[email protected]>
Sent: Friday, July 8, 2022 2:16 AMQuoted 6 lines · Parav Pandit
Quoted 6 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AMThis commit adds a new vDPA netlink attribution
VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES. Userspace can queryfeatures
Quoted 4 lines
Quoted 3 lines
of vDPA devices through this new attr.
Fixes a64917bc2e9b vdpa: (Provide interface to read driver feature)Missing the "" in the line.
will fix
Quoted 8 lines
Quoted 4 lines
I reviewed the patches again.
However, this is not the fix.
A fix cannot add a new UAPI.I think we have discussed this, on why we can not re-name the existing wrong named attr, and why we can not re-use the attr.
So are you suggesting remove this fixes tag?
And why a fix can not add a new uAPI?
Because a new attribute cannot fix any existing attribute.
What is done in the patch is show current attributes of the vdpa device (which sometimes contains a different value than the mgmt. device). So it is a new functionality that cannot have fixes tag.
Quoted 8 lines
Quoted 2 lines
Code is already considering negotiated driver features to return the device
config space.
Quoted 1 line
Hence it is fine.
No, the spec says:
The device MUST allow reading of any device-specific configuration field beforeFEATURES_OKis set by the driver.Quoted 1 line
Quoted 7 lines
Quoted 2 lines
This patch intents to provide device features to user space. First what vdpa device are capable of, are already returned by features
attribute on the management device.
Quoted 1 line
This is done in commit [1].
we have discussed this in another thread, vDPA device feature bits can be different from the management device feature bits.
Quoted 1 line
Yes.
Quoted 8 lines
Quoted 1 line
The only reason to have it is, when one management device indicates that
feature is supported, but device may end up not supporting this feature if such feature is shared with other devices on same physical device.
Quoted 1 line
For example all VFs may not be symmetric after large number of them are
in use. In such case features bit of management device can differ (more features) than the vdpa device of this VF.
Quoted 2 lines
Hence, showing on the device is useful.
Quoted 8 lines
Quoted 1 line
As mentioned before in V2, commit [1] has wrongly named the attribute to
VDPA_ATTR_DEV_SUPPORTED_FEATURES.Quoted 1 line
It should have been,
VDPA_ATTR_DEV_MGMTDEV_SUPPORTED_FEATURES.Quoted 2 lines
Because it is in UAPI, and since we don't want to break compilation of iproute2, It cannot be renamed anymore.
Yes, rename it will break current uAPI, so I can not rename it.
Quoted 1 line
I know, which is why this patch needs to do following listed changes described in previous email.
Quoted 12 lines
Quoted 1 line
Given that, we do not want to start trend of naming device attributes with
additional _VDPA_ to it as done in this patch.
Quoted 3 lines
Error in commit [1] was exception.
Hence, please reuse
VDPA_ATTR_DEV_SUPPORTED_FEATURESto returnfor device features too.
Quoted 2 lines
Secondly, you need output example for showing device features in the
commit log.
Quoted 3 lines
3rd, please drop the fixes tag as new capability is not a fix.
Re: [PATCH V3 3/6] vDPA: allow userspace to query features of a vDPA device
Quoted 20 lines · Parav Pandit
Quoted 20 lines
From: Zhu, Lingshan <[email protected]>
Sent: Friday, July 8, 2022 2:16 AMQuoted 5 lines · Parav Pandit
Quoted 5 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AMThis commit adds a new vDPA netlink attribution
VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES. Userspace can queryfeatures
Quoted 4 lines
Quoted 3 lines
of vDPA devices through this new attr.
Fixes a64917bc2e9b vdpa: (Provide interface to read driver feature)Missing the "" in the line.
will fix
Quoted 4 lines
I reviewed the patches again.
However, this is not the fix.
A fix cannot add a new UAPI.
Quoted 8 lines
Quoted 4 lines
I think we have discussed this, on why we can not re-name the existing wrong named attr, and why we can not re-use the attr.
So are you suggesting remove this fixes tag?
And why a fix can not add a new uAPI?Because a new attribute cannot fix any existing attribute.
What is done in the patch is show current attributes of the vdpa device (which sometimes contains a different value than the mgmt. device). So it is a new functionality that cannot have fixes tag.
OK, I get the points now.
Quoted 41 lines
Quoted 7 lines
Quoted 2 lines
Code is already considering negotiated driver features to return the device
config space.
Quoted 1 line
Hence it is fine.
No, the spec says:
The device MUST allow reading of any device-specific configuration field beforeFEATURES_OKis set by the driver.Quoted 6 lines
Quoted 2 lines
This patch intents to provide device features to user space. First what vdpa device are capable of, are already returned by features
attribute on the management device.
Quoted 1 line
This is done in commit [1].
we have discussed this in another thread, vDPA device feature bits can be different from the management device feature bits.
Yes.
Quoted 8 lines
Quoted 1 line
The only reason to have it is, when one management device indicates that
feature is supported, but device may end up not supporting this feature if such feature is shared with other devices on same physical device.
Quoted 1 line
For example all VFs may not be symmetric after large number of them are
in use. In such case features bit of management device can differ (more features) than the vdpa device of this VF.
Quoted 2 lines
Hence, showing on the device is useful.
Quoted 7 lines
Quoted 1 line
As mentioned before in V2, commit [1] has wrongly named the attribute to
VDPA_ATTR_DEV_SUPPORTED_FEATURES.Quoted 1 line
It should have been,
VDPA_ATTR_DEV_MGMTDEV_SUPPORTED_FEATURES.Quoted 2 lines
Because it is in UAPI, and since we don't want to break compilation of iproute2, It cannot be renamed anymore.
Yes, rename it will break current uAPI, so I can not rename it.
I know, which is why this patch needs to do following listed changes described in previous email.
Quoted 10 lines
Quoted 1 line
Given that, we do not want to start trend of naming device attributes with
additional _VDPA_ to it as done in this patch.
Quoted 3 lines
Error in commit [1] was exception.
Hence, please reuse
VDPA_ATTR_DEV_SUPPORTED_FEATURESto returnfor device features too.
Quoted 1 line
Secondly, you need output example for showing device features in the
commit log.
Quoted 2 lines
3rd, please drop the fixes tag as new capability is not a fix.
PATCH v3 4/6 vDPA: !FEATURES_OK should not block querying device config space
In reply to Zhu LingshanUsers may want to query the config space of a vDPA device, to choose a appropriate one for a certain guest. This means the users need to read the config space before FEATURES_OK, and the existence of config space contents does not depend on FEATURES_OK.
The spec says:
The device MUST allow reading of any device-specific configuration field before FEATURES_OK is set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device.
--- drivers/vdpa/vdpa.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/vdpa/vdpa.c +0 -8
@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, {u32 device_id;void *hdr; -u8 status;int err;down_read (&vdev->cf_lock); - status = vdev->config->get_status (vdev); -if (!(status &VIRTIO_CONFIG_S_FEATURES_OK )) { -NL_SET_ERR_MSG_MOD (extack,"Features negotiation not completed" ); - err = -EAGAIN ; - goto out; - } - hdr =genlmsg_put (msg, portid, seq, &vdpa_nl_family, flags,VDPA_CMD_DEV_CONFIG_GET );if (!hdr) {
Signature · 1 line
2.31.1
RE: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 10 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device, to choose a appropriate one for a certain guest. This means the users need to read the config space before
FEATURES_OK, and the existence of config space contents does not depend onFEATURES_OK.
Quoted 7 lines
The spec says:
The device MUST allow reading of any device-specific configuration field beforeFEATURES_OKis set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device.Fixes 30ef7a8ac8a07 (vdpa: Read device configuration only if FEATURES_OK)
Fix is fine, but fixes tag needs correction described below.
Above commit id is 13 letters should be 12.
And
It should be in format
Please use checkpatch.pl script before posting the patches to catch these errors. There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.
Quoted 30 lines
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 8 -------- 1 file changed, 8 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
9b0e39b2f022..d76b22b2f7ae100644drivers/vdpa/vdpa.c +0
-8@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, { u32 device_id;void *hdr; -u8 status;int err;down_read (&vdev->cf_lock); - status = vdev->config->get_status (vdev); -if (!(status &VIRTIO_CONFIG_S_FEATURES_OK )) { -NL_SET_ERR_MSG_MOD (extack,"Features negotiation not completed"); - err = -EAGAIN ; - goto out; - } - hdr =genlmsg_put (msg, portid, seq, &vdpa_nl_family, flags,VDPA_CMD_DEV_CONFIG_GET );if (!hdr) {
--
2.31.1
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 18 lines · Parav Pandit
Quoted 9 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device, to choose a appropriate one for a certain guest. This means the users need to read the config space before
FEATURES_OK, and the existence of config space contents does not depend onFEATURES_OK.Quoted 7 lines
The spec says:
The device MUST allow reading of any device-specific configuration field beforeFEATURES_OKis set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device.Fixes 30ef7a8ac8a07 (vdpa: Read device configuration only if FEATURES_OK)Fix is fine, but fixes tag needs correction described below.
Quoted 7 lines
Above commit id is 13 letters should be 12.
And
It should be in formatFixes 30ef7a8ac8a0 ("vdpa: Read device configuration only if FEATURES_OK")Please use checkpatch.pl script before posting the patches to catch these errors. There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.
strange, checkpatch.pl did not complain this, I will fix this tag. Thanks
Quoted 31 lines
Quoted 31 lines
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 8 -------- 1 file changed, 8 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
9b0e39b2f022..d76b22b2f7ae100644drivers/vdpa/vdpa.c +0
-8@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, { u32 device_id;void *hdr; -u8 status;int err;down_read (&vdev->cf_lock); - status = vdev->config->get_status (vdev); -if (!(status &VIRTIO_CONFIG_S_FEATURES_OK )) { -NL_SET_ERR_MSG_MOD (extack,"Features negotiation not completed"); - err = -EAGAIN ; - goto out; - } - hdr =genlmsg_put (msg, portid, seq, &vdpa_nl_family, flags,VDPA_CMD_DEV_CONFIG_GET );if (!hdr) {
--
2.31.1
Michael S. Tsirkin
maintainerRe: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
In reply to Parav PanditQuoted 5 lines · Parav Pandit
Quoted 5 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AM
Quoted 8 lines
Quoted 8 lines
Users may want to query the config space of a vDPA device, to choose a appropriate one for a certain guest. This means the users need to read the config space before
FEATURES_OK, and the existence of config space contents does not depend onFEATURES_OK.The spec says:
The device MUST allow reading of any device-specific configuration field beforeFEATURES_OKis set by the driver. This includes fields which are
c> > conditional on feature bits, as long as those feature bits are offered by the
Quoted 9 lines
Quoted 3 lines
device.
Fixes 30ef7a8ac8a07 (vdpa: Read device configuration only if FEATURES_OK)Fix is fine, but fixes tag needs correction described below.
Above commit id is 13 letters should be 12.
And
It should be in formatFixes 30ef7a8ac8a0 ("vdpa: Read device configuration only if FEATURES_OK")
Yea you normally use
--format='Fixes: %h (\"%s\")'
Quoted 2 lines
Please use checkpatch.pl script before posting the patches to catch these errors. There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.
I don't think checkpatch complains about this if for no other reason that sometimes the 6 byte hash is not enough.
Quoted 16 lines
Quoted 16 lines
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 8 -------- 1 file changed, 8 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
9b0e39b2f022..d76b22b2f7ae100644drivers/vdpa/vdpa.c +0
-1@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, { u32 device_id;void *hdr; -u8 status;int err;
Quoted 14 lines
Quoted 11 lines
drivers/vdpa/vdpa.c +0
-7down_read (&vdev->cf_lock); - status = vdev->config->get_status (vdev); -if (!(status &VIRTIO_CONFIG_S_FEATURES_OK )) { -NL_SET_ERR_MSG_MOD (extack,"Features negotiation not completed"); - err = -EAGAIN ; - goto out; - } - hdr =genlmsg_put (msg, portid, seq, &vdpa_nl_family, flags,VDPA_CMD_DEV_CONFIG_GET );Quoted 3 lines
if (!hdr) {
--
2.31.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Parav Pandit
Quoted 9 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device, to choose a appropriate one for a certain guest. This means the users need to read the config space before
FEATURES_OK, and the existence of config space contents does not depend onFEATURES_OK.
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
The spec says:
The device MUST allow reading of any device-specific configuration field beforeFEATURES_OKis set by the driver. This includes fields which arec> > conditional on feature bits, as long as those feature bits are offered by the
Quoted 1 line
Quoted 1 line
device.
yes
Quoted 11 lines
Quoted 8 lines
Quoted 2 lines
Fixes 30ef7a8ac8a07 (vdpa: Read device configuration only if FEATURES_OK)Fix is fine, but fixes tag needs correction described below.
Above commit id is 13 letters should be 12.
And
It should be in formatFixes 30ef7a8ac8a0 ("vdpa: Read device configuration only if FEATURES_OK")Yea you normally use
--format='Fixes: %h (\"%s\")'
Thanks, but I will drop this fix tag, since Parav suggest I drop the fix tag of the 3/6 patch which reporting device feature bits to the upserspace(this fix is composed of several patches).
Quoted 38 lines
Quoted 4 lines
Please use checkpatch.pl script before posting the patches to catch these errors. There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.
I don't think checkpatch complains about this if for no other reason that sometimes the 6 byte hash is not enough.
Quoted 30 lines
Quoted 30 lines
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 8 -------- 1 file changed, 8 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
9b0e39b2f022..d76b22b2f7ae100644drivers/vdpa/vdpa.c +0
-8@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, { u32 device_id;void *hdr; -u8 status;int err;down_read (&vdev->cf_lock); - status = vdev->config->get_status (vdev); -if (!(status &VIRTIO_CONFIG_S_FEATURES_OK )) { -NL_SET_ERR_MSG_MOD (extack,"Features negotiation not completed"); - err = -EAGAIN ; - goto out; - } - hdr =genlmsg_put (msg, portid, seq, &vdpa_nl_family, flags,VDPA_CMD_DEV_CONFIG_GET );if (!hdr) {
--
2.31.1
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
In reply to Parav PanditSorry to chime in late in the game. For some reason I couldn't get to most emails for this discussion (I only subscribed to the virtualization list), while I was taking off amongst the past few weeks.
It looks to me this patch is incomplete. Noted down the way in vdpa_dev_net_config_fill(), we have the following:
features = vdev->config->get_driver_features(vdev);
if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features,
VDPA_ATTR_PAD))
return -EMSGSIZE;Making call to .get_driver_features() doesn't make sense when feature negotiation isn't complete. Neither should present negotiated_features to userspace before negotiation is done.
Similarly, max_vqp through vdpa_dev_net_mq_config_fill() probably should not show before negotiation is done - it depends on driver features negotiated.
Last but not the least, this "vdpa dev config" command was not designed to display the real config space register values in the first place. Quoting the vdpa-dev(8) man page:
Quoted 2 lines
vdpa dev config show - Show configuration of specific device or all devices.
DEV - specifies the vdpa device to show its configuration. If this argument is omitted all devices configuration is listed.
It doesn't say anything about configuration space or register values in config space. As long as it can convey the config attribute when instantiating vDPA device instance, and more importantly, the config can be easily imported from or exported to userspace tools when trying to reconstruct vdpa instance intact on destination host for live migration, IMHO in my personal interpretation it doesn't matter what the config space may present. It may be worth while adding a new debug command to expose the real register value, but that's another story.
Having said, please consider to drop the Fixes tag, as appears to me you're proposing a new feature rather than fixing a real issue.
Thanks,
-Siwei
Quoted 52 lines · Parav Pandit via Virtualization
Quoted 9 lines
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device, to choose a appropriate one for a certain guest. This means the users need to read the config space before
FEATURES_OK, and the existence of config space contents does not depend onFEATURES_OK.Quoted 7 lines
The spec says:
The device MUST allow reading of any device-specific configuration field beforeFEATURES_OKis set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device.Fixes 30ef7a8ac8a07 (vdpa: Read device configuration only if FEATURES_OK)Fix is fine, but fixes tag needs correction described below.
Above commit id is 13 letters should be 12.
And
It should be in formatFixes 30ef7a8ac8a0 ("vdpa: Read device configuration only if FEATURES_OK")Please use checkpatch.pl script before posting the patches to catch these errors. There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.
Quoted 26 lines
Signed-off-by Zhu Lingshan<[email protected]>--- drivers/vdpa/vdpa.c | 8 -------- 1 file changed, 8 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
9b0e39b2f022..d76b22b2f7ae100644drivers/vdpa/vdpa.c +0
-8@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, { u32 device_id;void *hdr; -u8 status;int err;down_read (&vdev->cf_lock); - status = vdev->config->get_status (vdev); -if (!(status &VIRTIO_CONFIG_S_FEATURES_OK )) { -NL_SET_ERR_MSG_MOD (extack,"Features negotiation not completed"); - err = -EAGAIN ; - goto out; - } - hdr = genlmsg_put(msg, portid, seq, &vdpa_nl_family, flags,
Quoted 8 lines
Quoted 4 lines
drivers/vdpa/vdpa.c +0
-0VDPA_CMD_DEV_CONFIG_GET);if (!hdr) {
--
2.31.1_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
_______________________________________________
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]
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 11 lines · Lingshan
Quoted 8 lines · Si-Wei Liu
Sorry to chime in late in the game. For some reason I couldn't get to most emails for this discussion (I only subscribed to the virtualization list), while I was taking off amongst the past few weeks.
It looks to me this patch is incomplete. Noted down the way in
vdpa_dev_net_config_fill(), we have the following:features = vdev->config->get_driver_features(vdev); if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features, VDPA_ATTR_PAD)) return -EMSGSIZE;
Quoted 4 lines
Quoted 3 lines
Making call to .get_driver_features() doesn't make sense when feature negotiation isn't complete. Neither should present
negotiated_featuresto userspace before negotiation is done.Similarly,
max_vqpthroughvdpa_dev_net_mq_config_fill()probably should not show before negotiation is done - it depends on driver features negotiated.I have another patch in this series introduces
device_featuresand will reportdevice_featuresto the userspace even features negotiation not done. Because the spec says we should allow driver access the config space beforeFEATURES_OK.
The config space can be accessed by guest before features_ok doesn't necessarily mean the value is valid. You may want to double check with Michael for what he quoted earlier:
Quoted 8 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered before accessing that part of the configuration space.
and how many driver bugs taking wrong assumption of the validity of config space field without features_ok. I am not sure what use case you want to expose config resister values for before features_ok, if it's mostly for live migration I guess it's probably heading a wrong direction.
Quoted 8 lines
Quoted 7 lines
Last but not the least, this "vdpa dev config" command was not designed to display the real config space register values in the first place. Quoting the vdpa-dev(8) man page:
Quoted 2 lines
vdpa dev config show - Show configuration of specific device or all devices.
DEV - specifies the vdpa device to show its configuration. If this argument is omitted all devices configuration is listed.It doesn't say anything about configuration space or register values in config space. As long as it can convey the config attribute when instantiating vDPA device instance, and more importantly, the config can be easily imported from or exported to userspace tools when trying to reconstruct vdpa instance intact on destination host for live migration, IMHO in my personal interpretation it doesn't matter what the config space may present. It may be worth while adding a new debug command to expose the real register value, but that's another story.
I am not sure getting your points. vDPA now reports device feature
bits(device_features)and negotiated featurebits(driver_features), and yes, the drivers features can be a subset of the device features; and the vDPA device features can be a subset of the management device features.
What I said is after unblocking the conditional check, you'd have to handle the case for each of the vdpa attribute when feature negotiation is not yet done: basically the register values you got from config space via the vdpa_get_config_unlocked() call is not considered to be valid before features_ok (per-spec). Although in some case you may get sane value, such behavior is generally undefined. If you desire to show just the device_features alone without any config space field, which the device had advertised *before feature negotiation is complete*, that'll be fine. But looks to me this is not how patch has been implemented. Probably need some more work?
Regards,
-Siwei
Quoted 69 lines
Quoted 2 lines
Having said, please consider to drop the Fixes tag, as appears to me you're proposing a new feature rather than fixing a real issue.
it's a new feature to report the device feature bits than only negotiated features, however this patch is a must, or it will block the device feature bits reporting. but I agree, the fix tag is not a must.
Quoted 65 lines
Thanks,
-SiweiQuoted 59 lines · Parav Pandit via Virtualization
Quoted 8 lines
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device, to choose a appropriate one for a certain guest. This means the users need to read the config space before
FEATURES_OK, and the existence of config space contents does not depend onFEATURES_OK.Quoted 7 lines
The spec says:
The device MUST allow reading of any device-specific configuration field beforeFEATURES_OKis set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device.Fixes 30ef7a8ac8a07 (vdpa: Read device configuration only if FEATURES_OK)Fix is fine, but fixes tag needs correction described below.
Above commit id is 13 letters should be 12.
And
It should be in formatFixes 30ef7a8ac8a0 ("vdpa: Read device configuration only if FEATURES_OK")Please use checkpatch.pl script before posting the patches to catch these errors. There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.
Quoted 27 lines
Signed-off-by Zhu Lingshan<[email protected]>--- drivers/vdpa/vdpa.c | 8 -------- 1 file changed, 8 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
9b0e39b2f022..d76b22b2f7ae100644drivers/vdpa/vdpa.c +0
-8@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, { u32 device_id;void *hdr; -u8 status;int err;down_read (&vdev->cf_lock); - status = vdev->config->get_status (vdev); -if (!(status &VIRTIO_CONFIG_S_FEATURES_OK )) { -NL_SET_ERR_MSG_MOD (extack,"Features negotiation not completed"); - err = -EAGAIN ; - goto out; - } - hdr =genlmsg_put (msg, portid, seq, &vdpa_nl_family, flags,VDPA_CMD_DEV_CONFIG_GET );Quoted 3 lines
if (!hdr) {
--
2.31.1_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 14 lines · Si-Wei Liu
Quoted 11 lines · Lingshan
Quoted 8 lines · Si-Wei Liu
Sorry to chime in late in the game. For some reason I couldn't get to most emails for this discussion (I only subscribed to the virtualization list), while I was taking off amongst the past few weeks.
It looks to me this patch is incomplete. Noted down the way in
vdpa_dev_net_config_fill(), we have the following:features = vdev->config->get_driver_features(vdev); if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features, VDPA_ATTR_PAD)) return -EMSGSIZE;
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Making call to .get_driver_features() doesn't make sense when feature negotiation isn't complete. Neither should present
negotiated_featuresto userspace before negotiation is done.Similarly,
max_vqpthroughvdpa_dev_net_mq_config_fill()probably should not show before negotiation is done - it depends on driver features negotiated.I have another patch in this series introduces
device_featuresand will reportdevice_featuresto the userspace even features negotiation not done. Because the spec says we should allow driver access the config space beforeFEATURES_OK.The config space can be accessed by guest before
features_okdoesn't necessarily mean the value is valid.
It's valid as long as the device offers the feature:
"The device MUST allow reading of any device-specific configuration field before FEATURES_OK is set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device."
Quoted 11 lines
You may want to double check with Michael for what he quoted earlier:
Quoted 8 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered before accessing that part of the configuration space.
and how many driver bugs taking wrong assumption of the validity of config space field without
features_ok. I am not sure what use case you want to expose config resister values for beforefeatures_ok, if it's mostly for live migration I guess it's probably heading a wrong direction.
I guess it's not for migration. For migration, a provision with the correct features/capability would be sufficient.
Thanks
Quoted 85 lines
Quoted 10 lines
Quoted 9 lines
Last but not the least, this "vdpa dev config" command was not designed to display the real config space register values in the first place. Quoting the vdpa-dev(8) man page:
Quoted 2 lines
vdpa dev config show - Show configuration of specific device or all devices.
DEV - specifies the vdpa device to show its configuration. If this argument is omitted all devices configuration is listed.It doesn't say anything about configuration space or register values in config space. As long as it can convey the config attribute when instantiating vDPA device instance, and more importantly, the config can be easily imported from or exported to userspace tools when trying to reconstruct vdpa instance intact on destination host for live migration, IMHO in my personal interpretation it doesn't matter what the config space may present. It may be worth while adding a new debug command to expose the real register value, but that's another story.
I am not sure getting your points. vDPA now reports device feature
bits(device_features)and negotiated featurebits(driver_features), and yes, the drivers features can be a subset of the device features; and the vDPA device features can be a subset of the management device features.What I said is after unblocking the conditional check, you'd have to handle the case for each of the vdpa attribute when feature negotiation is not yet done: basically the register values you got from config space via the
vdpa_get_config_unlocked()call is not considered to be valid beforefeatures_ok(per-spec). Although in some case you may get sane value, such behavior is generally undefined. If you desire to show just thedevice_featuresalone without any config space field, which the device had advertised *before feature negotiation is complete*, that'll be fine. But looks to me this is not how patch has been implemented. Probably need some more work?Regards,
-SiweiQuoted 69 lines
Quoted 2 lines
Having said, please consider to drop the Fixes tag, as appears to me you're proposing a new feature rather than fixing a real issue.
it's a new feature to report the device feature bits than only negotiated features, however this patch is a must, or it will block the device feature bits reporting. but I agree, the fix tag is not a must.
Quoted 65 lines
Thanks,
-SiweiQuoted 59 lines · Parav Pandit via Virtualization
Quoted 8 lines
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device, to choose a appropriate one for a certain guest. This means the users need to read the config space before
FEATURES_OK, and the existence of config space contents does not depend onFEATURES_OK.Quoted 7 lines
The spec says:
The device MUST allow reading of any device-specific configuration field beforeFEATURES_OKis set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device.Fixes 30ef7a8ac8a07 (vdpa: Read device configuration only if FEATURES_OK)Fix is fine, but fixes tag needs correction described below.
Above commit id is 13 letters should be 12.
And
It should be in formatFixes 30ef7a8ac8a0 ("vdpa: Read device configuration only if FEATURES_OK")Please use checkpatch.pl script before posting the patches to catch these errors. There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.
Quoted 27 lines
Signed-off-by Zhu Lingshan<[email protected]>--- drivers/vdpa/vdpa.c | 8 -------- 1 file changed, 8 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
9b0e39b2f022..d76b22b2f7ae100644drivers/vdpa/vdpa.c +0
-8@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, { u32 device_id;void *hdr; -u8 status;int err;down_read (&vdev->cf_lock); - status = vdev->config->get_status (vdev); -if (!(status &VIRTIO_CONFIG_S_FEATURES_OK )) { -NL_SET_ERR_MSG_MOD (extack,"Features negotiation not completed"); - err = -EAGAIN ; - goto out; - } - hdr =genlmsg_put (msg, portid, seq, &vdpa_nl_family, flags,VDPA_CMD_DEV_CONFIG_GET );Quoted 3 lines
if (!hdr) {
--
2.31.1_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 18 lines · Jason Wang
Quoted 16 lines · Si-Wei Liu
Quoted 13 lines · Lingshan
Quoted 10 lines · Si-Wei Liu
Sorry to chime in late in the game. For some reason I couldn't get to most emails for this discussion (I only subscribed to the virtualization list), while I was taking off amongst the past few weeks.
It looks to me this patch is incomplete. Noted down the way in
vdpa_dev_net_config_fill(), we have the following:
features =vdev->config->get_driver_features(vdev);
if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features, VDPA_ATTR_PAD))
return-EMSGSIZE;Making call to .get_driver_features() doesn't make sense when feature negotiation isn't complete. Neither should present
negotiated_featuresto userspace before negotiation is done.
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
Similarly,
max_vqpthroughvdpa_dev_net_mq_config_fill()probably should not show before negotiation is done - it depends on driver features negotiated.I have another patch in this series introduces
device_featuresand will reportdevice_featuresto the userspace even features negotiation not done. Because the spec says we should allow driver access the config space beforeFEATURES_OK.The config space can be accessed by guest before
features_okdoesn't necessarily mean the value is valid.It's valid as long as the device offers the feature:
"The device MUST allow reading of any device-specific configuration field before
FEATURES_OKis set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device."
I guess this statement only conveys that the field in config space can be read before FEATURES_OK is set, though it does not *explicitly* states the validity of field.
And looking at:
"The mac address field always exists (though is only valid if VIRTIO_NET_F_MAC is set), and status only exists if VIRTIO_NET_F_STATUS is set."
It appears to me there's a border line set between "exist" and "valid". If I understand the spec wording correctly, a spec-conforming device implementation may or may not offer valid status value in the config space when VIRTIO_NET_F_STATUS is offered, but before the feature is negotiated. On the other hand, config space should contain valid mac address the moment VIRTIO_NET_F_MAC feature is offered, regardless being negotiated or not. By that, there seems to be leeway for the device implementation to decide when config space field may become valid, though for most of QEMU's software virtio devices, valid value is present to config space the very first moment when feature is offered.
"If the VIRTIO_NET_F_MAC feature bit is set, the configuration space mac entry indicates the “physical” address of the network card, otherwise the driver would typically generate a random local MAC address." "If the VIRTIO_NET_F_STATUS feature bit is negotiated, the link status comes from the bottom bit of status. Otherwise, the driver assumes it’s active."
And also there are special cases where the read of specific configuration space field MUST be deferred to until FEATURES_OK is set:
"If the VIRTIO_BLK_F_CONFIG_WCE feature is negotiated, the cache mode can be read or set through the writeback field. 0 corresponds to a writethrough cache, 1 to a writeback cache11. The cache mode after reset can be either writeback or writethrough. The actual mode can be determined by reading writeback after feature negotiation." "The driver MUST NOT read writeback before setting the FEATURES_OK device status bit."
"If VIRTIO_BLK_F_CONFIG_WCE is negotiated but VIRTIO_BLK_F_FLUSH is not, the device MUST initialize writeback to 0."
Since the spec doesn't explicitly mandate the validity of each config space field when feature of concern is offered, to be safer we'd have to live with odd device implementation. I know for sure QEMU software devices won't for 99% of these cases, but that's not what is currently defined in the spec.
Quoted 9 lines
Quoted 9 lines
You may want to double check with Michael for what he quoted earlier:
Quoted 6 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
For optional configuration space fields, the driver MUST check that the corresponding feature is offered before accessing that part of the configuration space.
and how many driver bugs taking wrong assumption of the validity of config space field without
features_ok. I am not sure what use case you want to expose config resister values for beforefeatures_ok, if it's mostly for live migration I guess it's probably heading a wrong direction.I guess it's not for migration.
Then what's the other possible use case than live migration, were to expose config space values? Troubleshooting config space discrepancy between vDPA and the emulated virtio device in userspace? Or tracking changes in config space across feature negotiation, but for what? It'd be beneficial to the interface design if the specific use case can be clearly described...
Quoted 1 line
For migration, a provision with the correct features/capability would be sufficient.
Right, that's what I thought too. It doesn't need to expose config space values, simply exporting all attributes for vdpa device creation will do the work.
-Siwei
Quoted 91 lines
Thanks
Quoted 86 lines
Quoted 10 lines
Quoted 9 lines
Last but not the least, this "vdpa dev config" command was not designed to display the real config space register values in the first place. Quoting the vdpa-dev(8) man page:
Quoted 2 lines
vdpa dev config show - Show configuration of specific device or all devices.
DEV - specifies the vdpa device to show its configuration. If this argument is omitted all devices configuration is listed.It doesn't say anything about configuration space or register values in config space. As long as it can convey the config attribute when instantiating vDPA device instance, and more importantly, the config can be easily imported from or exported to userspace tools when trying to reconstruct vdpa instance intact on destination host for live migration, IMHO in my personal interpretation it doesn't matter what the config space may present. It may be worth while adding a new debug command to expose the real register value, but that's another story.
I am not sure getting your points. vDPA now reports device feature
bits(device_features)and negotiated featurebits(driver_features), and yes, the drivers features can be a subset of the device features; and the vDPA device features can be a subset of the management device features.What I said is after unblocking the conditional check, you'd have to handle the case for each of the vdpa attribute when feature negotiation is not yet done: basically the register values you got from config space via the
vdpa_get_config_unlocked()call is not considered to be valid beforefeatures_ok(per-spec). Although in some case you may get sane value, such behavior is generally undefined. If you desire to show just thedevice_featuresalone without any config space field, which the device had advertised *before feature negotiation is complete*, that'll be fine. But looks to me this is not how patch has been implemented. Probably need some more work?Regards,
-SiweiQuoted 70 lines
Quoted 2 lines
Having said, please consider to drop the Fixes tag, as appears to me you're proposing a new feature rather than fixing a real issue.
it's a new feature to report the device feature bits than only negotiated features, however this patch is a must, or it will block the device feature bits reporting. but I agree, the fix tag is not a must.
Quoted 66 lines
Thanks,
-SiweiQuoted 59 lines · Parav Pandit via Virtualization
Quoted 8 lines
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device, to choose a appropriate one for a certain guest. This means the users need to read the config space before
FEATURES_OK, and the existence of config space contents does not depend onFEATURES_OK.Quoted 7 lines
The spec says:
The device MUST allow reading of any device-specific configuration field beforeFEATURES_OKis set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device.Fixes 30ef7a8ac8a07 (vdpa: Read device configuration only if FEATURES_OK)Fix is fine, but fixes tag needs correction described below.
Above commit id is 13 letters should be 12.
And
It should be in formatFixes 30ef7a8ac8a0 ("vdpa: Read device configuration only if FEATURES_OK")Please use checkpatch.pl script before posting the patches to catch these errors. There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.
Quoted 27 lines
Signed-off-by Zhu Lingshan<[email protected]>---
drivers/vdpa/vdpa.c| 8 --------1 file changed, 8 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
9b0e39b2f022..d76b22b2f7ae100644drivers/vdpa/vdpa.c +0
-8@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, { u32 device_id; void *hdr; - u8 status; int err; down_read(&vdev->cf_lock); - status = vdev->config->get_status(vdev); - if (!(status & VIRTIO_CONFIG_S_FEATURES_OK)) { - NL_SET_ERR_MSG_MOD(extack, "Features negotiation not completed"); - err = -EAGAIN; - goto out; - } - hdr = genlmsg_put(msg, portid, seq, &vdpa_nl_family, flags, VDPA_CMD_DEV_CONFIG_GET);Quoted 3 lines
if (!hdr) {
Signature · 1 line
2.31.1_______________________________________________
Virtualization mailing list
[email protected]
https://urldefense.com/v3/__https://lists.linuxfoundation.org/mailman/listinfo/virtualization__;!!ACWV5N9M2RV99hQ!Pkwym7OAjoDucUqs2fAwchxqL8-BGd6wOl-51xcgB_yCNwPJ_cs8A1y-cYmrLTB4OBNsimnZuqJPcvQIl3g$
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 42 lines · Si-Wei Liu
Quoted 38 lines · Jason Wang
Quoted 26 lines · Si-Wei Liu
Quoted 23 lines · Lingshan
Quoted 20 lines · Si-Wei Liu
Sorry to chime in late in the game. For some reason I couldn't get to most emails for this discussion (I only subscribed to the virtualization list), while I was taking off amongst the past few weeks.
It looks to me this patch is incomplete. Noted down the way in
vdpa_dev_net_config_fill(), we have the following:features = vdev->config->get_driver_features(vdev); if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features, VDPA_ATTR_PAD)) return -EMSGSIZE;Making call to .get_driver_features() doesn't make sense when feature negotiation isn't complete. Neither should present
negotiated_featuresto userspace before negotiation is done.Similarly,
max_vqpthroughvdpa_dev_net_mq_config_fill()probably should not show before negotiation is done - it depends on driver features negotiated.Quoted 6 lines
Quoted 4 lines
I have another patch in this series introduces
device_featuresand will reportdevice_featuresto the userspace even features negotiation not done. Because the spec says we should allow driver access the config space beforeFEATURES_OK.The config space can be accessed by guest before
features_okdoesn't necessarily mean the value is valid.It's valid as long as the device offers the feature:
Quoted 7 lines
Quoted 4 lines
"The device MUST allow reading of any device-specific configuration field before
FEATURES_OKis set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device."I guess this statement only conveys that the field in config space can be read before
FEATURES_OKis set, though it does not *explicitly* states the validity of field.
My understanding is that it should be valid as long as the device offers the feature.
For example, if _MQ is offered by device, the max_virt_queue_pairs is always valid and can be read from the driver no matter whether _MQ is negotiated.
Quoted 7 lines
And looking at:
"The mac address field always exists (though is only valid if
VIRTIO_NET_F_MACis set), and status only exists ifVIRTIO_NET_F_STATUSis set."
Quoted 5 lines
It appears to me there's a border line set between "exist" and "valid". If I understand the spec wording correctly, a spec-conforming device implementation may or may not offer valid status value in the config space when
VIRTIO_NET_F_STATUSis offered, but before the feature is negotiated.
That's not what I read, maybe Michael can clarify this.
Quoted 3 lines
On the other hand, config space should contain valid mac address the moment
VIRTIO_NET_F_MACfeature is offered, regardless being negotiated or not.
I agree here.
Quoted 11 lines
By that, there seems to be leeway for the device implementation to decide when config space field may become valid, though for most of QEMU's software virtio devices, valid value is present to config space the very first moment when feature is offered.
"If the
VIRTIO_NET_F_MACfeature bit is set, the configuration space mac entry indicates the “physical” address of the network card, otherwise the driver would typically generate a random local MAC address." "If theVIRTIO_NET_F_STATUSfeature bit is negotiated, the link status comes from the bottom bit of status. Otherwise, the driver assumes it’s active."
This is mostly the way how drivers that don't support _F_STATUS work.
Quoted 11 lines
And also there are special cases where the read of specific configuration space field MUST be deferred to until
FEATURES_OKis set:"If the
VIRTIO_BLK_F_CONFIG_WCEfeature is negotiated, the cache mode can be read or set through the writeback field. 0 corresponds to a writethrough cache, 1 to a writeback cache11. The cache mode after reset can be either writeback or writethrough. The actual mode can be determined by reading writeback after feature negotiation." "The driver MUST NOT read writeback before setting theFEATURES_OKdevice status bit."
This seems to conflict with the normatives I quoted above, and I don't get why we need this.
Quoted 29 lines
"If
VIRTIO_BLK_F_CONFIG_WCEis negotiated butVIRTIO_BLK_F_FLUSHis not, the device MUST initialize writeback to 0."Since the spec doesn't explicitly mandate the validity of each config space field when feature of concern is offered, to be safer we'd have to live with odd device implementation. I know for sure QEMU software devices won't for 99% of these cases, but that's not what is currently defined in the spec.
Quoted 20 lines
Quoted 18 lines
You may want to double check with Michael for what he quoted earlier:
Quoted 9 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered
before accessing that part of the configuration space.and how many driver bugs taking wrong assumption of the validity of config space field without
features_ok. I am not sure what use case you want to expose config resister values for beforefeatures_ok, if it's mostly for live migration I guess it's probably heading a wrong direction.
Quoted 7 lines
Quoted 1 line
I guess it's not for migration.
Then what's the other possible use case than live migration, were to expose config space values? Troubleshooting config space discrepancy between vDPA and the emulated virtio device in userspace? Or tracking changes in config space across feature negotiation, but for what? It'd be beneficial to the interface design if the specific use case can be clearly described...
Monitoring or debugging I guess.
Thanks
Quoted 141 lines
Quoted 4 lines
For migration, a provision with the correct features/capability would be sufficient.
Right, that's what I thought too. It doesn't need to expose config space values, simply exporting all attributes for vdpa device creation will do the work.
-Siwei
Quoted 130 lines
Thanks
Quoted 125 lines
Quoted 21 lines
Quoted 12 lines
Last but not the least, this "vdpa dev config" command was not designed to display the real config space register values in the first place. Quoting the vdpa-dev(8) man page:
Quoted 4 lines
vdpa dev config show - Show configuration of specific device or all devices.
DEV - specifies the vdpa device to show its configuration. If this argument is omitted all devices configuration is listed.Quoted 9 lines
It doesn't say anything about configuration space or register values in config space. As long as it can convey the config attribute when instantiating vDPA device instance, and more importantly, the config can be easily imported from or exported to userspace tools when trying to reconstruct vdpa instance intact on destination host for live migration, IMHO in my personal interpretation it doesn't matter what the config space may present. It may be worth while adding a new debug command to expose the real register value, but that's another story.
Quoted 5 lines
I am not sure getting your points. vDPA now reports device feature
bits(device_features)and negotiated featurebits(driver_features), and yes, the drivers features can be a subset of the device features; and the vDPA device features can be a subset of the management device features.What I said is after unblocking the conditional check, you'd have to handle the case for each of the vdpa attribute when feature negotiation is not yet done: basically the register values you got from config space via the
vdpa_get_config_unlocked()call is not considered to be valid beforefeatures_ok(per-spec). Although in some case you may get sane value, such behavior is generally undefined. If you desire to show just thedevice_featuresalone without any config space field, which the device had advertised *before feature negotiation is complete*, that'll be fine. But looks to me this is not how patch has been implemented. Probably need some more work?Regards,
-SiweiQuoted 83 lines
Quoted 3 lines
Having said, please consider to drop the Fixes tag, as appears to me you're proposing a new feature rather than fixing a real issue.
it's a new feature to report the device feature bits than only negotiated features, however this patch is a must, or it will block the device feature bits reporting. but I agree, the fix tag is not a must.
Quoted 75 lines
Thanks,
-SiweiQuoted 68 lines · Parav Pandit via Virtualization
Quoted 19 lines
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device, to choose a
appropriate one for a certain guest. This means the users need to read the
config space beforeFEATURES_OK, and the existence of config space contents does not depend onFEATURES_OK.The spec says:
The device MUST allow reading of any device-specific configuration field
beforeFEATURES_OKis set by the driver. This includes fields which are
conditional on feature bits, as long as those feature bits are offered by the
device.Quoted 2 lines
Fixes 30ef7a8ac8a07 (vdpa: Read device configuration only if
FEATURES_OK)Fix is fine, but fixes tag needs correction described below.
Above commit id is 13 letters should be 12.
And
It should be in formatFixes 30ef7a8ac8a0 ("vdpa: Read device configuration only if
FEATURES_OK")Please use checkpatch.pl script before posting the patches to catch these errors.
There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.Quoted 28 lines
Signed-off-by Zhu Lingshan<[email protected]>--- drivers/vdpa/vdpa.c | 8 -------- 1 file changed, 8 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
9b0e39b2f022..d76b22b2f7ae100644drivers/vdpa/vdpa.c +0
-8@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, { u32 device_id;void *hdr; -u8 status;int err;down_read (&vdev->cf_lock); - status = vdev->config->get_status (vdev); -if (!(status &VIRTIO_CONFIG_S_FEATURES_OK )) { -NL_SET_ERR_MSG_MOD (extack,"Features negotiation not completed"); - err = -EAGAIN ; - goto out; - } - hdr =genlmsg_put (msg, portid, seq, &vdpa_nl_family, flags,VDPA_CMD_DEV_CONFIG_GET );if (!hdr) {Quoted 2 lines
--
2.31.1_______________________________________________
Virtualization mailing list
[email protected]
https://urldefense.com/v3/__https://lists.linuxfoundation.org/mailman/listinfo/virtualization__;!!ACWV5N9M2RV99hQ!Pkwym7OAjoDucUqs2fAwchxqL8-BGd6wOl-51xcgB_yCNwPJ_cs8A1y-cYmrLTB4OBNsimnZuqJPcvQIl3g$
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 45 lines · Jason Wang
Quoted 37 lines · Si-Wei Liu
Quoted 34 lines · Jason Wang
Quoted 24 lines · Si-Wei Liu
Quoted 22 lines · Lingshan
Quoted 20 lines · Si-Wei Liu
Sorry to chime in late in the game. For some reason I couldn't get to most emails for this discussion (I only subscribed to the virtualization list), while I was taking off amongst the past few weeks.
It looks to me this patch is incomplete. Noted down the way in
vdpa_dev_net_config_fill(), we have the following:features = vdev->config->get_driver_features(vdev); if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features, VDPA_ATTR_PAD)) return -EMSGSIZE;Making call to .get_driver_features() doesn't make sense when feature negotiation isn't complete. Neither should present
negotiated_featuresto userspace before negotiation is done.Similarly,
max_vqpthroughvdpa_dev_net_mq_config_fill()probably should not show before negotiation is done - it depends on driver features negotiated.Quoted 6 lines
Quoted 4 lines
I have another patch in this series introduces
device_featuresand will reportdevice_featuresto the userspace even features negotiation not done. Because the spec says we should allow driver access the config space beforeFEATURES_OK.The config space can be accessed by guest before
features_okdoesn't necessarily mean the value is valid.It's valid as long as the device offers the feature:
Quoted 7 lines
Quoted 4 lines
"The device MUST allow reading of any device-specific configuration field before
FEATURES_OKis set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device."I guess this statement only conveys that the field in config space can be read before
FEATURES_OKis set, though it does not *explicitly* states the validity of field.
Quoted 6 lines
My understanding is that it should be valid as long as the device offers the feature.
For example, if
_MQis offered by device, themax_virt_queue_pairsis always valid and can be read from the driver no matter whether_MQis negotiated.
agreed, that's also my understanding
Quoted 212 lines
Quoted 7 lines
And looking at:
"The mac address field always exists (though is only valid if
VIRTIO_NET_F_MACis set), and status only exists ifVIRTIO_NET_F_STATUSis set."Quoted 5 lines
It appears to me there's a border line set between "exist" and "valid". If I understand the spec wording correctly, a spec-conforming device implementation may or may not offer valid status value in the config space when
VIRTIO_NET_F_STATUSis offered, but before the feature is negotiated.That's not what I read, maybe Michael can clarify this.
Quoted 3 lines
On the other hand, config space should contain valid mac address the moment
VIRTIO_NET_F_MACfeature is offered, regardless being negotiated or not.I agree here.
Quoted 11 lines
By that, there seems to be leeway for the device implementation to decide when config space field may become valid, though for most of QEMU's software virtio devices, valid value is present to config space the very first moment when feature is offered.
"If the
VIRTIO_NET_F_MACfeature bit is set, the configuration space mac entry indicates the “physical” address of the network card, otherwise the driver would typically generate a random local MAC address." "If theVIRTIO_NET_F_STATUSfeature bit is negotiated, the link status comes from the bottom bit of status. Otherwise, the driver assumes it’s active."This is mostly the way how drivers that don't support
_F_STATUSwork.Quoted 10 lines
And also there are special cases where the read of specific configuration space field MUST be deferred to until
FEATURES_OKis set:"If the
VIRTIO_BLK_F_CONFIG_WCEfeature is negotiated, the cache mode can be read or set through the writeback field. 0 corresponds to a writethrough cache, 1 to a writeback cache11. The cache mode after reset can be either writeback or writethrough. The actual mode can be determined by reading writeback after feature negotiation." "The driver MUST NOT read writeback before setting theFEATURES_OKdevice status bit."This seems to conflict with the normatives I quoted above, and I don't get why we need this.
Quoted 26 lines
"If
VIRTIO_BLK_F_CONFIG_WCEis negotiated butVIRTIO_BLK_F_FLUSHis not, the device MUST initialize writeback to 0."Since the spec doesn't explicitly mandate the validity of each config space field when feature of concern is offered, to be safer we'd have to live with odd device implementation. I know for sure QEMU software devices won't for 99% of these cases, but that's not what is currently defined in the spec.
Quoted 17 lines
Quoted 16 lines
You may want to double check with Michael for what he quoted earlier:
Quoted 9 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered
before accessing that part of the configuration space.and how many driver bugs taking wrong assumption of the validity of config space field without
features_ok. I am not sure what use case you want to expose config resister values for beforefeatures_ok, if it's mostly for live migration I guess it's probably heading a wrong direction.Quoted 7 lines
Quoted 1 line
I guess it's not for migration.
Then what's the other possible use case than live migration, were to expose config space values? Troubleshooting config space discrepancy between vDPA and the emulated virtio device in userspace? Or tracking changes in config space across feature negotiation, but for what? It'd be beneficial to the interface design if the specific use case can be clearly described...
Monitoring or debugging I guess.
Thanks
Quoted 130 lines
Quoted 3 lines
For migration, a provision with the correct features/capability would be sufficient.
Right, that's what I thought too. It doesn't need to expose config space values, simply exporting all attributes for vdpa device creation will do the work.
-Siwei
Quoted 121 lines
Thanks
Quoted 118 lines
Quoted 19 lines
Quoted 10 lines
Last but not the least, this "vdpa dev config" command was not designed to display the real config space register values in the first place. Quoting the vdpa-dev(8) man page:
Quoted 4 lines
vdpa dev config show - Show configuration of specific device or all devices.
DEV - specifies the vdpa device to show its configuration. If this argument is omitted all devices configuration is listed.Quoted 9 lines
It doesn't say anything about configuration space or register values in config space. As long as it can convey the config attribute when instantiating vDPA device instance, and more importantly, the config can be easily imported from or exported to userspace tools when trying to reconstruct vdpa instance intact on destination host for live migration, IMHO in my personal interpretation it doesn't matter what the config space may present. It may be worth while adding a new debug command to expose the real register value, but that's another story.
Quoted 5 lines
I am not sure getting your points. vDPA now reports device feature
bits(device_features)and negotiated featurebits(driver_features), and yes, the drivers features can be a subset of the device features; and the vDPA device features can be a subset of the management device features.What I said is after unblocking the conditional check, you'd have to handle the case for each of the vdpa attribute when feature negotiation is not yet done: basically the register values you got from config space via the
vdpa_get_config_unlocked()call is not considered to be valid beforefeatures_ok(per-spec). Although in some case you may get sane value, such behavior is generally undefined. If you desire to show just thedevice_featuresalone without any config space field, which the device had advertised *before feature negotiation is complete*, that'll be fine. But looks to me this is not how patch has been implemented. Probably need some more work?Regards,
-SiweiQuoted 79 lines
Quoted 2 lines
Having said, please consider to drop the Fixes tag, as appears to me you're proposing a new feature rather than fixing a real issue.
it's a new feature to report the device feature bits than only negotiated features, however this patch is a must, or it will block the device feature bits reporting. but I agree, the fix tag is not a must.
Quoted 73 lines
Thanks,
-SiweiQuoted 68 lines · Parav Pandit via Virtualization
Quoted 19 lines
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device, to choose a
appropriate one for a certain guest. This means the users need to read the
config space beforeFEATURES_OK, and the existence of config space contents does not depend onFEATURES_OK.The spec says:
The device MUST allow reading of any device-specific configuration field
beforeFEATURES_OKis set by the driver. This includes fields which are
conditional on feature bits, as long as those feature bits are offered by the
device.Quoted 2 lines
Fixes 30ef7a8ac8a07 (vdpa: Read device configuration only if
FEATURES_OK)Fix is fine, but fixes tag needs correction described below.
Above commit id is 13 letters should be 12.
And
It should be in formatFixes 30ef7a8ac8a0 ("vdpa: Read device configuration only if
FEATURES_OK")Please use checkpatch.pl script before posting the patches to catch these errors.
There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.Quoted 28 lines
Signed-off-by Zhu Lingshan<[email protected]>--- drivers/vdpa/vdpa.c | 8 -------- 1 file changed, 8 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
9b0e39b2f022..d76b22b2f7ae100644drivers/vdpa/vdpa.c +0
-8@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, { u32 device_id;void *hdr; -u8 status;int err;down_read (&vdev->cf_lock); - status = vdev->config->get_status (vdev); -if (!(status &VIRTIO_CONFIG_S_FEATURES_OK )) { -NL_SET_ERR_MSG_MOD (extack,"Features negotiation not completed"); - err = -EAGAIN ; - goto out; - } - hdr =genlmsg_put (msg, portid, seq, &vdpa_nl_family, flags,VDPA_CMD_DEV_CONFIG_GET );if (!hdr) {Quoted 2 lines
--
2.31.1_______________________________________________
Virtualization mailing list
[email protected]
https://urldefense.com/v3/__https://lists.linuxfoundation.org/mailman/listinfo/virtualization__;!!ACWV5N9M2RV99hQ!Pkwym7OAjoDucUqs2fAwchxqL8-BGd6wOl-51xcgB_yCNwPJ_cs8A1y-cYmrLTB4OBNsimnZuqJPcvQIl3g$
spec clarification (was Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space)
In reply to Jason WangHi Michael,
Could you please comment on the different wording between "exist" and "valid" in spec? Having seen quite a few relevant discussions regarding MTU validation and VERSION_1 negotiation on s390, I was in the impression this is not the first time people getting confused because of ambiguity of random wording without detailed example helping to clarify around the context, or due lack of clear definition set ahead. I like your idea to keep things consistent (conditional depending on feature presence), however, without proper interpretation of how spec is supposed to work, we are on a slippery slope towards inconsistency.
Quoted 6 lines · Jason Wang
Quoted 6 lines
And looking at:
"The mac address field always exists (though is only valid if
VIRTIO_NET_F_MACis set), and status only exists ifVIRTIO_NET_F_STATUSis set."
Quoted 7 lines
Quoted 5 lines
It appears to me there's a border line set between "exist" and "valid". If I understand the spec wording correctly, a spec-conforming device implementation may or may not offer valid status value in the config space when
VIRTIO_NET_F_STATUSis offered, but before the feature is negotiated.That's not what I read, maybe Michael can clarify this.
And Jason and I find below normatives are conflict with each other.
Quoted 12 lines
Quoted 1 line
"The device MUST allow reading of any device-specific configuration field before
FEATURES_OKis set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device."...
Quoted 10 lines
And also there are special cases where the read of specific configuration space field MUST be deferred to until
FEATURES_OKis set:"If the
VIRTIO_BLK_F_CONFIG_WCEfeature is negotiated, the cache mode can be read or set through the writeback field. 0 corresponds to a writethrough cache, 1 to a writeback cache11. The cache mode after reset can be either writeback or writethrough. The actual mode can be determined by reading writeback after feature negotiation." "The driver MUST NOT read writeback before setting theFEATURES_OKdevice status bit."
Quoted 3 lines
This seems to conflict with the normatives I quoted above, and I don't get why we need this.
Thanks,
-Siwei
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerRe: spec clarification (was Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space)
Quoted 30 lines · Si-Wei Liu
Hi Michael,
Could you please comment on the different wording between "exist" and "valid" in spec? Having seen quite a few relevant discussions regarding MTU validation and
VERSION_1negotiation on s390, I was in the impression this is not the first time people getting confused because of ambiguity of random wording without detailed example helping to clarify around the context, or due lack of clear definition set ahead. I like your idea to keep things consistent (conditional depending on feature presence), however, without proper interpretation of how spec is supposed to work, we are on a slippery slope towards inconsistency.On 7/28/2022 12:36 AM, Jason Wang wrote:
And looking at:
"The mac address field always exists (though is only valid if
VIRTIO_NET_F_MACis set), and status only exists ifVIRTIO_NET_F_STATUSis set."It appears to me there's a border line set between "exist" and "valid". If I understand the spec wording correctly, a spec-conforming device implementation may or may not offer valid status value in the config space when
VIRTIO_NET_F_STATUSis offered, but before the feature is negotiated.That's not what I read, maybe Michael can clarify this.
Quoted 6 lines
And Jason and I find below normatives are conflict with each other.
"The device MUST allow reading of any device-specific configuration field before
FEATURES_OKis set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device."
So I proposed this back in April:
https://lists.oasis-open.org/archives/virtio-comment/202201/msg00068.html
I intended this for 1.2 but it quickly became clear it won't make it in time. Working on reviving the proposal and addressing the comments.
Quoted 14 lines
...
And also there are special cases where the read of specific configuration space field MUST be deferred to until
FEATURES_OKis set:"If the
VIRTIO_BLK_F_CONFIG_WCEfeature is negotiated, the cache mode can be read or set through the writeback field. 0 corresponds to a writethrough cache, 1 to a writeback cache11. The cache mode after reset can be either writeback or writethrough. The actual mode can be determined by reading writeback after feature negotiation." "The driver MUST NOT read writeback before setting theFEATURES_OKdevice status bit."
Quoted 7 lines
This seems to conflict with the normatives I quoted above, and I don't get why we need this.
Thanks,
-Siwei
The last one I take to mean writeback is special.
I am not sure why it should be. Paolo you proposed this text could you comment please?
Thanks!
Signature · 18 lines
MST This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC. In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting. Subscribe: [email protected] Unsubscribe: [email protected] List help: [email protected] List archive: https://lists.oasis-open.org/archives/virtio-comment/ Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists Committee: https://www.oasis-open.org/committees/virtio/ Join OASIS: https://www.oasis-open.org/join/
Michael S. Tsirkin
maintainerRe: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
In reply to Si-Wei LiuQuoted 86 lines · Si-Wei Liu
Quoted 37 lines · Jason Wang
Quoted 27 lines · Si-Wei Liu
Quoted 24 lines · Lingshan
Quoted 21 lines · Si-Wei Liu
Sorry to chime in late in the game. For some reason I couldn't get to most emails for this discussion (I only subscribed to the virtualization list), while I was taking off amongst the past few weeks.
It looks to me this patch is incomplete. Noted down the way in
vdpa_dev_net_config_fill(), we have the following:
features =vdev->config->get_driver_features(vdev); if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features, VDPA_ATTR_PAD)) return-EMSGSIZE;Making call to .get_driver_features() doesn't make sense when feature negotiation isn't complete. Neither should present
negotiated_featuresto userspace before negotiation is done.Similarly,
max_vqpthroughvdpa_dev_net_mq_config_fill()probably should not show before negotiation is done - it depends on driver features negotiated.Quoted 6 lines
Quoted 4 lines
I have another patch in this series introduces
device_featuresand will reportdevice_featuresto the userspace even features negotiation not done. Because the spec says we should allow driver access the config space beforeFEATURES_OK.The config space can be accessed by guest before
features_okdoesn't necessarily mean the value is valid.Quoted 6 lines
It's valid as long as the device offers the feature:
"The device MUST allow reading of any device-specific configuration field before
FEATURES_OKis set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device."I guess this statement only conveys that the field in config space can be read before
FEATURES_OKis set, though it does not *explicitly* states the validity of field.And looking at:
"The mac address field always exists (though is only valid if
VIRTIO_NET_F_MACis set), and status only exists ifVIRTIO_NET_F_STATUSis set."It appears to me there's a border line set between "exist" and "valid". If I understand the spec wording correctly, a spec-conforming device implementation may or may not offer valid status value in the config space when
VIRTIO_NET_F_STATUSis offered, but before the feature is negotiated. On the other hand, config space should contain valid mac address the momentVIRTIO_NET_F_MACfeature is offered, regardless being negotiated or not. By that, there seems to be leeway for the device implementation to decide when config space field may become valid, though for most of QEMU's software virtio devices, valid value is present to config space the very first moment when feature is offered."If the
VIRTIO_NET_F_MACfeature bit is set, the configuration space mac entry indicates the “physical” address of the network card, otherwise the driver would typically generate a random local MAC address."
"If theVIRTIO_NET_F_STATUSfeature bit is negotiated, the link status comes from the bottom bit of status. Otherwise, the driver assumes it’s active."And also there are special cases where the read of specific configuration space field MUST be deferred to until
FEATURES_OKis set:"If the
VIRTIO_BLK_F_CONFIG_WCEfeature is negotiated, the cache mode can be read or set through the writeback field. 0 corresponds to a writethrough cache, 1 to a writeback cache11. The cache mode after reset can be either writeback or writethrough. The actual mode can be determined by reading writeback after feature negotiation."
"The driver MUST NOT read writeback before setting theFEATURES_OKdevice status bit."
"IfVIRTIO_BLK_F_CONFIG_WCEis negotiated butVIRTIO_BLK_F_FLUSHis not, the device MUST initialize writeback to 0."
Quoted 4 lines
Since the spec doesn't explicitly mandate the validity of each config space field when feature of concern is offered, to be safer we'd have to live with odd device implementation. I know for sure QEMU software devices won't for 99% of these cases, but that's not what is currently defined in the spec.
Thanks for raising this subject. I started working on this in April:
https://lists.oasis-open.org/archives/virtio-comment/202201/msg00068.html
working now to address the comments.
Quoted 169 lines
Quoted 13 lines
Quoted 13 lines
You may want to double check with Michael for what he quoted earlier:
Quoted 9 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered
before accessing that part of the configuration space.Quoted 8 lines
Quoted 5 lines
and how many driver bugs taking wrong assumption of the validity of config space field without
features_ok. I am not sure what use case you want to expose config resister values for beforefeatures_ok, if it's mostly for live migration I guess it's probably heading a wrong direction.I guess it's not for migration.
Then what's the other possible use case than live migration, were to expose config space values? Troubleshooting config space discrepancy between vDPA and the emulated virtio device in userspace? Or tracking changes in config space across feature negotiation, but for what? It'd be beneficial to the interface design if the specific use case can be clearly described...
Quoted 2 lines
For migration, a provision with the correct features/capability would be sufficient.
Right, that's what I thought too. It doesn't need to expose config space values, simply exporting all attributes for vdpa device creation will do the work.
-Siwei
Quoted 133 lines
Thanks
Quoted 128 lines
Quoted 23 lines
Quoted 13 lines
Last but not the least, this "vdpa dev config" command was not designed to display the real config space register values in the first place. Quoting the vdpa-dev(8) man page:
Quoted 5 lines
vdpa dev config show - Show configuration of specific device or all devices.
DEV - specifies the vdpa device to show its configuration. If this argument is omitted all devices configuration is listed.Quoted 10 lines
It doesn't say anything about configuration space or register values in config space. As long as it can convey the config attribute when instantiating vDPA device instance, and more importantly, the config can be easily imported from or exported to userspace tools when trying to reconstruct vdpa instance intact on destination host for live migration, IMHO in my personal interpretation it doesn't matter what the config space may present. It may be worth while adding a new debug command to expose the real register value, but that's another story.
Quoted 5 lines
I am not sure getting your points. vDPA now reports device feature
bits(device_features)and negotiated featurebits(driver_features), and yes, the drivers features can be a subset of the device features; and the vDPA device features can be a subset of the management device features.What I said is after unblocking the conditional check, you'd have to handle the case for each of the vdpa attribute when feature negotiation is not yet done: basically the register values you got from config space via the
vdpa_get_config_unlocked()call is not considered to be valid beforefeatures_ok(per-spec). Although in some case you may get sane value, such behavior is generally undefined. If you desire to show just thedevice_featuresalone without any config space field, which the device had advertised *before feature negotiation is complete*, that'll be fine. But looks to me this is not how patch has been implemented. Probably need some more work?Regards,
-SiweiQuoted 84 lines
Quoted 4 lines
Having said, please consider to drop the Fixes tag, as appears to me you're proposing a new feature rather than fixing a real issue.
it's a new feature to report the device feature bits than only negotiated features, however this patch is a must, or it will block the device feature bits reporting. but I agree, the fix tag is not a must.
Quoted 75 lines
Thanks,
-SiweiQuoted 68 lines · Parav Pandit via Virtualization
Quoted 19 lines
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device, to choose a
appropriate one for a certain guest. This means the users need to read the
config space beforeFEATURES_OK, and the existence of config space contents does not depend onFEATURES_OK.The spec says:
The device MUST allow reading of any device-specific configuration field
beforeFEATURES_OKis set by the driver. This includes fields which are
conditional on feature bits, as long as those feature bits are offered by the
device.Quoted 2 lines
Fixes 30ef7a8ac8a07 (vdpa: Read deviceconfiguration only if
FEATURES_OK)Fix is fine, but fixes tag needs correction described below.
Above commit id is 13 letters should be 12.
And
It should be in formatFixes 30ef7a8ac8a0 ("vdpa: Read device configurationonly if
FEATURES_OK")Please use checkpatch.pl script before posting the patches to catch these errors.
There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.Quoted 27 lines
Signed-off-by Zhu Lingshan<[email protected]>---
drivers/vdpa/vdpa.c| 8 --------1 file changed, 8 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
9b0e39b2f022..d76b22b2f7ae100644drivers/vdpa/vdpa.c +0
-8@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, { u32 device_id; void *hdr; - u8 status; int err; down_read(&vdev->cf_lock); - status = vdev->config->get_status(vdev); - if (!(status & VIRTIO_CONFIG_S_FEATURES_OK)) { - NL_SET_ERR_MSG_MOD(extack, "Features negotiation not completed"); - err = -EAGAIN; - goto out; - } - hdr = genlmsg_put(msg, portid, seq, &vdpa_nl_family, flags, VDPA_CMD_DEV_CONFIG_GET);Quoted 3 lines
if (!hdr) {
Signature · 1 line
2.31.1_______________________________________________
Virtualization mailing list
[email protected]
https://urldefense.com/v3/__https://lists.linuxfoundation.org/mailman/listinfo/virtualization__;!!ACWV5N9M2RV99hQ!Pkwym7OAjoDucUqs2fAwchxqL8-BGd6wOl-51xcgB_yCNwPJ_cs8A1y-cYmrLTB4OBNsimnZuqJPcvQIl3g$
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 87 lines · Michael S. Tsirkin
Quoted 81 lines · Si-Wei Liu
Quoted 33 lines · Jason Wang
Quoted 25 lines · Si-Wei Liu
Quoted 23 lines · Lingshan
Quoted 21 lines · Si-Wei Liu
Sorry to chime in late in the game. For some reason I couldn't get to most emails for this discussion (I only subscribed to the virtualization list), while I was taking off amongst the past few weeks.
It looks to me this patch is incomplete. Noted down the way in
vdpa_dev_net_config_fill(), we have the following:
features =vdev->config->get_driver_features(vdev); if (nla_put_u64_64bit(msg,VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features,
VDPA_ATTR_PAD)) return-EMSGSIZE;Making call to .get_driver_features() doesn't make sense when feature negotiation isn't complete. Neither should present
negotiated_featuresto userspace before negotiation is done.Similarly,
max_vqpthroughvdpa_dev_net_mq_config_fill()probably should not show before negotiation is done - it depends on driver features negotiated.Quoted 6 lines
Quoted 4 lines
I have another patch in this series introduces
device_featuresand will reportdevice_featuresto the userspace even features negotiation not done. Because the spec says we should allow driver access the config space beforeFEATURES_OK.The config space can be accessed by guest before
features_okdoesn't necessarily mean the value is valid.Quoted 6 lines
It's valid as long as the device offers the feature:
"The device MUST allow reading of any device-specific configuration field before
FEATURES_OKis set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device."I guess this statement only conveys that the field in config space can be read before
FEATURES_OKis set, though it does not *explicitly* states the validity of field.And looking at:
"The mac address field always exists (though is only valid if
VIRTIO_NET_F_MACis set), and status only exists ifVIRTIO_NET_F_STATUSis set."It appears to me there's a border line set between "exist" and "valid". If I understand the spec wording correctly, a spec-conforming device implementation may or may not offer valid status value in the config space when
VIRTIO_NET_F_STATUSis offered, but before the feature is negotiated. On the other hand, config space should contain valid mac address the momentVIRTIO_NET_F_MACfeature is offered, regardless being negotiated or not. By that, there seems to be leeway for the device implementation to decide when config space field may become valid, though for most of QEMU's software virtio devices, valid value is present to config space the very first moment when feature is offered."If the
VIRTIO_NET_F_MACfeature bit is set, the configuration space mac entry indicates the “physical” address of the network card, otherwise the driver would typically generate a random local MAC address."
"If theVIRTIO_NET_F_STATUSfeature bit is negotiated, the link status comes from the bottom bit of status. Otherwise, the driver assumes it’s active."And also there are special cases where the read of specific configuration space field MUST be deferred to until
FEATURES_OKis set:"If the
VIRTIO_BLK_F_CONFIG_WCEfeature is negotiated, the cache mode can be read or set through the writeback field. 0 corresponds to a writethrough cache, 1 to a writeback cache11. The cache mode after reset can be either writeback or writethrough. The actual mode can be determined by reading writeback after feature negotiation."
"The driver MUST NOT read writeback before setting theFEATURES_OKdevice status bit."
"IfVIRTIO_BLK_F_CONFIG_WCEis negotiated butVIRTIO_BLK_F_FLUSHis not, the device MUST initialize writeback to 0."Quoted 4 lines
Since the spec doesn't explicitly mandate the validity of each config space field when feature of concern is offered, to be safer we'd have to live with odd device implementation. I know for sure QEMU software devices won't for 99% of these cases, but that's not what is currently defined in the spec.
Quoted 5 lines
Thanks for raising this subject. I started working on this in April:
working now to address the comments.
Great, thank you very much!
Is there a link to the latest draft that reflects the change uptodate? The one above with iterative feature negotiation seemed getting some resistance because of backward incompatibility with older spec? Please copy me in the loop when you have the draft ready. I am not in the virtio-comment list.
Thanks,
-Siwei
Quoted 151 lines
Quoted 151 lines
Quoted 13 lines
Quoted 13 lines
You may want to double check with Michael for what he quoted earlier:
Quoted 9 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered
before accessing that part of the configuration space.Quoted 7 lines
Quoted 5 lines
and how many driver bugs taking wrong assumption of the validity of config space field without
features_ok. I am not sure what use case you want to expose config resister values for beforefeatures_ok, if it's mostly for live migration I guess it's probably heading a wrong direction.I guess it's not for migration.
Then what's the other possible use case than live migration, were to expose config space values? Troubleshooting config space discrepancy between vDPA and the emulated virtio device in userspace? Or tracking changes in config space across feature negotiation, but for what? It'd be beneficial to the interface design if the specific use case can be clearly described...
Quoted 2 lines
For migration, a provision with the correct features/capability would be sufficient.
Right, that's what I thought too. It doesn't need to expose config space values, simply exporting all attributes for vdpa device creation will do the work.
-Siwei
Quoted 116 lines
Thanks
Quoted 113 lines
Quoted 21 lines
Quoted 11 lines
Last but not the least, this "vdpa dev config" command was not designed to display the real config space register values in the first place. Quoting the vdpa-dev(8) man page:
Quoted 5 lines
vdpa dev config show - Show configuration of specific device or all devices.
DEV - specifies the vdpa device to show its configuration. If this argument is omitted all devices configuration is listed.Quoted 10 lines
It doesn't say anything about configuration space or register values in config space. As long as it can convey the config attribute when instantiating vDPA device instance, and more importantly, the config can be easily imported from or exported to userspace tools when trying to reconstruct vdpa instance intact on destination host for live migration, IMHO in my personal interpretation it doesn't matter what the config space may present. It may be worth while adding a new debug command to expose the real register value, but that's another story.
Quoted 5 lines
I am not sure getting your points. vDPA now reports device feature
bits(device_features)and negotiated featurebits(driver_features), and yes, the drivers features can be a subset of the device features; and the vDPA device features can be a subset of the management device features.What I said is after unblocking the conditional check, you'd have to handle the case for each of the vdpa attribute when feature negotiation is not yet done: basically the register values you got from config space via the
vdpa_get_config_unlocked()call is not considered to be valid beforefeatures_ok(per-spec). Although in some case you may get sane value, such behavior is generally undefined. If you desire to show just thedevice_featuresalone without any config space field, which the device had advertised *before feature negotiation is complete*, that'll be fine. But looks to me this is not how patch has been implemented. Probably need some more work?Regards,
-SiweiQuoted 72 lines
Quoted 3 lines
Having said, please consider to drop the Fixes tag, as appears to me you're proposing a new feature rather than fixing a real issue.
it's a new feature to report the device feature bits than only negotiated features, however this patch is a must, or it will block the device feature bits reporting. but I agree, the fix tag is not a must.
Quoted 65 lines
Thanks,
-SiweiQuoted 61 lines · Parav Pandit via Virtualization
Quoted 19 lines
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device, to choose a
appropriate one for a certain guest. This means the users need to read the
config space beforeFEATURES_OK, and the existence of config space contents does not depend onFEATURES_OK.The spec says:
The device MUST allow reading of any device-specific configuration field
beforeFEATURES_OKis set by the driver. This includes fields which are
conditional on feature bits, as long as those feature bits are offered by the
device.Quoted 2 lines
Fixes 30ef7a8ac8a07 (vdpa: Read deviceconfiguration only if
FEATURES_OK)Fix is fine, but fixes tag needs correction described below.
Above commit id is 13 letters should be 12.
And
It should be in formatFixes 30ef7a8ac8a0 ("vdpa: Read device configurationonly if
FEATURES_OK")Please use checkpatch.pl script before posting the patches to catch these errors.
There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.Quoted 27 lines
Signed-off-by Zhu Lingshan<[email protected]>--- drivers/vdpa/vdpa.c | 8 -------- 1 file changed, 8 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
9b0e39b2f022..d76b22b2f7ae100644drivers/vdpa/vdpa.c +0
-8@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, { u32 device_id; void *hdr; - u8 status; int err; down_read(&vdev->cf_lock); - status = vdev->config->get_status(vdev); - if (!(status & VIRTIO_CONFIG_S_FEATURES_OK)) { - NL_SET_ERR_MSG_MOD(extack, "Features negotiation not completed"); - err = -EAGAIN; - goto out; - } - hdr = genlmsg_put(msg, portid, seq, &vdpa_nl_family, flags, VDPA_CMD_DEV_CONFIG_GET);
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
if (!hdr) {
Signature · 1 line
2.31.1_______________________________________________
Virtualization mailing list
[email protected]
https://urldefense.com/v3/__https://lists.linuxfoundation.org/mailman/listinfo/virtualization__;!!ACWV5N9M2RV99hQ!Pkwym7OAjoDucUqs2fAwchxqL8-BGd6wOl-51xcgB_yCNwPJ_cs8A1y-cYmrLTB4OBNsimnZuqJPcvQIl3g$
_______________________________________________
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]
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 17 lines · Lingshan
Quoted 14 lines · Si-Wei Liu
Quoted 11 lines · Lingshan
Quoted 8 lines · Si-Wei Liu
Sorry to chime in late in the game. For some reason I couldn't get to most emails for this discussion (I only subscribed to the virtualization list), while I was taking off amongst the past few weeks.
It looks to me this patch is incomplete. Noted down the way in
vdpa_dev_net_config_fill(), we have the following:features = vdev->config->get_driver_features(vdev); if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features, VDPA_ATTR_PAD)) return -EMSGSIZE;
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Making call to .get_driver_features() doesn't make sense when feature negotiation isn't complete. Neither should present
negotiated_featuresto userspace before negotiation is done.Similarly,
max_vqpthroughvdpa_dev_net_mq_config_fill()probably should not show before negotiation is done - it depends on driver features negotiated.I have another patch in this series introduces
device_featuresand will reportdevice_featuresto the userspace even features negotiation not done. Because the spec says we should allow driver access the config space beforeFEATURES_OK.The config space can be accessed by guest before
features_okdoesn't necessarily mean the value is valid. You may want to double check with Michael for what he quoted earlier:that's why I proposed to fix these issues, e.g., if no
_F_MAC, vDPA kernel should not return a mac to the userspace, there is not a default value for mac.
Then please show us the code, as I can only comment based on your latest (v4) patch and it was not there.. To be honest, I don't understand the motivation and the use cases you have, is it for debugging/monitoring or there's really a use case for live migration? For the former, you can do a direct dump on all config space fields regardless of endianess and feature negotiation without having to worry about validity (meaningful to present to admin user). To me these are conflict asks that is impossible to mix in exact one command.
Quoted 14 lines
Quoted 14 lines
Quoted 8 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered before accessing that part of the configuration space.
and how many driver bugs taking wrong assumption of the validity of config space field without
features_ok. I am not sure what use case you want to expose config resister values for beforefeatures_ok, if it's mostly for live migration I guess it's probably heading a wrong direction.Quoted 2 lines
Quoted 2 lines
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Last but not the least, this "vdpa dev config" command was not designed to display the real config space register values in the first place. Quoting the vdpa-dev(8) man page:
Quoted 2 lines
vdpa dev config show - Show configuration of specific device or all devices.
DEV - specifies the vdpa device to show its configuration. If this argument is omitted all devices configuration is listed.It doesn't say anything about configuration space or register values in config space. As long as it can convey the config attribute when instantiating vDPA device instance, and more importantly, the config can be easily imported from or exported to userspace tools when trying to reconstruct vdpa instance intact on destination host for live migration, IMHO in my personal interpretation it doesn't matter what the config space may present. It may be worth while adding a new debug command to expose the real register value, but that's another story.
I am not sure getting your points. vDPA now reports device feature
bits(device_features)and negotiated featurebits(driver_features), and yes, the drivers features can be a subset of the device features; and the vDPA device features can be a subset of the management device features.What I said is after unblocking the conditional check, you'd have to handle the case for each of the vdpa attribute when feature negotiation is not yet done: basically the register values you got from config space via the
vdpa_get_config_unlocked()call is not considered to be valid beforefeatures_ok(per-spec). Although in some case you may get sane value, such behavior is generally undefined. If you desire to show just thedevice_featuresalone without any config space field, which the device had advertised *before feature negotiation is complete*, that'll be fine. But looks to me this is not how patch has been implemented. Probably need some more work?They are
driver_features(negotiated)and thedevice_features(which comes with the device), and the config space fields that depend on them. In this series, we report both to the userspace.
I fail to understand what you want to present from your description. May be worth showing some example outputs that at least include the following cases: 1) when device offers features but not yet acknowledge by guest 2) when guest acknowledged features and device is yet to accept 3) after guest feature negotiation is completed (agreed upon between guest and device).
Thanks,
-Siwei
Quoted 66 lines
Quoted 66 lines
Regards,
-SiweiQuoted 62 lines
Quoted 2 lines
Having said, please consider to drop the Fixes tag, as appears to me you're proposing a new feature rather than fixing a real issue.
it's a new feature to report the device feature bits than only negotiated features, however this patch is a must, or it will block the device feature bits reporting. but I agree, the fix tag is not a must.
Quoted 59 lines
Thanks,
-SiweiQuoted 54 lines · Parav Pandit via Virtualization
Quoted 8 lines
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device, to choose a appropriate one for a certain guest. This means the users need to read the config space before
FEATURES_OK, and the existence of config space contents does not depend onFEATURES_OK.Quoted 7 lines
The spec says:
The device MUST allow reading of any device-specific configuration field beforeFEATURES_OKis set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device.Fixes 30ef7a8ac8a07 (vdpa: Read device configuration only if FEATURES_OK)Fix is fine, but fixes tag needs correction described below.
Above commit id is 13 letters should be 12.
And
It should be in formatFixes 30ef7a8ac8a0 ("vdpa: Read device configuration only if FEATURES_OK")Please use checkpatch.pl script before posting the patches to catch these errors. There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.
Quoted 29 lines
Signed-off-by Zhu Lingshan<[email protected]>--- drivers/vdpa/vdpa.c | 8 -------- 1 file changed, 8 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
9b0e39b2f022..d76b22b2f7ae100644drivers/vdpa/vdpa.c +0
-8@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, { u32 device_id;void *hdr; -u8 status;int err;down_read (&vdev->cf_lock); - status = vdev->config->get_status (vdev); -if (!(status &VIRTIO_CONFIG_S_FEATURES_OK )) { -NL_SET_ERR_MSG_MOD (extack,"Features negotiation not completed"); - err = -EAGAIN ; - goto out; - } - hdr =genlmsg_put (msg, portid, seq, &vdpa_nl_family, flags,VDPA_CMD_DEV_CONFIG_GET );if (!hdr) {
--
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
2.31.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
_______________________________________________
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]
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 28 lines · Lingshan
Quoted 25 lines · Si-Wei Liu
Quoted 22 lines · Lingshan
Quoted 19 lines · Si-Wei Liu
Quoted 11 lines · Lingshan
Quoted 8 lines · Si-Wei Liu
Sorry to chime in late in the game. For some reason I couldn't get to most emails for this discussion (I only subscribed to the virtualization list), while I was taking off amongst the past few weeks.
It looks to me this patch is incomplete. Noted down the way in
vdpa_dev_net_config_fill(), we have the following:features = vdev->config->get_driver_features(vdev); if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features, VDPA_ATTR_PAD)) return -EMSGSIZE;Quoted 4 lines
Quoted 3 lines
Making call to .get_driver_features() doesn't make sense when feature negotiation isn't complete. Neither should present
negotiated_featuresto userspace before negotiation is done.Similarly,
max_vqpthroughvdpa_dev_net_mq_config_fill()probably should not show before negotiation is done - it depends on driver features negotiated.I have another patch in this series introduces
device_featuresand will reportdevice_featuresto the userspace even features negotiation not done. Because the spec says we should allow driver access the config space beforeFEATURES_OK.The config space can be accessed by guest before
features_okdoesn't necessarily mean the value is valid. You may want to double check with Michael for what he quoted earlier:
Quoted 8 lines
Quoted 2 lines
Quoted 1 line
that's why I proposed to fix these issues, e.g., if no
_F_MAC, vDPA kernel should not return a mac to the userspace, there is not a default value for mac.Then please show us the code, as I can only comment based on your latest (v4) patch and it was not there.. To be honest, I don't understand the motivation and the use cases you have, is it for debugging/monitoring or there's really a use case for live migration? For the former, you can do a direct dump on all config space fields regardless of endianess and feature negotiation without having to worry about validity (meaningful to present to admin user). To me these are conflict asks that is impossible to mix in exact one command.
This bug just has been revealed two days, and you will see the patch soon.
There are something to clarify:
1) we need to read the device features, or how can you pick a proper LM destination
2) vdpa dev config show can show both device features and driver features, there just need a patch for iproute2
3) To process information like MQ, we don't just dump the config space, MST has explained before
So, it's for live migration... Then why not export those config parameters specified for vdpa creation (as well as device feature bits) to the output of "vdpa dev show" command? That's where device side config lives and is static across vdpa's life cycle. "vdpa dev config show" is mostly for dynamic driver side config, and the validity is subject to feature negotiation. I suppose this should suit your need of LM, e.g.
$ vdpa dev add name vdpa1 mgmtdev pci/0000:41:04.2 max_vqp 7 mtu 2000 $ vdpa dev show vdpa1 vdpa1: type network mgmtdev pci/0000:41:04.2 vendor_id 5555 max_vqs 15 max_vq_size 256 max_vqp 7 mtu 2000 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 RING_PACKED
For it to work, you'd want to pass "struct vdpa_dev_set_config" to _vdpa_register_device() during registration, and get it saved there in "struct vdpa_device". Then in vdpa_dev_fill() show each field conditionally subject to "struct vdpa_dev_set_config.mask".
Thanks,
-Siwei
Quoted 20 lines
Thanks
Zhu LingshanQuoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 9 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered before accessing that part of the configuration space.
and how many driver bugs taking wrong assumption of the validity of config space field without
features_ok. I am not sure what use case you want to expose config resister values for beforefeatures_ok, if it's mostly for live migration I guess it's probably heading a wrong direction.Quoted 4 lines
Quoted 4 lines
Last but not the least, this "vdpa dev config" command was not designed to display the real config space register values in the first place. Quoting the vdpa-dev(8) man page:
Quoted 88 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
vdpa dev config show - Show configuration of specific device or all devices.
DEV - specifies the vdpa device to show its configuration. If this argument is omitted all devices configuration is listed.It doesn't say anything about configuration space or register values in config space. As long as it can convey the config attribute when instantiating vDPA device instance, and more importantly, the config can be easily imported from or exported to userspace tools when trying to reconstruct vdpa instance intact on destination host for live migration, IMHO in my personal interpretation it doesn't matter what the config space may present. It may be worth while adding a new debug command to expose the real register value, but that's another story.
I am not sure getting your points. vDPA now reports device feature
bits(device_features)and negotiated featurebits(driver_features), and yes, the drivers features can be a subset of the device features; and the vDPA device features can be a subset of the management device features.What I said is after unblocking the conditional check, you'd have to handle the case for each of the vdpa attribute when feature negotiation is not yet done: basically the register values you got from config space via the
vdpa_get_config_unlocked()call is not considered to be valid beforefeatures_ok(per-spec). Although in some case you may get sane value, such behavior is generally undefined. If you desire to show just thedevice_featuresalone without any config space field, which the device had advertised *before feature negotiation is complete*, that'll be fine. But looks to me this is not how patch has been implemented. Probably need some more work?They are
driver_features(negotiated)and thedevice_features(which comes with the device), and the config space fields that depend on them. In this series, we report both to the userspace.I fail to understand what you want to present from your description. May be worth showing some example outputs that at least include the following cases: 1) when device offers features but not yet acknowledge by guest 2) when guest acknowledged features and device is yet to accept 3) after guest feature negotiation is completed (agreed upon between guest and device).
Only two feature sets: 1) what the device has. (2) what is negotiated
Quoted 79 lines
Thanks,
-SiweiQuoted 75 lines
Quoted 74 lines
Regards,
-SiweiQuoted 69 lines
Quoted 2 lines
Having said, please consider to drop the Fixes tag, as appears to me you're proposing a new feature rather than fixing a real issue.
it's a new feature to report the device feature bits than only negotiated features, however this patch is a must, or it will block the device feature bits reporting. but I agree, the fix tag is not a must.
Quoted 65 lines
Thanks,
-SiweiQuoted 59 lines · Parav Pandit via Virtualization
Quoted 8 lines
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device, to choose a appropriate one for a certain guest. This means the users need to read the config space before
FEATURES_OK, and the existence of config space contents does not depend onFEATURES_OK.Quoted 7 lines
The spec says:
The device MUST allow reading of any device-specific configuration field beforeFEATURES_OKis set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device.Fixes 30ef7a8ac8a07 (vdpa: Read device configuration only if FEATURES_OK)Fix is fine, but fixes tag needs correction described below.
Above commit id is 13 letters should be 12.
And
It should be in formatFixes 30ef7a8ac8a0 ("vdpa: Read device configuration only if FEATURES_OK")Please use checkpatch.pl script before posting the patches to catch these errors. There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.
Quoted 27 lines
Signed-off-by Zhu Lingshan<[email protected]>--- drivers/vdpa/vdpa.c | 8 -------- 1 file changed, 8 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
9b0e39b2f022..d76b22b2f7ae100644drivers/vdpa/vdpa.c +0
-8@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, { u32 device_id;void *hdr; -u8 status;int err;down_read (&vdev->cf_lock); - status = vdev->config->get_status (vdev); -if (!(status &VIRTIO_CONFIG_S_FEATURES_OK )) { -NL_SET_ERR_MSG_MOD (extack,"Features negotiation not completed"); - err = -EAGAIN ; - goto out; - } - hdr =genlmsg_put (msg, portid, seq, &vdpa_nl_family, flags,VDPA_CMD_DEV_CONFIG_GET );Quoted 3 lines
if (!hdr) {
--
2.31.1_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 29 lines · Si-Wei Liu
Quoted 26 lines · Lingshan
Quoted 23 lines · Si-Wei Liu
Quoted 20 lines · Lingshan
Quoted 17 lines · Si-Wei Liu
Quoted 14 lines · Lingshan
Quoted 11 lines · Si-Wei Liu
Sorry to chime in late in the game. For some reason I couldn't get to most emails for this discussion (I only subscribed to the virtualization list), while I was taking off amongst the past few weeks.
It looks to me this patch is incomplete. Noted down the way in
vdpa_dev_net_config_fill(), we have the following:
features =vdev->config->get_driver_features(vdev);
if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features, VDPA_ATTR_PAD))
return-EMSGSIZE;Making call to .get_driver_features() doesn't make sense when feature negotiation isn't complete. Neither should present
negotiated_featuresto userspace before negotiation is done.Similarly,
max_vqpthroughvdpa_dev_net_mq_config_fill()probably should not show before negotiation is done - it depends on driver features negotiated.
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
I have another patch in this series introduces
device_featuresand will reportdevice_featuresto the userspace even features negotiation not done. Because the spec says we should allow driver access the config space beforeFEATURES_OK.The config space can be accessed by guest before
features_okdoesn't necessarily mean the value is valid. You may want to double check with Michael for what he quoted earlier:that's why I proposed to fix these issues, e.g., if no
_F_MAC, vDPA kernel should not return a mac to the userspace, there is not a default value for mac.Then please show us the code, as I can only comment based on your latest (v4) patch and it was not there.. To be honest, I don't understand the motivation and the use cases you have, is it for debugging/monitoring or there's really a use case for live migration? For the former, you can do a direct dump on all config space fields regardless of endianess and feature negotiation without having to worry about validity (meaningful to present to admin user). To me these are conflict asks that is impossible to mix in exact one command.
This bug just has been revealed two days, and you will see the patch soon.
There are something to clarify:
1) we need to read the device features, or how can you pick a proper LM destination
So it's probably not very efficient to use this, the manager layer should have the knowledge about the compatibility before doing migration other than try-and-fail.
And it's the task of the management to gather the nodes whose devices could be live migrated to each other as something like "cluster" which we've already used in the case of cpuflags.
1) during node bootstrap, the capability of each node and devices was reported to management layer
2) management layer decide the cluster and make sure the migration can only done among the nodes insides the cluster
3) before migration, the vDPA needs to be provisioned on the destination
Quoted 3 lines
Quoted 2 lines
2) vdpa dev config show can show both device features and driver features, there just need a patch for iproute2
3) To process information like MQ, we don't just dump the config space, MST has explained beforeSo, it's for live migration... Then why not export those config parameters specified for vdpa creation (as well as device feature bits) to the output of "vdpa dev show" command? That's where device side config lives and is static across vdpa's life cycle. "vdpa dev config show" is mostly for dynamic driver side config, and the validity is subject to feature negotiation. I suppose this should suit your need of LM, e.g.
I think so.
Quoted 6 lines
$ vdpa dev add name vdpa1 mgmtdev pci/0000:41:04.2 max_vqp 7 mtu 2000 $ vdpa dev show vdpa1 vdpa1: type network mgmtdev pci/0000:41:04.2 vendor_id 5555 max_vqs 15 max_vq_size 256 max_vqp 7 mtu 2000 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 RING_PACKED
Note that the mgmt should know this destination have those capability/features before the provisioning.
Quoted 5 lines
For it to work, you'd want to pass "struct
vdpa_dev_set_config" to_vdpa_register_device()during registration, and get it saved there in "structvdpa_device". Then invdpa_dev_fill()show each field conditionally subject to "struct vdpa_dev_set_config.mask".Thanks,
-Siwei
Thanks
Quoted 110 lines
Quoted 109 lines
Thanks
Zhu LingshanQuoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 9 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered before accessing that part of the configuration space.
and how many driver bugs taking wrong assumption of the validity of config space field without
features_ok. I am not sure what use case you want to expose config resister values for beforefeatures_ok, if it's mostly for live migration I guess it's probably heading a wrong direction.Quoted 4 lines
Quoted 4 lines
Last but not the least, this "vdpa dev config" command was not designed to display the real config space register values in the first place. Quoting the vdpa-dev(8) man page:
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
vdpa dev config show - Show configuration of specific device or all devices.
DEV - specifies the vdpa device to show its configuration. If this argument is omitted all devices configuration is listed.It doesn't say anything about configuration space or register values in config space. As long as it can convey the config attribute when instantiating vDPA device instance, and more importantly, the config can be easily imported from or exported to userspace tools when trying to reconstruct vdpa instance intact on destination host for live migration, IMHO in my personal interpretation it doesn't matter what the config space may present. It may be worth while adding a new debug command to expose the real register value, but that's another story.
I am not sure getting your points. vDPA now reports device feature
bits(device_features)and negotiated featurebits(driver_features), and yes, the drivers features can be a subset of the device features; and the vDPA device features can be a subset of the management device features.What I said is after unblocking the conditional check, you'd have to handle the case for each of the vdpa attribute when feature negotiation is not yet done: basically the register values you got from config space via the
vdpa_get_config_unlocked()call is not considered to be valid beforefeatures_ok(per-spec). Although in some case you may get sane value, such behavior is generally undefined. If you desire to show just thedevice_featuresalone without any config space field, which the device had advertised *before feature negotiation is complete*, that'll be fine. But looks to me this is not how patch has been implemented. Probably need some more work?They are
driver_features(negotiated)and thedevice_features(which comes with the device), and the config space fields that depend on them. In this series, we report both to the userspace.I fail to understand what you want to present from your description. May be worth showing some example outputs that at least include the following cases: 1) when device offers features but not yet acknowledge by guest 2) when guest acknowledged features and device is yet to accept 3) after guest feature negotiation is completed (agreed upon between guest and device).
Only two feature sets: 1) what the device has. (2) what is negotiated
Quoted 80 lines
Thanks,
-SiweiQuoted 76 lines
Quoted 75 lines
Regards,
-SiweiQuoted 70 lines
Quoted 2 lines
Having said, please consider to drop the Fixes tag, as appears to me you're proposing a new feature rather than fixing a real issue.
it's a new feature to report the device feature bits than only negotiated features, however this patch is a must, or it will block the device feature bits reporting. but I agree, the fix tag is not a must.
Quoted 66 lines
Thanks,
-SiweiQuoted 60 lines · Parav Pandit via Virtualization
Quoted 8 lines
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device, to choose a appropriate one for a certain guest. This means the users need to read the config space before
FEATURES_OK, and the existence of config space contents does not depend onFEATURES_OK.Quoted 7 lines
The spec says:
The device MUST allow reading of any device-specific configuration field beforeFEATURES_OKis set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device.Fixes 30ef7a8ac8a07 (vdpa: Read device configuration only if FEATURES_OK)Fix is fine, but fixes tag needs correction described below.
Above commit id is 13 letters should be 12.
And
It should be in formatFixes 30ef7a8ac8a0 ("vdpa: Read device configuration only if FEATURES_OK")Please use checkpatch.pl script before posting the patches to catch these errors. There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.
Quoted 27 lines
Signed-off-by Zhu Lingshan<[email protected]>---
drivers/vdpa/vdpa.c| 8 --------1 file changed, 8 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
9b0e39b2f022..d76b22b2f7ae100644drivers/vdpa/vdpa.c +0
-8@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, { u32 device_id; void *hdr; - u8 status; int err; down_read(&vdev->cf_lock); - status = vdev->config->get_status(vdev); - if (!(status & VIRTIO_CONFIG_S_FEATURES_OK)) { - NL_SET_ERR_MSG_MOD(extack, "Features negotiation not completed"); - err = -EAGAIN; - goto out; - } - hdr = genlmsg_put(msg, portid, seq, &vdpa_nl_family, flags,Quoted 4 lines
VDPA_CMD_DEV_CONFIG_GET);
if (!hdr) {Signature · 1 line
2.31.1_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 59 lines · Jason Wang
Quoted 29 lines · Si-Wei Liu
Quoted 26 lines · Lingshan
Quoted 23 lines · Si-Wei Liu
Quoted 20 lines · Lingshan
Quoted 17 lines · Si-Wei Liu
Quoted 14 lines · Lingshan
Quoted 11 lines · Si-Wei Liu
Sorry to chime in late in the game. For some reason I couldn't get to most emails for this discussion (I only subscribed to the virtualization list), while I was taking off amongst the past few weeks.
It looks to me this patch is incomplete. Noted down the way in
vdpa_dev_net_config_fill(), we have the following:
features =vdev->config->get_driver_features(vdev);
if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features, VDPA_ATTR_PAD))
return-EMSGSIZE;Making call to .get_driver_features() doesn't make sense when feature negotiation isn't complete. Neither should present
negotiated_featuresto userspace before negotiation is done.Similarly,
max_vqpthroughvdpa_dev_net_mq_config_fill()probably should not show before negotiation is done - it depends on driver features negotiated.Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
I have another patch in this series introduces
device_featuresand will reportdevice_featuresto the userspace even features negotiation not done. Because the spec says we should allow driver access the config space beforeFEATURES_OK.The config space can be accessed by guest before
features_okdoesn't necessarily mean the value is valid. You may want to double check with Michael for what he quoted earlier:that's why I proposed to fix these issues, e.g., if no
_F_MAC, vDPA kernel should not return a mac to the userspace, there is not a default value for mac.Then please show us the code, as I can only comment based on your latest (v4) patch and it was not there.. To be honest, I don't understand the motivation and the use cases you have, is it for debugging/monitoring or there's really a use case for live migration? For the former, you can do a direct dump on all config space fields regardless of endianess and feature negotiation without having to worry about validity (meaningful to present to admin user). To me these are conflict asks that is impossible to mix in exact one command.
This bug just has been revealed two days, and you will see the patch soon.
There are something to clarify:
1) we need to read the device features, or how can you pick a proper LM destinationSo it's probably not very efficient to use this, the manager layer should have the knowledge about the compatibility before doing migration other than try-and-fail.
And it's the task of the management to gather the nodes whose devices could be live migrated to each other as something like "cluster" which we've already used in the case of cpuflags.
1) during node bootstrap, the capability of each node and devices was reported to management layer
2) management layer decide the cluster and make sure the migration can only done among the nodes insides the cluster
3) before migration, the vDPA needs to be provisioned on the destinationQuoted 3 lines
Quoted 2 lines
2) vdpa dev config show can show both device features and driver features, there just need a patch for iproute2
3) To process information like MQ, we don't just dump the config space, MST has explained beforeSo, it's for live migration... Then why not export those config parameters specified for vdpa creation (as well as device feature bits) to the output of "vdpa dev show" command? That's where device side config lives and is static across vdpa's life cycle. "vdpa dev config show" is mostly for dynamic driver side config, and the validity is subject to feature negotiation. I suppose this should suit your need of LM, e.g.
I think so.
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
$ vdpa dev add name vdpa1 mgmtdev pci/0000:41:04.2 max_vqp 7 mtu 2000 $ vdpa dev show vdpa1 vdpa1: type network mgmtdev pci/0000:41:04.2 vendor_id 5555 max_vqs 15 max_vq_size 256 max_vqp 7 mtu 2000 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 RING_PACKEDNote that the mgmt should know this destination have those capability/features before the provisioning.
Yes, mgmt software should have to check the above from source.
Quoted 124 lines
Quoted 7 lines
For it to work, you'd want to pass "struct
vdpa_dev_set_config" to_vdpa_register_device()during registration, and get it saved there in "structvdpa_device". Then invdpa_dev_fill()show each field conditionally subject to "struct vdpa_dev_set_config.mask".Thanks,
-SiweiThanks
Quoted 111 lines
Quoted 110 lines
Thanks
Zhu LingshanQuoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 9 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered before accessing that part of the configuration space.
and how many driver bugs taking wrong assumption of the validity of config space field without
features_ok. I am not sure what use case you want to expose config resister values for beforefeatures_ok, if it's mostly for live migration I guess it's probably heading a wrong direction.Quoted 4 lines
Quoted 4 lines
Last but not the least, this "vdpa dev config" command was not designed to display the real config space register values in the first place. Quoting the vdpa-dev(8) man page:
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
vdpa dev config show - Show configuration of specific device or all devices.
DEV - specifies the vdpa device to show its configuration. If this argument is omitted all devices configuration is listed.It doesn't say anything about configuration space or register values in config space. As long as it can convey the config attribute when instantiating vDPA device instance, and more importantly, the config can be easily imported from or exported to userspace tools when trying to reconstruct vdpa instance intact on destination host for live migration, IMHO in my personal interpretation it doesn't matter what the config space may present. It may be worth while adding a new debug command to expose the real register value, but that's another story.
I am not sure getting your points. vDPA now reports device feature
bits(device_features)and negotiated featurebits(driver_features), and yes, the drivers features can be a subset of the device features; and the vDPA device features can be a subset of the management device features.What I said is after unblocking the conditional check, you'd have to handle the case for each of the vdpa attribute when feature negotiation is not yet done: basically the register values you got from config space via the
vdpa_get_config_unlocked()call is not considered to be valid beforefeatures_ok(per-spec). Although in some case you may get sane value, such behavior is generally undefined. If you desire to show just thedevice_featuresalone without any config space field, which the device had advertised *before feature negotiation is complete*, that'll be fine. But looks to me this is not how patch has been implemented. Probably need some more work?They are
driver_features(negotiated)and thedevice_features(which comes with the device), and the config space fields that depend on them. In this series, we report both to the userspace.I fail to understand what you want to present from your description. May be worth showing some example outputs that at least include the following cases: 1) when device offers features but not yet acknowledge by guest 2) when guest acknowledged features and device is yet to accept 3) after guest feature negotiation is completed (agreed upon between guest and device).
Only two feature sets: 1) what the device has. (2) what is negotiated
Quoted 81 lines
Thanks,
-SiweiQuoted 77 lines
Quoted 76 lines
Regards,
-SiweiQuoted 71 lines
Quoted 2 lines
Having said, please consider to drop the Fixes tag, as appears to me you're proposing a new feature rather than fixing a real issue.
it's a new feature to report the device feature bits than only negotiated features, however this patch is a must, or it will block the device feature bits reporting. but I agree, the fix tag is not a must.
Quoted 67 lines
Thanks,
-SiweiQuoted 60 lines · Parav Pandit via Virtualization
Quoted 8 lines
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device, to choose a appropriate one for a certain guest. This means the users need to read the config space before
FEATURES_OK, and the existence of config space contents does not depend onFEATURES_OK.Quoted 7 lines
The spec says:
The device MUST allow reading of any device-specific configuration field beforeFEATURES_OKis set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device.Fixes 30ef7a8ac8a07 (vdpa: Read device configuration only if FEATURES_OK)Fix is fine, but fixes tag needs correction described below.
Above commit id is 13 letters should be 12.
And
It should be in formatFixes 30ef7a8ac8a0 ("vdpa: Read device configuration only if FEATURES_OK")Please use checkpatch.pl script before posting the patches to catch these errors. There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.
Quoted 27 lines
Signed-off-by Zhu Lingshan<[email protected]>---
drivers/vdpa/vdpa.c| 8 --------1 file changed, 8 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
9b0e39b2f022..d76b22b2f7ae100644drivers/vdpa/vdpa.c +0
-8@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, { u32 device_id; void *hdr; - u8 status; int err; down_read(&vdev->cf_lock); - status = vdev->config->get_status(vdev); - if (!(status & VIRTIO_CONFIG_S_FEATURES_OK)) { - NL_SET_ERR_MSG_MOD(extack, "Features negotiation not completed"); - err = -EAGAIN; - goto out; - } - hdr = genlmsg_put(msg, portid, seq, &vdpa_nl_family, flags,Quoted 4 lines
VDPA_CMD_DEV_CONFIG_GET);
if (!hdr) {Signature · 1 line
2.31.1_______________________________________________
Virtualization mailing list
[email protected]
https://urldefense.com/v3/__https://lists.linuxfoundation.org/mailman/listinfo/virtualization__;!!ACWV5N9M2RV99hQ!NzOv5Ew_Z2CP-zHyD7RsUoStLZ54KpB21QyuZ8L63YVPLEGDEwvcOSDlIGxQPHY-DMkOa9sKKZdBSaNknMU$
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 69 lines · Si-Wei Liu
Quoted 66 lines · Jason Wang
Quoted 29 lines · Si-Wei Liu
Quoted 26 lines · Lingshan
Quoted 23 lines · Si-Wei Liu
Quoted 20 lines · Lingshan
Quoted 17 lines · Si-Wei Liu
Quoted 14 lines · Lingshan
Quoted 11 lines · Si-Wei Liu
Sorry to chime in late in the game. For some reason I couldn't get to most emails for this discussion (I only subscribed to the virtualization list), while I was taking off amongst the past few weeks.
It looks to me this patch is incomplete. Noted down the way in
vdpa_dev_net_config_fill(), we have the following:
features =vdev->config->get_driver_features(vdev);
if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features, VDPA_ATTR_PAD))
return-EMSGSIZE;Making call to .get_driver_features() doesn't make sense when feature negotiation isn't complete. Neither should present
negotiated_featuresto userspace before negotiation is done.Similarly,
max_vqpthroughvdpa_dev_net_mq_config_fill()probably should not show before negotiation is done - it depends on driver features negotiated.Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
I have another patch in this series introduces
device_featuresand will reportdevice_featuresto the userspace even features negotiation not done. Because the spec says we should allow driver access the config space beforeFEATURES_OK.The config space can be accessed by guest before
features_okdoesn't necessarily mean the value is valid. You may want to double check with Michael for what he quoted earlier:that's why I proposed to fix these issues, e.g., if no
_F_MAC, vDPA kernel should not return a mac to the userspace, there is not a default value for mac.Then please show us the code, as I can only comment based on your latest (v4) patch and it was not there.. To be honest, I don't understand the motivation and the use cases you have, is it for debugging/monitoring or there's really a use case for live migration? For the former, you can do a direct dump on all config space fields regardless of endianess and feature negotiation without having to worry about validity (meaningful to present to admin user). To me these are conflict asks that is impossible to mix in exact one command.
This bug just has been revealed two days, and you will see the patch soon.
There are something to clarify:
1) we need to read the device features, or how can you pick a proper LM destinationSo it's probably not very efficient to use this, the manager layer should have the knowledge about the compatibility before doing migration other than try-and-fail.
And it's the task of the management to gather the nodes whose devices could be live migrated to each other as something like "cluster" which we've already used in the case of cpuflags.
1) during node bootstrap, the capability of each node and devices was reported to management layer
2) management layer decide the cluster and make sure the migration can only done among the nodes insides the cluster
3) before migration, the vDPA needs to be provisioned on the destinationQuoted 3 lines
Quoted 2 lines
2) vdpa dev config show can show both device features and driver features, there just need a patch for iproute2
3) To process information like MQ, we don't just dump the config space, MST has explained beforeSo, it's for live migration... Then why not export those config parameters specified for vdpa creation (as well as device feature bits) to the output of "vdpa dev show" command? That's where device side config lives and is static across vdpa's life cycle. "vdpa dev config show" is mostly for dynamic driver side config, and the validity is subject to feature negotiation. I suppose this should suit your need of LM, e.g.
I think so.
Quoted 6 lines
$ vdpa dev add name vdpa1 mgmtdev pci/0000:41:04.2 max_vqp 7 mtu 2000 $ vdpa dev show vdpa1 vdpa1: type network mgmtdev pci/0000:41:04.2 vendor_id 5555 max_vqs 15 max_vq_size 256 max_vqp 7 mtu 2000 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 RING_PACKED
Quoted 2 lines
Quoted 1 line
Note that the mgmt should know this destination have those capability/features before the provisioning.
Yes, mgmt software should have to check the above from source.
On destination mgmt software can run below to check vdpa mgmtdev's capability/features:
$ vdpa mgmtdev show pci/0000:41:04.3 pci/0000:41:04.3: supported_classes net max_supported_vqs 257 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 RING_PACKED
Quoted 118 lines
Quoted 118 lines
Quoted 8 lines
For it to work, you'd want to pass "struct
vdpa_dev_set_config" to_vdpa_register_device()during registration, and get it saved there in "structvdpa_device". Then invdpa_dev_fill()show each field conditionally subject to "struct vdpa_dev_set_config.mask".Thanks,
-SiweiThanks
Quoted 105 lines
Quoted 105 lines
Thanks
Zhu LingshanQuoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 9 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered before accessing that part of the configuration space.
and how many driver bugs taking wrong assumption of the validity of config space field without
features_ok. I am not sure what use case you want to expose config resister values for beforefeatures_ok, if it's mostly for live migration I guess it's probably heading a wrong direction.Quoted 4 lines
Quoted 4 lines
Last but not the least, this "vdpa dev config" command was not designed to display the real config space register values in the first place. Quoting the vdpa-dev(8) man page:
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
vdpa dev config show - Show configuration of specific device or all devices.
DEV - specifies the vdpa device to show its configuration. If this argument is omitted all devices configuration is listed.It doesn't say anything about configuration space or register values in config space. As long as it can convey the config attribute when instantiating vDPA device instance, and more importantly, the config can be easily imported from or exported to userspace tools when trying to reconstruct vdpa instance intact on destination host for live migration, IMHO in my personal interpretation it doesn't matter what the config space may present. It may be worth while adding a new debug command to expose the real register value, but that's another story.
I am not sure getting your points. vDPA now reports device feature
bits(device_features)and negotiated featurebits(driver_features), and yes, the drivers features can be a subset of the device features; and the vDPA device features can be a subset of the management device features.What I said is after unblocking the conditional check, you'd have to handle the case for each of the vdpa attribute when feature negotiation is not yet done: basically the register values you got from config space via the
vdpa_get_config_unlocked()call is not considered to be valid beforefeatures_ok(per-spec). Although in some case you may get sane value, such behavior is generally undefined. If you desire to show just thedevice_featuresalone without any config space field, which the device had advertised *before feature negotiation is complete*, that'll be fine. But looks to me this is not how patch has been implemented. Probably need some more work?They are
driver_features(negotiated)and thedevice_features(which comes with the device), and the config space fields that depend on them. In this series, we report both to the userspace.I fail to understand what you want to present from your description. May be worth showing some example outputs that at least include the following cases: 1) when device offers features but not yet acknowledge by guest 2) when guest acknowledged features and device is yet to accept 3) after guest feature negotiation is completed (agreed upon between guest and device).
Only two feature sets: 1) what the device has. (2) what is negotiated
Quoted 77 lines
Thanks,
-SiweiQuoted 74 lines
Quoted 74 lines
Regards,
-SiweiQuoted 70 lines
Quoted 2 lines
Having said, please consider to drop the Fixes tag, as appears to me you're proposing a new feature rather than fixing a real issue.
it's a new feature to report the device feature bits than only negotiated features, however this patch is a must, or it will block the device feature bits reporting. but I agree, the fix tag is not a must.
Quoted 67 lines
Thanks,
-SiweiQuoted 60 lines · Parav Pandit via Virtualization
Quoted 8 lines
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device, to choose a appropriate one for a certain guest. This means the users need to read the config space before
FEATURES_OK, and the existence of config space contents does not depend onFEATURES_OK.Quoted 7 lines
The spec says:
The device MUST allow reading of any device-specific configuration field beforeFEATURES_OKis set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device.Fixes 30ef7a8ac8a07 (vdpa: Read device configuration only if FEATURES_OK)Fix is fine, but fixes tag needs correction described below.
Above commit id is 13 letters should be 12.
And
It should be in formatFixes 30ef7a8ac8a0 ("vdpa: Read device configuration only if FEATURES_OK")Please use checkpatch.pl script before posting the patches to catch these errors. There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.
Quoted 27 lines
Signed-off-by Zhu Lingshan<[email protected]>---
drivers/vdpa/vdpa.c| 8 --------1 file changed, 8 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
9b0e39b2f022..d76b22b2f7ae100644drivers/vdpa/vdpa.c +0
-8@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, { u32 device_id; void *hdr; - u8 status; int err; down_read(&vdev->cf_lock); - status = vdev->config->get_status(vdev); - if (!(status & VIRTIO_CONFIG_S_FEATURES_OK)) { - NL_SET_ERR_MSG_MOD(extack, "Features negotiation not completed"); - err = -EAGAIN; - goto out; - } - hdr = genlmsg_put(msg, portid, seq, &vdpa_nl_family, flags,Quoted 4 lines
VDPA_CMD_DEV_CONFIG_GET);
if (!hdr) {Signature · 1 line
2.31.1_______________________________________________
Virtualization mailing list
[email protected]
https://urldefense.com/v3/__https://lists.linuxfoundation.org/mailman/listinfo/virtualization__;!!ACWV5N9M2RV99hQ!NzOv5Ew_Z2CP-zHyD7RsUoStLZ54KpB21QyuZ8L63YVPLEGDEwvcOSDlIGxQPHY-DMkOa9sKKZdBSaNknMU$
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 122 lines · Si-Wei Liu
Quoted 111 lines · Si-Wei Liu
Quoted 108 lines · Jason Wang
Quoted 57 lines · Si-Wei Liu
Quoted 54 lines · Lingshan
Quoted 51 lines · Si-Wei Liu
Quoted 33 lines · Lingshan
Quoted 30 lines · Si-Wei Liu
Quoted 27 lines · Lingshan
Quoted 13 lines · Si-Wei Liu
Sorry to chime in late in the game. For some reason I couldn't get to most emails for this discussion (I only subscribed to the virtualization list), while I was taking off amongst the past few weeks.
It looks to me this patch is incomplete. Noted down the way in
vdpa_dev_net_config_fill(), we have the following:features = vdev->config->get_driver_features(vdev); if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features, VDPA_ATTR_PAD)) return -EMSGSIZE;Quoted 7 lines
Making call to .get_driver_features() doesn't make sense when feature negotiation isn't complete. Neither should present
negotiated_featuresto userspace before negotiation is done.Similarly,
max_vqpthroughvdpa_dev_net_mq_config_fill()probably should not show before negotiation is done - it depends on driver features negotiated.I have another patch in this series introduces
device_featuresand will reportdevice_featuresto the userspace even features negotiation not done. Because the spec says we should allow driver access the config space beforeFEATURES_OK.Quoted 6 lines
Quoted 3 lines
The config space can be accessed by guest before
features_okdoesn't necessarily mean the value is valid. You may want to double check with Michael for what he quoted earlier:that's why I proposed to fix these issues, e.g., if no
_F_MAC, vDPA kernel should not return a mac to the userspace, there is not a default value for mac.Then please show us the code, as I can only comment based on your latest (v4) patch and it was not there.. To be honest, I don't understand the motivation and the use cases you have, is it for debugging/monitoring or there's really a use case for live migration? For the former, you can do a direct dump on all config space fields regardless of endianess and feature negotiation without having to worry about validity (meaningful to present to admin user). To me these are conflict asks that is impossible to mix in exact one command.
Quoted 6 lines
Quoted 6 lines
This bug just has been revealed two days, and you will see the patch soon.
There are something to clarify:
1) we need to read the device features, or how can you pick a proper LM destinationSo it's probably not very efficient to use this, the manager layer should have the knowledge about the compatibility before doing migration other than try-and-fail.
And it's the task of the management to gather the nodes whose devices could be live migrated to each other as something like "cluster" which we've already used in the case of cpuflags.
1) during node bootstrap, the capability of each node and devices was reported to management layer
2) management layer decide the cluster and make sure the migration can only done among the nodes insides the cluster
3) before migration, the vDPA needs to be provisioned on the destinationQuoted 11 lines
Quoted 4 lines
2) vdpa dev config show can show both device features and driver features, there just need a patch for iproute2
3) To process information like MQ, we don't just dump the config space, MST has explained beforeSo, it's for live migration... Then why not export those config parameters specified for vdpa creation (as well as device feature bits) to the output of "vdpa dev show" command? That's where device side config lives and is static across vdpa's life cycle. "vdpa dev config show" is mostly for dynamic driver side config, and the validity is subject to feature negotiation. I suppose this should suit your need of LM, e.g.
I think so.
Quoted 8 lines
$ vdpa dev add name vdpa1 mgmtdev pci/0000:41:04.2 max_vqp 7 mtu 2000 $ vdpa dev show vdpa1 vdpa1: type network mgmtdev pci/0000:41:04.2 vendor_id 5555 max_vqs 15 max_vq_size 256 max_vqp 7 mtu 2000 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 RING_PACKEDQuoted 3 lines
Quoted 2 lines
Note that the mgmt should know this destination have those capability/features before the provisioning.
Yes, mgmt software should have to check the above from source.
On destination mgmt software can run below to check vdpa mgmtdev's capability/features:
Quoted 6 lines
$ vdpa mgmtdev show pci/0000:41:04.3 pci/0000:41:04.3: supported_classes net max_supported_vqs 257 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 RING_PACKED
Right and this is probably better to be done at node bootstrapping for the management to know about the cluster.
Thanks
Quoted 179 lines
Quoted 179 lines
Quoted 179 lines
Quoted 11 lines
For it to work, you'd want to pass "struct
vdpa_dev_set_config" to_vdpa_register_device()during registration, and get it saved there in "structvdpa_device". Then invdpa_dev_fill()show each field conditionally subject to "struct vdpa_dev_set_config.mask".Thanks,
-SiweiThanks
Quoted 163 lines
Quoted 163 lines
Thanks
Zhu LingshanQuoted 59 lines
Quoted 55 lines
Quoted 43 lines
Quoted 10 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered
before accessing that part of the configuration space.and how many driver bugs taking wrong assumption of the validity of config space field without
features_ok. I am not sure what use case you want to expose config resister values for beforefeatures_ok, if it's mostly for live migration I guess it's probably heading a wrong direction.Quoted 20 lines
Quoted 10 lines
Last but not the least, this "vdpa dev config" command was not designed to display the real config space register values in the first place. Quoting the vdpa-dev(8) man page:
Quoted 4 lines
vdpa dev config show - Show configuration of specific device or all devices.
DEV - specifies the vdpa device to show its configuration. If this argument is omitted all devices configuration is listed.Quoted 10 lines
It doesn't say anything about configuration space or register values in config space. As long as it can convey the config attribute when instantiating vDPA device instance, and more importantly, the config can be easily imported from or exported to userspace tools when trying to reconstruct vdpa instance intact on destination host for live migration, IMHO in my personal interpretation it doesn't matter what the config space may present. It may be worth while adding a new debug command to expose the real register value, but that's another story.
Quoted 5 lines
I am not sure getting your points. vDPA now reports device feature
bits(device_features)and negotiated featurebits(driver_features), and yes, the drivers features can be a subset of the device features; and the vDPA device features can be a subset of the management device features.Quoted 12 lines
What I said is after unblocking the conditional check, you'd have to handle the case for each of the vdpa attribute when feature negotiation is not yet done: basically the register values you got from config space via the
vdpa_get_config_unlocked()call is not considered to be valid beforefeatures_ok(per-spec). Although in some case you may get sane value, such behavior is generally undefined. If you desire to show just thedevice_featuresalone without any config space field, which the device had advertised *before feature negotiation is complete*, that'll be fine. But looks to me this is not how patch has been implemented. Probably need some more work?Quoted 4 lines
They are
driver_features(negotiated)and thedevice_features(which comes with the device), and the config space fields that depend on them. In this series, we report both to the userspace.Quoted 6 lines
I fail to understand what you want to present from your description. May be worth showing some example outputs that at least include the following cases: 1) when device offers features but not yet acknowledge by guest 2) when guest acknowledged features and device is yet to accept 3) after guest feature negotiation is completed (agreed upon between guest and device).
Only two feature sets: 1) what the device has. (2) what is negotiated
Quoted 94 lines
Thanks,
-SiweiQuoted 91 lines
Quoted 91 lines
Regards,
-SiweiQuoted 87 lines
Quoted 4 lines
Having said, please consider to drop the Fixes tag, as appears to me you're proposing a new feature rather than fixing a real issue.
it's a new feature to report the device feature bits than only negotiated features, however this patch is a must, or it will block the device feature bits reporting. but I agree, the fix tag is not a must.
Quoted 79 lines
Thanks,
-SiweiQuoted 71 lines · Parav Pandit via Virtualization
Quoted 20 lines
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device, to choose a
appropriate one for a certain guest. This means the users need to read the
config space beforeFEATURES_OK, and the existence of config space
contents does not depend onFEATURES_OK.The spec says:
The device MUST allow reading of any device-specific configuration field
beforeFEATURES_OKis set by the driver. This includes fields which are
conditional on feature bits, as long as those feature bits are offered by the
device.Quoted 2 lines
Fixes 30ef7a8ac8a07 (vdpa: Read device configuration onlyif
FEATURES_OK)Fix is fine, but fixes tag needs correction described below.
Above commit id is 13 letters should be 12.
And
It should be in formatFixes 30ef7a8ac8a0 ("vdpa: Read device configuration only if
FEATURES_OK")Please use checkpatch.pl script before posting the patches to catch these errors.
There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.Quoted 28 lines
Signed-off-by Zhu Lingshan<[email protected]>--- drivers/vdpa/vdpa.c | 8 -------- 1 file changed, 8 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
9b0e39b2f022..d76b22b2f7ae100644drivers/vdpa/vdpa.c +0
-8@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, { u32 device_id;void *hdr; -u8 status;int err;down_read (&vdev->cf_lock); - status = vdev->config->get_status (vdev); -if (!(status &VIRTIO_CONFIG_S_FEATURES_OK )) { -NL_SET_ERR_MSG_MOD (extack,"Features negotiation not completed"); - err = -EAGAIN ; - goto out; - } - hdr = genlmsg_put(msg, portid, seq, &vdpa_nl_family,flags,
Quoted 4 lines
VDPA_CMD_DEV_CONFIG_GET); if (!hdr) {--
2.31.1_______________________________________________
Virtualization mailing list
[email protected]
https://urldefense.com/v3/__https://lists.linuxfoundation.org/mailman/listinfo/virtualization__;!!ACWV5N9M2RV99hQ!NzOv5Ew_Z2CP-zHyD7RsUoStLZ54KpB21QyuZ8L63YVPLEGDEwvcOSDlIGxQPHY-DMkOa9sKKZdBSaNknMU$
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 109 lines · Jason Wang
Quoted 108 lines · Si-Wei Liu
Quoted 99 lines · Si-Wei Liu
Quoted 97 lines · Jason Wang
Quoted 51 lines · Si-Wei Liu
Quoted 49 lines · Lingshan
Quoted 47 lines · Si-Wei Liu
Quoted 30 lines · Lingshan
Quoted 28 lines · Si-Wei Liu
Quoted 26 lines · Lingshan
Quoted 13 lines · Si-Wei Liu
Sorry to chime in late in the game. For some reason I couldn't get to most emails for this discussion (I only subscribed to the virtualization list), while I was taking off amongst the past few weeks.
It looks to me this patch is incomplete. Noted down the way in
vdpa_dev_net_config_fill(), we have the following:features = vdev->config->get_driver_features(vdev); if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features, VDPA_ATTR_PAD)) return -EMSGSIZE;Quoted 7 lines
Making call to .get_driver_features() doesn't make sense when feature negotiation isn't complete. Neither should present
negotiated_featuresto userspace before negotiation is done.Similarly,
max_vqpthroughvdpa_dev_net_mq_config_fill()probably should not show before negotiation is done - it depends on driver features negotiated.I have another patch in this series introduces
device_featuresand will reportdevice_featuresto the userspace even features negotiation not done. Because the spec says we should allow driver access the config space beforeFEATURES_OK.Quoted 6 lines
Quoted 3 lines
The config space can be accessed by guest before
features_okdoesn't necessarily mean the value is valid. You may want to double check with Michael for what he quoted earlier:that's why I proposed to fix these issues, e.g., if no
_F_MAC, vDPA kernel should not return a mac to the userspace, there is not a default value for mac.Then please show us the code, as I can only comment based on your latest (v4) patch and it was not there.. To be honest, I don't understand the motivation and the use cases you have, is it for debugging/monitoring or there's really a use case for live migration? For the former, you can do a direct dump on all config space fields regardless of endianess and feature negotiation without having to worry about validity (meaningful to present to admin user). To me these are conflict asks that is impossible to mix in exact one command.
Quoted 6 lines
Quoted 6 lines
This bug just has been revealed two days, and you will see the patch soon.
There are something to clarify:
1) we need to read the device features, or how can you pick a proper LM destinationSo it's probably not very efficient to use this, the manager layer should have the knowledge about the compatibility before doing migration other than try-and-fail.
And it's the task of the management to gather the nodes whose devices could be live migrated to each other as something like "cluster" which we've already used in the case of cpuflags.
1) during node bootstrap, the capability of each node and devices was reported to management layer
2) management layer decide the cluster and make sure the migration can only done among the nodes insides the cluster
3) before migration, the vDPA needs to be provisioned on the destinationQuoted 11 lines
Quoted 4 lines
2) vdpa dev config show can show both device features and driver features, there just need a patch for iproute2
3) To process information like MQ, we don't just dump the config space, MST has explained beforeSo, it's for live migration... Then why not export those config parameters specified for vdpa creation (as well as device feature bits) to the output of "vdpa dev show" command? That's where device side config lives and is static across vdpa's life cycle. "vdpa dev config show" is mostly for dynamic driver side config, and the validity is subject to feature negotiation. I suppose this should suit your need of LM, e.g.
I think so.
Quoted 7 lines
$ vdpa dev add name vdpa1 mgmtdev pci/0000:41:04.2 max_vqp 7 mtu 2000 $ vdpa dev show vdpa1 vdpa1: type network mgmtdev pci/0000:41:04.2 vendor_id 5555 max_vqs 15 max_vq_size 256 max_vqp 7 mtu 2000 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 RING_PACKEDQuoted 3 lines
Quoted 2 lines
Note that the mgmt should know this destination have those capability/features before the provisioning.
Yes, mgmt software should have to check the above from source.
On destination mgmt software can run below to check vdpa mgmtdev's capability/features:
Quoted 8 lines
Quoted 6 lines
$ vdpa mgmtdev show pci/0000:41:04.3 pci/0000:41:04.3: supported_classes net max_supported_vqs 257 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 RING_PACKEDRight and this is probably better to be done at node bootstrapping for the management to know about the cluster.
Exactly. That's what mgmt software is supposed to do typically.
Thanks,
-Siwei
Quoted 169 lines
Thanks
Quoted 166 lines
Quoted 166 lines
Quoted 166 lines
Quoted 8 lines
For it to work, you'd want to pass "struct
vdpa_dev_set_config" to_vdpa_register_device()during registration, and get it saved there in "structvdpa_device". Then invdpa_dev_fill()show each field conditionally subject to "struct vdpa_dev_set_config.mask".Thanks,
-SiweiThanks
Quoted 154 lines
Quoted 154 lines
Thanks
Zhu LingshanQuoted 56 lines
Quoted 52 lines
Quoted 40 lines
Quoted 9 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered
before accessing that part of the configuration space.and how many driver bugs taking wrong assumption of the validity of config space field without
features_ok. I am not sure what use case you want to expose config resister values for beforefeatures_ok, if it's mostly for live migration I guess it's probably heading a wrong direction.Quoted 19 lines
Quoted 9 lines
Last but not the least, this "vdpa dev config" command was not designed to display the real config space register values in the first place. Quoting the vdpa-dev(8) man page:
Quoted 4 lines
vdpa dev config show - Show configuration of specific device or all devices.
DEV - specifies the vdpa device to show its configuration. If this argument is omitted all devices configuration is listed.Quoted 10 lines
It doesn't say anything about configuration space or register values in config space. As long as it can convey the config attribute when instantiating vDPA device instance, and more importantly, the config can be easily imported from or exported to userspace tools when trying to reconstruct vdpa instance intact on destination host for live migration, IMHO in my personal interpretation it doesn't matter what the config space may present. It may be worth while adding a new debug command to expose the real register value, but that's another story.
Quoted 5 lines
I am not sure getting your points. vDPA now reports device feature
bits(device_features)and negotiated featurebits(driver_features), and yes, the drivers features can be a subset of the device features; and the vDPA device features can be a subset of the management device features.Quoted 12 lines
What I said is after unblocking the conditional check, you'd have to handle the case for each of the vdpa attribute when feature negotiation is not yet done: basically the register values you got from config space via the
vdpa_get_config_unlocked()call is not considered to be valid beforefeatures_ok(per-spec). Although in some case you may get sane value, such behavior is generally undefined. If you desire to show just thedevice_featuresalone without any config space field, which the device had advertised *before feature negotiation is complete*, that'll be fine. But looks to me this is not how patch has been implemented. Probably need some more work?Quoted 4 lines
They are
driver_features(negotiated)and thedevice_features(which comes with the device), and the config space fields that depend on them. In this series, we report both to the userspace.Quoted 6 lines
I fail to understand what you want to present from your description. May be worth showing some example outputs that at least include the following cases: 1) when device offers features but not yet acknowledge by guest 2) when guest acknowledged features and device is yet to accept 3) after guest feature negotiation is completed (agreed upon between guest and device).
Only two feature sets: 1) what the device has. (2) what is negotiated
Quoted 89 lines
Thanks,
-SiweiQuoted 87 lines
Quoted 87 lines
Regards,
-SiweiQuoted 84 lines
Quoted 3 lines
Having said, please consider to drop the Fixes tag, as appears to me you're proposing a new feature rather than fixing a real issue.
it's a new feature to report the device feature bits than only negotiated features, however this patch is a must, or it will block the device feature bits reporting. but I agree, the fix tag is not a must.
Quoted 77 lines
Thanks,
-SiweiQuoted 71 lines · Parav Pandit via Virtualization
Quoted 22 lines
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device,
to choose a
appropriate one for a certain guest. This means the users
need to read the
config space before FEATURES_OK, and the existence of config
space
contents does not depend on FEATURES_OK.The spec says:
The device MUST allow reading of any device-specific
configuration field
before FEATURES_OK is set by the driver. This includes
fields which are
conditional on feature bits, as long as those feature bits
are offered by the
device.Fixes: 30ef7a8ac8a07 (vdpa: Read device configuration only
if FEATURES_OK)Fix is fine, but fixes tag needs correction described below.
Above commit id is 13 letters should be 12.
And
It should be in formatFixes 30ef7a8ac8a0 ("vdpa: Read device configuration only if
FEATURES_OK")Please use checkpatch.pl script before posting the patches to catch these errors.
There is a bot that looks at the fixes tag and identifies the right kernel version to apply this fix.Quoted 32 lines
Signed-off-by: Zhu Lingshan<[email protected]>
---
drivers/vdpa/vdpa.c | 8 --------
1 file changed, 8 deletions(-)diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c index
9b0e39b2f022..d76b22b2f7ae 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device
*vdev,
struct sk_buff *msg, u32 portid, {
u32 device_id;
void *hdr;
- u8 status;
int err;down_read(&vdev->cf_lock);
- status = vdev->config->get_status(vdev);
- if (!(status & VIRTIO_CONFIG_S_FEATURES_OK)) {
- NL_SET_ERR_MSG_MOD(extack, "Features negotiation not
completed");
- err = -EAGAIN;
- goto out;
- }
-
hdr = genlmsg_put(msg, portid, seq, &vdpa_nl_family,
flags,
VDPA_CMD_DEV_CONFIG_GET);
if (!hdr) {
--
2.31.1_______________________________________________
Virtualization mailing list
[email protected]
https://urldefense.com/v3/__https://lists.linuxfoundation.org/mailman/listinfo/virtualization__;!!ACWV5N9M2RV99hQ!NzOv5Ew_Z2CP-zHyD7RsUoStLZ54KpB21QyuZ8L63YVPLEGDEwvcOSDlIGxQPHY-DMkOa9sKKZdBSaNknMU$
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 118 lines · Si-Wei Liu
Quoted 115 lines · Jason Wang
Quoted 114 lines · Si-Wei Liu
Quoted 99 lines · Si-Wei Liu
Quoted 97 lines · Jason Wang
Quoted 51 lines · Si-Wei Liu
Quoted 49 lines · Lingshan
Quoted 47 lines · Si-Wei Liu
Quoted 30 lines · Lingshan
Quoted 28 lines · Si-Wei Liu
Quoted 26 lines · Lingshan
Quoted 13 lines · Si-Wei Liu
Sorry to chime in late in the game. For some reason I couldn't get to most emails for this discussion (I only subscribed to the virtualization list), while I was taking off amongst the past few weeks.
It looks to me this patch is incomplete. Noted down the way in
vdpa_dev_net_config_fill(), we have the following:
features =vdev->config->get_driver_features(vdev); if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features, VDPA_ATTR_PAD))
return-EMSGSIZE;Quoted 7 lines
Making call to .get_driver_features() doesn't make sense when feature negotiation isn't complete. Neither should present
negotiated_featuresto userspace before negotiation is done.Similarly,
max_vqpthroughvdpa_dev_net_mq_config_fill()probably should not show before negotiation is done - it depends on driver features negotiated.I have another patch in this series introduces
device_featuresand will reportdevice_featuresto the userspace even features negotiation not done. Because the spec says we should allow driver access the config space beforeFEATURES_OK.Quoted 6 lines
Quoted 3 lines
The config space can be accessed by guest before
features_okdoesn't necessarily mean the value is valid. You may want to double check with Michael for what he quoted earlier:that's why I proposed to fix these issues, e.g., if no
_F_MAC, vDPA kernel should not return a mac to the userspace, there is not a default value for mac.Then please show us the code, as I can only comment based on your latest (v4) patch and it was not there.. To be honest, I don't understand the motivation and the use cases you have, is it for debugging/monitoring or there's really a use case for live migration? For the former, you can do a direct dump on all config space fields regardless of endianess and feature negotiation without having to worry about validity (meaningful to present to admin user). To me these are conflict asks that is impossible to mix in exact one command.
Quoted 6 lines
Quoted 6 lines
This bug just has been revealed two days, and you will see the patch soon.
There are something to clarify:
1) we need to read the device features, or how can you pick a proper LM destinationSo it's probably not very efficient to use this, the manager layer should have the knowledge about the compatibility before doing migration other than try-and-fail.
And it's the task of the management to gather the nodes whose devices could be live migrated to each other as something like "cluster" which we've already used in the case of cpuflags.
1) during node bootstrap, the capability of each node and devices was reported to management layer
2) management layer decide the cluster and make sure the migration can only done among the nodes insides the cluster
3) before migration, the vDPA needs to be provisioned on the destinationQuoted 11 lines
Quoted 4 lines
2) vdpa dev config show can show both device features and driver features, there just need a patch for iproute2
3) To process information like MQ, we don't just dump the config space, MST has explained beforeSo, it's for live migration... Then why not export those config parameters specified for vdpa creation (as well as device feature bits) to the output of "vdpa dev show" command? That's where device side config lives and is static across vdpa's life cycle. "vdpa dev config show" is mostly for dynamic driver side config, and the validity is subject to feature negotiation. I suppose this should suit your need of LM, e.g.
I think so.
Quoted 7 lines
$ vdpa dev add name vdpa1 mgmtdev pci/0000:41:04.2 max_vqp 7 mtu 2000 $ vdpa dev show vdpa1 vdpa1: type network mgmtdev pci/0000:41:04.2 vendor_id 5555 max_vqs 15 max_vq_size 256 max_vqp 7 mtu 2000 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 RING_PACKEDQuoted 3 lines
Quoted 2 lines
Note that the mgmt should know this destination have those capability/features before the provisioning.
Yes, mgmt software should have to check the above from source.
On destination mgmt software can run below to check vdpa mgmtdev's capability/features:
$ vdpa mgmtdev show pci/0000:41:04.3 pci/0000:41:04.3: supported_classes net max_supported_vqs 257 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 RING_PACKED
Quoted 3 lines
Quoted 2 lines
Right and this is probably better to be done at node bootstrapping for the management to know about the cluster.
Exactly. That's what mgmt software is supposed to do typically.
I think this could apply to both mgmt devices and vDPA devices:
1)mgmt device, see whether the mgmt device is capable to create a vDPA device with a certain feature bits, this is for LM 2)vDPA device, report the device features, it is for normal operation
Thanks,
Zhu Lingshan
Quoted 176 lines
Thanks,
-SiweiQuoted 171 lines
Thanks
Quoted 168 lines
Quoted 168 lines
Quoted 168 lines
Quoted 8 lines
For it to work, you'd want to pass "struct
vdpa_dev_set_config" to_vdpa_register_device()during registration, and get it saved there in "structvdpa_device". Then invdpa_dev_fill()show each field conditionally subject to "struct vdpa_dev_set_config.mask".Thanks,
-SiweiThanks
Quoted 156 lines
Quoted 156 lines
Thanks
Zhu LingshanQuoted 56 lines
Quoted 52 lines
Quoted 40 lines
Quoted 9 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered
before accessing that part of the configuration space.and how many driver bugs taking wrong assumption of the validity of config space field without
features_ok. I am not sure what use case you want to expose config resister values for beforefeatures_ok, if it's mostly for live migration I guess it's probably heading a wrong direction.Quoted 19 lines
Quoted 9 lines
Last but not the least, this "vdpa dev config" command was not designed to display the real config space register values in the first place. Quoting the vdpa-dev(8) man page:
Quoted 4 lines
vdpa dev config show - Show configuration of specific device
or all devices.
DEV - specifies the vdpa device to show its configuration. If
this argument is omitted all devices configuration is listed.Quoted 10 lines
It doesn't say anything about configuration space or register values in config space. As long as it can convey the config attribute when instantiating vDPA device instance, and more importantly, the config can be easily imported from or exported to userspace tools when trying to reconstruct vdpa instance intact on destination host for live migration, IMHO in my personal interpretation it doesn't matter what the config space may present. It may be worth while adding a new debug command to expose the real register value, but that's another story.
Quoted 5 lines
I am not sure getting your points. vDPA now reports device feature
bits(device_features)and negotiated featurebits(driver_features), and yes, the drivers features can be a subset of the device features; and the vDPA device features can be a subset of the management device features.Quoted 12 lines
What I said is after unblocking the conditional check, you'd have to handle the case for each of the vdpa attribute when feature negotiation is not yet done: basically the register values you got from config space via the
vdpa_get_config_unlocked()call is not considered to be valid beforefeatures_ok(per-spec). Although in some case you may get sane value, such behavior is generally undefined. If you desire to show just thedevice_featuresalone without any config space field, which the device had advertised *before feature negotiation is complete*, that'll be fine. But looks to me this is not how patch has been implemented. Probably need some more work?Quoted 4 lines
They are
driver_features(negotiated)and thedevice_features(which comes with the device), and the config space fields that depend on them. In this series, we report both to the userspace.Quoted 6 lines
I fail to understand what you want to present from your description. May be worth showing some example outputs that at least include the following cases: 1) when device offers features but not yet acknowledge by guest 2) when guest acknowledged features and device is yet to accept 3) after guest feature negotiation is completed (agreed upon between guest and device).
Only two feature sets: 1) what the device has. (2) what is negotiated
Quoted 91 lines
Thanks,
-SiweiQuoted 89 lines
Quoted 89 lines
Regards,
-SiweiQuoted 86 lines
Quoted 3 lines
Having said, please consider to drop the Fixes tag, as appears to me you're proposing a new feature rather than fixing a real issue.
it's a new feature to report the device feature bits than only negotiated features, however this patch is a must, or it will block the device feature bits reporting. but I agree, the fix tag is not a must.
Quoted 79 lines
Thanks,
-SiweiQuoted 73 lines · Parav Pandit via Virtualization
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device,
to choose a
appropriate one for a certain guest. This means the users
need to read the
config space before FEATURES_OK, and the existence of config
space
contents does not depend on FEATURES_OK.The spec says:
The device MUST allow reading of any device-specific
configuration field
before FEATURES_OK is set by the driver. This includes
fields which are
conditional on feature bits, as long as those feature bits
are offered by the
device.Fixes: 30ef7a8ac8a07 (vdpa: Read device configuration only
if FEATURES_OK)
Fix is fine, but fixes tag needs correction described below.Above commit id is 13 letters should be 12.
And
It should be in format
Fixes: 30ef7a8ac8a0 ("vdpa: Read device configuration only if
FEATURES_OK")Please use checkpatch.pl script before posting the patches to
catch these errors.
There is a bot that looks at the fixes tag and identifies the
right kernel version to apply this fix.Signed-off-by: Zhu Lingshan<[email protected]>
---
drivers/vdpa/vdpa.c | 8 --------
1 file changed, 8 deletions(-)diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c index
9b0e39b2f022..d76b22b2f7ae 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct vdpa_device
*vdev,
struct sk_buff *msg, u32 portid, {
u32 device_id;
void *hdr;
- u8 status;
int err;down_read(&vdev->cf_lock);
- status = vdev->config->get_status(vdev);
- if (!(status & VIRTIO_CONFIG_S_FEATURES_OK)) {
- NL_SET_ERR_MSG_MOD(extack, "Features negotiation
not
completed");
- err = -EAGAIN;
- goto out;
- }
-
hdr = genlmsg_put(msg, portid, seq, &vdpa_nl_family,
flags,
VDPA_CMD_DEV_CONFIG_GET);
if (!hdr) {
--
2.31.1
_______________________________________________
Virtualization mailing list
[email protected]
https://urldefense.com/v3/__https://lists.linuxfoundation.org/mailman/listinfo/virtualization__;!!ACWV5N9M2RV99hQ!NzOv5Ew_Z2CP-zHyD7RsUoStLZ54KpB21QyuZ8L63YVPLEGDEwvcOSDlIGxQPHY-DMkOa9sKKZdBSaNknMU$
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 121 lines · Lingshan
Quoted 118 lines · Si-Wei Liu
Quoted 115 lines · Jason Wang
Quoted 114 lines · Si-Wei Liu
Quoted 99 lines · Si-Wei Liu
Quoted 97 lines · Jason Wang
Quoted 51 lines · Si-Wei Liu
Quoted 49 lines · Lingshan
Quoted 47 lines · Si-Wei Liu
Quoted 30 lines · Lingshan
Quoted 28 lines · Si-Wei Liu
Quoted 26 lines · Lingshan
Quoted 20 lines · Si-Wei Liu
Sorry to chime in late in the game. For some reason I couldn't
get to most emails for this discussion (I only subscribed to
the virtualization list), while I was taking off amongst the
past few weeks.It looks to me this patch is incomplete. Noted down the way in
vdpa_dev_net_config_fill(), we have the following:
features = vdev->config->get_driver_features(vdev);
if (nla_put_u64_64bit(msg,
VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features,
VDPA_ATTR_PAD))
return -EMSGSIZE;Making call to .get_driver_features() doesn't make sense when
feature negotiation isn't complete. Neither should present
negotiated_features to userspace before negotiation is done.Similarly, max_vqp through vdpa_dev_net_mq_config_fill()
probably should not show before negotiation is done - it
depends on driver features negotiated.I have another patch in this series introduces
device_featuresand will reportdevice_featuresto the userspace even features negotiation not done. Because the spec says we should allow driver access the config space beforeFEATURES_OK.Quoted 6 lines
Quoted 3 lines
The config space can be accessed by guest before
features_okdoesn't necessarily mean the value is valid. You may want to double check with Michael for what he quoted earlier:that's why I proposed to fix these issues, e.g., if no
_F_MAC, vDPA kernel should not return a mac to the userspace, there is not a default value for mac.Then please show us the code, as I can only comment based on your latest (v4) patch and it was not there.. To be honest, I don't understand the motivation and the use cases you have, is it for debugging/monitoring or there's really a use case for live migration? For the former, you can do a direct dump on all config space fields regardless of endianess and feature negotiation without having to worry about validity (meaningful to present to admin user). To me these are conflict asks that is impossible to mix in exact one command.
Quoted 6 lines
Quoted 6 lines
This bug just has been revealed two days, and you will see the patch soon.
There are something to clarify:
1) we need to read the device features, or how can you pick a proper LM destinationSo it's probably not very efficient to use this, the manager layer should have the knowledge about the compatibility before doing migration other than try-and-fail.
And it's the task of the management to gather the nodes whose devices could be live migrated to each other as something like "cluster" which we've already used in the case of cpuflags.
1) during node bootstrap, the capability of each node and devices was reported to management layer
2) management layer decide the cluster and make sure the migration can only done among the nodes insides the cluster
3) before migration, the vDPA needs to be provisioned on the destinationQuoted 11 lines
Quoted 4 lines
2) vdpa dev config show can show both device features and driver features, there just need a patch for iproute2
3) To process information like MQ, we don't just dump the config space, MST has explained beforeSo, it's for live migration... Then why not export those config parameters specified for vdpa creation (as well as device feature bits) to the output of "vdpa dev show" command? That's where device side config lives and is static across vdpa's life cycle. "vdpa dev config show" is mostly for dynamic driver side config, and the validity is subject to feature negotiation. I suppose this should suit your need of LM, e.g.
I think so.
Quoted 7 lines
$ vdpa dev add name vdpa1 mgmtdev pci/0000:41:04.2 max_vqp 7 mtu 2000 $ vdpa dev show vdpa1 vdpa1: type network mgmtdev pci/0000:41:04.2 vendor_id 5555 max_vqs 15 max_vq_size 256 max_vqp 7 mtu 2000 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 RING_PACKEDQuoted 3 lines
Quoted 2 lines
Note that the mgmt should know this destination have those capability/features before the provisioning.
Yes, mgmt software should have to check the above from source.
On destination mgmt software can run below to check vdpa mgmtdev's capability/features:
$ vdpa mgmtdev show pci/0000:41:04.3 pci/0000:41:04.3: supported_classes net max_supported_vqs 257 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 RING_PACKED
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
Right and this is probably better to be done at node bootstrapping for the management to know about the cluster.
Exactly. That's what mgmt software is supposed to do typically.
I think this could apply to both mgmt devices and vDPA devices:
1)mgmt device, see whether the mgmt device is capable to create a vDPA device with a certain feature bits, this is for LM 2)vDPA device, report the device features, it is for normal operation
Can you elaborate the use case "for normal operations"? Then it has nothing to do with LM for sure, correct?
Noted for the LM case, just as Jason indicated, it's not even *required* for the mgmt software to gather the device features through "vdpa dev show" on source host *alive* right before live migration is started. Depending on the way how it is implemented, the mgmt software can well collect device capability on boot strap time, or may well save the vdpa device capability/config in persistent store ahead of time, say before any VM is to be launched. Then with all such info collected for each cluster node, mgmt software is able to get its own way to infer and sort out the live migration compatibility between nodes. I'm not sure which case you would need to check the device features, but in case you need it, it'd be better live in "vdpa dev show" than "vdpa dev config show".
Thanks,
-Siwei
Quoted 181 lines
Thanks,
Zhu LingshanQuoted 177 lines
Thanks,
-SiweiQuoted 172 lines
Thanks
Quoted 169 lines
Quoted 169 lines
Quoted 169 lines
Quoted 8 lines
For it to work, you'd want to pass "struct
vdpa_dev_set_config" to_vdpa_register_device()during registration, and get it saved there in "structvdpa_device". Then invdpa_dev_fill()show each field conditionally subject to "struct vdpa_dev_set_config.mask".Thanks,
-SiweiThanks
Quoted 157 lines
Quoted 157 lines
Thanks
Zhu LingshanQuoted 56 lines
Quoted 52 lines
Quoted 40 lines
Quoted 9 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered
before accessing that part of the configuration space.and how many driver bugs taking wrong assumption of the validity of config space field without
features_ok. I am not sure what use case you want to expose config resister values for beforefeatures_ok, if it's mostly for live migration I guess it's probably heading a wrong direction.Quoted 19 lines
Quoted 19 lines
Last but not the least, this "vdpa dev config" command was not
designed to display the real config space register values in
the first place. Quoting the vdpa-dev(8) man page:vdpa dev config show - Show configuration of specific device
or all devices.
DEV - specifies the vdpa device to show its configuration. If
this argument is omitted all devices configuration is listed.
It doesn't say anything about configuration space or register
values in config space. As long as it can convey the config
attribute when instantiating vDPA device instance, and more
importantly, the config can be easily imported from or
exported to userspace tools when trying to reconstruct vdpa
instance intact on destination host for live migration, IMHO
in my personal interpretation it doesn't matter what the
config space may present. It may be worth while adding a new
debug command to expose the real register value, but that's
another story.Quoted 5 lines
I am not sure getting your points. vDPA now reports device feature
bits(device_features)and negotiated featurebits(driver_features), and yes, the drivers features can be a subset of the device features; and the vDPA device features can be a subset of the management device features.Quoted 12 lines
What I said is after unblocking the conditional check, you'd have to handle the case for each of the vdpa attribute when feature negotiation is not yet done: basically the register values you got from config space via the
vdpa_get_config_unlocked()call is not considered to be valid beforefeatures_ok(per-spec). Although in some case you may get sane value, such behavior is generally undefined. If you desire to show just thedevice_featuresalone without any config space field, which the device had advertised *before feature negotiation is complete*, that'll be fine. But looks to me this is not how patch has been implemented. Probably need some more work?Quoted 4 lines
They are
driver_features(negotiated)and thedevice_features(which comes with the device), and the config space fields that depend on them. In this series, we report both to the userspace.Quoted 6 lines
I fail to understand what you want to present from your description. May be worth showing some example outputs that at least include the following cases: 1) when device offers features but not yet acknowledge by guest 2) when guest acknowledged features and device is yet to accept 3) after guest feature negotiation is completed (agreed upon between guest and device).
Only two feature sets: 1) what the device has. (2) what is negotiated
Quoted 92 lines
Thanks,
-SiweiQuoted 90 lines
Quoted 90 lines
Regards,
-SiweiQuoted 87 lines
Quoted 3 lines
Having said, please consider to drop the Fixes tag, as appears
to me you're proposing a new feature rather than fixing a real
issue.it's a new feature to report the device feature bits than only negotiated features, however this patch is a must, or it will block the device feature bits reporting. but I agree, the fix tag is not a must.
Quoted 80 lines
Thanks,
-SiweiOn 7/1/2022 3:12 PM, Parav Pandit via Virtualization wrote:
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device,
to choose a
appropriate one for a certain guest. This means the users
need to read the
config space before FEATURES_OK, and the existence of config
space
contents does not depend on FEATURES_OK.The spec says:
The device MUST allow reading of any device-specific
configuration field
before FEATURES_OK is set by the driver. This includes
fields which are
conditional on feature bits, as long as those feature bits
are offered by the
device.Fixes: 30ef7a8ac8a07 (vdpa: Read device configuration only
if FEATURES_OK)
Fix is fine, but fixes tag needs correction described below.Above commit id is 13 letters should be 12.
And
It should be in format
Fixes: 30ef7a8ac8a0 ("vdpa: Read device configuration only if
FEATURES_OK")Please use checkpatch.pl script before posting the patches to
catch these errors.
There is a bot that looks at the fixes tag and identifies the
right kernel version to apply this fix.Signed-off-by: Zhu Lingshan<[email protected]>
---
drivers/vdpa/vdpa.c | 8 --------
1 file changed, 8 deletions(-)diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c index
9b0e39b2f022..d76b22b2f7ae 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct
vdpa_device
*vdev,
struct sk_buff *msg, u32 portid, {
u32 device_id;
void *hdr;
- u8 status;
int err;down_read(&vdev->cf_lock);
- status = vdev->config->get_status(vdev);
- if (!(status & VIRTIO_CONFIG_S_FEATURES_OK)) {
- NL_SET_ERR_MSG_MOD(extack, "Features
negotiation not
completed");
- err = -EAGAIN;
- goto out;
- }
-
hdr = genlmsg_put(msg, portid, seq, &vdpa_nl_family,
flags,
VDPA_CMD_DEV_CONFIG_GET);
if (!hdr) {
--
2.31.1
_______________________________________________
Virtualization mailing list
[email protected]
https://urldefense.com/v3/__https://lists.linuxfoundation.org/mailman/listinfo/virtualization__;!!ACWV5N9M2RV99hQ!NzOv5Ew_Z2CP-zHyD7RsUoStLZ54KpB21QyuZ8L63YVPLEGDEwvcOSDlIGxQPHY-DMkOa9sKKZdBSaNknMU$
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
Quoted 124 lines · Si-Wei Liu
Quoted 121 lines · Lingshan
Quoted 118 lines · Si-Wei Liu
Quoted 115 lines · Jason Wang
Quoted 114 lines · Si-Wei Liu
Quoted 99 lines · Si-Wei Liu
Quoted 97 lines · Jason Wang
Quoted 51 lines · Si-Wei Liu
Quoted 49 lines · Lingshan
Quoted 47 lines · Si-Wei Liu
Quoted 30 lines · Lingshan
Quoted 28 lines · Si-Wei Liu
Quoted 26 lines · Lingshan
On 7/27/2022 5:43 PM, Si-Wei Liu wrote:
Sorry to chime in late in the game. For some reason I couldn't
get to most emails for this discussion (I only subscribed to
the virtualization list), while I was taking off amongst the
past few weeks.It looks to me this patch is incomplete. Noted down the way in
vdpa_dev_net_config_fill(), we have the following:
features = vdev->config->get_driver_features(vdev);
if (nla_put_u64_64bit(msg,
VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features,
VDPA_ATTR_PAD))
return -EMSGSIZE;Making call to .get_driver_features() doesn't make sense when
feature negotiation isn't complete. Neither should present
negotiated_features to userspace before negotiation is done.Similarly, max_vqp through vdpa_dev_net_mq_config_fill()
probably should not show before negotiation is done - it
depends on driver features negotiated.
I have another patch in this series introduces device_features
and will report device_features to the userspace even features
negotiation not done. Because the spec says we should allow
driver access the config space before FEATURES_OK.Quoted 6 lines
Quoted 3 lines
The config space can be accessed by guest before
features_okdoesn't necessarily mean the value is valid. You may want to double check with Michael for what he quoted earlier:that's why I proposed to fix these issues, e.g., if no
_F_MAC, vDPA kernel should not return a mac to the userspace, there is not a default value for mac.Then please show us the code, as I can only comment based on your latest (v4) patch and it was not there.. To be honest, I don't understand the motivation and the use cases you have, is it for debugging/monitoring or there's really a use case for live migration? For the former, you can do a direct dump on all config space fields regardless of endianess and feature negotiation without having to worry about validity (meaningful to present to admin user). To me these are conflict asks that is impossible to mix in exact one command.
Quoted 6 lines
Quoted 6 lines
This bug just has been revealed two days, and you will see the patch soon.
There are something to clarify:
1) we need to read the device features, or how can you pick a proper LM destinationSo it's probably not very efficient to use this, the manager layer should have the knowledge about the compatibility before doing migration other than try-and-fail.
And it's the task of the management to gather the nodes whose devices could be live migrated to each other as something like "cluster" which we've already used in the case of cpuflags.
1) during node bootstrap, the capability of each node and devices was reported to management layer
2) management layer decide the cluster and make sure the migration can only done among the nodes insides the cluster
3) before migration, the vDPA needs to be provisioned on the destinationQuoted 11 lines
Quoted 4 lines
2) vdpa dev config show can show both device features and driver features, there just need a patch for iproute2
3) To process information like MQ, we don't just dump the config space, MST has explained beforeSo, it's for live migration... Then why not export those config parameters specified for vdpa creation (as well as device feature bits) to the output of "vdpa dev show" command? That's where device side config lives and is static across vdpa's life cycle. "vdpa dev config show" is mostly for dynamic driver side config, and the validity is subject to feature negotiation. I suppose this should suit your need of LM, e.g.
I think so.
Quoted 7 lines
$ vdpa dev add name vdpa1 mgmtdev pci/0000:41:04.2 max_vqp 7 mtu 2000 $ vdpa dev show vdpa1 vdpa1: type network mgmtdev pci/0000:41:04.2 vendor_id 5555 max_vqs 15 max_vq_size 256 max_vqp 7 mtu 2000 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 RING_PACKEDQuoted 3 lines
Quoted 2 lines
Note that the mgmt should know this destination have those capability/features before the provisioning.
Yes, mgmt software should have to check the above from source.
On destination mgmt software can run below to check vdpa mgmtdev's capability/features:
$ vdpa mgmtdev show pci/0000:41:04.3 pci/0000:41:04.3: supported_classes net max_supported_vqs 257 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 RING_PACKED
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
Right and this is probably better to be done at node bootstrapping for the management to know about the cluster.
Exactly. That's what mgmt software is supposed to do typically.
I think this could apply to both mgmt devices and vDPA devices:
1)mgmt device, see whether the mgmt device is capable to create a vDPA device with a certain feature bits, this is for LM 2)vDPA device, report the device features, it is for normal operationCan you elaborate the use case "for normal operations"? Then it has nothing to do with LM for sure, correct?
like when you just want to check the features to pick a proper device
Quoted 2 lines
Noted for the LM case, just as Jason indicated, it's not even *required* for the mgmt software to gather the device features through "vdpa dev show" on source host *alive* right before live migration is started. Depending on the way how it is implemented, the mgmt software can well collect device capability on boot strap time, or may well save the vdpa device capability/config in persistent store ahead of time, say before any VM is to be launched. Then with all such info collected for each cluster node, mgmt software is able to get its own way to infer and sort out the live migration compatibility between nodes. I'm not sure which case you would need to check the device features, but in case you need it, it'd be better live in "vdpa dev show" than "vdpa dev config show".
it not only for LM
Quoted 185 lines
Thanks,
-SiweiQuoted 180 lines
Thanks,
Zhu LingshanQuoted 176 lines
Thanks,
-SiweiQuoted 171 lines
Thanks
Quoted 168 lines
Quoted 168 lines
Quoted 168 lines
Quoted 8 lines
For it to work, you'd want to pass "struct
vdpa_dev_set_config" to_vdpa_register_device()during registration, and get it saved there in "structvdpa_device". Then invdpa_dev_fill()show each field conditionally subject to "struct vdpa_dev_set_config.mask".Thanks,
-SiweiThanks
Quoted 156 lines
Quoted 156 lines
Thanks
Zhu LingshanQuoted 56 lines
Quoted 52 lines
Quoted 40 lines
Quoted 9 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check
that the corresponding feature is offered
before accessing that part of the configuration space.and how many driver bugs taking wrong assumption of the validity of config space field without
features_ok. I am not sure what use case you want to expose config resister values for beforefeatures_ok, if it's mostly for live migration I guess it's probably heading a wrong direction.Quoted 24 lines
Last but not the least, this "vdpa dev config" command was not
designed to display the real config space register values in
the first place. Quoting the vdpa-dev(8) man page:vdpa dev config show - Show configuration of specific device
or all devices.
DEV - specifies the vdpa device to show its configuration. If
this argument is omitted all devices configuration is listed.
It doesn't say anything about configuration space or register
values in config space. As long as it can convey the config
attribute when instantiating vDPA device instance, and more
importantly, the config can be easily imported from or
exported to userspace tools when trying to reconstruct vdpa
instance intact on destination host for live migration, IMHO
in my personal interpretation it doesn't matter what the
config space may present. It may be worth while adding a new
debug command to expose the real register value, but that's
another story.
I am not sure getting your points. vDPA now reports device
feature bits(device_features) and negotiated feature
bits(driver_features), and yes, the drivers features can be a
subset of the device features; and the vDPA device features can
be a subset of the management device features.Quoted 12 lines
What I said is after unblocking the conditional check, you'd have to handle the case for each of the vdpa attribute when feature negotiation is not yet done: basically the register values you got from config space via the
vdpa_get_config_unlocked()call is not considered to be valid beforefeatures_ok(per-spec). Although in some case you may get sane value, such behavior is generally undefined. If you desire to show just thedevice_featuresalone without any config space field, which the device had advertised *before feature negotiation is complete*, that'll be fine. But looks to me this is not how patch has been implemented. Probably need some more work?Quoted 4 lines
They are
driver_features(negotiated)and thedevice_features(which comes with the device), and the config space fields that depend on them. In this series, we report both to the userspace.Quoted 6 lines
I fail to understand what you want to present from your description. May be worth showing some example outputs that at least include the following cases: 1) when device offers features but not yet acknowledge by guest 2) when guest acknowledged features and device is yet to accept 3) after guest feature negotiation is completed (agreed upon between guest and device).
Only two feature sets: 1) what the device has. (2) what is negotiated
Quoted 91 lines
Thanks,
-SiweiQuoted 89 lines
Quoted 89 lines
Regards,
-SiweiQuoted 86 lines
Having said, please consider to drop the Fixes tag, as appears
to me you're proposing a new feature rather than fixing a real
issue.
it's a new feature to report the device feature bits than only
negotiated features, however this patch is a must, or it will
block the device feature bits reporting. but I agree, the fix
tag is not a must.
Thanks,
-SiweiOn 7/1/2022 3:12 PM, Parav Pandit via Virtualization wrote:
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device,
to choose a
appropriate one for a certain guest. This means the users
need to read the
config space before FEATURES_OK, and the existence of config
space
contents does not depend on FEATURES_OK.The spec says:
The device MUST allow reading of any device-specific
configuration field
before FEATURES_OK is set by the driver. This includes
fields which are
conditional on feature bits, as long as those feature bits
are offered by the
device.Fixes: 30ef7a8ac8a07 (vdpa: Read device configuration only
if FEATURES_OK)
Fix is fine, but fixes tag needs correction described below.Above commit id is 13 letters should be 12.
And
It should be in format
Fixes: 30ef7a8ac8a0 ("vdpa: Read device configuration only if
FEATURES_OK")Please use checkpatch.pl script before posting the patches to
catch these errors.
There is a bot that looks at the fixes tag and identifies the
right kernel version to apply this fix.Signed-off-by: Zhu Lingshan<[email protected]>
---
drivers/vdpa/vdpa.c | 8 --------
1 file changed, 8 deletions(-)diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c index
9b0e39b2f022..d76b22b2f7ae 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct
vdpa_device
*vdev,
struct sk_buff *msg, u32 portid, {
u32 device_id;
void *hdr;
- u8 status;
int err;down_read(&vdev->cf_lock);
- status = vdev->config->get_status(vdev);
- if (!(status & VIRTIO_CONFIG_S_FEATURES_OK)) {
- NL_SET_ERR_MSG_MOD(extack, "Features negotiation not
completed");
- err = -EAGAIN;
- goto out;
- }
-
hdr = genlmsg_put(msg, portid, seq, &vdpa_nl_family,
flags,
VDPA_CMD_DEV_CONFIG_GET);
if (!hdr) {
--
2.31.1
_______________________________________________
Virtualization mailing list
[email protected]
https://urldefense.com/v3/__https://lists.linuxfoundation.org/mailman/listinfo/virtualization__;!!ACWV5N9M2RV99hQ!NzOv5Ew_Z2CP-zHyD7RsUoStLZ54KpB21QyuZ8L63YVPLEGDEwvcOSDlIGxQPHY-DMkOa9sKKZdBSaNknMU$
Re: [PATCH V3 4/6] vDPA: !FEATURES_OK should not block querying device config space
In reply to Si-Wei LiuQuoted 124 lines · Si-Wei Liu
Quoted 121 lines · Lingshan
Quoted 118 lines · Si-Wei Liu
Quoted 115 lines · Jason Wang
Quoted 114 lines · Si-Wei Liu
Quoted 99 lines · Si-Wei Liu
Quoted 97 lines · Jason Wang
Quoted 51 lines · Si-Wei Liu
Quoted 49 lines · Lingshan
Quoted 47 lines · Si-Wei Liu
Quoted 30 lines · Lingshan
Quoted 28 lines · Si-Wei Liu
Quoted 26 lines · Lingshan
On 7/27/2022 5:43 PM, Si-Wei Liu wrote:
Sorry to chime in late in the game. For some reason I couldn't
get to most emails for this discussion (I only subscribed to
the virtualization list), while I was taking off amongst the
past few weeks.It looks to me this patch is incomplete. Noted down the way in
vdpa_dev_net_config_fill(), we have the following:
features = vdev->config->get_driver_features(vdev);
if (nla_put_u64_64bit(msg,
VDPA_ATTR_DEV_NEGOTIATED_FEATURES, features,
VDPA_ATTR_PAD))
return -EMSGSIZE;Making call to .get_driver_features() doesn't make sense when
feature negotiation isn't complete. Neither should present
negotiated_features to userspace before negotiation is done.Similarly, max_vqp through vdpa_dev_net_mq_config_fill()
probably should not show before negotiation is done - it
depends on driver features negotiated.
I have another patch in this series introduces device_features
and will report device_features to the userspace even features
negotiation not done. Because the spec says we should allow
driver access the config space before FEATURES_OK.Quoted 6 lines
Quoted 3 lines
The config space can be accessed by guest before
features_okdoesn't necessarily mean the value is valid. You may want to double check with Michael for what he quoted earlier:that's why I proposed to fix these issues, e.g., if no
_F_MAC, vDPA kernel should not return a mac to the userspace, there is not a default value for mac.Then please show us the code, as I can only comment based on your latest (v4) patch and it was not there.. To be honest, I don't understand the motivation and the use cases you have, is it for debugging/monitoring or there's really a use case for live migration? For the former, you can do a direct dump on all config space fields regardless of endianess and feature negotiation without having to worry about validity (meaningful to present to admin user). To me these are conflict asks that is impossible to mix in exact one command.
Quoted 6 lines
Quoted 6 lines
This bug just has been revealed two days, and you will see the patch soon.
There are something to clarify:
1) we need to read the device features, or how can you pick a proper LM destinationSo it's probably not very efficient to use this, the manager layer should have the knowledge about the compatibility before doing migration other than try-and-fail.
And it's the task of the management to gather the nodes whose devices could be live migrated to each other as something like "cluster" which we've already used in the case of cpuflags.
1) during node bootstrap, the capability of each node and devices was reported to management layer
2) management layer decide the cluster and make sure the migration can only done among the nodes insides the cluster
3) before migration, the vDPA needs to be provisioned on the destinationQuoted 11 lines
Quoted 4 lines
2) vdpa dev config show can show both device features and driver features, there just need a patch for iproute2
3) To process information like MQ, we don't just dump the config space, MST has explained beforeSo, it's for live migration... Then why not export those config parameters specified for vdpa creation (as well as device feature bits) to the output of "vdpa dev show" command? That's where device side config lives and is static across vdpa's life cycle. "vdpa dev config show" is mostly for dynamic driver side config, and the validity is subject to feature negotiation. I suppose this should suit your need of LM, e.g.
I think so.
Quoted 7 lines
$ vdpa dev add name vdpa1 mgmtdev pci/0000:41:04.2 max_vqp 7 mtu 2000 $ vdpa dev show vdpa1 vdpa1: type network mgmtdev pci/0000:41:04.2 vendor_id 5555 max_vqs 15 max_vq_size 256 max_vqp 7 mtu 2000 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 RING_PACKEDQuoted 3 lines
Quoted 2 lines
Note that the mgmt should know this destination have those capability/features before the provisioning.
Yes, mgmt software should have to check the above from source.
On destination mgmt software can run below to check vdpa mgmtdev's capability/features:
$ vdpa mgmtdev show pci/0000:41:04.3 pci/0000:41:04.3: supported_classes net max_supported_vqs 257 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 RING_PACKED
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
Right and this is probably better to be done at node bootstrapping for the management to know about the cluster.
Exactly. That's what mgmt software is supposed to do typically.
I think this could apply to both mgmt devices and vDPA devices:
1)mgmt device, see whether the mgmt device is capable to create a vDPA device with a certain feature bits, this is for LM 2)vDPA device, report the device features, it is for normal operationCan you elaborate the use case "for normal operations"? Then it has nothing to do with LM for sure, correct?
like when you just want to check the features to pick a proper device
Quoted 2 lines
Noted for the LM case, just as Jason indicated, it's not even *required* for the mgmt software to gather the device features through "vdpa dev show" on source host *alive* right before live migration is started. Depending on the way how it is implemented, the mgmt software can well collect device capability on boot strap time, or may well save the vdpa device capability/config in persistent store ahead of time, say before any VM is to be launched. Then with all such info collected for each cluster node, mgmt software is able to get its own way to infer and sort out the live migration compatibility between nodes. I'm not sure which case you would need to check the device features, but in case you need it, it'd be better live in "vdpa dev show" than "vdpa dev config show".
it is not only for LM
Quoted 185 lines
Thanks,
-SiweiQuoted 180 lines
Thanks,
Zhu LingshanQuoted 176 lines
Thanks,
-SiweiQuoted 171 lines
Thanks
Quoted 168 lines
Quoted 168 lines
Quoted 168 lines
Quoted 8 lines
For it to work, you'd want to pass "struct
vdpa_dev_set_config" to_vdpa_register_device()during registration, and get it saved there in "structvdpa_device". Then invdpa_dev_fill()show each field conditionally subject to "struct vdpa_dev_set_config.mask".Thanks,
-SiweiThanks
Quoted 156 lines
Quoted 156 lines
Thanks
Zhu LingshanQuoted 56 lines
Quoted 52 lines
Quoted 40 lines
Quoted 9 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check
that the corresponding feature is offered
before accessing that part of the configuration space.and how many driver bugs taking wrong assumption of the validity of config space field without
features_ok. I am not sure what use case you want to expose config resister values for beforefeatures_ok, if it's mostly for live migration I guess it's probably heading a wrong direction.Quoted 24 lines
Last but not the least, this "vdpa dev config" command was not
designed to display the real config space register values in
the first place. Quoting the vdpa-dev(8) man page:vdpa dev config show - Show configuration of specific device
or all devices.
DEV - specifies the vdpa device to show its configuration. If
this argument is omitted all devices configuration is listed.
It doesn't say anything about configuration space or register
values in config space. As long as it can convey the config
attribute when instantiating vDPA device instance, and more
importantly, the config can be easily imported from or
exported to userspace tools when trying to reconstruct vdpa
instance intact on destination host for live migration, IMHO
in my personal interpretation it doesn't matter what the
config space may present. It may be worth while adding a new
debug command to expose the real register value, but that's
another story.
I am not sure getting your points. vDPA now reports device
feature bits(device_features) and negotiated feature
bits(driver_features), and yes, the drivers features can be a
subset of the device features; and the vDPA device features can
be a subset of the management device features.Quoted 12 lines
What I said is after unblocking the conditional check, you'd have to handle the case for each of the vdpa attribute when feature negotiation is not yet done: basically the register values you got from config space via the
vdpa_get_config_unlocked()call is not considered to be valid beforefeatures_ok(per-spec). Although in some case you may get sane value, such behavior is generally undefined. If you desire to show just thedevice_featuresalone without any config space field, which the device had advertised *before feature negotiation is complete*, that'll be fine. But looks to me this is not how patch has been implemented. Probably need some more work?Quoted 4 lines
They are
driver_features(negotiated)and thedevice_features(which comes with the device), and the config space fields that depend on them. In this series, we report both to the userspace.Quoted 6 lines
I fail to understand what you want to present from your description. May be worth showing some example outputs that at least include the following cases: 1) when device offers features but not yet acknowledge by guest 2) when guest acknowledged features and device is yet to accept 3) after guest feature negotiation is completed (agreed upon between guest and device).
Only two feature sets: 1) what the device has. (2) what is negotiated
Quoted 91 lines
Thanks,
-SiweiQuoted 89 lines
Quoted 89 lines
Regards,
-SiweiQuoted 86 lines
Having said, please consider to drop the Fixes tag, as appears
to me you're proposing a new feature rather than fixing a real
issue.
it's a new feature to report the device feature bits than only
negotiated features, however this patch is a must, or it will
block the device feature bits reporting. but I agree, the fix
tag is not a must.
Thanks,
-SiweiOn 7/1/2022 3:12 PM, Parav Pandit via Virtualization wrote:
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AMUsers may want to query the config space of a vDPA device,
to choose a
appropriate one for a certain guest. This means the users
need to read the
config space before FEATURES_OK, and the existence of config
space
contents does not depend on FEATURES_OK.The spec says:
The device MUST allow reading of any device-specific
configuration field
before FEATURES_OK is set by the driver. This includes
fields which are
conditional on feature bits, as long as those feature bits
are offered by the
device.Fixes: 30ef7a8ac8a07 (vdpa: Read device configuration only
if FEATURES_OK)
Fix is fine, but fixes tag needs correction described below.Above commit id is 13 letters should be 12.
And
It should be in format
Fixes: 30ef7a8ac8a0 ("vdpa: Read device configuration only if
FEATURES_OK")Please use checkpatch.pl script before posting the patches to
catch these errors.
There is a bot that looks at the fixes tag and identifies the
right kernel version to apply this fix.Signed-off-by: Zhu Lingshan<[email protected]>
---
drivers/vdpa/vdpa.c | 8 --------
1 file changed, 8 deletions(-)diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c index
9b0e39b2f022..d76b22b2f7ae 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -851,17 +851,9 @@ vdpa_dev_config_fill(struct
vdpa_device
*vdev,
struct sk_buff *msg, u32 portid, {
u32 device_id;
void *hdr;
- u8 status;
int err;down_read(&vdev->cf_lock);
- status = vdev->config->get_status(vdev);
- if (!(status & VIRTIO_CONFIG_S_FEATURES_OK)) {
- NL_SET_ERR_MSG_MOD(extack, "Features negotiation not
completed");
- err = -EAGAIN;
- goto out;
- }
-
hdr = genlmsg_put(msg, portid, seq, &vdpa_nl_family,
flags,
VDPA_CMD_DEV_CONFIG_GET);
if (!hdr) {
--
2.31.1
_______________________________________________
Virtualization mailing list
[email protected]
https://urldefense.com/v3/__https://lists.linuxfoundation.org/mailman/listinfo/virtualization__;!!ACWV5N9M2RV99hQ!NzOv5Ew_Z2CP-zHyD7RsUoStLZ54KpB21QyuZ8L63YVPLEGDEwvcOSDlIGxQPHY-DMkOa9sKKZdBSaNknMU$
PATCH v3 5/6 vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
In reply to Zhu LingshanIf VIRTIO_NET_F_MQ == 0, the virtio device should have one queue pair, so when userspace querying queue pair numbers, it should return mq=1 than zero.
Function vdpa_dev_net_config_fill() fills the attributions of the vDPA devices, so that it should call vdpa_dev_net_mq_config_fill() so the parameter in vdpa_dev_net_mq_config_fill() should be feature_device than feature_driver for the vDPA devices themselves
Before this change, when MQ = 0, iproute2 output:
$vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link up link_announce false max_vq_pairs 0 mtu 1500
After applying this commit, when MQ = 0, iproute2 output:
$vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link up link_announce false max_vq_pairs 1 mtu 1500
--- drivers/vdpa/vdpa.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/vdpa/vdpa.c +4 -3
@@ -806,9 +806,10 @@ static int vdpa_dev_net_mq_config_fill(struct vdpa_device *vdev,u16 val_u16;if ((features &BIT_ULL (VIRTIO_NET_F_MQ )) ==0 ) -return 0 ; + val_u16 =1 ; +else + val_u16 =__virtio16_to_cpu (true, config->max_virtqueue_pairs); - val_u16 =le16_to_cpu (config->max_virtqueue_pairs);return nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , val_u16); }
@@ -842,7 +843,7 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms VDPA_ATTR_PAD))return -EMSGSIZE ; -return vdpa_dev_net_mq_config_fill (vdev, msg, features_driver, &config); +return vdpa_dev_net_mq_config_fill (vdev, msg, features_device, &config); } static int
Signature · 1 line
2.31.1
RE: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 13 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AM
IfVIRTIO_NET_F_MQ== 0, the virtio device should have one queue pair, so when userspace querying queue pair numbers, it should return mq=1 than zero.Function
vdpa_dev_net_config_fill()fills the attributions of the vDPA devices, so that it should callvdpa_dev_net_mq_config_fill()so the parameter invdpa_dev_net_mq_config_fill()should befeature_devicethanfeature_driverfor the vDPA devices themselves
Quoted 5 lines
Before this change, when MQ = 0, iproute2 output:
$vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link uplink_announcefalsemax_vq_pairs0 mtu 1500
The fix belongs to user space.
When a feature bit _MQ is not negotiated, vdpa kernel space will not add attribute VDPA_ATTR_DEV_NET_CFG_MAX_VQP. When such attribute is not returned by kernel, max_vq_pairs should not be shown by the iproute2.
We have many config space fields that depend on the feature bits and some of them do not have any defaults. To keep consistency of existence of config space fields among all, we don't want to show default like below.
Please fix the iproute2 to not print max_vq_pairs when it is not returned by the kernel.
Quoted 44 lines
After applying this commit, when MQ = 0, iproute2 output:
$vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link uplink_announcefalsemax_vq_pairs1 mtu 1500Fixes a64917bc2e9b (vdpa: Provide interface to read driver features)Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
d76b22b2f7ae..846dd37f3549100644drivers/vdpa/vdpa.c +3
-2@@ -806,9 +806,10 @@ static int vdpa_dev_net_mq_config_fill(structvdpa_device *vdev, u16 val_u16;if ((features &BIT_ULL (VIRTIO_NET_F_MQ )) ==0 ) -return 0 ; + val_u16 =1 ; +else + val_u16 =__virtio16_to_cpu (true, config- >max_virtqueue_pairs); - val_u16 =le16_to_cpu (config->max_virtqueue_pairs); return nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MAX_VQP,
val_u16); }drivers/vdpa/vdpa.c +0
-0@@ -842,7 +843,7 @@ static int vdpa_dev_net_config_fill(struct
vdpa_device*vdev, structsk_buff*msdrivers/vdpa/vdpa.c +0
-1VDPA_ATTR_PAD))return -EMSGSIZE ; - return vdpa_dev_net_mq_config_fill(vdev, msg, features_driver,&config);
drivers/vdpa/vdpa.c +2
-1+return vdpa_dev_net_mq_config_fill (vdev, msg, features_device, +&config); } static int --2.31.1
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 12 lines · Parav Pandit
Quoted 12 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AM
IfVIRTIO_NET_F_MQ== 0, the virtio device should have one queue pair, so when userspace querying queue pair numbers, it should return mq=1 than zero.Function
vdpa_dev_net_config_fill()fills the attributions of the vDPA devices, so that it should callvdpa_dev_net_mq_config_fill()so the parameter invdpa_dev_net_mq_config_fill()should befeature_devicethanfeature_driverfor the vDPA devices themselves
Quoted 8 lines
Quoted 5 lines
Before this change, when MQ = 0, iproute2 output:
$vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link uplink_announcefalsemax_vq_pairs0 mtu 1500The fix belongs to user space.
When a feature bit_MQis not negotiated, vdpa kernel space will not add attributeVDPA_ATTR_DEV_NET_CFG_MAX_VQP. When such attribute is not returned by kernel,max_vq_pairsshould not be shown by the iproute2.
I think userspace tool does not need to care whether MQ is offered or negotiated, it just needs to read the number of queues there, so if no MQ, it is not "not any queues", there are still 1 queue pair to be a virtio-net device, means two queues.
If not, how can you tell the user there are only 2 queues? The end users may don't know this is default. They may misunderstand this as an error or defects.
Quoted 49 lines
We have many config space fields that depend on the feature bits and some of them do not have any defaults. To keep consistency of existence of config space fields among all, we don't want to show default like below.
Please fix the iproute2 to not print
max_vq_pairswhen it is not returned by the kernel.Quoted 43 lines
After applying this commit, when MQ = 0, iproute2 output:
$vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link uplink_announcefalsemax_vq_pairs1 mtu 1500Fixes a64917bc2e9b (vdpa: Provide interface to read driver features)Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
d76b22b2f7ae..846dd37f3549100644drivers/vdpa/vdpa.c +3
-2@@ -806,9 +806,10 @@ static int vdpa_dev_net_mq_config_fill(structvdpa_device *vdev, u16 val_u16;if ((features &BIT_ULL (VIRTIO_NET_F_MQ )) ==0 ) -return 0 ; + val_u16 =1 ; +else + val_u16 =__virtio16_to_cpu (true, config- > max_virtqueue_pairs); - val_u16 =le16_to_cpu (config->max_virtqueue_pairs);return nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , val_u16); }@@ -842,7 +843,7 @@ static int vdpa_dev_net_config_fill(struct
vdpa_device*vdev, structsk_buff*ms
VDPA_ATTR_PAD))
return-EMSGSIZE;drivers/vdpa/vdpa.c +0
-1- return vdpa_dev_net_mq_config_fill(vdev, msg, features_driver,&config);
drivers/vdpa/vdpa.c +2
-1+return vdpa_dev_net_mq_config_fill (vdev, msg, features_device, +&config); } static int --2.31.1
RE: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Friday, July 8, 2022 2:21 AMQuoted 12 lines · Parav Pandit
Quoted 12 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AM
IfVIRTIO_NET_F_MQ== 0, the virtio device should have one queue pair, so when userspace querying queue pair numbers, it should return mq=1 than zero.Function
vdpa_dev_net_config_fill()fills the attributions of the vDPA devices, so that it should callvdpa_dev_net_mq_config_fill()so the parameter invdpa_dev_net_mq_config_fill()should befeature_devicethanfeature_driverfor the vDPA devices themselvesQuoted 7 lines
Quoted 5 lines
Before this change, when MQ = 0, iproute2 output:
$vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link uplink_announcefalsemax_vq_pairs0 mtu 1500The fix belongs to user space.
When a feature bit_MQis not negotiated, vdpa kernel space will not addattribute
VDPA_ATTR_DEV_NET_CFG_MAX_VQP.Quoted 1 line
When such attribute is not returned by kernel,
max_vq_pairsshould notbe shown by the iproute2.
I think userspace tool does not need to care whether MQ is offered or negotiated, it just needs to read the number of queues there, so if no MQ, it is not "not any queues", there are still 1 queue pair to be a virtio-net device, means two queues.
Quoted 4 lines
If not, how can you tell the user there are only 2 queues? The end users may don't know this is default. They may misunderstand this as an error or defects.
Quoted 1 line
When max_vq_pairs is not shown, it means that device didn’t expose MAX_VQ_PAIRS attribute to its guest users. (Because _MQ was not negotiated).
It is not error or defect.
It precisely shows what is exposed.
User space will care when it wants to turn off/on _MQ feature bits and MAX_QP values.
Showing max_vq_pairs of 1 even when _MQ is not negotiated, incorrectly says that max_vq_pairs is exposed to the guest, but it is not offered.
So, please fix the iproute2 to not print max_vq_pairs when it is not returned by the kernel.
Quoted 49 lines
Quoted 1 line
We have many config space fields that depend on the feature bits and
some of them do not have any defaults.
Quoted 1 line
To keep consistency of existence of config space fields among all, we don't
want to show default like below.
Quoted 2 lines
Please fix the iproute2 to not print
max_vq_pairswhen it is not returnedby the kernel.
Quoted 20 lines
Quoted 20 lines
After applying this commit, when MQ = 0, iproute2 output:
$vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link uplink_announcefalsemax_vq_pairs1 mtu 1500Fixes a64917bc2e9b (vdpa: Provide interface to read driver features)Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
d76b22b2f7ae..846dd37f3549100644drivers/vdpa/vdpa.c +0
-0@@ -806,9 +806,10 @@ static int vdpa_dev_net_mq_config_fill(structvdpa_device *vdev, u16 val_u16;Quoted 8 lines
drivers/vdpa/vdpa.c static int vdpa_dev_net_mq_config_fill(struct vdpa_device *vdev,
Quoted 8 lines
drivers/vdpa/vdpa.c +3
-2if ((features &BIT_ULL (VIRTIO_NET_F_MQ )) ==0 ) -return 0 ; + val_u16 =1 ; +else + val_u16 =__virtio16_to_cpu (true, config- > max_virtqueue_pairs); - val_u16 =le16_to_cpu (config->max_virtqueue_pairs); return nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MAX_VQP,
val_u16);Quoted 13 lines
Quoted 13 lines
drivers/vdpa/vdpa.c +0
-0}@@ -842,7 +843,7 @@ static int vdpa_dev_net_config_fill(struct
vdpa_device*vdev, structsk_buff*ms
VDPA_ATTR_PAD))
return-EMSGSIZE;drivers/vdpa/vdpa.c +0
-1- return vdpa_dev_net_mq_config_fill(vdev, msg, features_driver,&config);
drivers/vdpa/vdpa.c +2
-0+return vdpa_dev_net_mq_config_fill (vdev, msg, features_device, +&config); }
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
static int
--
2.31.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 39 lines · Parav Pandit
Quoted 31 lines
From: Zhu, Lingshan <[email protected]>
Sent: Friday, July 8, 2022 2:21 AMQuoted 11 lines · Parav Pandit
Quoted 11 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AM
IfVIRTIO_NET_F_MQ== 0, the virtio device should have one queue pair, so when userspace querying queue pair numbers, it should return mq=1 than zero.Function
vdpa_dev_net_config_fill()fills the attributions of the vDPA devices, so that it should callvdpa_dev_net_mq_config_fill()so the parameter invdpa_dev_net_mq_config_fill()should befeature_devicethanfeature_driverfor the vDPA devices themselvesQuoted 7 lines
Quoted 5 lines
Before this change, when MQ = 0, iproute2 output:
$vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link uplink_announcefalsemax_vq_pairs0 mtu 1500The fix belongs to user space.
When a feature bit_MQis not negotiated, vdpa kernel space will not addattribute
VDPA_ATTR_DEV_NET_CFG_MAX_VQP.Quoted 1 line
When such attribute is not returned by kernel,
max_vq_pairsshould notbe shown by the iproute2.
I think userspace tool does not need to care whether MQ is offered or negotiated, it just needs to read the number of queues there, so if no MQ, it is not "not any queues", there are still 1 queue pair to be a virtio-net device, means two queues.Quoted 3 lines
If not, how can you tell the user there are only 2 queues? The end users may don't know this is default. They may misunderstand this as an error or defects.
When
max_vq_pairsis not shown, it means that device didn’t exposeMAX_VQ_PAIRSattribute to its guest users. (Because_MQwas not negotiated).
It is not error or defect.
It precisely shows what is exposed.
Quoted 5 lines
User space will care when it wants to turn off/on
_MQfeature bits andMAX_QPvalues.Showing
max_vq_pairsof 1 even when_MQis not negotiated, incorrectly says thatmax_vq_pairsis exposed to the guest, but it is not offered.So, please fix the iproute2 to not print
max_vq_pairswhen it is not returned by the kernel.
iproute2 can report whether there is MQ feature in the device / driver feature bits. I think iproute2 only queries the number of max queues here.
max_vq_pairs shows how many queue pairs there, this attribute's existence does not depend on MQ, if no MQ, there are still one queue pair, so just show one.
Quoted 51 lines
Quoted 51 lines
Quoted 2 lines
We have many config space fields that depend on the feature bits and
some of them do not have any defaults.
Quoted 1 line
To keep consistency of existence of config space fields among all, we don't
want to show default like below.
Quoted 1 line
Please fix the iproute2 to not print
max_vq_pairswhen it is not returnedby the kernel.
Quoted 19 lines
Quoted 19 lines
After applying this commit, when MQ = 0, iproute2 output:
$vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link uplink_announcefalsemax_vq_pairs1 mtu 1500Fixes a64917bc2e9b (vdpa: Provide interface to read driver features)Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
d76b22b2f7ae..846dd37f3549100644drivers/vdpa/vdpa.c +0
-0@@ -806,9 +806,10 @@ static int vdpa_dev_net_mq_config_fill(structvdpa_device *vdev, u16 val_u16;Quoted 8 lines
drivers/vdpa/vdpa.c static int vdpa_dev_net_mq_config_fill(struct vdpa_device *vdev,
Quoted 8 lines
drivers/vdpa/vdpa.c +3
-2if ((features &BIT_ULL (VIRTIO_NET_F_MQ )) ==0 ) -return 0 ; + val_u16 =1 ; +else + val_u16 =__virtio16_to_cpu (true, config- > max_virtqueue_pairs); - val_u16 =le16_to_cpu (config->max_virtqueue_pairs); return nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MAX_VQP,
val_u16);Quoted 16 lines
Quoted 16 lines
drivers/vdpa/vdpa.c +0
-0}@@ -842,7 +843,7 @@ static int vdpa_dev_net_config_fill(struct
vdpa_device*vdev, structsk_buff*ms
VDPA_ATTR_PAD))
return-EMSGSIZE;drivers/vdpa/vdpa.c +0
-1- return vdpa_dev_net_mq_config_fill(vdev, msg, features_driver,&config);
drivers/vdpa/vdpa.c +2
-1+return vdpa_dev_net_mq_config_fill (vdev, msg, features_device, +&config); } static int --2.31.1
RE: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 8 lines
From: Zhu, Lingshan <[email protected]>
Sent: Sunday, July 10, 2022 10:30 PMQuoted 1 line
Showing
max_vq_pairsof 1 even when_MQis not negotiated, incorrectlysays that
max_vq_pairsis exposed to the guest, but it is not offered.Quoted 2 lines
So, please fix the iproute2 to not print
max_vq_pairswhen it is not
Quoted 8 lines
returned by the kernel.
iproute2 can report whether there is MQ feature in the device / driver feature bits.
I think iproute2 only queries the number of max queues here.
max_vq_pairsshows how many queue pairs there, this attribute's existence does not depend on MQ, if no MQ, there are still one queue pair, so just show one.
This netlink attribute's existence is depending on the _MQ feature bit existence.
We can break that and report the value, but if we break that there are many other config space bits who doesn’t have good default like max_vq_pairs. There is ambiguity for user space what to do with it and so in the kernel space..
Instead of dealing with them differently in kernel, at present we attach each netlink attribute to a respective feature bit wherever applicable. And code in kernel and user space is uniform to handle them.
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 10 lines · Parav Pandit
Quoted 10 lines
From: Zhu, Lingshan <[email protected]>
Sent: Sunday, July 10, 2022 10:30 PMQuoted 1 line
Showing
max_vq_pairsof 1 even when_MQis not negotiated, incorrectlysays that
max_vq_pairsis exposed to the guest, but it is not offered.Quoted 1 line
So, please fix the iproute2 to not print
max_vq_pairswhen it is notreturned by the kernel.
iproute2 can report whether there is MQ feature in the device / driver feature bits.
I think iproute2 only queries the number of max queues here.
Quoted 4 lines
Quoted 3 lines
max_vq_pairsshows how many queue pairs there, this attribute's existence does not depend on MQ, if no MQ, there are still one queue pair, so just show one.This netlink attribute's existence is depending on the
_MQfeature bit existence.
why? If no MQ, then no queues?
Quoted 1 line
We can break that and report the value, but if we break that there are many other config space bits who doesn’t have good default like
max_vq_pairs.
max_vq_paris may not have a default value, but we know if there is no MQ, a virtio-net still have one queue pair to be functional.
Quoted 3 lines
There is ambiguity for user space what to do with it and so in the kernel space..
Instead of dealing with them differently in kernel, at present we attach each netlink attribute to a respective feature bit wherever applicable. And code in kernel and user space is uniform to handle them.
I get your point, but you see, by "max_vq_pairs", the user space tool is asking how many queue pairs there, it is not asking whether the device have MQ. Even no _MQ, we still need to tell the users that there are one queue pair, or it is not a functional virtio-net,
we should detect this error earlier in the device initialization.
I think it is still uniform, it there is _MQ, we return cfg.max_queue_pair, if no _MQ, return 1, still by netlink.
Thanks
RE: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 31 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:03 PMQuoted 11 lines · Parav Pandit
Quoted 11 lines
From: Zhu, Lingshan <[email protected]>
Sent: Sunday, July 10, 2022 10:30 PMQuoted 2 lines
Showing
max_vq_pairsof 1 even when_MQis not negotiated, incorrectlysays that
max_vq_pairsis exposed to the guest, but it is not offered.Quoted 1 line
So, please fix the iproute2 to not print
max_vq_pairswhen it is notreturned by the kernel.
iproute2 can report whether there is MQ feature in the device / driver feature bits.
I think iproute2 only queries the number of max queues here.Quoted 4 lines
Quoted 3 lines
max_vq_pairsshows how many queue pairs there, this attribute's existence does not depend on MQ, if no MQ, there are still one queue pair, so just show one.This netlink attribute's existence is depending on the
_MQfeature bitexistence.
why? If no MQ, then no queues?Quoted 1 line
We can break that and report the value, but if we break that there are
many other config space bits who doesn’t have good default like
max_vq_pairs.max_vq_parismay not have a default value, but we know if there is no MQ, a virtio-net still have one queue pair to be functional.Quoted 1 line
There is ambiguity for user space what to do with it and so in the kernel
space..
Quoted 1 line
Instead of dealing with them differently in kernel, at present we attach
Quoted 8 lines
each netlink attribute to a respective feature bit wherever applicable.
Quoted 1 line
And code in kernel and user space is uniform to handle them.
I get your point, but you see, by "
max_vq_pairs", the user space tool is asking how many queue pairs there, it is not asking whether the device have MQ.
Even no_MQ, we still need to tell the users that there are one queue pair, or it is not a functional virtio-net, we should detect this error earlier in the device initialization.
It is not an error. :)
When the user space which invokes netlink commands, detects that _MQ is not supported, hence it takes max_queue_pair = 1 by itself.
Quoted 3 lines
I think it is still uniform, it there is
_MQ, we return cfg.max_queue_pair, if no_MQ, return 1, still by netlink.
Better to do that in user space because we cannot do same for other config fields.
Quoted 2 lines
Thanks
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 31 lines · Parav Pandit
Quoted 31 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:03 PMQuoted 11 lines · Parav Pandit
Quoted 11 lines
From: Zhu, Lingshan <[email protected]>
Sent: Sunday, July 10, 2022 10:30 PMQuoted 2 lines
Showing
max_vq_pairsof 1 even when_MQis not negotiated, incorrectlysays that
max_vq_pairsis exposed to the guest, but it is not offered.Quoted 1 line
So, please fix the iproute2 to not print
max_vq_pairswhen it is notreturned by the kernel.
iproute2 can report whether there is MQ feature in the device / driver feature bits.
I think iproute2 only queries the number of max queues here.Quoted 4 lines
Quoted 3 lines
max_vq_pairsshows how many queue pairs there, this attribute's existence does not depend on MQ, if no MQ, there are still one queue pair, so just show one.This netlink attribute's existence is depending on the
_MQfeature bitexistence.
why? If no MQ, then no queues?Quoted 1 line
We can break that and report the value, but if we break that there are
many other config space bits who doesn’t have good default like
max_vq_pairs.max_vq_parismay not have a default value, but we know if there is no MQ, a virtio-net still have one queue pair to be functional.Quoted 1 line
There is ambiguity for user space what to do with it and so in the kernel
space..
Quoted 1 line
Instead of dealing with them differently in kernel, at present we attach
each netlink attribute to a respective feature bit wherever applicable.
Quoted 8 lines
Quoted 7 lines
Quoted 1 line
And code in kernel and user space is uniform to handle them.
I get your point, but you see, by "
max_vq_pairs", the user space tool is asking how many queue pairs there, it is not asking whether the device have MQ.
Even no_MQ, we still need to tell the users that there are one queue pair, or it is not a functional virtio-net, we should detect this error earlier in the device initialization.It is not an error. :)
I meant if no queues, it should be non-functional, which is an error.
Quoted 2 lines
When the user space which invokes netlink commands, detects that
_MQis not supported, hence it takesmax_queue_pair= 1 by itself.
I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user space tool.
Quoted 4 lines
Quoted 3 lines
I think it is still uniform, it there is
_MQ, we return cfg.max_queue_pair, if no_MQ, return 1, still by netlink.Better to do that in user space because we cannot do same for other config fields.
same as above
Quoted 2 lines
Quoted 2 lines
Thanks
RE: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 9 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQis not supported, hence it takes
max_queue_pair= 1 by itself.
I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user space tool.
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t exist regardless of field should have default or no default. User space should not guess either. User space gets to see if _MQ present/not present. If _MQ present than get reliable data from kernel. If _MQ not present, it means this device has one VQ pair.
Michael S. Tsirkin
maintainerRe: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 4 lines · Parav Pandit
Quoted 4 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQ
Quoted 8 lines
Quoted 5 lines
is not supported, hence it takes
max_queue_pair= 1 by itself.
I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user space tool.Kernel is reliable. It doesn’t expose a config space field if the field doesn’t exist regardless of field should have default or no default. User space should not guess either. User space gets to see if
_MQpresent/not present. If_MQpresent than get reliable data from kernel. If_MQnot present, it means this device has one VQ pair.
Yes that's fine. And if we just didn't return anything without MQ that would be fine. But IIUC netlink reports the # of pairs regardless, it just puts 0 there.
Signature · 1 line
MST
RE: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 16 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Tuesday, July 26, 2022 3:52 PMQuoted 10 lines · Parav Pandit
Quoted 10 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 2 lines
When the user space which invokes netlink commands, detects that
_MQis not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the userspace tool.
Quoted 8 lines
Quoted 1 line
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t exist
regardless of field should have default or no default.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/notpresent. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.Yes that's fine. And if we just didn't return anything without MQ that would be fine. But IIUC netlink reports the # of pairs regardless, it just puts 0 there.
I read it differently at [1] which checks for the MQ feature bit.
[1] https://elixir.bootlin.com/linux/latest/source/drivers/vdpa/vdpa.c#L825
Quoted 3 lines
--
MST
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
In reply to Parav PanditQuoted 9 lines · Parav Pandit
Quoted 8 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQis not supported, hence it takes
max_queue_pair= 1 by itself.
I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user space tool.Kernel is reliable. It doesn’t expose a config space field if the field doesn’t exist regardless of field should have default or no default.
so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 2 lines
User space should not guess either. User space gets to see if
_MQpresent/not present. If_MQpresent than get reliable data from kernel. If_MQnot present, it means this device has one VQ pair.
it is still a guess, right? And all user space tools implemented this feature need to guess
RE: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 16 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 5 lines
Quoted 5 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 1 line
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the _MQ feature and deriving the value.
The code you proposed will be present in the user space.
It will be uniform for _MQ and 10 other features that are present now and in the future.
For feature X, kernel reports default and for feature Y, kernel skip reporting it, because there is no default. <- This is what we are trying to avoid here.
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 19 lines · Parav Pandit
Quoted 19 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 5 lines
Quoted 5 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 1 line
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQ
Quoted 8 lines
Quoted 4 lines
present/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value.
The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now and in the future.
MQ and other features like RSS are different. If there is no _RSS_XX, there are no attributes like max_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout _MQ.
Quoted 1 line
For feature X, kernel reports default and for feature Y, kernel skip reporting it, because there is no default. <- This is what we are trying to avoid here.
Kernel reports one queue pair because there is actually one.
Quoted 1 line
RE: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 30 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 25 lines · Parav Pandit
Quoted 25 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
Quoted 8 lines
Quoted 4 lines
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andin the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ.
"we" = user space.
To keep the consistency among all the config space fields.
Quoted 5 lines
Quoted 1 line
For feature X, kernel reports default and for feature Y, kernel skip
reporting it, because there is no default. <- This is what we are trying to avoid here.
Kernel reports one queue pair because there is actually one.Quoted 1 line
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now and
Quoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.
The user space tools asks for the number of vq pairs, not whether the device has _MQ. _MQ and _RSS are not the same kind of concepts, as we have discussed above.
You have pointed out the logic: If there is _MQ, kernel answers max_vq_paris, if no _MQ, num_vq_paris=1.
So as MST pointed out, implementing this in kernel space can make our life easier, once for all.
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
For feature X, kernel reports default and for feature Y, kernel skip
reporting it, because there is no default. <- This is what we are trying to avoid here.
Kernel reports one queue pair because there is actually one.
Michael S. Tsirkin
maintainerRe: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
In reply to Parav PanditQuoted 34 lines · Parav Pandit
Quoted 34 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now and
Quoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.
Actually I looked and the code some more and I'm puzzled:
struct virtio_net_config config = {};
u64 features;
u16 val_u16;
vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config));
if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac),
config.mac))
return -EMSGSIZE;Mac returned even without VIRTIO_NET_F_MAC
val_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;
status returned even without VIRTIO_NET_F_STATUS
val_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;
MTU returned even without VIRTIO_NET_F_MTU
What's going on here?
Signature · 1 line
MST
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 34 lines · Michael S. Tsirkin
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now and
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
I can submit a fix in my next version patch for these issue.
Quoted 13 lines
struct virtio_net_config config = {};
u64 features;
u16 val_u16;
vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config));
if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac),
config.mac))
return -EMSGSIZE;Quoted 1 line
Mac returned even without
VIRTIO_NET_F_MAC
if no VIRTIO_NET_F_MAC, we should not nla_put VDPA_ATTR_DEV_NET_CFG_MAC_ADDR, the spec says the driver should generate a random mac.
Quoted 8 lines
val_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUS
if no VIRTIO_NET_F_STATUS, we should not nla_put VDPA_ATTR_DEV_NET_STATUS, the spec says the driver should assume the link is active.
Quoted 7 lines
val_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;MTU returned even without
VIRTIO_NET_F_MTU
same as above, the spec says config.mtu depends on VIRTIO_NET_F_MTU, so without this feature bit, we should not return MTU to the userspace.
Does these fix look good to you?
And I think we may need your adjudication for the two issues:
(1) Shall we answer max_vq_paris = 1 when _MQ not exist, I know you have agreed on this in a previous thread, its nice to clarify
(2) I think we should not re-use the netlink attr to report feature bits of both the management device and the vDPA device, this can lead to a new race condition, there are no locks(especially distributed locks for kernel_space and user_space) in the nla_put functions. Re-using the attr is some kind of breaking the netlink lockless design.
Thanks,
Zhu Lingshan
Quoted 5 lines
What's going on here?
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 59 lines · Lingshan
Quoted 34 lines · Michael S. Tsirkin
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 7 lines
Quoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
I can submit a fix in my next version patch for these issue.
Quoted 13 lines
struct virtio_net_config config = {}; u64 features; u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac)) return -EMSGSIZE;
Quoted 4 lines
Quoted 1 line
Mac returned even without
VIRTIO_NET_F_MACif no
VIRTIO_NET_F_MAC, we should notnla_putVDPA_ATTR_DEV_NET_CFG_MAC_ADDR, the spec says the driver should generate a random mac.
It's probably too late to do this. Most of the parents have this feature support, so probably not a real issue.
Quoted 11 lines
Quoted 8 lines
val_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSif no
VIRTIO_NET_F_STATUS, we should notnla_putVDPA_ATTR_DEV_NET_STATUS, the spec says the driver should assume the link is active.
Somehow similar to F_MAC. But we can report if F_MAC is not negotiated.
Quoted 9 lines
Quoted 7 lines
val_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;MTU returned even without
VIRTIO_NET_F_MTUsame as above, the spec says config.mtu depends on
VIRTIO_NET_F_MTU, so without this feature bit, we should not return MTU to the userspace.
Not a big issue, we just need to make sure the parent can report a correct MTU here.
Thanks
Quoted 21 lines
Does these fix look good to you?
And I think we may need your adjudication for the two issues:
(1) Shall we answermax_vq_paris= 1 when_MQnot exist, I know you have agreed on this in a previous thread, its nice to clarify
(2) I think we should not re-use the netlink attr to report feature bits of both the management device and the vDPA device,
this can lead to a new race condition, there are nolocks(especially distributed locks for kernel_space and user_space)in thenla_putfunctions. Re-using the attr is some kind of breaking the netlink lockless design.Thanks,
Zhu LingshanQuoted 5 lines
What's going on here?
Michael S. Tsirkin
maintainerRe: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 60 lines · Jason Wang
Quoted 59 lines · Lingshan
Quoted 34 lines · Michael S. Tsirkin
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 7 lines
Quoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
I can submit a fix in my next version patch for these issue.
Quoted 13 lines
struct virtio_net_config config = {}; u64 features; u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac)) return -EMSGSIZE;
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Mac returned even without
VIRTIO_NET_F_MACif no
VIRTIO_NET_F_MAC, we should notnla_putVDPA_ATTR_DEV_NET_CFG_MAC_ADDR, the spec says the driver should generate a random mac.It's probably too late to do this.
Not sure why.
Quoted 2 lines
Most of the parents have this
feature support, so probably not a real issue.
I guess not reporting MTU is not worse than failing initialization.
Quoted 21 lines
Quoted 11 lines
Quoted 8 lines
val_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSif no
VIRTIO_NET_F_STATUS, we should notnla_putVDPA_ATTR_DEV_NET_STATUS, the spec says the driver should assume the link is active.Somehow similar to
F_MAC. But we can report ifF_MACis not negotiated.Quoted 6 lines
Quoted 6 lines
val_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;
Quoted 30 lines
Quoted 3 lines
Quoted 1 line
MTU returned even without
VIRTIO_NET_F_MTUsame as above, the spec says config.mtu depends on
VIRTIO_NET_F_MTU, so without this feature bit, we should not return MTU to the userspace.Not a big issue, we just need to make sure the parent can report a correct MTU here.
Thanks
Quoted 21 lines
Does these fix look good to you?
And I think we may need your adjudication for the two issues:
(1) Shall we answermax_vq_paris= 1 when_MQnot exist, I know you have agreed on this in a previous thread, its nice to clarify
(2) I think we should not re-use the netlink attr to report feature bits of both the management device and the vDPA device,
this can lead to a new race condition, there are nolocks(especially distributed locks for kernel_space and user_space)in thenla_putfunctions. Re-using the attr is some kind of breaking the netlink lockless design.Thanks,
Zhu LingshanQuoted 5 lines
What's going on here?
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
In reply to Michael S. TsirkinQuoted 72 lines · Michael S. Tsirkin
Quoted 34 lines · Parav Pandit
Quoted 34 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct virtio_net_config config = {}; u64 features; u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac)) return -EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;
Quoted 4 lines
MTU returned even without
VIRTIO_NET_F_MTUWhat's going on here?
Probably too late to fix, but this should be fine as long as all parents support STATUS/MTU/MAC.
I wonder if we can add a check in the core and fail the device registration in this case.
Thanks
Quoted 5 lines
--
MST
Michael S. Tsirkin
maintainerRe: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 73 lines · Jason Wang
Quoted 72 lines · Michael S. Tsirkin
Quoted 34 lines · Parav Pandit
Quoted 34 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct virtio_net_config config = {}; u64 features; u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac)) return -EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;
Quoted 7 lines
Quoted 4 lines
MTU returned even without
VIRTIO_NET_F_MTUWhat's going on here?
Probably too late to fix, but this should be fine as long as all parents support STATUS/MTU/MAC.
Why is this too late to fix.
Quoted 10 lines
I wonder if we can add a check in the core and fail the device registration in this case.
Thanks
Quoted 5 lines
--
MST
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 78 lines · Michael S. Tsirkin
Quoted 76 lines · Jason Wang
Quoted 75 lines · Michael S. Tsirkin
Quoted 34 lines · Parav Pandit
Quoted 34 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct virtio_net_config config = {}; u64 features; u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac)) return -EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;MTU returned even without
VIRTIO_NET_F_MTU
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
What's going on here?
Probably too late to fix, but this should be fine as long as all parents support STATUS/MTU/MAC.
Why is this too late to fix.
If we make this conditional on the features. This may break the userspace that always expects VDPA_ATTR_DEV_NET_CFG_MTU?
Thanks
Quoted 12 lines
Quoted 11 lines
I wonder if we can add a check in the core and fail the device registration in this case.
Thanks
Quoted 5 lines
--
MST
Michael S. Tsirkin
maintainerRe: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 84 lines · Jason Wang
Quoted 83 lines · Michael S. Tsirkin
Quoted 80 lines · Jason Wang
Quoted 72 lines · Michael S. Tsirkin
Quoted 34 lines · Parav Pandit
Quoted 34 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct virtio_net_config config = {}; u64 features; u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac)) return -EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;Quoted 4 lines
MTU returned even without
VIRTIO_NET_F_MTUWhat's going on here?
Probably too late to fix, but this should be fine as long as all parents support STATUS/MTU/MAC.
Quoted 6 lines
Quoted 1 line
Why is this too late to fix.
If we make this conditional on the features. This may break the userspace that always expects
VDPA_ATTR_DEV_NET_CFG_MTU?Thanks
Well only on devices without MTU. I'm saying said userspace was reading trash on such devices anyway.
We don't generally maintain bug for bug compatiblity on a whim, only if userspace is actually known to break if we fix a bug.
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
I wonder if we can add a check in the core and fail the device registration in this case.
Thanks
Quoted 5 lines
--
MST
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 88 lines · Michael S. Tsirkin
Quoted 86 lines · Jason Wang
Quoted 84 lines · Michael S. Tsirkin
Quoted 73 lines · Jason Wang
Quoted 72 lines · Michael S. Tsirkin
Quoted 34 lines · Parav Pandit
Quoted 34 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct virtio_net_config config = {}; u64 features; u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac)) return -EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;Quoted 7 lines
Quoted 4 lines
MTU returned even without
VIRTIO_NET_F_MTUWhat's going on here?
Probably too late to fix, but this should be fine as long as all parents support STATUS/MTU/MAC.
Why is this too late to fix.
Quoted 7 lines
Quoted 4 lines
If we make this conditional on the features. This may break the userspace that always expects
VDPA_ATTR_DEV_NET_CFG_MTU?Thanks
Well only on devices without MTU. I'm saying said userspace was reading trash on such devices anyway.
It depends on the parent actually. For example, mlx5 query the lower mtu unconditionally:
err = query_mtu(mdev, &mtu);
if (err)
goto err_alloc;
ndev->config.mtu = cpu_to_mlx5vdpa16(mvdev, mtu);Supporting MTU features seems to be a must for real hardware. Otherwise the driver may not work correctly.
Quoted 2 lines
We don't generally maintain bug for bug compatiblity on a whim, only if userspace is actually known to break if we fix a bug.
So I think it should be fine to make this conditional then we should
have a consistent handling of other fields like MQ.
Thanks
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
I wonder if we can add a check in the core and fail the device registration in this case.
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Thanks
Quoted 5 lines
--
MST
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 96 lines · Jason Wang
Quoted 79 lines · Michael S. Tsirkin
Quoted 78 lines · Jason Wang
Quoted 77 lines · Michael S. Tsirkin
Quoted 76 lines · Jason Wang
Quoted 69 lines · Michael S. Tsirkin
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct virtio_net_config config = {}; u64 features; u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac)) return -EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;Quoted 4 lines
MTU returned even without
VIRTIO_NET_F_MTUWhat's going on here?
Probably too late to fix, but this should be fine as long as all parents support STATUS/MTU/MAC.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Why is this too late to fix.
If we make this conditional on the features. This may break the userspace that always expects
VDPA_ATTR_DEV_NET_CFG_MTU?Thanks
Well only on devices without MTU. I'm saying said userspace was reading trash on such devices anyway.
It depends on the parent actually. For example, mlx5 query the lower mtu unconditionally:
err = query_mtu(mdev, &mtu); if (err) goto err_alloc; ndev->config.mtu = cpu_to_mlx5vdpa16(mvdev, mtu);
Quoted 7 lines
Supporting MTU features seems to be a must for real hardware. Otherwise the driver may not work correctly.
Quoted 2 lines
We don't generally maintain bug for bug compatiblity on a whim, only if userspace is actually known to break if we fix a bug.
So I think it should be fine to make this conditional then we should
have a consistent handling of other fields like MQ.
For some fields that have a default value, like MQ =1, we can return the default value. For other fields without a default value, like MAC, we return nothing.
Does this sounds good? So, for MTU, if without _F_MTU, I think we can return 1500 by default.
Thanks,
Zhu Lingshan
Quoted 13 lines
Thanks
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
I wonder if we can add a check in the core and fail the device registration in this case.
Thanks
Quoted 4 lines
--
MST
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 105 lines · Lingshan
Quoted 101 lines · Jason Wang
Quoted 79 lines · Michael S. Tsirkin
Quoted 78 lines · Jason Wang
Quoted 77 lines · Michael S. Tsirkin
Quoted 76 lines · Jason Wang
Quoted 69 lines · Michael S. Tsirkin
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PM
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes max_queue_pair = 1 by itself.
I think the kernel module have all necessary information and it is
the only one which have precise information of a device, so it
should answer precisely than let the user space guess. The kernel
module should be reliable than stay silent, leave the question to
the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct virtio_net_config config = {}; u64 features; u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac)) return -EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;Quoted 4 lines
MTU returned even without
VIRTIO_NET_F_MTUWhat's going on here?
Probably too late to fix, but this should be fine as long as all parents support STATUS/MTU/MAC.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Why is this too late to fix.
If we make this conditional on the features. This may break the userspace that always expects
VDPA_ATTR_DEV_NET_CFG_MTU?Thanks
Well only on devices without MTU. I'm saying said userspace was reading trash on such devices anyway.
It depends on the parent actually. For example, mlx5 query the lower mtu unconditionally:
err = query_mtu(mdev, &mtu); if (err) goto err_alloc; ndev->config.mtu = cpu_to_mlx5vdpa16(mvdev, mtu);Supporting MTU features seems to be a must for real hardware. Otherwise the driver may not work correctly.
Quoted 2 lines
We don't generally maintain bug for bug compatiblity on a whim, only if userspace is actually known to break if we fix a bug.
Quoted 8 lines
Quoted 2 lines
So I think it should be fine to make this conditional then we should
have a consistent handling of other fields like MQ.For some fields that have a default value, like MQ =1, we can return the default value.
For other fields without a default value, like MAC, we return nothing.Does this sounds good? So, for MTU, if without
_F_MTU, I think we can return 1500 by default.
Or we can just read MTU from the device.
But It looks to me Michael wants it conditional.
Thanks
Quoted 17 lines
Thanks,
Zhu LingshanQuoted 13 lines
Thanks
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
I wonder if we can add a check in the core and fail the device registration in this case.
Thanks
Quoted 4 lines
--
MST
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 111 lines · Jason Wang
Quoted 110 lines · Lingshan
Quoted 96 lines · Jason Wang
Quoted 79 lines · Michael S. Tsirkin
Quoted 78 lines · Jason Wang
Quoted 77 lines · Michael S. Tsirkin
Quoted 76 lines · Jason Wang
Quoted 69 lines · Michael S. Tsirkin
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PM
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
is not supported, hence it takes max_queue_pair = 1 by itself.
I think the kernel module have all necessary information and it is
the only one which have precise information of a device, so it
should answer precisely than let the user space guess. The kernel
module should be reliable than stay silent, leave the question to
the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the
field doesn’tQuoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if _MQ
present/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If _MQ not present, it means this device has one VQ pair.
it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct virtio_net_config config = {}; u64 features; u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac)) return -EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;Quoted 4 lines
MTU returned even without
VIRTIO_NET_F_MTUWhat's going on here?
Probably too late to fix, but this should be fine as long as all parents support STATUS/MTU/MAC.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Why is this too late to fix.
If we make this conditional on the features. This may break the userspace that always expects
VDPA_ATTR_DEV_NET_CFG_MTU?Thanks
Well only on devices without MTU. I'm saying said userspace was reading trash on such devices anyway.
It depends on the parent actually. For example, mlx5 query the lower mtu unconditionally:
err = query_mtu(mdev, &mtu); if (err) goto err_alloc; ndev->config.mtu = cpu_to_mlx5vdpa16(mvdev, mtu);Quoted 7 lines
Supporting MTU features seems to be a must for real hardware. Otherwise the driver may not work correctly.
Quoted 2 lines
We don't generally maintain bug for bug compatiblity on a whim, only if userspace is actually known to break if we fix a bug.
So I think it should be fine to make this conditional then we should
have a consistent handling of other fields like MQ.For some fields that have a default value, like MQ =1, we can return the default value.
For other fields without a default value, like MAC, we return nothing.
Quoted 5 lines
Quoted 2 lines
Does this sounds good? So, for MTU, if without
_F_MTU, I think we can return 1500 by default.Or we can just read MTU from the device.
But It looks to me Michael wants it conditional.
if _F_MTU is offered, we can read it from the device config space. If _F_MTU not offered, I think it is conditional, however there can be a min default value, 1500 for Ethernet.
Thanks,
Zhu Lingshan
Quoted 15 lines
Thanks
Quoted 12 lines
Thanks,
Zhu LingshanQuoted 10 lines
Thanks
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
I wonder if we can add a check in the core and fail the device registration in this case.
Thanks
Quoted 3 lines
--
MST
Michael S. Tsirkin
maintainerRe: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
In reply to Jason WangQuoted 112 lines · Jason Wang
Quoted 111 lines · Lingshan
Quoted 96 lines · Jason Wang
Quoted 79 lines · Michael S. Tsirkin
Quoted 78 lines · Jason Wang
Quoted 77 lines · Michael S. Tsirkin
Quoted 76 lines · Jason Wang
Quoted 69 lines · Michael S. Tsirkin
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PM
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
is not supported, hence it takes max_queue_pair = 1 by itself.
I think the kernel module have all necessary information and it is
the only one which have precise information of a device, so it
should answer precisely than let the user space guess. The kernel
module should be reliable than stay silent, leave the question to
the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the
field doesn’tQuoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if _MQ
present/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If _MQ not present, it means this device has one VQ pair.
it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct virtio_net_config config = {}; u64 features; u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac)) return -EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;Quoted 4 lines
MTU returned even without
VIRTIO_NET_F_MTUWhat's going on here?
Probably too late to fix, but this should be fine as long as all parents support STATUS/MTU/MAC.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Why is this too late to fix.
If we make this conditional on the features. This may break the userspace that always expects
VDPA_ATTR_DEV_NET_CFG_MTU?Thanks
Well only on devices without MTU. I'm saying said userspace was reading trash on such devices anyway.
It depends on the parent actually. For example, mlx5 query the lower mtu unconditionally:
err = query_mtu(mdev, &mtu); if (err) goto err_alloc; ndev->config.mtu = cpu_to_mlx5vdpa16(mvdev, mtu);Quoted 7 lines
Supporting MTU features seems to be a must for real hardware. Otherwise the driver may not work correctly.
Quoted 2 lines
We don't generally maintain bug for bug compatiblity on a whim, only if userspace is actually known to break if we fix a bug.
So I think it should be fine to make this conditional then we should
have a consistent handling of other fields like MQ.For some fields that have a default value, like MQ =1, we can return the default value.
For other fields without a default value, like MAC, we return nothing.
Quoted 8 lines
Quoted 2 lines
Does this sounds good? So, for MTU, if without
_F_MTU, I think we can return 1500 by default.Or we can just read MTU from the device.
But It looks to me Michael wants it conditional.
Thanks
I'm fine either way but let's keep it consistent. And I think Parav wants it conditional.
Quoted 10 lines
Quoted 10 lines
Thanks,
Zhu LingshanQuoted 7 lines
Thanks
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
I wonder if we can add a check in the core and fail the device registration in this case.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Thanks
Quoted 4 lines
--
MST
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 117 lines · Michael S. Tsirkin
Quoted 115 lines · Jason Wang
Quoted 113 lines · Lingshan
Quoted 96 lines · Jason Wang
Quoted 79 lines · Michael S. Tsirkin
Quoted 78 lines · Jason Wang
Quoted 77 lines · Michael S. Tsirkin
Quoted 76 lines · Jason Wang
Quoted 69 lines · Michael S. Tsirkin
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 25 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMOn 7/26/2022 11:56 PM, Parav Pandit wrote:
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PM
When the user space which invokes netlink commands, detects that
_MQ
is not supported, hence it takes max_queue_pair = 1 by itself.
I think the kernel module have all necessary information and it is
the only one which have precise information of a device, so it
should answer precisely than let the user space guess. The kernel
module should be reliable than stay silent, leave the question to
the user space
tool.
Kernel is reliable. It doesn’t expose a config space field if the
field doesn’t
exist regardless of field should have default or no default.
so when you know it is one queue pair, you should answer one, not try
to guess.
User space should not guess either. User space gets to see if _MQ
present/not present. If _MQ present than get reliable data from kernel.
If _MQ not present, it means this device has one VQ pair.
it is still a guess, right? And all user space tools implemented this
feature need to guessNo. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct virtio_net_config config = {}; u64 features; u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac)) return -EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;Quoted 4 lines
MTU returned even without
VIRTIO_NET_F_MTUWhat's going on here?
Probably too late to fix, but this should be fine as long as all parents support STATUS/MTU/MAC.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Why is this too late to fix.
If we make this conditional on the features. This may break the userspace that always expects
VDPA_ATTR_DEV_NET_CFG_MTU?Thanks
Well only on devices without MTU. I'm saying said userspace was reading trash on such devices anyway.
It depends on the parent actually. For example, mlx5 query the lower mtu unconditionally:
err = query_mtu(mdev, &mtu); if (err) goto err_alloc; ndev->config.mtu = cpu_to_mlx5vdpa16(mvdev, mtu);Quoted 7 lines
Supporting MTU features seems to be a must for real hardware. Otherwise the driver may not work correctly.
Quoted 2 lines
We don't generally maintain bug for bug compatiblity on a whim, only if userspace is actually known to break if we fix a bug.
So I think it should be fine to make this conditional then we should
have a consistent handling of other fields like MQ.For some fields that have a default value, like MQ =1, we can return the default value.
For other fields without a default value, like MAC, we return nothing.Does this sounds good? So, for MTU, if without
_F_MTU, I think we can return 1500 by default.
Quoted 8 lines
Quoted 5 lines
Or we can just read MTU from the device.
But It looks to me Michael wants it conditional.
Thanks
I'm fine either way but let's keep it consistent. And I think Parav wants it conditional.
Parav, what's your opinion here?
Michale spots some in-consistent stuffs, so I think we should either
1) make all conditional, so we should change both MTU and MAC
or
2) make them unconditional, so we should only change MQ
Thanks
Quoted 19 lines
Quoted 18 lines
Quoted 18 lines
Thanks,
Zhu LingshanQuoted 13 lines
Thanks
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
I wonder if we can add a check in the core and fail the device registration in this case.
Thanks
Quoted 4 lines
--
MST
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
In reply to Michael S. TsirkinQuoted 69 lines · Michael S. Tsirkin
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct virtio_net_config config = {}; u64 features; u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac)) return -EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;
Quoted 6 lines
MTU returned even without
VIRTIO_NET_F_MTUWhat's going on here?
I guess this is spec thing (historical debt), I vaguely recall these fields are always present in config space regardless the existence of corresponding feature bit.
-Siwei
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerRe: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 75 lines · Si-Wei Liu
Quoted 72 lines · Michael S. Tsirkin
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct virtio_net_config config = {}; u64 features; u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac)) return -EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;MTU returned even without
VIRTIO_NET_F_MTU
Quoted 8 lines
Quoted 3 lines
What's going on here?
I guess this is spec thing (historical debt), I vaguely recall these fields are always present in config space regardless the existence of corresponding feature bit.
-Siwei
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered before accessing that part of the configuration space.
Signature · 1 line
MST
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 83 lines · Michael S. Tsirkin
Quoted 74 lines · Si-Wei Liu
Quoted 72 lines · Michael S. Tsirkin
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct virtio_net_config config = {}; u64 features; u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac)) return -EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;MTU returned even without
VIRTIO_NET_F_MTUQuoted 8 lines
Quoted 3 lines
What's going on here?
I guess this is spec thing (historical debt), I vaguely recall these fields are always present in config space regardless the existence of corresponding feature bit.
-Siwei
Quoted 8 lines
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered before accessing that part of the configuration space.
Well, this is driver side of requirement. As this interface is for host admin tool to query or configure vdpa device, we don't have to wait until feature negotiation is done on guest driver to extract vdpa attributes/parameters, say if we want to replicate another vdpa device with the same config on migration destination. I think what may need to be fix is to move off from using .vdpa_get_config_unlocked() which depends on feature negotiation. And/or expose config space register values through another set of attributes.
-Siwei
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 88 lines · Si-Wei Liu
Quoted 85 lines · Michael S. Tsirkin
Quoted 74 lines · Si-Wei Liu
Quoted 72 lines · Michael S. Tsirkin
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct
virtio_net_configconfig = {};
u64 features;
u16val_u16;vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config));
if (
nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac))
return-EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 =
le16_to_cpu(config.status);
if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return-EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 =
le16_to_cpu(config.mtu);
if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return-EMSGSIZE;MTU returned even without
VIRTIO_NET_F_MTUQuoted 8 lines
Quoted 3 lines
What's going on here?
I guess this is spec thing (historical debt), I vaguely recall these fields are always present in config space regardless the existence of corresponding feature bit.
-Siwei
Nope:
Quoted 7 lines
Quoted 6 lines
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered before accessing that part of the configuration space.
Well, this is driver side of requirement. As this interface is for host admin tool to query or configure vdpa device, we don't have to wait until feature negotiation is done on guest driver to extract vdpa attributes/parameters, say if we want to replicate another vdpa device with the same config on migration destination. I think what may need to be fix is to move off from using .vdpa_get_config_unlocked() which depends on feature negotiation. And/or expose config space register values through another set of attributes.
Yes, we don't have to wait for FEATURES_OK. In another patch in this series, I have added a new netlink attr to report the device features, and removed the blocker. So the LM orchestration SW can query the device features of the devices at the destination cluster, and pick a proper one, even mask out some features to meet the LM requirements.
Thanks,
Zhu Lingshan
Quoted 5 lines
-Siwei
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 91 lines · Lingshan
Quoted 88 lines · Si-Wei Liu
Quoted 85 lines · Michael S. Tsirkin
Quoted 74 lines · Si-Wei Liu
Quoted 72 lines · Michael S. Tsirkin
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct
virtio_net_configconfig = {};
u64 features;
u16val_u16;vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config));
if (
nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac))
return-EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 =
le16_to_cpu(config.status);
if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return-EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 =
le16_to_cpu(config.mtu);
if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return-EMSGSIZE;MTU returned even without
VIRTIO_NET_F_MTUQuoted 8 lines
Quoted 3 lines
What's going on here?
I guess this is spec thing (historical debt), I vaguely recall these fields are always present in config space regardless the existence of corresponding feature bit.
-Siwei
Nope:
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered before accessing that part of the configuration space.
Well, this is driver side of requirement. As this interface is for host admin tool to query or configure vdpa device, we don't have to wait until feature negotiation is done on guest driver to extract vdpa attributes/parameters, say if we want to replicate another vdpa device with the same config on migration destination. I think what may need to be fix is to move off from using .vdpa_get_config_unlocked() which depends on feature negotiation. And/or expose config space register values through another set of attributes.
Yes, we don't have to wait for
FEATURES_OK. In another patch in this series, I have added a new netlink attr to report the device features, and removed the blocker. So the LM orchestration SW can query the device features of the devices at the destination cluster, and pick a proper one, even mask out some features to meet the LM requirements.
For that end, you'd need to move off from using vdpa_get_config_unlocked() which depends on feature negotiation. Since this would slightly change the original semantics of each field that "vdpa dev config" shows, it probably need another netlink command and new uAPI.
-Siwei
Quoted 9 lines
Thanks,
Zhu LingshanQuoted 5 lines
-Siwei
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 96 lines · Si-Wei Liu
Quoted 93 lines · Lingshan
Quoted 90 lines · Si-Wei Liu
Quoted 87 lines · Michael S. Tsirkin
Quoted 74 lines · Si-Wei Liu
Quoted 72 lines · Michael S. Tsirkin
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct
virtio_net_configconfig = {};
u64 features;
u16val_u16;vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config));
if (
nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac))
return-EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 =
le16_to_cpu(config.status);
if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return-EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 =
le16_to_cpu(config.mtu);
if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return-EMSGSIZE;MTU returned even without
VIRTIO_NET_F_MTUQuoted 8 lines
Quoted 3 lines
What's going on here?
I guess this is spec thing (historical debt), I vaguely recall these fields are always present in config space regardless the existence of corresponding feature bit.
-Siwei
Nope:
2.5.1 Driver Requirements: Device Configuration Space
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered before accessing that part of the configuration space.
Well, this is driver side of requirement. As this interface is for host admin tool to query or configure vdpa device, we don't have to wait until feature negotiation is done on guest driver to extract vdpa attributes/parameters, say if we want to replicate another vdpa device with the same config on migration destination. I think what may need to be fix is to move off from using .vdpa_get_config_unlocked() which depends on feature negotiation. And/or expose config space register values through another set of attributes.
Yes, we don't have to wait for
FEATURES_OK. In another patch in this series, I have added a new netlink attr to report the device features, and removed the blocker. So the LM orchestration SW can query the device features of the devices at the destination cluster, and pick a proper one, even mask out some features to meet the LM requirements.For that end, you'd need to move off from using
vdpa_get_config_unlocked()which depends on feature negotiation. Since this would slightly change the original semantics of each field that "vdpa dev config" shows, it probably need another netlink command and new uAPI.
why not show both device_features and driver_features in "vdpa dev config show"?
Quoted 14 lines
-Siwei
Quoted 9 lines
Thanks,
Zhu LingshanQuoted 5 lines
-Siwei
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 99 lines · Lingshan
Quoted 96 lines · Si-Wei Liu
Quoted 93 lines · Lingshan
Quoted 90 lines · Si-Wei Liu
Quoted 87 lines · Michael S. Tsirkin
Quoted 74 lines · Si-Wei Liu
Quoted 72 lines · Michael S. Tsirkin
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PM
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes max_queue_pair = 1 by itself.
I think the kernel module have all necessary information and it is
the only one which have precise information of a device, so it
should answer precisely than let the user space guess. The kernel
module should be reliable than stay silent, leave the question to
the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct
virtio_net_configconfig = {};
u64 features;
u16val_u16;vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config));
if (
nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac))
return-EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 =
le16_to_cpu(config.status);
if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return-EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 =
le16_to_cpu(config.mtu);
if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return-EMSGSIZE;MTU returned even without
VIRTIO_NET_F_MTUQuoted 8 lines
Quoted 3 lines
What's going on here?
I guess this is spec thing (historical debt), I vaguely recall these fields are always present in config space regardless the existence of corresponding feature bit.
-Siwei
Nope:
2.5.1 Driver Requirements: Device Configuration Space
Quoted 9 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered before accessing that part of the configuration space.
Well, this is driver side of requirement. As this interface is for host admin tool to query or configure vdpa device, we don't have to wait until feature negotiation is done on guest driver to extract vdpa attributes/parameters, say if we want to replicate another vdpa device with the same config on migration destination. I think what may need to be fix is to move off from using .vdpa_get_config_unlocked() which depends on feature negotiation. And/or expose config space register values through another set of attributes.
Yes, we don't have to wait for
FEATURES_OK. In another patch in this series, I have added a new netlink attr to report the device features, and removed the blocker. So the LM orchestration SW can query the device features of the devices at the destination cluster, and pick a proper one, even mask out some features to meet the LM requirements.For that end, you'd need to move off from using
vdpa_get_config_unlocked()which depends on feature negotiation. Since this would slightly change the original semantics of each field that "vdpa dev config" shows, it probably need another netlink command and new uAPI.why not show both
device_featuresanddriver_featuresin "vdpa dev config show"?
As I requested in the other email, I'd like to see the proposed 'vdpa dev config ...' example output for various phases in feature negotiation, and the specific use case (motivation) for this proposed output. I am having difficulty to match what you want to do with the patch posted.
-Siwei
Quoted 7 lines
Quoted 7 lines
-Siwei
Quoted 3 lines
Thanks,
Zhu Lingshan
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
-Siwei
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 104 lines · Si-Wei Liu
Quoted 101 lines · Lingshan
Quoted 98 lines · Si-Wei Liu
Quoted 95 lines · Lingshan
Quoted 92 lines · Si-Wei Liu
Quoted 89 lines · Michael S. Tsirkin
Quoted 74 lines · Si-Wei Liu
Quoted 72 lines · Michael S. Tsirkin
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PM
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
is not supported, hence it takes max_queue_pair = 1 by itself.
I think the kernel module have all necessary information and it is
the only one which have precise information of a device, so it
should answer precisely than let the user space guess. The kernel
module should be reliable than stay silent, leave the question to
the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the
field doesn’tQuoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if _MQ
present/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If _MQ not present, it means this device has one VQ pair.
it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct
virtio_net_configconfig = {};
u64 features;
u16val_u16;vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config));
if (
nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac))
return-EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 =
le16_to_cpu(config.status);
if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return-EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 =
le16_to_cpu(config.mtu);
if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return-EMSGSIZE;MTU returned even without
VIRTIO_NET_F_MTUQuoted 8 lines
Quoted 3 lines
What's going on here?
I guess this is spec thing (historical debt), I vaguely recall these fields are always present in config space regardless the existence of corresponding feature bit.
-Siwei
Nope:
2.5.1 Driver Requirements: Device Configuration Space
...
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
For optional configuration space fields, the driver MUST check that the corresponding feature is offered before accessing that part of the configuration space.
Well, this is driver side of requirement. As this interface is for host admin tool to query or configure vdpa device, we don't have to wait until feature negotiation is done on guest driver to extract vdpa attributes/parameters, say if we want to replicate another vdpa device with the same config on migration destination. I think what may need to be fix is to move off from using .vdpa_get_config_unlocked() which depends on feature negotiation. And/or expose config space register values through another set of attributes.
Yes, we don't have to wait for
FEATURES_OK. In another patch in this series, I have added a new netlink attr to report the device features, and removed the blocker. So the LM orchestration SW can query the device features of the devices at the destination cluster, and pick a proper one, even mask out some features to meet the LM requirements.For that end, you'd need to move off from using
vdpa_get_config_unlocked()which depends on feature negotiation. Since this would slightly change the original semantics of each field that "vdpa dev config" shows, it probably need another netlink command and new uAPI.why not show both
device_featuresanddriver_featuresin "vdpa dev config show"?As I requested in the other email, I'd like to see the proposed 'vdpa dev config ...' example output for various phases in feature negotiation, and the specific use case (motivation) for this proposed output. I am having difficulty to match what you want to do with the patch posted.
The features bits of a device don't depend on the phases, and the driver_features only has meaningful values when FEATURES_OK.
Thanks
Quoted 19 lines
-Siwei
Quoted 15 lines
Quoted 14 lines
-Siwei
Quoted 9 lines
Thanks,
Zhu LingshanQuoted 5 lines
-Siwei
Michael S. Tsirkin
maintainerRe: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
In reply to Si-Wei LiuQuoted 88 lines · Si-Wei Liu
Quoted 85 lines · Michael S. Tsirkin
Quoted 74 lines · Si-Wei Liu
Quoted 72 lines · Michael S. Tsirkin
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan <[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct virtio_net_config config = {}; u64 features; u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac)) return -EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;MTU returned even without
VIRTIO_NET_F_MTUQuoted 8 lines
Quoted 3 lines
What's going on here?
I guess this is spec thing (historical debt), I vaguely recall these fields are always present in config space regardless the existence of corresponding feature bit.
-Siwei
Nope:
Quoted 7 lines
Quoted 6 lines
2.5.1 Driver Requirements: Device Configuration Space
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered before accessing that part of the configuration space.
Well, this is driver side of requirement.
Well driver and device are the only two entities in the spec.
Quoted 9 lines
As this interface is for host
admin tool to query or configure vdpa device, we don't have to wait until feature negotiation is done on guest driver to extract vdpa attributes/parameters, say if we want to replicate another vdpa device with the same config on migration destination. I think what may need to be fix is to move off from using .vdpa_get_config_unlocked() which depends on feature negotiation. And/or expose config space register values through another set of attributes.
Quoted 3 lines
-Siwei
Sounds like something that might use the proposed admin queue maybe. Hope that makes progress ...
Signature · 1 line
MST
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 89 lines · Michael S. Tsirkin
Quoted 88 lines · Si-Wei Liu
Quoted 86 lines · Michael S. Tsirkin
Quoted 73 lines · Si-Wei Liu
Quoted 72 lines · Michael S. Tsirkin
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Zhu, Lingshan<[email protected]>
Sent: Tuesday, July 26, 2022 10:53 PMQuoted 29 lines · Parav Pandit
Quoted 17 lines
From: Zhu, Lingshan<[email protected]>
Sent: Tuesday, July 26, 2022 10:15 PMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu, Lingshan<[email protected]>
Sent: Tuesday, July 12, 2022 11:46 PMQuoted 1 line
When the user space which invokes netlink commands, detects that
_MQQuoted 6 lines
Quoted 6 lines
is not supported, hence it takes
max_queue_pair= 1 by itself. I think the kernel module have all necessary information and it is the only one which have precise information of a device, so it should answer precisely than let the user space guess. The kernel module should be reliable than stay silent, leave the question to the user spacetool.
Quoted 2 lines
Kernel is reliable. It doesn’t expose a config space field if the field doesn’t
Quoted 8 lines
exist regardless of field should have default or no default. so when you know it is one queue pair, you should answer one, not try to guess.
Quoted 1 line
User space should not guess either. User space gets to see if
_MQpresent/not present. If
_MQpresent than get reliable data from kernel.Quoted 1 line
If
_MQnot present, it means this device has one VQ pair.it is still a guess, right? And all user space tools implemented this feature need to guess
No. it is not a guess.
It is explicitly checking the_MQfeature and deriving the value. The code you proposed will be present in the user space.
It will be uniform for_MQand 10 other features that are present now andQuoted 6 lines
Quoted 4 lines
in the future.
MQ and other features like RSS are different. If there is no_RSS_XX, there are no attributes likemax_rss_key_size, and there is not a default value. But for MQ, we know it has to be 1 wihtout_MQ."we" = user space.
To keep the consistency among all the config space fields.Actually I looked and the code some more and I'm puzzled:
struct virtio_net_config config = {}; u64 features; u16 val_u16; vdpa_get_config_unlocked(vdev, 0, &config, sizeof(config)); if (nla_put(msg, VDPA_ATTR_DEV_NET_CFG_MACADDR, sizeof(config.mac), config.mac)) return -EMSGSIZE;Mac returned even without
VIRTIO_NET_F_MACval_u16 = le16_to_cpu(config.status); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_STATUS, val_u16)) return -EMSGSIZE;status returned even without
VIRTIO_NET_F_STATUSval_u16 = le16_to_cpu(config.mtu); if (nla_put_u16(msg, VDPA_ATTR_DEV_NET_CFG_MTU, val_u16)) return -EMSGSIZE;MTU returned even without
VIRTIO_NET_F_MTUQuoted 8 lines
Quoted 3 lines
What's going on here?
I guess this is spec thing (historical debt), I vaguely recall these fields are always present in config space regardless the existence of corresponding feature bit.
-Siwei
Nope:
2.5.1 Driver Requirements: Device Configuration Space
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
...
For optional configuration space fields, the driver MUST check that the corresponding feature is offered before accessing that part of the configuration space.
Well, this is driver side of requirement.
Well driver and device are the only two entities in the spec.
We should mostly concern with device side requirement as this is what the vdpa admin tool is targeted for. Please refer to my earlier email//addressed to Jason.
Quoted 10 lines
Quoted 10 lines
As this interface is for host
admin tool to query or configure vdpa device, we don't have to wait until feature negotiation is done on guest driver to extract vdpa attributes/parameters, say if we want to replicate another vdpa device with the same config on migration destination. I think what may need to be fix is to move off from using .vdpa_get_config_unlocked() which depends on feature negotiation. And/or expose config space register values through another set of attributes.
Quoted 5 lines
Quoted 3 lines
-Siwei
Sounds like something that might use the proposed admin queue maybe. Hope that makes progress ...
Well it doesn't need to be that complex. Depending on need we may extract device configs pre-negotiation from vendor's vdpa device via some other op, but I doubt worth doing so. I don't quite understand the use case why we need to expose those values.
-Siwei
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerRe: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
In reply to Parav PanditQuoted 18 lines · Parav Pandit
Quoted 13 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AM
IfVIRTIO_NET_F_MQ== 0, the virtio device should have one queue pair, so when userspace querying queue pair numbers, it should return mq=1 than zero.Function
vdpa_dev_net_config_fill()fills the attributions of the vDPA devices, so that it should callvdpa_dev_net_mq_config_fill()so the parameter invdpa_dev_net_mq_config_fill()should befeature_devicethanfeature_driverfor the vDPA devices themselvesQuoted 5 lines
Before this change, when MQ = 0, iproute2 output:
$vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link uplink_announcefalsemax_vq_pairs0 mtu 1500
Quoted 8 lines
The fix belongs to user space.
When a feature bit_MQis not negotiated, vdpa kernel space will not add attributeVDPA_ATTR_DEV_NET_CFG_MAX_VQP. When such attribute is not returned by kernel,max_vq_pairsshould not be shown by the iproute2.We have many config space fields that depend on the feature bits and some of them do not have any defaults. To keep consistency of existence of config space fields among all, we don't want to show default like below.
Please fix the iproute2 to not print
max_vq_pairswhen it is not returned by the kernel.
Parav I read the discussion and don't get your argument. From driver's POV _MQ with 1 VQ pair and !_MQ are exactly functionally equivalent.
It's true that iproute probably needs to be fixed too, to handle old kernels. But iproute is not the only userspace, why not make it's life easier by fixing the kernel?
Signature · 6 lines
MST _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 25 lines · Michael S. Tsirkin
Quoted 24 lines · Parav Pandit
Quoted 12 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AM
IfVIRTIO_NET_F_MQ== 0, the virtio device should have one queue pair, so when userspace querying queue pair numbers, it should return mq=1 than zero.Function
vdpa_dev_net_config_fill()fills the attributions of the vDPA devices, so that it should callvdpa_dev_net_mq_config_fill()so the parameter invdpa_dev_net_mq_config_fill()should befeature_devicethanfeature_driverfor the vDPA devices themselvesQuoted 5 lines
Before this change, when MQ = 0, iproute2 output:
$vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link uplink_announcefalsemax_vq_pairs0 mtu 1500The fix belongs to user space.
When a feature bit_MQis not negotiated, vdpa kernel space will not add attributeVDPA_ATTR_DEV_NET_CFG_MAX_VQP. When such attribute is not returned by kernel,max_vq_pairsshould not be shown by the iproute2.We have many config space fields that depend on the feature bits and some of them do not have any defaults. To keep consistency of existence of config space fields among all, we don't want to show default like below.
Quoted 7 lines
Quoted 1 line
Please fix the iproute2 to not print
max_vq_pairswhen it is not returned by the kernel.Parav I read the discussion and don't get your argument. From driver's POV
_MQwith 1 VQ pair and !_MQ are exactly functionally equivalent.It's true that iproute probably needs to be fixed too, to handle old kernels. But iproute is not the only userspace, why not make it's life easier by fixing the kernel?
I will fix iproute2 once this series settles down
Thanks,
Zhu Lingshan
RE: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
In reply to Michael S. TsirkinQuoted 31 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, July 13, 2022 1:27 AMQuoted 13 lines · Parav Pandit
Quoted 13 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AM
IfVIRTIO_NET_F_MQ== 0, the virtio device should have one queue pair, so when userspace querying queue pair numbers, it should return mq=1 than zero.Function
vdpa_dev_net_config_fill()fills the attributions of the vDPA devices, so that it should callvdpa_dev_net_mq_config_fill()so the parameter invdpa_dev_net_mq_config_fill()should befeature_devicethanfeature_driverfor the vDPA devices themselvesQuoted 7 lines
Quoted 5 lines
Before this change, when MQ = 0, iproute2 output:
$vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link uplink_announcefalsemax_vq_pairs0 mtu 1500The fix belongs to user space.
When a feature bit_MQis not negotiated, vdpa kernel space will not addattribute
VDPA_ATTR_DEV_NET_CFG_MAX_VQP.Quoted 1 line
When such attribute is not returned by kernel,
max_vq_pairsshould not beshown by the iproute2.
Quoted 2 lines
We have many config space fields that depend on the feature bits and
some of them do not have any defaults.
Quoted 8 lines
Quoted 1 line
To keep consistency of existence of config space fields among all, we don't
want to show default like below.
Quoted 2 lines
Please fix the iproute2 to not print
max_vq_pairswhen it is not returned bythe kernel.
Parav I read the discussion and don't get your argument. From driver's POV
_MQwith 1 VQ pair and !_MQ are exactly functionally equivalent.
But we are talking from user POV here.
Quoted 4 lines
It's true that iproute probably needs to be fixed too, to handle old kernels. But iproute is not the only userspace, why not make it's life easier by fixing the kernel?
Because it cannot be fixed for other config space fields which are control by feature bits those do not have any defaults. So better to treat all in same way from user POV.
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerRe: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 32 lines · Parav Pandit
Quoted 32 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, July 13, 2022 1:27 AMQuoted 13 lines · Parav Pandit
Quoted 13 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AM
IfVIRTIO_NET_F_MQ== 0, the virtio device should have one queue pair, so when userspace querying queue pair numbers, it should return mq=1 than zero.Function
vdpa_dev_net_config_fill()fills the attributions of the vDPA devices, so that it should callvdpa_dev_net_mq_config_fill()so the parameter invdpa_dev_net_mq_config_fill()should befeature_devicethanfeature_driverfor the vDPA devices themselvesQuoted 7 lines
Quoted 5 lines
Before this change, when MQ = 0, iproute2 output:
$vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link uplink_announcefalsemax_vq_pairs0 mtu 1500The fix belongs to user space.
When a feature bit_MQis not negotiated, vdpa kernel space will not addattribute
VDPA_ATTR_DEV_NET_CFG_MAX_VQP.Quoted 1 line
When such attribute is not returned by kernel,
max_vq_pairsshould not beshown by the iproute2.
Quoted 2 lines
We have many config space fields that depend on the feature bits and
some of them do not have any defaults.
Quoted 1 line
To keep consistency of existence of config space fields among all, we don't
Quoted 8 lines
Quoted 7 lines
want to show default like below.
Quoted 2 lines
Please fix the iproute2 to not print
max_vq_pairswhen it is not returned bythe kernel.
Parav I read the discussion and don't get your argument. From driver's POV
_MQwith 1 VQ pair and !_MQ are exactly functionally equivalent.But we are talking from user POV here.
From spec POV there's just driver and device, user would be part of driver here.
Quoted 6 lines
Quoted 4 lines
It's true that iproute probably needs to be fixed too, to handle old kernels. But iproute is not the only userspace, why not make it's life easier by fixing the kernel?
Because it cannot be fixed for other config space fields which are control by feature bits those do not have any defaults. So better to treat all in same way from user POV.
Consistency is good for sure. What are these other fields though? Can you give examples so I understand please?
Signature · 1 line
MST
RE: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 45 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Tuesday, July 26, 2022 3:49 PMQuoted 40 lines · Parav Pandit
Quoted 40 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, July 13, 2022 1:27 AMQuoted 13 lines · Parav Pandit
Quoted 13 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AM IfVIRTIO_NET_F_MQ== 0, the virtio device should have one queue pair, so when userspace querying queue pair numbers, it should return mq=1 than zero.Function
vdpa_dev_net_config_fill()fills the attributions of the vDPA devices, so that it should callvdpa_dev_net_mq_config_fill()so the parameter invdpa_dev_net_mq_config_fill()should befeature_devicethanfeature_driverfor the vDPA devices themselvesQuoted 8 lines
Quoted 5 lines
Before this change, when MQ = 0, iproute2 output:
$vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link uplink_announcefalsemax_vq_pairs0 mtu 1500The fix belongs to user space.
When a feature bit_MQis not negotiated, vdpa kernel space will not addattribute
VDPA_ATTR_DEV_NET_CFG_MAX_VQP.Quoted 2 lines
When such attribute is not returned by kernel,
max_vq_pairsshould not beshown by the iproute2.
Quoted 3 lines
We have many config space fields that depend on the feature bits and
some of them do not have any defaults.
Quoted 2 lines
To keep consistency of existence of config space fields among all, we don't
want to show default like below.
Quoted 3 lines
Please fix the iproute2 to not print
max_vq_pairswhen it is not returned by
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
the kernel.
Parav I read the discussion and don't get your argument. From driver's POV
_MQwith 1 VQ pair and !_MQ are exactly functionallyequivalent.
Quoted 1 line
But we are talking from user POV here.
From spec POV there's just driver and device, user would be part of driver here.
User space application still need to inspect the _MQ bit to
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
It's true that iproute probably needs to be fixed too, to handle old kernels. But iproute is not the only userspace, why not make it's life easier by fixing the kernel?
Quoted 7 lines
Quoted 1 line
Because it cannot be fixed for other config space fields which are control by
feature bits those do not have any defaults.
Quoted 1 line
So better to treat all in same way from user POV.
Consistency is good for sure. What are these other fields though?
Can you give examples so I understand please?
speed only exists if VIRTIO_NET_F_SPEED_DUPLEX. rss_max_key_size exists only if VIRTIO_NET_F_RSS exists.
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
Quoted 52 lines · Parav Pandit
Quoted 40 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Tuesday, July 26, 2022 3:49 PMQuoted 36 lines · Parav Pandit
Quoted 36 lines
From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, July 13, 2022 1:27 AMQuoted 12 lines · Parav Pandit
Quoted 12 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AM IfVIRTIO_NET_F_MQ== 0, the virtio device should have one queue pair, so when userspace querying queue pair numbers, it should return mq=1 than zero.Function
vdpa_dev_net_config_fill()fills the attributions of the vDPA devices, so that it should callvdpa_dev_net_mq_config_fill()so the parameter invdpa_dev_net_mq_config_fill()should befeature_devicethanfeature_driverfor the vDPA devices themselvesQuoted 8 lines
Quoted 5 lines
Before this change, when MQ = 0, iproute2 output:
$vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link uplink_announcefalsemax_vq_pairs0 mtu 1500The fix belongs to user space.
When a feature bit_MQis not negotiated, vdpa kernel space will not addattribute
VDPA_ATTR_DEV_NET_CFG_MAX_VQP.Quoted 2 lines
When such attribute is not returned by kernel,
max_vq_pairsshould not beshown by the iproute2.
Quoted 2 lines
We have many config space fields that depend on the feature bits and
some of them do not have any defaults.
Quoted 2 lines
To keep consistency of existence of config space fields among all, we don't
want to show default like below.
Quoted 2 lines
Please fix the iproute2 to not print
max_vq_pairswhen it is not returned byQuoted 7 lines
Quoted 4 lines
Quoted 4 lines
the kernel.
Parav I read the discussion and don't get your argument. From driver's POV
_MQwith 1 VQ pair and !_MQ are exactly functionallyequivalent.
Quoted 1 line
But we are talking from user POV here.
From spec POV there's just driver and device, user would be part of driver here.
User space application still need to inspect the
_MQbit toQuoted 3 lines
Quoted 3 lines
Quoted 3 lines
It's true that iproute probably needs to be fixed too, to handle old kernels. But iproute is not the only userspace, why not make it's life easier by fixing the kernel?
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Because it cannot be fixed for other config space fields which are control by
feature bits those do not have any defaults.
Quoted 1 line
So better to treat all in same way from user POV.
Consistency is good for sure. What are these other fields though? Can you give examples so I understand please?
speed only exists if
VIRTIO_NET_F_SPEED_DUPLEX.rss_max_key_sizeexists only ifVIRTIO_NET_F_RSSexists.
That's different cases from the MQ case.
There are no default values for speed and rss_max_key_size. And processing speed without VIRTIO_NET_F_SPEED_DUPLEX, or rss_max_key_size exists without VIRTIO_NET_F_RSS are meaningless. But for MQ, if without MQ, we know it has to be 1 queue pair to be a functional virtio-net, and only one queue pair. This is meaningful.
Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0
In reply to Parav PanditQuoted 51 lines · Parav Pandit
Quoted 39 lines
From: Michael S. Tsirkin<[email protected]>
Sent: Tuesday, July 26, 2022 3:49 PMQuoted 35 lines · Parav Pandit
Quoted 35 lines
From: Michael S. Tsirkin<[email protected]>
Sent: Wednesday, July 13, 2022 1:27 AMQuoted 11 lines · Parav Pandit
Quoted 11 lines
From: Zhu Lingshan<[email protected]>
Sent: Friday, July 1, 2022 9:28 AM IfVIRTIO_NET_F_MQ== 0, the virtio device should have one queue pair, so when userspace querying queue pair numbers, it should return mq=1 than zero.Function
vdpa_dev_net_config_fill()fills the attributions of the vDPA devices, so that it should callvdpa_dev_net_mq_config_fill()so the parameter invdpa_dev_net_mq_config_fill()should befeature_devicethanfeature_driverfor the vDPA devices themselvesQuoted 8 lines
Quoted 5 lines
Before this change, when MQ = 0, iproute2 output:
$vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link uplink_announcefalsemax_vq_pairs0 mtu 1500The fix belongs to user space.
When a feature bit_MQis not negotiated, vdpa kernel space will not addattribute
VDPA_ATTR_DEV_NET_CFG_MAX_VQP.Quoted 2 lines
When such attribute is not returned by kernel,
max_vq_pairsshould not beshown by the iproute2.
Quoted 2 lines
We have many config space fields that depend on the feature bits and
some of them do not have any defaults.
Quoted 2 lines
To keep consistency of existence of config space fields among all, we don't
want to show default like below.
Quoted 2 lines
Please fix the iproute2 to not print
max_vq_pairswhen it is not returned byQuoted 7 lines
Quoted 4 lines
Quoted 4 lines
the kernel.
Parav I read the discussion and don't get your argument. From driver's POV
_MQwith 1 VQ pair and !_MQ are exactly functionallyequivalent.
Quoted 1 line
But we are talking from user POV here.
From spec POV there's just driver and device, user would be part of driver here.
User space application still need to inspect the
_MQbit toQuoted 3 lines
Quoted 3 lines
Quoted 3 lines
It's true that iproute probably needs to be fixed too, to handle old kernels. But iproute is not the only userspace, why not make it's life easier by fixing the kernel?
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Because it cannot be fixed for other config space fields which are control by
feature bits those do not have any defaults.
Quoted 1 line
So better to treat all in same way from user POV.
Consistency is good for sure. What are these other fields though? Can you give examples so I understand please?
speed only exists if
VIRTIO_NET_F_SPEED_DUPLEX.rss_max_key_sizeexists only ifVIRTIO_NET_F_RSSexists.
That's different cases from the MQ case.
There are no default values for speed and rss_max_key_size. And talking on speed without VIRTIO_NET_F_SEPPD_DUPLEX or rss_max_key_size without VIRTIO_NET_F_RSS are meaningless. But for MQ, if without MQ, we know it has to be 1 queue pair to be a functional virtio-net, and this is meaningful.
PATCH v3 6/6 vDPA: fix 'cast to restricted le16' warnings in vdpa.c
In reply to Zhu LingshanThis commit fixes spars warnings: cast to restricted __le16 in function vdpa_dev_net_config_fill() and vdpa_fill_stats_rec()
--- drivers/vdpa/vdpa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/vdpa/vdpa.c +3 -3
@@ -825,11 +825,11 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms config.mac))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.status); + val_u16 =__virtio16_to_cpu (true, config.status);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_STATUS , val_u16))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.mtu); + val_u16 =__virtio16_to_cpu (true, config.mtu);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MTU , val_u16))return -EMSGSIZE ;
@@ -911,7 +911,7 @@ static int vdpa_fill_stats_rec(struct vdpa_device *vdev, struct sk_buff *msg, }vdpa_get_config_unlocked (vdev,0 , &config,sizeof (config)); - max_vqp =le16_to_cpu (config.max_virtqueue_pairs); + max_vqp =__virtio16_to_cpu (true, config.max_virtqueue_pairs);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , max_vqp))return -EMSGSIZE ;
Signature · 1 line
2.31.1
RE: [PATCH V3 6/6] vDPA: fix 'cast to restricted le16' warnings in vdpa.c
Quoted 8 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AMThis commit fixes spars warnings: cast to restricted
__le16in functionvdpa_dev_net_config_fill()andvdpa_fill_stats_rec()
Missing fixes tag.
But I fail to understand the warning.
config.status is le16, and API used is to convert le16 to cpu. What is the warning about, can you please explain?
Quoted 37 lines
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
846dd37f3549..ed49fe46a79e100644drivers/vdpa/vdpa.c +0
-0@@ -825,11 +825,11 @@ static int vdpa_dev_net_config_fill(struct
vdpa_device*vdev, structsk_buff*msdrivers/vdpa/vdpa.c +3
-3config.mac))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.status); + val_u16 =__virtio16_to_cpu (true, config.status);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_STATUS , val_u16))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.mtu); + val_u16 =__virtio16_to_cpu (true, config.mtu);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MTU , val_u16))return -EMSGSIZE ;@@ -911,7 +911,7 @@ static int vdpa_fill_stats_rec(struct vdpa_device *vdev, struct sk_buff *msg, }vdpa_get_config_unlocked (vdev,0 , &config,sizeof (config)); - max_vqp =le16_to_cpu (config.max_virtqueue_pairs); + max_vqp =__virtio16_to_cpu (true, config.max_virtqueue_pairs);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , max_vqp))return
-EMSGSIZE;--
2.31.1
Re: [PATCH V3 6/6] vDPA: fix 'cast to restricted le16' warnings in vdpa.c
Quoted 8 lines · Parav Pandit
Quoted 7 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AMThis commit fixes spars warnings: cast to restricted
__le16in functionvdpa_dev_net_config_fill()andvdpa_fill_stats_rec()Missing fixes tag.
I am not sure whether this deserve a fix tag, I will look into it.
Quoted 4 lines
But I fail to understand the warning.
config.status is le16, and API used is to convert le16 to cpu. What is the warning about, can you please explain?
The warnings are:drivers/vdpa/vdpa.c:828:19: warning: cast to restricted __le16 drivers/vdpa/vdpa.c:828:19: warning: cast from restricted __virtio16
Quoted 38 lines
Quoted 38 lines
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
846dd37f3549..ed49fe46a79e100644drivers/vdpa/vdpa.c +0
-0@@ -825,11 +825,11 @@ static int vdpa_dev_net_config_fill(struct
vdpa_device*vdev, structsk_buff*ms
config.mac))
return-EMSGSIZE;drivers/vdpa/vdpa.c +3
-3- val_u16 =le16_to_cpu (config.status); + val_u16 =__virtio16_to_cpu (true, config.status);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_STATUS , val_u16))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.mtu); + val_u16 =__virtio16_to_cpu (true, config.mtu);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MTU , val_u16))return -EMSGSIZE ;@@ -911,7 +911,7 @@ static int vdpa_fill_stats_rec(struct vdpa_device *vdev, struct sk_buff *msg, }vdpa_get_config_unlocked (vdev,0 , &config,sizeof (config)); - max_vqp =le16_to_cpu (config.max_virtqueue_pairs); + max_vqp =__virtio16_to_cpu (true, config.max_virtqueue_pairs);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , max_vqp))return
-EMSGSIZE;--
2.31.1
RE: [PATCH V3 6/6] vDPA: fix 'cast to restricted le16' warnings in vdpa.c
Quoted 9 lines
From: Zhu, Lingshan <[email protected]>
Sent: Friday, July 8, 2022 2:25 AMQuoted 3 lines · Parav Pandit
Quoted 3 lines
From: Zhu Lingshan <[email protected]>
Sent: Friday, July 1, 2022 9:28 AM
Quoted 11 lines
Quoted 6 lines
Quoted 5 lines
This commit fixes spars warnings: cast to restricted
__le16in functionvdpa_dev_net_config_fill()andvdpa_fill_stats_rec()Missing fixes tag.
I am not sure whether this deserve a fix tag, I will look into it.
Quoted 4 lines
But I fail to understand the warning.
config.status is le16, and API used is to convert le16 to cpu. What is the warning about, can you please explain?
I see it. Its not le16, its __virtio16. Please add fixes tag.
With that Reviewed-by: Parav Pandit <[email protected]>
Quoted 41 lines
The warnings are:
drivers/vdpa/vdpa.c:828:19: warning: cast to restricted__le16drivers/vdpa/vdpa.c:828:19: warning: cast from restricted__virtio16Quoted 38 lines
Quoted 38 lines
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
846dd37f3549..ed49fe46a79e100644drivers/vdpa/vdpa.c +0
-0@@ -825,11 +825,11 @@ static int vdpa_dev_net_config_fill(struct
vdpa_device*vdev, structsk_buff*ms
config.mac))
return-EMSGSIZE;drivers/vdpa/vdpa.c +3
-3- val_u16 =le16_to_cpu (config.status); + val_u16 =__virtio16_to_cpu (true, config.status);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_STATUS , val_u16))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.mtu); + val_u16 =__virtio16_to_cpu (true, config.mtu);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MTU , val_u16))return -EMSGSIZE ;@@ -911,7 +911,7 @@ static int vdpa_fill_stats_rec(struct vdpa_device *vdev, struct sk_buff *msg, }vdpa_get_config_unlocked (vdev,0 , &config,sizeof (config)); - max_vqp =le16_to_cpu (config.max_virtqueue_pairs); + max_vqp =__virtio16_to_cpu (true, config.max_virtqueue_pairs);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , max_vqp))return
-EMSGSIZE;--
2.31.1
Michael S. Tsirkin
maintainerRe: [PATCH V3 6/6] vDPA: fix 'cast to restricted le16' warnings in vdpa.c
In reply to Zhu LingshanQuoted 17 lines · Zhu Lingshan
This commit fixes spars warnings: cast to restricted
__le16in functionvdpa_dev_net_config_fill()andvdpa_fill_stats_rec()Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c +0
-0@@ -825,11 +825,11 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms config.mac))return -EMSGSIZE ;
drivers/vdpa/vdpa.c static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms · line 835
Quoted 10 lines
drivers/vdpa/vdpa.c +2
-2- val_u16 =le16_to_cpu (config.status); + val_u16 =__virtio16_to_cpu (true, config.status);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_STATUS , val_u16))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.mtu); + val_u16 =__virtio16_to_cpu (true, config.mtu);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MTU , val_u16))return -EMSGSIZE ;
Wrong on BE platforms with legacy interface, isn't it? We generally don't handle legacy properly in VDPA so it's not a huge deal, but maybe add a comment at least?
Quoted 11 lines
drivers/vdpa/vdpa.c +1
-1@@ -911,7 +911,7 @@ static int vdpa_fill_stats_rec(struct vdpa_device *vdev, struct sk_buff *msg, }vdpa_get_config_unlocked (vdev,0 , &config,sizeof (config)); - max_vqp =le16_to_cpu (config.max_virtqueue_pairs); + max_vqp =__virtio16_to_cpu (true, config.max_virtqueue_pairs);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , max_vqp))return -EMSGSIZE ;Signature · 1 line
2.31.1
Re: [PATCH V3 6/6] vDPA: fix 'cast to restricted le16' warnings in vdpa.c
Quoted 23 lines · Michael S. Tsirkin
Quoted 22 lines · Zhu Lingshan
This commit fixes spars warnings: cast to restricted
__le16in functionvdpa_dev_net_config_fill()andvdpa_fill_stats_rec()Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c +1
-1@@ -825,11 +825,11 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms config.mac))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.status); + val_u16 =__virtio16_to_cpu (true, config.status);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_STATUS , val_u16))return -EMSGSIZE ;
Quoted 8 lines
drivers/vdpa/vdpa.c static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms · line 835
Quoted 5 lines
drivers/vdpa/vdpa.c +1
-1- val_u16 =le16_to_cpu (config.mtu); + val_u16 =__virtio16_to_cpu (true, config.mtu);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MTU , val_u16))return -EMSGSIZE ;Wrong on BE platforms with legacy interface, isn't it? We generally don't handle legacy properly in VDPA so it's not a huge deal, but maybe add a comment at least?
Sure, I can add a comment here: this is for modern devices only.
Thanks,
Zhu Lingshan
Quoted 13 lines
Quoted 13 lines
drivers/vdpa/vdpa.c +1
-1@@ -911,7 +911,7 @@ static int vdpa_fill_stats_rec(struct vdpa_device *vdev, struct sk_buff *msg, }vdpa_get_config_unlocked (vdev,0 , &config,sizeof (config)); - max_vqp =le16_to_cpu (config.max_virtqueue_pairs); + max_vqp =__virtio16_to_cpu (true, config.max_virtqueue_pairs);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , max_vqp))return -EMSGSIZE ;Signature · 1 line
2.31.1
Michael S. Tsirkin
maintainerRe: [PATCH V3 6/6] vDPA: fix 'cast to restricted le16' warnings in vdpa.c
Quoted 31 lines · Lingshan
Quoted 20 lines · Michael S. Tsirkin
Quoted 19 lines · Zhu Lingshan
This commit fixes spars warnings: cast to restricted
__le16in functionvdpa_dev_net_config_fill()andvdpa_fill_stats_rec()Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c +1
-1@@ -825,11 +825,11 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms config.mac))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.status); + val_u16 =__virtio16_to_cpu (true, config.status);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_STATUS , val_u16))Quoted 8 lines
drivers/vdpa/vdpa.c static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms · line 834
Quoted 5 lines
drivers/vdpa/vdpa.c +1
-1return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.mtu); + val_u16 =__virtio16_to_cpu (true, config.mtu);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MTU , val_u16))return -EMSGSIZE ;Wrong on BE platforms with legacy interface, isn't it? We generally don't handle legacy properly in VDPA so it's not a huge deal, but maybe add a comment at least?
Quoted 4 lines
Sure, I can add a comment here: this is for modern devices only.
Thanks,
Zhu Lingshan
Hmm. what "this" is for modern devices only here?
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/vdpa/vdpa.c +1
-1@@ -911,7 +911,7 @@ static int vdpa_fill_stats_rec(struct vdpa_device *vdev, struct sk_buff *msg, }vdpa_get_config_unlocked (vdev,0 , &config,sizeof (config)); - max_vqp =le16_to_cpu (config.max_virtqueue_pairs); + max_vqp =__virtio16_to_cpu (true, config.max_virtqueue_pairs);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , max_vqp))return -EMSGSIZE ;Signature · 1 line
2.31.1
Re: [PATCH V3 6/6] vDPA: fix 'cast to restricted le16' warnings in vdpa.c
Quoted 31 lines · Michael S. Tsirkin
Quoted 30 lines · Lingshan
Quoted 28 lines · Michael S. Tsirkin
Quoted 14 lines · Zhu Lingshan
This commit fixes spars warnings: cast to restricted
__le16in functionvdpa_dev_net_config_fill()andvdpa_fill_stats_rec()Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c +0
-0drivers/vdpa/vdpa.c static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms · line 832
Quoted 10 lines
drivers/vdpa/vdpa.c +2
-2@@ -825,11 +825,11 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms config.mac))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.status); + val_u16 =__virtio16_to_cpu (true, config.status);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_STATUS , val_u16))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.mtu); + val_u16 =__virtio16_to_cpu (true, config.mtu);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MTU , val_u16))return -EMSGSIZE ;Wrong on BE platforms with legacy interface, isn't it? We generally don't handle legacy properly in VDPA so it's not a huge deal, but maybe add a comment at least?
Quoted 5 lines
Quoted 4 lines
Sure, I can add a comment here: this is for modern devices only.
Thanks,
Zhu LingshanHmm. what "this" is for modern devices only here?
this cast, for LE modern devices.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/vdpa/vdpa.c +1
-1@@ -911,7 +911,7 @@ static int vdpa_fill_stats_rec(struct vdpa_device *vdev, struct sk_buff *msg, }vdpa_get_config_unlocked (vdev,0 , &config,sizeof (config)); - max_vqp =le16_to_cpu (config.max_virtqueue_pairs); + max_vqp =__virtio16_to_cpu (true, config.max_virtqueue_pairs);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , max_vqp))return -EMSGSIZE ;Signature · 1 line
2.31.1
Michael S. Tsirkin
maintainerRe: [PATCH V3 6/6] vDPA: fix 'cast to restricted le16' warnings in vdpa.c
Quoted 34 lines · Lingshan
Quoted 31 lines · Michael S. Tsirkin
Quoted 30 lines · Lingshan
Quoted 28 lines · Michael S. Tsirkin
Quoted 14 lines · Zhu Lingshan
This commit fixes spars warnings: cast to restricted
__le16in functionvdpa_dev_net_config_fill()andvdpa_fill_stats_rec()Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c +0
-0drivers/vdpa/vdpa.c static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms · line 832
Quoted 10 lines
drivers/vdpa/vdpa.c +2
-2@@ -825,11 +825,11 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms config.mac))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.status); + val_u16 =__virtio16_to_cpu (true, config.status);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_STATUS , val_u16))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.mtu); + val_u16 =__virtio16_to_cpu (true, config.mtu);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MTU , val_u16))return -EMSGSIZE ;Wrong on BE platforms with legacy interface, isn't it? We generally don't handle legacy properly in VDPA so it's not a huge deal, but maybe add a comment at least?
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
Sure, I can add a comment here: this is for modern devices only.
Thanks,
Zhu LingshanHmm. what "this" is for modern devices only here?
this cast, for LE modern devices.
I think status existed in legacy for sure, and it's possible that some legacy devices backported mtu and max_virtqueue_pairs otherwise we would have these fields as __le not as __virtio, right?
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/vdpa/vdpa.c +1
-1@@ -911,7 +911,7 @@ static int vdpa_fill_stats_rec(struct vdpa_device *vdev, struct sk_buff *msg, }vdpa_get_config_unlocked (vdev,0 , &config,sizeof (config)); - max_vqp =le16_to_cpu (config.max_virtqueue_pairs); + max_vqp =__virtio16_to_cpu (true, config.max_virtqueue_pairs);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , max_vqp))return -EMSGSIZE ;Signature · 1 line
2.31.1
Re: [PATCH V3 6/6] vDPA: fix 'cast to restricted le16' warnings in vdpa.c
Quoted 35 lines · Michael S. Tsirkin
Quoted 34 lines · Lingshan
Quoted 32 lines · Michael S. Tsirkin
Quoted 31 lines · Lingshan
Quoted 20 lines · Michael S. Tsirkin
Quoted 19 lines · Zhu Lingshan
This commit fixes spars warnings: cast to restricted
__le16in functionvdpa_dev_net_config_fill()andvdpa_fill_stats_rec()Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c +1
-1@@ -825,11 +825,11 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms config.mac))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.status); + val_u16 =__virtio16_to_cpu (true, config.status);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_STATUS , val_u16))Quoted 8 lines
drivers/vdpa/vdpa.c static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms · line 834
Quoted 5 lines
drivers/vdpa/vdpa.c +1
-1return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.mtu); + val_u16 =__virtio16_to_cpu (true, config.mtu);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MTU , val_u16))return -EMSGSIZE ;Wrong on BE platforms with legacy interface, isn't it? We generally don't handle legacy properly in VDPA so it's not a huge deal, but maybe add a comment at least?
Sure, I can add a comment here: this is for modern devices only.
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Thanks,
Zhu LingshanHmm. what "this" is for modern devices only here?
this cast, for LE modern devices.
I think status existed in legacy for sure, and it's possible that some legacy devices backported mtu and
max_virtqueue_pairsotherwise we would have these fields as__lenot as__virtio, right?
yes, that's the reason why it is virtio_16 than just le16.
I may find a better solution to detect whether it is LE, or BE without a virtio_dev structure.
Check whether vdpa_device->get_device_features() has VIRTIO_F_VERISON_1. If the device offers _F_VERSION_1, then it is a LE device, or it is a BE device, then we use __virtio16_to_cpu(false, config.status).
Does this look good?
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/vdpa/vdpa.c +1
-1@@ -911,7 +911,7 @@ static int vdpa_fill_stats_rec(struct vdpa_device *vdev, struct sk_buff *msg, }vdpa_get_config_unlocked (vdev,0 , &config,sizeof (config)); - max_vqp =le16_to_cpu (config.max_virtqueue_pairs); + max_vqp =__virtio16_to_cpu (true, config.max_virtqueue_pairs);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , max_vqp))return -EMSGSIZE ;Signature · 1 line
2.31.1
Michael S. Tsirkin
maintainerRe: [PATCH V3 6/6] vDPA: fix 'cast to restricted le16' warnings in vdpa.c
Quoted 47 lines · Lingshan
Quoted 35 lines · Michael S. Tsirkin
Quoted 34 lines · Lingshan
Quoted 32 lines · Michael S. Tsirkin
Quoted 31 lines · Lingshan
Quoted 20 lines · Michael S. Tsirkin
Quoted 19 lines · Zhu Lingshan
This commit fixes spars warnings: cast to restricted
__le16in functionvdpa_dev_net_config_fill()andvdpa_fill_stats_rec()Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c +1
-1@@ -825,11 +825,11 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms config.mac))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.status); + val_u16 =__virtio16_to_cpu (true, config.status);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_STATUS , val_u16))Quoted 8 lines
drivers/vdpa/vdpa.c static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms · line 832
Quoted 5 lines
drivers/vdpa/vdpa.c +1
-1return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.mtu); + val_u16 =__virtio16_to_cpu (true, config.mtu);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MTU , val_u16))return -EMSGSIZE ;Wrong on BE platforms with legacy interface, isn't it? We generally don't handle legacy properly in VDPA so it's not a huge deal, but maybe add a comment at least?
Sure, I can add a comment here: this is for modern devices only.
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Thanks,
Zhu LingshanHmm. what "this" is for modern devices only here?
this cast, for LE modern devices.
I think status existed in legacy for sure, and it's possible that some legacy devices backported mtu and
max_virtqueue_pairsotherwise we would have these fields as__lenot as__virtio, right?yes, that's the reason why it is
virtio_16than just le16.
Quoted 7 lines
I may find a better solution to detect whether it is LE, or BE without a
virtio_devstructure.
Check whethervdpa_device->get_device_features()hasVIRTIO_F_VERISON_1. If the device offers_F_VERSION_1, then it is a LE device,
or it is a BE device, then we use__virtio16_to_cpu(false, config.status).Does this look good?
No since the question is can be a legacy driver with a transitional device. I don't have a good idea yet. vhost has VHOST_SET_VRING_ENDIAN and maybe we need something like this for config as well?
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/vdpa/vdpa.c +1
-1@@ -911,7 +911,7 @@ static int vdpa_fill_stats_rec(struct vdpa_device *vdev, struct sk_buff *msg, }vdpa_get_config_unlocked (vdev,0 , &config,sizeof (config)); - max_vqp =le16_to_cpu (config.max_virtqueue_pairs); + max_vqp =__virtio16_to_cpu (true, config.max_virtqueue_pairs);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , max_vqp))return -EMSGSIZE ;Signature · 1 line
2.31.1
Re: [PATCH V3 6/6] vDPA: fix 'cast to restricted le16' warnings in vdpa.c
Quoted 52 lines · Michael S. Tsirkin
Quoted 51 lines · Lingshan
Quoted 34 lines · Michael S. Tsirkin
Quoted 33 lines · Lingshan
Quoted 32 lines · Michael S. Tsirkin
Quoted 31 lines · Lingshan
Quoted 20 lines · Michael S. Tsirkin
Quoted 19 lines · Zhu Lingshan
This commit fixes spars warnings: cast to restricted
__le16in functionvdpa_dev_net_config_fill()andvdpa_fill_stats_rec()Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c +1
-1@@ -825,11 +825,11 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms config.mac))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.status); + val_u16 =__virtio16_to_cpu (true, config.status);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_STATUS , val_u16))Quoted 8 lines
drivers/vdpa/vdpa.c static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms · line 832
Quoted 5 lines
drivers/vdpa/vdpa.c +1
-1return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.mtu); + val_u16 =__virtio16_to_cpu (true, config.mtu);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MTU , val_u16))return -EMSGSIZE ;Wrong on BE platforms with legacy interface, isn't it? We generally don't handle legacy properly in VDPA so it's not a huge deal, but maybe add a comment at least?
Sure, I can add a comment here: this is for modern devices only.
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Thanks,
Zhu LingshanHmm. what "this" is for modern devices only here?
this cast, for LE modern devices.
I think status existed in legacy for sure, and it's possible that some legacy devices backported mtu and
max_virtqueue_pairsotherwise we would have these fields as__lenot as__virtio, right?yes, that's the reason why it is
virtio_16than just le16.I may find a better solution to detect whether it is LE, or BE without a
virtio_devstructure.
Check whethervdpa_device->get_device_features()hasVIRTIO_F_VERISON_1. If the device offers_F_VERSION_1, then it is a LE device,
or it is a BE device, then we use__virtio16_to_cpu(false, config.status).
Quoted 4 lines
Quoted 1 line
Does this look good?
No since the question is can be a legacy driver with a transitional device. I don't have a good idea yet. vhost has
VHOST_SET_VRING_ENDIANand maybe we need something like this for config as well?
Is it a little overkill to implementing vdpa_ops.get_endian()?
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/vdpa/vdpa.c +1
-1@@ -911,7 +911,7 @@ static int vdpa_fill_stats_rec(struct vdpa_device *vdev, struct sk_buff *msg, }vdpa_get_config_unlocked (vdev,0 , &config,sizeof (config)); - max_vqp =le16_to_cpu (config.max_virtqueue_pairs); + max_vqp =__virtio16_to_cpu (true, config.max_virtqueue_pairs);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , max_vqp))return -EMSGSIZE ;Signature · 1 line
2.31.1
Michael S. Tsirkin
maintainerRe: [PATCH V3 6/6] vDPA: fix 'cast to restricted le16' warnings in vdpa.c
Quoted 55 lines · Lingshan
Quoted 52 lines · Michael S. Tsirkin
Quoted 51 lines · Lingshan
Quoted 34 lines · Michael S. Tsirkin
Quoted 33 lines · Lingshan
Quoted 32 lines · Michael S. Tsirkin
Quoted 31 lines · Lingshan
Quoted 20 lines · Michael S. Tsirkin
Quoted 19 lines · Zhu Lingshan
This commit fixes spars warnings: cast to restricted
__le16in functionvdpa_dev_net_config_fill()andvdpa_fill_stats_rec()Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c +1
-1@@ -825,11 +825,11 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms config.mac))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.status); + val_u16 =__virtio16_to_cpu (true, config.status);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_STATUS , val_u16))Quoted 8 lines
drivers/vdpa/vdpa.c static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms · line 832
Quoted 5 lines
drivers/vdpa/vdpa.c +1
-1return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.mtu); + val_u16 =__virtio16_to_cpu (true, config.mtu);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MTU , val_u16))return -EMSGSIZE ;Wrong on BE platforms with legacy interface, isn't it? We generally don't handle legacy properly in VDPA so it's not a huge deal, but maybe add a comment at least?
Sure, I can add a comment here: this is for modern devices only.
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Thanks,
Zhu LingshanHmm. what "this" is for modern devices only here?
this cast, for LE modern devices.
I think status existed in legacy for sure, and it's possible that some legacy devices backported mtu and
max_virtqueue_pairsotherwise we would have these fields as__lenot as__virtio, right?yes, that's the reason why it is
virtio_16than just le16.I may find a better solution to detect whether it is LE, or BE without a
virtio_devstructure.
Check whethervdpa_device->get_device_features()hasVIRTIO_F_VERISON_1. If the device offers_F_VERSION_1, then it is a LE device,
or it is a BE device, then we use__virtio16_to_cpu(false, config.status).
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
Does this look good?
No since the question is can be a legacy driver with a transitional device. I don't have a good idea yet. vhost has
VHOST_SET_VRING_ENDIANand maybe we need something like this for config as well?Is it a little overkill to implementing
vdpa_ops.get_endian()?
I think the question is driver endian-ness.
But another approach is really just to say userspace should tweak config endian itself. Let's just say that in the comment? /*
* Assume little endian for now, userspace can tweak this for
* legacy guest support.
*/
?
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/vdpa/vdpa.c +1
-1@@ -911,7 +911,7 @@ static int vdpa_fill_stats_rec(struct vdpa_device *vdev, struct sk_buff *msg, }vdpa_get_config_unlocked (vdev,0 , &config,sizeof (config)); - max_vqp =le16_to_cpu (config.max_virtqueue_pairs); + max_vqp =__virtio16_to_cpu (true, config.max_virtqueue_pairs);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , max_vqp))return -EMSGSIZE ;Signature · 1 line
2.31.1
Re: [PATCH V3 6/6] vDPA: fix 'cast to restricted le16' warnings in vdpa.c
Quoted 61 lines · Michael S. Tsirkin
Quoted 53 lines · Lingshan
Quoted 51 lines · Michael S. Tsirkin
Quoted 50 lines · Lingshan
Quoted 34 lines · Michael S. Tsirkin
Quoted 33 lines · Lingshan
Quoted 32 lines · Michael S. Tsirkin
Quoted 31 lines · Lingshan
Quoted 20 lines · Michael S. Tsirkin
Quoted 19 lines · Zhu Lingshan
This commit fixes spars warnings: cast to restricted
__le16in functionvdpa_dev_net_config_fill()andvdpa_fill_stats_rec()Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c +1
-1@@ -825,11 +825,11 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms config.mac))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.status); + val_u16 =__virtio16_to_cpu (true, config.status);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_STATUS , val_u16))Quoted 8 lines
drivers/vdpa/vdpa.c static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms · line 832
Quoted 5 lines
drivers/vdpa/vdpa.c +1
-1return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.mtu); + val_u16 =__virtio16_to_cpu (true, config.mtu);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MTU , val_u16))return -EMSGSIZE ;Wrong on BE platforms with legacy interface, isn't it? We generally don't handle legacy properly in VDPA so it's not a huge deal, but maybe add a comment at least?
Sure, I can add a comment here: this is for modern devices only.
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Thanks,
Zhu LingshanHmm. what "this" is for modern devices only here?
this cast, for LE modern devices.
I think status existed in legacy for sure, and it's possible that some legacy devices backported mtu and
max_virtqueue_pairsotherwise we would have these fields as__lenot as__virtio, right?yes, that's the reason why it is
virtio_16than just le16.I may find a better solution to detect whether it is LE, or BE without a
virtio_devstructure.
Check whethervdpa_device->get_device_features()hasVIRTIO_F_VERISON_1. If the device offers_F_VERSION_1, then it is a LE device,
or it is a BE device, then we use__virtio16_to_cpu(false, config.status).Quoted 5 lines
Quoted 4 lines
Quoted 1 line
Does this look good?
No since the question is can be a legacy driver with a transitional device. I don't have a good idea yet. vhost has
VHOST_SET_VRING_ENDIANand maybe we need something like this for config as well?Is it a little overkill to implementing
vdpa_ops.get_endian()?I think the question is driver endian-ness.
Quoted 7 lines
But another approach is really just to say userspace should tweak config endian itself. Let's just say that in the comment? /*
* Assume little endian for now, userspace can tweak this for
* legacy guest support.
*/
?
Oh, yes, the user space can tweak the value!!!
I will add this comment, thanks!!!!
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/vdpa/vdpa.c +1
-1@@ -911,7 +911,7 @@ static int vdpa_fill_stats_rec(struct vdpa_device *vdev, struct sk_buff *msg, }vdpa_get_config_unlocked (vdev,0 , &config,sizeof (config)); - max_vqp =le16_to_cpu (config.max_virtqueue_pairs); + max_vqp =__virtio16_to_cpu (true, config.max_virtqueue_pairs);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , max_vqp))return -EMSGSIZE ;Signature · 1 line
2.31.1
Re: [PATCH V3 6/6] vDPA: fix 'cast to restricted le16' warnings in vdpa.c
In reply to Michael S. TsirkinQuoted 52 lines · Michael S. Tsirkin
Quoted 51 lines · Lingshan
Quoted 34 lines · Michael S. Tsirkin
Quoted 33 lines · Lingshan
Quoted 32 lines · Michael S. Tsirkin
Quoted 31 lines · Lingshan
Quoted 20 lines · Michael S. Tsirkin
Quoted 19 lines · Zhu Lingshan
This commit fixes spars warnings: cast to restricted
__le16in functionvdpa_dev_net_config_fill()andvdpa_fill_stats_rec()Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c +1
-1@@ -825,11 +825,11 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms config.mac))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.status); + val_u16 =__virtio16_to_cpu (true, config.status);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_STATUS , val_u16))Quoted 8 lines
drivers/vdpa/vdpa.c static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms · line 832
Quoted 5 lines
drivers/vdpa/vdpa.c +1
-1return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.mtu); + val_u16 =__virtio16_to_cpu (true, config.mtu);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MTU , val_u16))return -EMSGSIZE ;Wrong on BE platforms with legacy interface, isn't it? We generally don't handle legacy properly in VDPA so it's not a huge deal, but maybe add a comment at least?
Sure, I can add a comment here: this is for modern devices only.
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Thanks,
Zhu LingshanHmm. what "this" is for modern devices only here?
this cast, for LE modern devices.
I think status existed in legacy for sure, and it's possible that some legacy devices backported mtu and
max_virtqueue_pairsotherwise we would have these fields as__lenot as__virtio, right?yes, that's the reason why it is
virtio_16than just le16.I may find a better solution to detect whether it is LE, or BE without a
virtio_devstructure.
Check whethervdpa_device->get_device_features()hasVIRTIO_F_VERISON_1. If the device offers_F_VERSION_1, then it is a LE device,
or it is a BE device, then we use__virtio16_to_cpu(false, config.status).
Quoted 4 lines
Quoted 1 line
Does this look good?
No since the question is can be a legacy driver with a transitional device. I don't have a good idea yet. vhost has
VHOST_SET_VRING_ENDIANand maybe we need something like this for config as well?
Not sure, and even if we had this, the query could happen before VHOST_SET_VRING_ENDIAN.
Actually, the patch should be fine itself, since the issue exist even before the patch (which assumes a le).
Thanks
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/vdpa/vdpa.c +1
-1@@ -911,7 +911,7 @@ static int vdpa_fill_stats_rec(struct vdpa_device *vdev, struct sk_buff *msg, }vdpa_get_config_unlocked (vdev,0 , &config,sizeof (config)); - max_vqp =le16_to_cpu (config.max_virtqueue_pairs); + max_vqp =__virtio16_to_cpu (true, config.max_virtqueue_pairs);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , max_vqp))return -EMSGSIZE ;Signature · 1 line
2.31.1
Michael S. Tsirkin
maintainerRe: [PATCH V3 6/6] vDPA: fix 'cast to restricted le16' warnings in vdpa.c
Quoted 60 lines · Jason Wang
Quoted 52 lines · Michael S. Tsirkin
Quoted 51 lines · Lingshan
Quoted 34 lines · Michael S. Tsirkin
Quoted 33 lines · Lingshan
Quoted 32 lines · Michael S. Tsirkin
Quoted 31 lines · Lingshan
Quoted 20 lines · Michael S. Tsirkin
Quoted 19 lines · Zhu Lingshan
This commit fixes spars warnings: cast to restricted
__le16in functionvdpa_dev_net_config_fill()andvdpa_fill_stats_rec()Signed-off-by Zhu Lingshan <[email protected]>--- drivers/vdpa/vdpa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/vdpa/vdpa.c +1
-1@@ -825,11 +825,11 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms config.mac))return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.status); + val_u16 =__virtio16_to_cpu (true, config.status);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_STATUS , val_u16))Quoted 8 lines
drivers/vdpa/vdpa.c static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms · line 832
Quoted 5 lines
drivers/vdpa/vdpa.c +1
-1return -EMSGSIZE ; - val_u16 =le16_to_cpu (config.mtu); + val_u16 =__virtio16_to_cpu (true, config.mtu);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MTU , val_u16))return -EMSGSIZE ;Wrong on BE platforms with legacy interface, isn't it? We generally don't handle legacy properly in VDPA so it's not a huge deal, but maybe add a comment at least?
Sure, I can add a comment here: this is for modern devices only.
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Thanks,
Zhu LingshanHmm. what "this" is for modern devices only here?
this cast, for LE modern devices.
I think status existed in legacy for sure, and it's possible that some legacy devices backported mtu and
max_virtqueue_pairsotherwise we would have these fields as__lenot as__virtio, right?yes, that's the reason why it is
virtio_16than just le16.I may find a better solution to detect whether it is LE, or BE without a
virtio_devstructure.
Check whethervdpa_device->get_device_features()hasVIRTIO_F_VERISON_1. If the device offers_F_VERSION_1, then it is a LE device,
or it is a BE device, then we use__virtio16_to_cpu(false, config.status).Quoted 4 lines
Quoted 1 line
Does this look good?
No since the question is can be a legacy driver with a transitional device. I don't have a good idea yet. vhost has
VHOST_SET_VRING_ENDIANand maybe we need something like this for config as well?
Quoted 7 lines
Not sure, and even if we had this, the query could happen before
VHOST_SET_VRING_ENDIAN.Actually, the patch should be fine itself, since the issue exist even before the patch (which assumes a le).
Thanks
I agree, let's just add a TODO comment.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/vdpa/vdpa.c +1
-1@@ -911,7 +911,7 @@ static int vdpa_fill_stats_rec(struct vdpa_device *vdev, struct sk_buff *msg, }vdpa_get_config_unlocked (vdev,0 , &config,sizeof (config)); - max_vqp =le16_to_cpu (config.max_virtqueue_pairs); + max_vqp =__virtio16_to_cpu (true, config.max_virtqueue_pairs);if (nla_put_u16 (msg,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , max_vqp))return -EMSGSIZE ;Signature · 1 line
2.31.1