how to safely tear down a cm_id?
Hi gang,
We're chasing some bugs in RDS. In trying to explore possible causes I found that I don't really understand the sequence of events needed to safely tear down a cm_id.
I'm worried that we have cm event callbacks being processed in the ib_cm thread racing with our krds thread which is tearing down the cm_id.
If you get rid of unrelated rds-specific teardown and error checking, our cm_id teardown (rds_ib_conn_shutdown()) simplifies down to:
rdma_disconnect(cm_id);
rdma_destroy_qp(cm_id);
rdma_destroy_id(cm_id);We blow through all of those without waiting for anything specifically CM related. We could wait for some send and receive work completions, sure, but we might not if the universe aligns just right and everything is idle when we tear things down.
Is it safe to blow through those calls while the ib_cm thread might be
processing a callback for the given cm_id? Should we be serializing the two
specifically?
I think this code was initially written under the assumption that rmda_disconnect() would only return once all CM callbacks completed. I'm worried that rdma_disconnect() doesn't work that way.
- z
--
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
Quoted 11 lines
rdma_disconnect(cm_id); rdma_destroy_qp(cm_id); rdma_destroy_id(cm_id);We blow through all of those without waiting for anything specifically CM related. We could wait for some send and receive work completions, sure, but
we might not if the universe aligns just right and everything is idle when we
tear things down.
Quoted 8 lines
Is it safe to blow through those calls while the
ib_cmthread might be
processing a callback for the givencm_id? Should we be serializing the
two
specifically?I think this code was initially written under the assumption that
rmda_disconnect()would only return once all CM callbacks completed. I'm worried thatrdma_disconnect()doesn't work that way.
rdma_destroy_id will block until all CM callbacks complete. rdma_disconnect does not. It merely issues or responds to a disconnect request. If it issues a disconnect request, then a disconnect callback will eventually follow, possibly before rdma_disconnect returns.
- Sean
--
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
Quoted 4 lines
rdma_destroy_idwill block until all CM callbacks complete.rdma_disconnectdoes not. It merely issues or responds to a disconnect request. If it issues a disconnect request, then a disconnect callback will eventually follow, possibly beforerdma_disconnectreturns.
Thanks, that's just the sort of detail I was looking for. Now to audit some code.
- z
--
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