Skip to contentSkip to conversation

RDMA_CM_EVENT_REJECTED and ressources release

DISCUSSION Yann Droneaud 2 participants 3 messages Jun 20, 2012 – Jun 21, 2012 3 messages not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

Hi,

I'm trying to make my InfiniBand verbs/RDMA application more reliable regarding RDMA CM error events.

In particular, I'm trying to handle verbs ressources release.

Here's a scenarii from the client point of view:

rdma_resolve_addr()
=> event RDMA_CM_EVENT_ADDR_RESOLVED
rdma_resolv_route()
=> event RDMA_CM_EVENT_ROUTE_RESOLVED
ibv_reg_mr()
ibv_create_cq()
rdma_create_qp()
rdma_connect()
=> event RDMA_CM_EVENT_REJECTED !

In the handler of RDMA_CM_EVENT_REJECTED, I could handle this in two different ways:

- call rdma_disconnect(): even if the connection is not established, rdma_disconnect() can be called.

In this case, all receive WR posted came back in error.

But there's no event RDMA_CM_EVENT_TIMEWAIT_EXIT to handle where the program could call rdma_destroy_qp(), ibv_destroy_cq(), ibv_dereg_mr(), and rdma_destroy_id().

Note there's no event RDMA_CM_EVENT_DISCONNECTED either (indeed).

- call rdma_destroy_qp(), ibv_destroy_cq(), ibv_dereg_mr(), and rdma_destroy_id().

Before calling ibv_destroy_cq(), the program call ibv_poll_cq() to flush the CQ (but the function return -2 when called on the CQ used to hold receive WC, but without problem on the one used to hold send WC)

The completion channel which was registered against the CQ is notified of an event. ibv_get_cq_event() will return a pointer to the destroyed CQ and ibv_poll_cq() return 0 (no WC). (and currently my code is calling ibv_ack_cq_events() then
ibv_req_notify_cq() on the CQ returned by ibv_get_cq_event).

Neither solution seems really suitable to me.

Do you have any tip/hint to handle this situation.

Regards.

Signature · 8 lines
Yann Droneaud
OPTEYA


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
In reply to a message not in the archive
Quoted 35 lines · Veerendra Allada

Is it possible to delay the memory registrations (ibv_reg_mr) and the ibv_post_recv()'s until the connection is established ? Based on what i understood, i am suggesting the following sequence of calls on Client and Server. See if it helps.

Client
rdma_create_event_channel()
rdma_create_id()
rdma_resolve_addr()
ibv_alloc_pd()
ibv_create_comp_channel()
ibv_create_cq()
rdma_create_qp()
rdma_resolve_route()
rdma_connect()

If the connection is not successful, call the corresponding destroy calls in the the reverse order.
If the connection is successful, register memory and post the receive calls.

Server
rdma_create_event_channel()
rdma_create_id()
rdma_bind_addr()
rdma_listen()

Up on a new incoming connection request, do the following sequence.

ibv_alloc_pd()
ibv_create_comp_channel()
ibv_create_cq()
rdma_create_qp()
rdma_accept()

Quoted 5 lines

After the connection is successful, register memory and then post receive requests.
At this point you should be able to post ibv_post_send requests and poll your completion queue's, etc.

Thanks for your answer, but it's not applicable on my case:

I have to post receive works before doing rdma_accept()/rdma_connect() so that both side are ready to receive messages sent by other peer.

Not doing so will lead to races, RNR errors will be triggered on the sending side if it's faster than the receiving side.

If the protocol implemented above the RDMA connection is request/response based and initiated by the client, the client could follow your proposed scheme, but on the server side, it will have to post receive works before calling rdma_accept().

Regards.

Signature · 8 lines
Yann Droneaud
OPTEYA


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw
In reply to a message not in the archive

PiAtIGNhbGwgcmRtYV9kaXNjb25uZWN0KCk6IGV2ZW4gaWYgdGhlIGNvbm5lY3Rpb24gaXMgbm90 IGVzdGFibGlzaGVkLA0KPiAgIHJkbWFfZGlzY29ubmVjdCgpIGNhbiBiZSBjYWxsZWQuDQo+IA0K PiAgIEluIHRoaXMgY2FzZSwgYWxsIHJlY2VpdmUgV1IgcG9zdGVkIGNhbWUgYmFjayBpbiBlcnJv ci4NCg0KT24gcHJvY2Vzc2luZyBhIHJlamVjdCBldmVudCwgdGhlIGxpYnJkbWFjbSBzaG91bGQg dHJhbnNpdGlvbiB0aGUgUVAgaW50byB0aGUgZXJyb3Igc3RhdGUuICBUaGF0IHNob3VsZCBmbHVz aCBhbGwgcG9zdGVkIHdvcmsgcmVxdWVzdHMuICBBdCB0aGF0IHBvaW50LCB5b3Ugc2hvdWxkIG9u bHkgbmVlZCB0byBwdWxsIG9mZiB0aGUgZmFpbGVkIFdScyBmcm9tIHRoZSBDUSwgdGhlbiBkZXN0 cm95IGV2ZXJ5dGhpbmcuDQoNCj4gLSBjYWxsIHJkbWFfZGVzdHJveV9xcCgpLCBpYnZfZGVzdHJv eV9jcSgpLCBpYnZfZGVyZWdfbXIoKSwgYW5kDQo+ICAgcmRtYV9kZXN0cm95X2lkKCkuDQo+IA0K PiAgIEJlZm9yZSBjYWxsaW5nIGlidl9kZXN0cm95X2NxKCksIHRoZSBwcm9ncmFtIGNhbGwgaWJ2 X3BvbGxfY3EoKSB0bw0KPiAgIGZsdXNoIHRoZSBDUSAoYnV0IHRoZSBmdW5jdGlvbiByZXR1cm4g LTIgd2hlbiBjYWxsZWQgb24gdGhlIENRIHVzZWQNCj4gICB0byBob2xkIHJlY2VpdmUgV0MsIGJ1 dCB3aXRob3V0IHByb2JsZW0gb24gdGhlIG9uZSB1c2VkIHRvIGhvbGQgc2VuZA0KPiAgIFdDKQ0K DQpJIGhhdmUgbm8gaWRlYSB3aGF0IHRoZSAtMiByZXR1cm4gY29kZSBpcyBpbmRpY2F0aW5nIG9y IHdoeSBpdCBvY2N1cnMuICBCdXQgdHJ5IHBvbGxpbmcgdGhlIENRIGJlZm9yZSBhdHRlbXB0aW5n IHRvIGRlc3Ryb3kgdGhlIFFQLg0KDQotIFNlYW4NCg==
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html