[azure][PATCH 0/2] [Hyper-V] pci-hyperv: Use device serial number as PCI domain

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[azure][PATCH 0/2] [Hyper-V] pci-hyperv: Use device serial number as PCI domain

Marcelo Cerri
Fixes for LP1667527 (already included in Xenial).

Haiyang Zhang (1):
  PCI: hv: Use device serial number as PCI domain

Jack Morgenstein (1):
  net/mlx4_core: Use cq quota in SRIOV when creating completion EQs

 drivers/net/ethernet/mellanox/mlx4/eq.c   |  5 ++---
 drivers/net/ethernet/mellanox/mlx4/main.c |  3 ++-
 drivers/pci/host/pci-hyperv.c             | 12 ++++++++++++
 3 files changed, 16 insertions(+), 4 deletions(-)

--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[azure][PATCH 1/2] net/mlx4_core: Use cq quota in SRIOV when creating completion EQs

Marcelo Cerri
From: Jack Morgenstein <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1667527

When creating EQs to handle CQ completion events for the PF
or for VFs, we create enough EQE entries to handle completions
for the max number of CQs that can use that EQ.

When SRIOV is activated, the max number of CQs a VF (or the PF) can
obtain is its CQ quota (determined by the Hypervisor resource tracker).
Therefore, when creating an EQ, the number of EQE entries that the VF
should request for that EQ is the CQ quota value (and not the total
number of CQs available in the FW).

Under SRIOV, the PF, also must use its CQ quota, because
the resource tracker also controls how many CQs the PF can obtain.

Using the FW total CQs instead of the CQ quota when creating EQs resulted
wasting MTT entries, due to allocating more EQEs than were needed.

Fixes: 5a0d0a6161ae ("mlx4: Structures and init/teardown for VF resource quotas")
Signed-off-by: Jack Morgenstein <[hidden email]>
Reported-by: Dexuan Cui <[hidden email]>
Signed-off-by: Tariq Toukan <[hidden email]>
Signed-off-by: David S. Miller <[hidden email]>
(cherry picked from commit 6ed63d845e7866ff1a0eac9f0fa554fdf2c64e1d)
Signed-off-by: Marcelo Henrique Cerri <[hidden email]>
---
 drivers/net/ethernet/mellanox/mlx4/eq.c   | 5 ++---
 drivers/net/ethernet/mellanox/mlx4/main.c | 3 ++-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index 0509996957d9..232f46db0dce 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -1256,9 +1256,8 @@ int mlx4_init_eq_table(struct mlx4_dev *dev)
  mlx4_warn(dev, "Failed adding irq rmap\n");
  }
 #endif
- err = mlx4_create_eq(dev, dev->caps.num_cqs -
-  dev->caps.reserved_cqs +
-  MLX4_NUM_SPARE_EQE,
+ err = mlx4_create_eq(dev, dev->quotas.cq +
+     MLX4_NUM_SPARE_EQE,
      (dev->flags & MLX4_FLAG_MSI_X) ?
      i + 1 - !!(i > MLX4_EQ_ASYNC) : 0,
      eq);
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index bffa6f345f2f..60dbe9b1f6fd 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -3503,6 +3503,8 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data,
  goto err_disable_msix;
  }
 
