IB/ipoib: improve latency in ipoib/cm connection formation
PATCH 1/1 IB/ipoib: improve latency in ipoib/cm connection formation
ipoib connected mode presently queries the device[HCA] to get P_Key table entry during connection formation. This will increase the time taken to form the connection, especially when limited P_Keys are in use. This gets worse when multiple connection attempts are done in parallel. Improve this by using the cached version of ib_find_pkey().
This improved the latency from 500ms to 3ms on an internal setup.
--- drivers/infiniband/ulp/ipoib/ipoib_cm.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_cm.c +3 -1
@@ -40,6 +40,7 @@#include <linux/moduleparam.h> #include <linux/sched/signal.h> #include <linux/sched/mm.h> +#include <rdma/ib_cache.h> #include "ipoib.h"
@@ -1122,7 +1123,8 @@ static int ipoib_cm_modify_tx_init(struct net_device *dev,struct ipoib_dev_priv *priv =ipoib_priv (dev);struct ib_qp_attr qp_attr;int qp_attr_mask, ret; - ret =ib_find_pkey (priv->ca, priv->port, priv->pkey, &qp_attr.pkey_index); + ret =ib_find_cached_pkey (priv->ca, priv->port, priv->pkey, + &qp_attr.pkey_index);if (ret) {ipoib_warn (priv,"pkey 0x%x not found: %d\n" , priv->pkey, ret);return ret;
Signature · 1 line
1.7.1
Jason Gunthorpe
maintainerQuoted 25 lines · Manjunath Patil
ipoib connected mode presently queries the device[HCA] to get
P_Keytable entry during connection formation. This will increase the time taken to form the connection, especially when limitedP_Keysare in use. This gets worse when multiple connection attempts are done in parallel. Improve this by using the cached version ofib_find_pkey().This improved the latency from 500ms to 3ms on an internal setup.
Suggested-by Haakon Bugge <[email protected]>Signed-off-by Manjunath Patil <[email protected]>drivers/infiniband/ulp/ipoib/ipoib_cm.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)drivers/infiniband/ulp/ipoib/ipoib_cm.c +2
-0+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c@@ -40,6 +40,7 @@#include <linux/moduleparam.h> #include <linux/sched/signal.h> #include <linux/sched/mm.h> +#include <rdma/ib_cache.h> #include "ipoib.h"
drivers/infiniband/ulp/ipoib/ipoib_cm.c static int ipoib_cm_modify_tx_init(struct net_device *dev, · line 1127
Quoted 6 lines
drivers/infiniband/ulp/ipoib/ipoib_cm.c +2
-1@@ -1122,7 +1123,8 @@ static int ipoib_cm_modify_tx_init(struct net_device *dev,struct ipoib_dev_priv *priv =ipoib_priv (dev);struct ib_qp_attr qp_attr;int qp_attr_mask, ret; - ret =ib_find_pkey (priv->ca, priv->port, priv->pkey, &qp_attr.pkey_index); + ret =ib_find_cached_pkey (priv->ca, priv->port, priv->pkey, + &qp_attr.pkey_index);
ipoib interfaces are locked to a single pkey, you should be able to get the pkey index that was determined at link up time and use it here instead of searching anything
Jason
Quoted 33 lines · Manjunath Patil
drivers/infiniband/ulp/ipoib/ipoib_cm.c static int ipoib_cm_modify_tx_init(struct
Quoted 26 lines
ipoib connected mode presently queries the device[HCA] to get
P_Keytable entry during connection formation. This will increase the time taken to form the connection, especially when limitedP_Keysare in use. This gets worse when multiple connection attempts are done in parallel. Improve this by using the cached version ofib_find_pkey().This improved the latency from 500ms to 3ms on an internal setup.
Suggested-by Haakon Bugge <[email protected]>Signed-off-by Manjunath Patil <[email protected]>drivers/infiniband/ulp/ipoib/ipoib_cm.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)drivers/infiniband/ulp/ipoib/ipoib_cm.c +2
-0+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c@@ -40,6 +40,7 @@#include <linux/moduleparam.h> #include <linux/sched/signal.h> #include <linux/sched/mm.h> +#include <rdma/ib_cache.h> #include "ipoib.h" @@ -1122,7 +1123,8 @@ static int ipoib_cm_modify_tx_init(struct
net_device*dev,drivers/infiniband/ulp/ipoib/ipoib_cm.c static int ipoib_cm_modify_tx_init(struct net_device *dev,
Quoted 4 lines
drivers/infiniband/ulp/ipoib/ipoib_cm.c +0
-1struct ipoib_dev_priv *priv =ipoib_priv (dev);struct ib_qp_attr qp_attr;int qp_attr_mask, ret; - ret = ib_find_pkey(priv->ca, priv->port, priv->pkey,&qp_attr.pkey_index);
Quoted 8 lines
drivers/infiniband/ulp/ipoib/ipoib_cm.c static int ipoib_cm_modify_tx_init(struct net_device *dev, · line 1127
Quoted 2 lines
drivers/infiniband/ulp/ipoib/ipoib_cm.c +2
-0+ ret =ib_find_cached_pkey (priv->ca, priv->port, priv->pkey, + &qp_attr.pkey_index);ipoib interfaces are locked to a single pkey, you should be able to get the pkey index that was determined at link up time and use it here instead of searching anything
Jason
Thank you Jason for your input. I will explore and get back to you.
-Manjunath
Quoted 37 lines · Manjunath Patil
Quoted 34 lines · Manjunath Patil
drivers/infiniband/ulp/ipoib/ipoib_cm.c static int ipoib_cm_modify_tx_init(struct
Quoted 26 lines
ipoib connected mode presently queries the device[HCA] to get
P_Keytable entry during connection formation. This will increase the time taken to form the connection, especially when limitedP_Keysare in use. This gets worse when multiple connection attempts are done in parallel. Improve this by using the cached version ofib_find_pkey().This improved the latency from 500ms to 3ms on an internal setup.
Suggested-by Haakon Bugge <[email protected]>Signed-off-by Manjunath Patil <[email protected]>
drivers/infiniband/ulp/ipoib/ipoib_cm.c| 4 +++-1 files changed, 3 insertions(+), 1 deletions(-)drivers/infiniband/ulp/ipoib/ipoib_cm.c +2
-0+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c@@ -40,6 +40,7 @@#include <linux/moduleparam.h> #include <linux/sched/signal.h> #include <linux/sched/mm.h> +#include <rdma/ib_cache.h> #include "ipoib.h" @@ -1122,7 +1123,8 @@ static int ipoib_cm_modify_tx_init(struct
net_device*dev,drivers/infiniband/ulp/ipoib/ipoib_cm.c static int ipoib_cm_modify_tx_init(struct net_device *dev,
Quoted 4 lines
drivers/infiniband/ulp/ipoib/ipoib_cm.c +0
-1struct ipoib_dev_priv *priv =ipoib_priv (dev);struct ib_qp_attr qp_attr;int qp_attr_mask, ret; - ret = ib_find_pkey(priv->ca, priv->port, priv->pkey,&qp_attr.pkey_index);
Quoted 6 lines
Quoted 6 lines
drivers/infiniband/ulp/ipoib/ipoib_cm.c static int ipoib_cm_modify_tx_init(struct net_device *dev, · line 1127
Quoted 2 lines
drivers/infiniband/ulp/ipoib/ipoib_cm.c +2
-0+ ret =ib_find_cached_pkey (priv->ca, priv->port, priv->pkey, + &qp_attr.pkey_index);ipoib interfaces are locked to a single pkey, you should be able to get the pkey index that was determined at link up time and use it here instead of searching anything
Isn't possible to:
# ip link add DEVICE name NAME type ipoib [ pkey PKEY ]
?
Thxs, Håkon
Quoted 6 lines
Quoted 2 lines
Jason
Thank you Jason for your input. I will explore and get back to you.
-Manjunath
Quoted 37 lines · Manjunath Patil
Quoted 34 lines · Manjunath Patil
drivers/infiniband/ulp/ipoib/ipoib_cm.c static int ipoib_cm_modify_tx_init(struct
Quoted 26 lines
ipoib connected mode presently queries the device[HCA] to get
P_Keytable entry during connection formation. This will increase the time taken to form the connection, especially when limitedP_Keysare in use. This gets worse when multiple connection attempts are done in parallel. Improve this by using the cached version ofib_find_pkey().This improved the latency from 500ms to 3ms on an internal setup.
Suggested-by Haakon Bugge <[email protected]>Signed-off-by Manjunath Patil <[email protected]>
drivers/infiniband/ulp/ipoib/ipoib_cm.c| 4 +++-1 files changed, 3 insertions(+), 1 deletions(-)drivers/infiniband/ulp/ipoib/ipoib_cm.c +2
-0+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c@@ -40,6 +40,7 @@#include <linux/moduleparam.h> #include <linux/sched/signal.h> #include <linux/sched/mm.h> +#include <rdma/ib_cache.h> #include "ipoib.h" @@ -1122,7 +1123,8 @@ static int ipoib_cm_modify_tx_init(struct
net_device*dev,drivers/infiniband/ulp/ipoib/ipoib_cm.c static int ipoib_cm_modify_tx_init(struct net_device *dev,
Quoted 4 lines
drivers/infiniband/ulp/ipoib/ipoib_cm.c +0
-1struct ipoib_dev_priv *priv =ipoib_priv (dev);struct ib_qp_attr qp_attr;int qp_attr_mask, ret; - ret = ib_find_pkey(priv->ca, priv->port, priv->pkey,&qp_attr.pkey_index);
Quoted 6 lines
Quoted 6 lines
drivers/infiniband/ulp/ipoib/ipoib_cm.c static int ipoib_cm_modify_tx_init(struct net_device *dev, · line 1127
Quoted 2 lines
drivers/infiniband/ulp/ipoib/ipoib_cm.c +2
-0+ ret =ib_find_cached_pkey (priv->ca, priv->port, priv->pkey, + &qp_attr.pkey_index);ipoib interfaces are locked to a single pkey, you should be able to get the pkey index that was determined at link up time and use it here instead of searching anything
Isn't possible to:
# ip link add DEVICE name NAME type ipoib [ pkey PKEY ]
?
Thxs, Håkon
Quoted 6 lines
Quoted 2 lines
Jason
Thank you Jason for your input. I will explore and get back to you.
-Manjunath
Jason Gunthorpe
maintainerQuoted 14 lines · Haakon Bugge
Quoted 7 lines
Quoted 7 lines
Review static int ipoib_cm_modify_tx_init(struct
Quoted 1 line
(quoted diff) +0
-0@@ -1122,7 +1123,8 @@ static int ipoib_cm_modify_tx_init(struct
net_device*dev,drivers/infiniband/ulp/ipoib/ipoib_cm.c static int ipoib_cm_modify_tx_init(struct net_device *dev,
Quoted 4 lines
drivers/infiniband/ulp/ipoib/ipoib_cm.c +0
-1struct ipoib_dev_priv *priv =ipoib_priv (dev);struct ib_qp_attr qp_attr;int qp_attr_mask, ret; - ret = ib_find_pkey(priv->ca, priv->port, priv->pkey,&qp_attr.pkey_index);
Quoted 6 lines
Quoted 6 lines
drivers/infiniband/ulp/ipoib/ipoib_cm.c static int ipoib_cm_modify_tx_init(struct net_device *dev, · line 1127
Quoted 2 lines
drivers/infiniband/ulp/ipoib/ipoib_cm.c +2
-0+ ret =ib_find_cached_pkey (priv->ca, priv->port, priv->pkey, + &qp_attr.pkey_index);ipoib interfaces are locked to a single pkey, you should be able to get the pkey index that was determined at link up time and use it here instead of searching anything
Quoted 5 lines
Isn't possible to:
# ip link add DEVICE name NAME type ipoib [ pkey PKEY ]?
Yes, and each new netdev that spawns has a fixed pkey that doesn't change for the life of the netdev
Jason