public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH libibverbs] XRC - Sample application issues
@ 2013-08-08 15:05 Yishai Hadas
       [not found] ` <1375974336-26314-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Yishai Hadas @ 2013-08-08 15:05 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA, roland-BHEL68pLQRGGvPXPguhicg
  Cc: ogerlitz-VPRAkNaXOzVWk0Htik3J/w, tzahio-VPRAkNaXOzVWk0Htik3J/w,
	yishaih-VPRAkNaXOzVWk0Htik3J/w, sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
	jay.e.sternberg-ral2JQCrhuEAvxtiuMwx3w, Eli Cohen

Fix sync issue when clients go down, it comes to prevent a case when
client misses a response from the daemon then wait forever.

Fix typo in error message.

Signed-off-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Eli Cohen <eli-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---

This patch is on top of V9 of XRC series that was already sent.
It should be squashed into latest patch #7 named 'Add XRC sample application'.

Jay, Sean - please review.


 examples/xsrq_pingpong.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/examples/xsrq_pingpong.c b/examples/xsrq_pingpong.c
index 984740d..aceef2e 100644
--- a/examples/xsrq_pingpong.c
+++ b/examples/xsrq_pingpong.c
@@ -376,7 +376,7 @@ static int connect_qps(int index)
 			  IBV_QP_STATE | IBV_QP_AV | IBV_QP_PATH_MTU |
 			  IBV_QP_DEST_QPN | IBV_QP_RQ_PSN |
 			  IBV_QP_MAX_DEST_RD_ATOMIC | IBV_QP_MIN_RNR_TIMER)) {
-		fprintf(stderr, "Failed to modify send QP[%d] to RTR\n", index);
+		fprintf(stderr, "Failed to modify recv QP[%d] to RTR\n", index);
 		return 1;
 	}
 
@@ -884,6 +884,13 @@ int main(int argc, char *argv[])
 	if (ctx.use_event)
 		ibv_ack_cq_events(ctx.recv_cq, num_cq_events);
 
+	/* Process should wait before closing its resources to make sure
+	  * latest daemon's response sent via its target QP destined to an XSRQ
+	  * created by another client won't be lost.
+	  * Failure to do so will cause the client to wait for that sent message forever.
+	  * See comment on pp_post_send.
+	*/
+	sleep(1);
 	if (pp_close_ctx())
 		return 1;
 
-- 
1.7.1

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

* RE: [PATCH libibverbs] XRC - Sample application issues
       [not found] ` <1375974336-26314-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2013-08-16 15:10   ` Hefty, Sean
       [not found]     ` <63247C4015478741AE4981C62DF608835683DDC8@MTLDAG01.mtl.com>
       [not found]     ` <1828884A29C6694DAF28B7E6B8A8237388CA64F6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Hefty, Sean @ 2013-08-16 15:10 UTC (permalink / raw)
  To: Yishai Hadas, linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org
  Cc: ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
	tzahio-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org, Sternberg, Jay E,
	Eli Cohen

> @@ -884,6 +884,13 @@ int main(int argc, char *argv[])
>  	if (ctx.use_event)
>  		ibv_ack_cq_events(ctx.recv_cq, num_cq_events);
> 
> +	/* Process should wait before closing its resources to make sure
> +	  * latest daemon's response sent via its target QP destined to an XSRQ
> +	  * created by another client won't be lost.
> +	  * Failure to do so will cause the client to wait for that sent message
> forever.
> +	  * See comment on pp_post_send.
> +	*/
> +	sleep(1);

I dislike adding sleep calls into code.  Isn't there a more robust way to handle this?
--
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	[flat|nested] 6+ messages in thread

* Re: [PATCH libibverbs] XRC - Sample application issues
       [not found]       ` <63247C4015478741AE4981C62DF608835683DDC8-fViJhHBwANKuSA5JZHE7gA@public.gmane.org>
@ 2013-08-18  9:05         ` Yishai Hadas
       [not found]           ` <52108E6C.9070908-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Yishai Hadas @ 2013-08-18  9:05 UTC (permalink / raw)
  To: Hefty, Sean, Roland Dreier,
	linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)
  Cc: yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org, Eli Cohen,
	jay.e.sternberg-ral2JQCrhuEAvxtiuMwx3w, Or Gerlitz,
	Tzahi Oved (tzahio-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org)

On 8/16/2013 06:11 PM, Sean Hefty wrote:
>> @@ -884,6 +884,13 @@ int main(int argc, char *argv[])
>>   	if (ctx.use_event)
>>   		ibv_ack_cq_events(ctx.recv_cq, num_cq_events);
>>
>> +	/* Process should wait before closing its resources to make sure
>> +	  * latest daemon's response sent via its target QP destined to an XSRQ
>> +	  * created by another client won't be lost.
>> +	  * Failure to do so will cause the client to wait for that sent message
>> forever.
>> +	  * See comment on pp_post_send.
>> +	*/
>> +	sleep(1);
> I dislike adding sleep calls into code.  Isn't there a more robust way to handle this?

     In general I agree this sleep is a workaround that comes to solve a synchronization hole in this sample application.
     For that reason I put 5 lines comment to describe the problem and the reason for that sleep statement.
     Long term you could think of synchronizing all the processes through the sockets mechanism to assure they terminate when all packets are received.


--
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	[flat|nested] 6+ messages in thread

* RE: [PATCH libibverbs] XRC - Sample application issues
       [not found]     ` <1828884A29C6694DAF28B7E6B8A8237388CA64F6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2013-08-19 15:27       ` Steve Wise
  0 siblings, 0 replies; 6+ messages in thread
From: Steve Wise @ 2013-08-19 15:27 UTC (permalink / raw)
  To: 'Hefty, Sean', 'Yishai Hadas',
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, roland-BHEL68pLQRGGvPXPguhicg
  Cc: ogerlitz-VPRAkNaXOzVWk0Htik3J/w, tzahio-VPRAkNaXOzVWk0Htik3J/w,
	'Sternberg, Jay E', 'Eli Cohen'



> -----Original Message-----
> From: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of
> Hefty, Sean
> Sent: Friday, August 16, 2013 10:11 AM
> To: Yishai Hadas; linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org
> Cc: ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org; tzahio-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org; Sternberg, Jay E; Eli Cohen
> Subject: RE: [PATCH libibverbs] XRC - Sample application issues
> 
> > @@ -884,6 +884,13 @@ int main(int argc, char *argv[])
> >  	if (ctx.use_event)
> >  		ibv_ack_cq_events(ctx.recv_cq, num_cq_events);
> >
> > +	/* Process should wait before closing its resources to make sure
> > +	  * latest daemon's response sent via its target QP destined to an XSRQ
> > +	  * created by another client won't be lost.
> > +	  * Failure to do so will cause the client to wait for that sent message
> > forever.
> > +	  * See comment on pp_post_send.
> > +	*/
> > +	sleep(1);
> 
> I dislike adding sleep calls into code.  Isn't there a more robust way to handle this?

Perhaps you could synchronize between the processes using the TCP socket  used to exchange the QP
info...

Steve.
 


--
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	[flat|nested] 6+ messages in thread

