Skip to contentSkip to conversation

how to safely tear down a cm_id?

DISCUSSION Zach Brown 2 participants 3 messages Sep 15, 2010 2 messages not in the archive InfiniBand

lore
Share & tools
lore

Zach Brown

author
#0 lore raw

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

A message that is not in the archive (sent off-list or not yet received): 20100915192954.GA7566-Mg0Rv1oTIzIdlZp+k6BvrWXnswh1EIUO@public.gmane.org

#2 lore raw
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_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.

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

A message that is not in the archive (sent off-list or not yet received): CF9C39F99A89134C9CF9C4CCB68B8DDF25AB6B2AC4-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org

author
#4 lore raw
Quoted 4 lines

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.

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