From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sfi-mx-3.v28.ch3.sourceforge.com ([172.29.28.123] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NmnBB-0000A0-Df for ltp-list@lists.sourceforge.net; Wed, 03 Mar 2010 11:55:53 +0000 Received: from mail-pw0-f47.google.com ([209.85.160.47]) by sfi-mx-3.v28.ch3.sourceforge.com with esmtp (Exim 4.69) id 1NmnBA-0006co-He for ltp-list@lists.sourceforge.net; Wed, 03 Mar 2010 11:55:53 +0000 Received: by pwi5 with SMTP id 5so735078pwi.34 for ; Wed, 03 Mar 2010 03:55:47 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <20100303045624.GB10185@linux.vnet.ibm.com> <20100303070342.GB19084@linux.vnet.ibm.com> <364299f41003030118x6136dda6u7017054febea4b96@mail.gmail.com> <20100303094541.GB23601@linux.vnet.ibm.com> <364299f41003030342m7bf4a44ey897b7d2ca365a318@mail.gmail.com> Date: Wed, 3 Mar 2010 03:55:46 -0800 Message-ID: <364299f41003030355y5a921691vdde6baafbe8439cd@mail.gmail.com> From: Garrett Cooper Subject: Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c List-Id: Linux Test Project General Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable Errors-To: ltp-list-bounces@lists.sourceforge.net To: naresh kamboju Cc: ltp-list@lists.sourceforge.net On Wed, Mar 3, 2010 at 3:49 AM, naresh kamboju wr= ote: > On Wed, Mar 3, 2010 at 5:12 PM, Garrett Cooper wrote: >> On Wed, Mar 3, 2010 at 3:33 AM, naresh kamboju = wrote: >>> On Wed, Mar 3, 2010 at 3:15 PM, Rishikesh K Rajak >>> wrote: >>>> On Wed, Mar 03, 2010 at 01:18:50AM -0800, Garrett Cooper wrote: >>>>> Uh, hold on a sec before we call it good... >>>> >>>> oh ok, holiding on for bit. >>>> >>>> Naresh, can you please send a patch with incorporating garret's comment >>>> ? >>>>>>> + =A0 =A0 =A0 =A0/* Step 3 Implementation */ >>>>>>> =A0 =A0 =A0 /* Make sure the two children has been waiting */ >>>>>>> - =A0 =A0 /*do { >>>>>>> - =A0 =A0 =A0 =A0 =A0 =A0 sleep(1); >>>>>>> + =A0 =A0 do { >>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 sem_getvalue(sem_1, &val); >>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 //printf("val =3D %d\n", val); >>>>>>> =A0 =A0 =A0 } while (val !=3D 1); >>>>>>> - =A0 =A0 */ >>>>> >>>>> Please provide another patch with a limit to this -- >>> >>> Garrett, >>> >>> When sem_wait is called 'val' value will be decremented by one. >>> To ensure that sem_wait is called, we are checking 'val' value by >>> calling sem_getvalue(). in this case we don=92t need to decrement the >>> values by --. IIUC. >>> (snip) >>> OTOH, >>>>> I get annoyed >>>>> with tests that have infinite loops in them because the underlying >>>>> functionality is broken. >>> I agree with you, having infinite loops in test case is not a good. >>> However, in this patch while loop is not infinite loop. It is a >>> conditional loop with finite value. >>> >>> Please let me know if you have any issues. >> >> =A0 =A0The problem was that it wasn't failing properly as stated in the >> manpage on mips* (was decrementing past 0) and it was blocking >> indefinitely. Hence I had to yank those tests from the default run. > do you mean, after applying above patch you have noticed these kind of be= havior? Not with this patch; I've seen this kind of behavior in general under odd conditions with my former team's embedded setup running tests with POSIX semaphores, so I don't doubt that others could run into the similar functional issues given the right conditions. Thanks, -Garrett ---------------------------------------------------------------------------= --- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list