All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] RPING: Make sure CQ event thread exits before destroying the CQ.
@ 2010-10-20 19:28 Steve Wise
       [not found] ` <20101020192859.1431.68877.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org>
  0 siblings, 1 reply; 15+ messages in thread
From: Steve Wise @ 2010-10-20 19:28 UTC (permalink / raw)
  To: sean.hefty-ral2JQCrhuEAvxtiuMwx3w; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

It is possible for the CQ event thread to poll the CQ after it has been
destroyed which can result in a seg fault on T3 interfaces.  This patch
cancels the thread and waits for it to exit before destroying the CQ.

Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
---

 examples/rping.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/examples/rping.c b/examples/rping.c
index 91952e7..e603d3b 100644
--- a/examples/rping.c
+++ b/examples/rping.c
@@ -800,10 +800,10 @@ static void *rping_persistent_server_thread(void *arg)
 
 	rping_test_server(cb);
 	rdma_disconnect(cb->child_cm_id);
-	rping_free_buffers(cb);
-	rping_free_qp(cb);
 	pthread_cancel(cb->cqthread);
 	pthread_join(cb->cqthread, NULL);
+	rping_free_buffers(cb);
+	rping_free_qp(cb);
 	rdma_destroy_id(cb->child_cm_id);
 	free_cb(cb);
 	return NULL;
@@ -888,6 +888,8 @@ static int rping_run_server(struct rping_cb *cb)
 
 	rping_test_server(cb);
 	rdma_disconnect(cb->child_cm_id);
+	pthread_cancel(cb->cqthread);
+	pthread_join(cb->cqthread, NULL);
 	rdma_destroy_id(cb->child_cm_id);
 err2:
 	rping_free_buffers(cb);
@@ -1055,6 +1057,8 @@ static int rping_run_client(struct rping_cb *cb)
 
 	rping_test_client(cb);
 	rdma_disconnect(cb->cm_id);
+	pthread_cancel(cb->cqthread);
+	pthread_join(cb->cqthread, NULL);
 err2:
 	rping_free_buffers(cb);
 err1:

--
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] 15+ messages in thread

end of thread, other threads:[~2010-10-21 12:30 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-20 19:28 [PATCH 1/2] RPING: Make sure CQ event thread exits before destroying the CQ Steve Wise
     [not found] ` <20101020192859.1431.68877.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org>
2010-10-20 19:29   ` [PATCH 2/2] RPING: Remove printf for FLUSH completion Steve Wise
     [not found]     ` <20101020192905.1431.40267.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org>
2010-10-20 21:12       ` Hefty, Sean
     [not found]         ` <CF9C39F99A89134C9CF9C4CCB68B8DDF25B801FB15-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2010-10-21 12:30           ` Steve Wise
2010-10-20 20:05   ` [PATCH 1/2] RPING: Make sure CQ event thread exits before destroying the CQ Bart Van Assche
     [not found]     ` <AANLkTi=uAuXT1RMEQ+vsA4FkN2828mZ2q0KPKXxpb6H0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-10-20 20:12       ` Steve Wise
     [not found]         ` <4CBF4D30.3050500-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2010-10-20 20:23           ` Bart Van Assche
     [not found]             ` <AANLkTimTpM_h7P8tacZic2aP7i=dBiAquDN5S_D881ae-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-10-20 20:26               ` Steve Wise
2010-10-20 20:35               ` Jason Gunthorpe
     [not found]                 ` <20101020203551.GO10362-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2010-10-20 20:56                   ` Steve Wise
     [not found]                     ` <4CBF5786.2020203-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2010-10-20 21:05                       ` Robert D. Russell
2010-10-20 21:16                       ` Jason Gunthorpe
     [not found]                         ` <20101020211617.GP10362-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2010-10-21 10:16                           ` Bart Van Assche
     [not found]                             ` <AANLkTi=eJdjgQ4MKPxddUA2eBOswf-5fo5wm=JzX=Hib-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-10-21 10:40                               ` Bart Van Assche
2010-10-20 20:31       ` Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.