+ mlx4_init_quotas(dev);
+
  err = mlx4_setup_hca(dev);
  if (err == -EBUSY && (dev->flags & MLX4_FLAG_MSI_X) &&
     !mlx4_is_mfunc(dev)) {
@@ -3515,7 +3517,6 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data,
  if (err)
  goto err_steer;
 
- mlx4_init_quotas(dev);
  /* When PF resources are ready arm its comm channel to enable
  * getting commands
  */
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[azure][PATCH 2/2] PCI: hv: Use device serial number as PCI domain

Marcelo Cerri
In reply to this post by Marcelo Cerri
From: Haiyang Zhang <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1667527

Use the device serial number as the PCI domain.  The serial numbers start
with 1 and are unique within a VM.  So names, such as VF NIC names, that
include domain number as part of the name, can be shorter than that based
on part of bus UUID previously.  The new names will also stay same for VMs
created with copied VHD and same number of devices.

Signed-off-by: Haiyang Zhang <[hidden email]>
Signed-off-by: Stephen Hemminger <[hidden email]>
Signed-off-by: Bjorn Helgaas <[hidden email]>
Reviewed-by: K. Y. Srinivasan <[hidden email]>
(cherry picked from commit 4a9b0933bdfcd85da840284bf5a0eb17b654b9c2)
Signed-off-by: Marcelo Henrique Cerri <[hidden email]>
---
 drivers/pci/host/pci-hyperv.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index d096237f9591..a679b6acb438 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -1320,6 +1320,18 @@ static struct hv_pci_dev *new_pcichild_device(struct hv_pcibus_device *hbus,
  get_pcichild(hpdev, hv_pcidev_ref_initial);
  get_pcichild(hpdev, hv_pcidev_ref_childlist);
  spin_lock_irqsave(&hbus->device_list_lock, flags);
+
+ /*
+ * When a device is being added to the bus, we set the PCI domain
+ * number to be the device serial number, which is non-zero and
+ * unique on the same VM.  The serial numbers start with 1, and
+ * increase by 1 for each device.  So device names including this
+ * can have shorter names than based on the bus instance UUID.
+ * Only the first device serial number is used for domain, so the
+ * domain number will not change after the first device is added.
+ */
+ if (list_empty(&hbus->children))
+ hbus->sysdata.domain = desc->ser;
  list_add_tail(&hpdev->list_entry, &hbus->children);
  spin_unlock_irqrestore(&hbus->device_list_lock, flags);
  return hpdev;
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[azure][PATCH v2 0/2] [Hyper-V] pci-hyperv: Use device serial number as PCI domain

Marcelo Cerri
In reply to this post by Marcelo Cerri
(just adding the From line)

Fixes for LP1667527 (already included in Xenial).

Haiyang Zhang (1):
  PCI: hv: Use device serial number as PCI domain

Jack Morgenstein (1):
  net/mlx4_core: Use cq quota in SRIOV when creating completion EQs

 drivers/net/ethernet/mellanox/mlx4/eq.c   |  5 ++---
 drivers/net/ethernet/mellanox/mlx4/main.c |  3 ++-
 drivers/pci/host/pci-hyperv.c             | 12 ++++++++++++
 3 files changed, 16 insertions(+), 4 deletions(-)

--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[azure][PATCH v2 1/2] net/mlx4_core: Use cq quota in SRIOV when creating completion EQs

Marcelo Cerri
From: Jack Morgenstein <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1667527

When creating EQs to handle CQ completion events for the PF
or for VFs, we create enough EQE entries to handle completions
for the max number of CQs that can use that EQ.

When SRIOV is activated, the max number of CQs a VF (or the PF) can
obtain is its CQ quota (determined by the Hypervisor resource tracker).
Therefore, when creating an EQ, the number of EQE entries that the VF
should request for that EQ is the CQ quota value (and not the total
number of CQs available in the FW).

Under SRIOV, the PF, also must use its CQ quota, because
the resource tracker also controls how many CQs the PF can obtain.

Using the FW total CQs instead of the CQ quota when creating EQs resulted
wasting MTT entries, due to allocating more EQEs than were needed.

Fixes: 5a0d0a6161ae ("mlx4: Structures and init/teardown for VF resource quotas")
Signed-off-by: Jack Morgenstein <[hidden email]>
Reported-by: Dexuan Cui <[hidden email]>
Signed-off-by: Tariq Toukan <[hidden email]>
Signed-off-by: David S. Miller <[hidden email]>
(cherry picked from commit 6ed63d845e7866ff1a0eac9f0fa554fdf2c64e1d)
Signed-off-by: Marcelo Henrique Cerri <[hidden email]>
---
 drivers/net/ethernet/mellanox/mlx4/eq.c   | 5 ++---
 drivers/net/ethernet/mellanox/mlx4/main.c | 3 ++-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index 0509996957d9..232f46db0dce 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -1256,9 +1256,8 @@ int mlx4_init_eq_table(struct mlx4_dev *dev)
  mlx4_warn(dev, "Failed adding irq rmap\n");
  }
 #endif
- err = mlx4_create_eq(dev, dev->caps.num_cqs -
-  dev->caps.reserved_cqs +
-  MLX4_NUM_SPARE_EQE,
+ err = mlx4_create_eq(dev, dev->quotas.cq +
+     MLX4_NUM_SPARE_EQE,
      (dev->flags & MLX4_FLAG_MSI_X) ?
      i + 1 - !!(i > MLX4_EQ_ASYNC) : 0,
      eq);
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index bffa6f345f2f..60dbe9b1f6fd 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -3503,6 +3503,8 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data,
  goto err_disable_msix;
  }
 
+ mlx4_init_quotas(dev);
+
  err = mlx4_setup_hca(dev);
  if (err == -EBUSY && (dev->flags & MLX4_FLAG_MSI_X) &&
     !mlx4_is_mfunc(dev)) {
@@ -3515,7 +3517,6 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data,
  if (err)
  goto err_steer;
 
- mlx4_init_quotas(dev);
  /* When PF resources are ready arm its comm channel to enable
  * getting commands
  */
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[azure][PATCH v2 2/2] PCI: hv: Use device serial number as PCI domain

Marcelo Cerri
In reply to this post by Marcelo Cerri
From: Haiyang Zhang <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1667527

Use the device serial number as the PCI domain.  The serial numbers start
with 1 and are unique within a VM.  So names, such as VF NIC names, that
include domain number as part of the name, can be shorter than that based
on part of bus UUID previously.  The new names will also stay same for VMs
created with copied VHD and same number of devices.

Signed-off-by: Haiyang Zhang <[hidden email]>
Signed-off-by: Stephen Hemminger <[hidden email]>
Signed-off-by: Bjorn Helgaas <[hidden email]>
Reviewed-by: K. Y. Srinivasan <[hidden email]>
(cherry picked from commit 4a9b0933bdfcd85da840284bf5a0eb17b654b9c2)
Signed-off-by: Marcelo Henrique Cerri <[hidden email]>
---
 drivers/pci/host/pci-hyperv.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index d096237f9591..a679b6acb438 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -1320,6 +1320,18 @@ static struct hv_pci_dev *new_pcichild_device(struct hv_pcibus_device *hbus,
  get_pcichild(hpdev, hv_pcidev_ref_initial);
  get_pcichild(hpdev, hv_pcidev_ref_childlist);
  spin_lock_irqsave(&hbus->device_list_lock, flags);
+
+ /*
+ * When a device is being added to the bus, we set the PCI domain
+ * number to be the device serial number, which is non-zero and
+ * unique on the same VM.  The serial numbers start with 1, and
+ * increase by 1 for each device.  So device names including this
+ * can have shorter names than based on the bus instance UUID.
+ * Only the first device serial number is used for domain, so the
+ * domain number will not change after the first device is added.
+ */
+ if (list_empty(&hbus->children))
+ hbus->sysdata.domain = desc->ser;
  list_add_tail(&hpdev->list_entry, &hbus->children);
  spin_unlock_irqrestore(&hbus->device_list_lock, flags);
  return hpdev;
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ACK: [azure][PATCH 0/2] [Hyper-V] pci-hyperv: Use device serial number as PCI domain

Tim Gardner-2
In reply to this post by Marcelo Cerri
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ACK: [azure][PATCH 0/2] [Hyper-V] pci-hyperv: Use device serial number as PCI domain

brad.figg
In reply to this post by Marcelo Cerri
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

APPLIED: [azure][PATCH 0/2] [Hyper-V] pci-hyperv: Use device serial number as PCI domain

Marcelo Cerri
In reply to this post by Marcelo Cerri
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ACK: [azure][PATCH v2 2/2] PCI: hv: Use device serial number as PCI domain

Tim Gardner-2
In reply to this post by Marcelo Cerri
Loading...