Skip to contentSkip to conversation

xprtrdma: Make sure Send CQ is allocated on an existing CPU

PATCH Superseded Nicolas Morey-Chaisemartin 3 participants 5 messages Jan 23, 2019

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xprtrdma: Make sure Send CQ is allocated on an existing CPU

Make sure host has at least 2 CPU before allocating to CPU#1

Fixes a4699f5647f3 (xprtrdma: Put Send CQ in IB_POLL_WORKQUEUE mode)
---
 net/sunrpc/xprtrdma/verbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/xprtrdma/verbs.c +1 -1
index b725911c0f3f..36aa7b2648e4 100644
@@ -546,7 +546,7 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
 
 	sendcq = ib_alloc_cq(ia->ri_device, NULL,
 			     ep->rep_attr.cap.max_send_wr + 1,
-			     1, IB_POLL_WORKQUEUE);
+			     num_online_cpus() > 1 ? 1 : 0, IB_POLL_WORKQUEUE);
 	if (IS_ERR(sendcq)) {
 		rc = PTR_ERR(sendcq);
 		dprintk("RPC:       %s: failed to create send CQ: %i\n",
Signature · 1 line
2.18.0
#1 lore raw

Hi Nicolas-

Quoted 3 lines · Nicolas Morey-Chaisemartin

Make sure host has at least 2 CPU before allocating to CPU#1

The fourth parameter of ib_alloc_cq() is not a CPU number, it's a completion vector number. What failure did you see that prompted this patch?

Quoted 22 lines
Fixes a4699f5647f3 (xprtrdma: Put Send CQ in IB_POLL_WORKQUEUE mode)

---
net/sunrpc/xprtrdma/verbs.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/xprtrdma/verbs.c +1 -1
index b725911c0f3f..36aa7b2648e4 100644
@@ -546,7 +546,7 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
 
 	sendcq = ib_alloc_cq(ia->ri_device, NULL,
 			     ep->rep_attr.cap.max_send_wr + 1,
-			     1, IB_POLL_WORKQUEUE);
+			     num_online_cpus() > 1 ? 1 : 0, IB_POLL_WORKQUEUE);
 	if (IS_ERR(sendcq)) {
 		rc = PTR_ERR(sendcq);
 		dprintk("RPC:       %s: failed to create send CQ: %i\n",
Signature · 1 line
2.18.0

--
Chuck Lever

#2 lore raw
Quoted 8 lines · Chuck Lever

Hi Nicolas-

Quoted 3 lines · Nicolas Morey-Chaisemartin

Make sure host has at least 2 CPU before allocating to CPU#1

The fourth parameter of ib_alloc_cq() is not a CPU number, it's a completion vector number. What failure did you see that prompted this patch?

When trying to mount, I get this:
+ mount -o rdma,port=20049 192.168.20.15:/tmp/RAM /tmp/RAM
mount.nfs: mounting 192.168.20.15:/tmp/RAM failed, reason given by server: No such file or directory

Digging a bit into the code, it appears that the cq allocation here returns a ENOENT which come from mlx5_vector2eqn. On my system (VM with a mlx5 card with SRIOV), the comp_eqs_list only contains one entry with index == 0

Nicolas

#3 lore raw
Quoted 10 lines · Nicolas Morey-Chaisemartin
Quoted 8 lines · Chuck Lever

Hi Nicolas-

Quoted 3 lines · Nicolas Morey-Chaisemartin

Make sure host has at least 2 CPU before allocating to CPU#1

The fourth parameter of ib_alloc_cq() is not a CPU number, it's a completion vector number. What failure did you see that prompted this patch?

Quoted 9 lines

When trying to mount, I get this:
+ mount -o rdma,port=20049 192.168.20.15:/tmp/RAM /tmp/RAM
mount.nfs: mounting 192.168.20.15:/tmp/RAM failed, reason given by server: No such file or directory

Digging a bit into the code, it appears that the cq allocation here returns a ENOENT which come from mlx5_vector2eqn. On my system (VM with a mlx5 card with SRIOV), the comp_eqs_list only contains one entry with index == 0

Nicolas

Also, adding a 2nd core to my VM fixes the issue (thus my understanding that it was a CPU number)

#4 lore raw
Quoted 21 lines · Nicolas Morey-Chaisemartin
Quoted 14 lines · Nicolas Morey-Chaisemartin
Quoted 8 lines · Chuck Lever

Hi Nicolas-

Quoted 3 lines · Nicolas Morey-Chaisemartin

Make sure host has at least 2 CPU before allocating to CPU#1

The fourth parameter of ib_alloc_cq() is not a CPU number, it's a completion vector number. What failure did you see that prompted this patch?

When trying to mount, I get this:
+ mount -o rdma,port=20049 192.168.20.15:/tmp/RAM /tmp/RAM
mount.nfs: mounting 192.168.20.15:/tmp/RAM failed, reason given by server: No such file or directory

Quoted 7 lines
Quoted 5 lines

Digging a bit into the code, it appears that the cq allocation here returns a ENOENT which come from mlx5_vector2eqn. On my system (VM with a mlx5 card with SRIOV), the comp_eqs_list only contains one entry with index == 0

Nicolas

Also, adding a 2nd core to my VM fixes the issue (thus my understanding that it was a CPU number)

Fair enough. The 2nd CPU adds a 2nd compvec. Instead of num_cpus_online() you want ib_device::num_comp_vectors.

I suspect there's a spiffier way to go about this these days thanks to ib_get_vector_affinity, but you've found a longstanding bug. So let's get something that can be comfortably backported to stable.

--
Chuck Lever