All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-rc v3] RDMA/restrack: Track driver QP types in resource tracker
@ 2019-08-01 10:43 Gal Pressman
  2019-08-01 12:12 ` Leon Romanovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Gal Pressman @ 2019-08-01 10:43 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe, Leon Romanovsky; +Cc: linux-rdma, Gal Pressman

The check for QP type different than XRC has excluded driver QP
types from the resource tracker.
As a result, "rdma resource show" user command would not show opened
driver QPs which does not reflect the real state of the system.

Check QP type explicitly instead of assuming enum values/ordering.

Fixes: 40909f664d27 ("RDMA/efa: Add EFA verbs implementation")
Signed-off-by: Gal Pressman <galpress@amazon.com>
---
v3:
* Reword commit message
* Change the commit in Fixes: line

v2:
* Improve commit message
---
 drivers/infiniband/core/core_priv.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h
index 589ed805e0ad..3a8b0911c3bc 100644
--- a/drivers/infiniband/core/core_priv.h
+++ b/drivers/infiniband/core/core_priv.h
@@ -321,7 +321,9 @@ static inline struct ib_qp *_ib_create_qp(struct ib_device *dev,
 					  struct ib_udata *udata,
 					  struct ib_uobject *uobj)
 {
+	enum ib_qp_type qp_type = attr->qp_type;
 	struct ib_qp *qp;
+	bool is_xrc;
 
 	if (!dev->ops.create_qp)
 		return ERR_PTR(-EOPNOTSUPP);
@@ -339,7 +341,8 @@ static inline struct ib_qp *_ib_create_qp(struct ib_device *dev,
 	 * and more importantly they are created internaly by driver,
 	 * see mlx5 create_dev_resources() as an example.
 	 */
-	if (attr->qp_type < IB_QPT_XRC_INI) {
+	is_xrc = qp_type == IB_QPT_XRC_INI || qp_type == IB_QPT_XRC_TGT;
+	if ((qp_type < IB_QPT_MAX && !is_xrc) || qp_type == IB_QPT_DRIVER) {
 		qp->res.type = RDMA_RESTRACK_QP;
 		if (uobj)
 			rdma_restrack_uadd(&qp->res);
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH for-rc v3] RDMA/restrack: Track driver QP types in resource tracker
  2019-08-01 10:43 [PATCH for-rc v3] RDMA/restrack: Track driver QP types in resource tracker Gal Pressman
@ 2019-08-01 12:12 ` Leon Romanovsky
  2019-08-01 15:56   ` Doug Ledford
  0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2019-08-01 12:12 UTC (permalink / raw)
  To: Gal Pressman; +Cc: Doug Ledford, Jason Gunthorpe, linux-rdma

On Thu, Aug 01, 2019 at 01:43:54PM +0300, Gal Pressman wrote:
> The check for QP type different than XRC has excluded driver QP
> types from the resource tracker.
> As a result, "rdma resource show" user command would not show opened
> driver QPs which does not reflect the real state of the system.
>
> Check QP type explicitly instead of assuming enum values/ordering.
>
> Fixes: 40909f664d27 ("RDMA/efa: Add EFA verbs implementation")
> Signed-off-by: Gal Pressman <galpress@amazon.com>
> ---
> v3:
> * Reword commit message
> * Change the commit in Fixes: line
>
> v2:
> * Improve commit message
> ---
>  drivers/infiniband/core/core_priv.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>

Please don't forget rdmatool patch.

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH for-rc v3] RDMA/restrack: Track driver QP types in resource tracker
  2019-08-01 12:12 ` Leon Romanovsky
@ 2019-08-01 15:56   ` Doug Ledford
  0 siblings, 0 replies; 3+ messages in thread
From: Doug Ledford @ 2019-08-01 15:56 UTC (permalink / raw)
  To: Leon Romanovsky, Gal Pressman; +Cc: Jason Gunthorpe, linux-rdma

[-- Attachment #1: Type: text/plain, Size: 1121 bytes --]

On Thu, 2019-08-01 at 15:12 +0300, Leon Romanovsky wrote:
> On Thu, Aug 01, 2019 at 01:43:54PM +0300, Gal Pressman wrote:
> > The check for QP type different than XRC has excluded driver QP
> > types from the resource tracker.
> > As a result, "rdma resource show" user command would not show opened
> > driver QPs which does not reflect the real state of the system.
> > 
> > Check QP type explicitly instead of assuming enum values/ordering.
> > 
> > Fixes: 40909f664d27 ("RDMA/efa: Add EFA verbs implementation")
> > Signed-off-by: Gal Pressman <galpress@amazon.com>
> > ---
> > v3:
> > * Reword commit message
> > * Change the commit in Fixes: line
> > 
> > v2:
> > * Improve commit message
> > ---
> >  drivers/infiniband/core/core_priv.h | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> 
> Please don't forget rdmatool patch.
> 
> Thanks,
> Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

Thanks, applied to for-rc.

-- 
Doug Ledford <dledford@redhat.com>
    GPG KeyID: B826A3330E572FDD
    Fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-01 16:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-01 10:43 [PATCH for-rc v3] RDMA/restrack: Track driver QP types in resource tracker Gal Pressman
2019-08-01 12:12 ` Leon Romanovsky
2019-08-01 15:56   ` Doug Ledford

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.