public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/CMA: fail qkey setting for RDMA_PS_IPOIB and IB_LINK_LAYER_ETHERNET
@ 2011-07-07 13:37 Moni Shoua
       [not found] ` <1310045857-26040-1-git-send-email-monis-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Moni Shoua @ 2011-07-07 13:37 UTC (permalink / raw)
  To: sean.hefty-ral2JQCrhuEAvxtiuMwx3w, roland-DgEjT+Ai2ygdnm+yROfE0A,
	eli-VPRAkNaXOzVS1MOuV/RT9w
  Cc: Moni Shoua, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	orend-VPRAkNaXOzVWk0Htik3J/w

From: Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

In general, when link layer is ETHERNET it is wrong to use IPoIB port space since
no IPoIB interface is available. Specifically, setting qkey when port space is
RDMA_PS_IPOIB, requires SA query which is impossible when link layer is IB_LINK_LAYER_ETHERNET.

Signed-off-by: Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/core/cma.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index b6a33b3..9bf83d5 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -314,6 +314,9 @@ static int cma_set_qkey(struct rdma_id_private *id_priv)
 		id_priv->qkey = RDMA_UDP_QKEY;
 		break;
 	case RDMA_PS_IPOIB:
+		if (rdma_port_get_link_layer(id_priv->cma_dev->device, id_priv->id.port_num) ==
+			IB_LINK_LAYER_ETHERNET)
+			return -EINVAL;
 		ib_addr_get_mgid(&id_priv->id.route.addr.dev_addr, &rec.mgid);
 		ret = ib_sa_get_mcmember_rec(id_priv->id.device,
 					     id_priv->id.port_num, &rec.mgid,
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [PATCH] IB/CMA: fail qkey setting for RDMA_PS_IPOIB and IB_LINK_LAYER_ETHERNET
       [not found] ` <1310045857-26040-1-git-send-email-monis-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
@ 2011-07-07 16:55   ` Hefty, Sean
       [not found]     ` <1828884A29C6694DAF28B7E6B8A8237302D0F3-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Hefty, Sean @ 2011-07-07 16:55 UTC (permalink / raw)
  To: Moni Shoua, roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	eli-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org
  Cc: Moni Shoua, linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	orend-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org

> In general, when link layer is ETHERNET it is wrong to use IPoIB port space
> since
> no IPoIB interface is available. Specifically, setting qkey when port space is
> RDMA_PS_IPOIB, requires SA query which is impossible when link layer is
> IB_LINK_LAYER_ETHERNET.

Can you describe the problem that the current code causes?  Does it lead to a kernel crash?

Maybe the issue is that port space ipoib should never be associated with a non-IB device, with a check added to cma_acquire_dev().

- Sean
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] IB/CMA: fail qkey setting for RDMA_PS_IPOIB and IB_LINK_LAYER_ETHERNET
       [not found]     ` <1828884A29C6694DAF28B7E6B8A8237302D0F3-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2011-07-08 11:02       ` Moni Shoua
  2011-07-10  6:32       ` Or Gerlitz
  1 sibling, 0 replies; 4+ messages in thread
From: Moni Shoua @ 2011-07-08 11:02 UTC (permalink / raw)
  To: Hefty, Sean
  Cc: Moni Shoua, roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	eli-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	orend-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org

Yes, the kernel crashed after watchdog detected a lockup. This
happened while running udaddy -p 0x2 with RoCE. The crash isn't 100%
reproducible but I have a pair of nodes where that used to crash with
probability of 50%.
The fix you suggest seems to detect the mismatch between port space
and link layer earlier, so I guess it handles the bug better. I'll
rewrite, retest and send a fix on Sunday.

- monis

On Thu, Jul 7, 2011 at 7:55 PM, Hefty, Sean <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
>> In general, when link layer is ETHERNET it is wrong to use IPoIB port space
>> since
>> no IPoIB interface is available. Specifically, setting qkey when port space is
>> RDMA_PS_IPOIB, requires SA query which is impossible when link layer is
>> IB_LINK_LAYER_ETHERNET.
>
> Can you describe the problem that the current code causes?  Does it lead to a kernel crash?
>
> Maybe the issue is that port space ipoib should never be associated with a non-IB device, with a check added to cma_acquire_dev().
>
> - Sean
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] IB/CMA: fail qkey setting for RDMA_PS_IPOIB and IB_LINK_LAYER_ETHERNET
       [not found]     ` <1828884A29C6694DAF28B7E6B8A8237302D0F3-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
  2011-07-08 11:02       ` Moni Shoua
@ 2011-07-10  6:32       ` Or Gerlitz
  1 sibling, 0 replies; 4+ messages in thread
From: Or Gerlitz @ 2011-07-10  6:32 UTC (permalink / raw)
  To: Hefty, Sean
  Cc: Moni Shoua, roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	eli-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	orend-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org


>
> Can you describe the problem that the current code causes?  Does it lead to a kernel crash?
> Maybe the issue is that port space ipoib should never be associated with a non-IB device, with a check added to cma_acquire_dev().

Sean, Moni,

I believe that crashing the kernel from user space should be 
avoided/fixed anyway, is that
crash possible also under IB?

Or.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2011-07-10  6:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-07 13:37 [PATCH] IB/CMA: fail qkey setting for RDMA_PS_IPOIB and IB_LINK_LAYER_ETHERNET Moni Shoua
     [not found] ` <1310045857-26040-1-git-send-email-monis-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
2011-07-07 16:55   ` Hefty, Sean
     [not found]     ` <1828884A29C6694DAF28B7E6B8A8237302D0F3-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2011-07-08 11:02       ` Moni Shoua
2011-07-10  6:32       ` Or Gerlitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox