<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>Fast lock loop with arm</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><SPAN LANG="en-gb"><FONT FACE="Times New Roman">Hi,</FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">I have a big problem with fast lock mutex on arm CPU: </FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">sometimes I find one or more children that go in an infinite loop, in the while loop of get_lock function. </FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">They remain in Run for long time (sometimes hours) and openser keeps 100% CPU.</FONT></SPAN>
</P>

<P><SPAN LANG="en-gb"><FONT FACE="Times New Roman">Now I have changed the functions get_lock and tsl in order to obtain more info and </FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">I observe that&nbsp; (if and) when the process finish the cycle, it have done a big amount of cycles.&nbsp; </FONT></SPAN>
</P>

<P><SPAN LANG="en-gb"><FONT FACE="Times New Roman">This the log with my added info:</FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">Mar 26 20:29:08 SAM-IP openser[1645]: NOTICE:tm:_lock: ret 1 (cycle)</FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">Mar 26 20:29:51 SAM-IP openser[1645]: NOTICE:tm:_lock: ret 1 (cycle)</FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">Mar 26 20:29:55 SAM-IP openser[1645]: NOTICE:tm:_lock: ret 1 (cycle)</FONT></SPAN>
</P>

<P><SPAN LANG="en-gb"><FONT FACE="Times New Roman">Mar 26 20:29:55 SAM-IP openser[1645]: NOTICE:tm:t_retransmit_reply: MYTM lock </FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">[process in loop]</FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">Mar 26 20:33:46 SAM-IP openser[1645]: NOTICE:tm:_lock: ret 59374917 (cycle)</FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">[after 4 minutes and 59374917 cycles, this is an example with a &quot;short&quot; loop]</FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">Mar 26 20:33:46 SAM-IP openser[1645]: NOTICE:tm:t_retransmit_reply: MYTM lock done </FONT></SPAN>
</P>

<P><SPAN LANG="en-gb"><FONT FACE="Times New Roman">I&#8217;m not able to recognize the call flow that generates the loop (I know only that it always happens when t_retransmit_reply calls LOCK_REPLIES), </FONT></SPAN></P>

<P><SPAN LANG="en-gb"><FONT FACE="Times New Roman">but I urgently need a work around to escape from the loop.</FONT></SPAN>
</P>

<P><SPAN LANG="en-gb"><FONT FACE="Times New Roman">This is the get_lock function with my counter j:</FONT></SPAN>
</P>

<P><SPAN LANG="en-gb"><FONT FACE="Times New Roman">inline static int get_lock(fl_lock_t* lock)</FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">{</FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">#ifdef ADAPTIVE_WAIT</FONT></SPAN>

<BR><SPAN LANG="en-gb">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT FACE="Times New Roman">int i=ADAPTIVE_WAIT_LOOPS;</FONT></SPAN>

<BR><SPAN LANG="en-gb">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT FACE="Times New Roman">int j=1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /***** my change ****/</FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">#endif</FONT></SPAN>

<BR><SPAN LANG="en-gb">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>

<BR><SPAN LANG="en-gb">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT FACE="Times New Roman">while(tsl(lock)){</FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">#ifdef BUSY_WAIT</FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">#elif defined ADAPTIVE_WAIT</FONT></SPAN>

<BR><SPAN LANG="en-gb">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT FACE="Times New Roman">j++;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /***** my change ****/</FONT></SPAN>

<BR><SPAN LANG="en-gb">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT FACE="Times New Roman">if (i&gt;0) i--;</FONT></SPAN>

<BR><SPAN LANG="en-gb">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT FACE="Times New Roman">else sched_yield();</FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">#else</FONT></SPAN>

<BR><SPAN LANG="en-gb">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT FACE="Times New Roman">sched_yield();</FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">#endif</FONT></SPAN>

<BR><SPAN LANG="en-gb">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT FACE="Times New Roman">}</FONT></SPAN>

<BR><SPAN LANG="en-gb">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT FACE="Times New Roman">return(j);</FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">}</FONT></SPAN>
</P>

<P><SPAN LANG="en-gb"><FONT FACE="Times New Roman">Can I break the lock when my counter reaches a big value? </FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">Should I call the unlock function after the break?</FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">which value can be considered too big?</FONT></SPAN>
</P>

<P><SPAN LANG="en-gb"><FONT FACE="Times New Roman">Thanks,</FONT></SPAN>

<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">Daniele </FONT></SPAN>
</P>
<BR>
<BR>

<p>**********************************************************************
The information in this message is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this 
message
by anyone else is unauthorized. If you are not the intended 
recipient, any
disclosure, copying, or distribution of the message, or any action 
or
omission taken by you in reliance on it, is prohibited and may be 
unlawful.
Please immediately contact the sender if you have received this 
message in error.


**********************************************************************</p>
</BODY>
</HTML>