* Re: [PATCH libibverbs] XRC - Sample application issues
       [not found]           ` <52108E6C.9070908-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
@ 2013-08-19 19:12             ` Jason Gunthorpe
       [not found]               ` <20130819191216.GA29493-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Gunthorpe @ 2013-08-19 19:12 UTC (permalink / raw)
  To: Yishai Hadas
  Cc: Hefty, Sean, Roland Dreier,
	linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org),
	yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org, Eli Cohen,
	jay.e.sternberg-ral2JQCrhuEAvxtiuMwx3w, Or Gerlitz,
	Tzahi Oved (tzahio-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org)

On Sun, Aug 18, 2013 at 12:05:48PM +0300, Yishai Hadas wrote:
> On 8/16/2013 06:11 PM, Sean Hefty wrote:
> >>@@ -884,6 +884,13 @@ int main(int argc, char *argv[])
> >>  	if (ctx.use_event)
> >>  		ibv_ack_cq_events(ctx.recv_cq, num_cq_events);
> >>
> >>+	/* Process should wait before closing its resources to make sure
> >>+	  * latest daemon's response sent via its target QP destined to an XSRQ
> >>+	  * created by another client won't be lost.
> >>+	  * Failure to do so will cause the client to wait for that sent message
> >>forever.
> >>+	  * See comment on pp_post_send.
> >>+	*/
> >>+	sleep(1);
> >I dislike adding sleep calls into code.  Isn't there a more robust way to handle this?
> 
> In general I agree this sleep is a workaround that comes to solve a
> synchronization hole in this sample application.  For that reason I
> put 5 lines comment to describe the problem and the reason for that
> sleep statement.  Long term you could think of synchronizing all the
> processes through the sockets mechanism to assure they terminate
> when all packets are received.

This example is very close to the only code that people will have
access to when trying to work with XRC.

It should be complete and correct under all cases. So no sleeps, IMHO.

Jason
--
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	[flat|nested] 6+ messages in thread

* Re: [PATCH libibverbs] XRC - Sample application issues
       [not found]               ` <20130819191216.GA29493-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2013-08-20  5:16                 ` Ido Shamai
  0 siblings, 0 replies; 6+ messages in thread
From: Ido Shamai @ 2013-08-20  5:16 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Yishai Hadas, Hefty, Sean, Roland Dreier,
	linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org),
	yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org, Eli Cohen,
	jay.e.sternberg-ral2JQCrhuEAvxtiuMwx3w, Or Gerlitz,
	Tzahi Oved (tzahio-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org)


On 8/19/2013 10:12 PM, Jason Gunthorpe wrote:
> On Sun, Aug 18, 2013 at 12:05:48PM +0300, Yishai Hadas wrote:
>> On 8/16/2013 06:11 PM, Sean Hefty wrote:
>>>> @@ -884,6 +884,13 @@ int main(int argc, char *argv[])
>>>>   	if (ctx.use_event)
>>>>   		ibv_ack_cq_events(ctx.recv_cq, num_cq_events);
>>>>
>>>> +	/* Process should wait before closing its resources to make sure
>>>> +	  * latest daemon's response sent via its target QP destined to an XSRQ
>>>> +	  * created by another client won't be lost.
>>>> +	  * Failure to do so will cause the client to wait for that sent message
>>>> forever.
>>>> +	  * See comment on pp_post_send.
>>>> +	*/
>>>> +	sleep(1);
>>> I dislike adding sleep calls into code.  Isn't there a more robust way to handle this?
>> In general I agree this sleep is a workaround that comes to solve a
>> synchronization hole in this sample application.  For that reason I
>> put 5 lines comment to describe the problem and the reason for that
>> sleep statement.  Long term you could think of synchronizing all the
>> processes through the sockets mechanism to assure they terminate
>> when all packets are received.
> This example is very close to the only code that people will have
> access to when trying to work with XRC.
Latest perftest package also contains a use case of XRC.
No sleep.

Ido
> It should be complete and correct under all cases. So no sleeps, IMHO.
>
> Jason
> --
> 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
>

--
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	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-08-20  5:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-08 15:05 [PATCH libibverbs] XRC - Sample application issues Yishai Hadas
     [not found] ` <1375974336-26314-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-08-16 15:10   ` Hefty, Sean
     [not found]     ` <63247C4015478741AE4981C62DF608835683DDC8@MTLDAG01.mtl.com>
     [not found]       ` <63247C4015478741AE4981C62DF608835683DDC8-fViJhHBwANKuSA5JZHE7gA@public.gmane.org>
2013-08-18  9:05         ` Yishai Hadas
     [not found]           ` <52108E6C.9070908-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2013-08-19 19:12             ` Jason Gunthorpe
     [not found]               ` <20130819191216.GA29493-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-08-20  5:16                 ` Ido Shamai
     [not found]     ` <1828884A29C6694DAF28B7E6B8A8237388CA64F6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-08-19 15:27       ` Steve Wise

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox