All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Synchronization required before release the lock:  sem_post/8-1.c
@ 2010-02-25 13:45 ` naresh kamboju
  0 siblings, 0 replies; 22+ messages in thread
From: naresh kamboju @ 2010-02-25 13:45 UTC (permalink / raw)
  To: ltp-list; +Cc: Subrata Modak, Garrett Cooper, Masatake YAMATO, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2836 bytes --]

Hi,

I have found abnormal behavior of sem_post/8-1.c test case under posix.
This test case passes in some times and failed in many times :-(

After my investigation found synchronization is missing between the
child processes.
Made a patch to fix this issue.

Patch includes
1.	Reverting back changes made by mreed on Sep 25 2006. Making sure
child has been waiting for the lock (below Refs).
2.	using sleep in while loop is not a good idea, so sleep is removed
from while loop
3.	For the synchronization I have added sleep before releasing the lock.


After applying this patch I have tested this test case 1000 times continuously.
All the times test case reported as Test Pass :-)


Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >
---
 testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
|   15    8 +     7 -     0 !
 1 file changed, 8 insertions(+), 7 deletions(-)

Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
===================================================================
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
@@ -161,7 +161,6 @@ int main()
        }
        fprintf(stderr, "P: child_1:%d forked\n", c_1);

-       sleep(1);
        c_2 = fork();
        if (c_2 == 0)
        {
@@ -176,13 +175,13 @@ int main()
        }
        fprintf(stderr, "P: child_2: %d forked\n", c_2);

+        /* Step 3 Implementation */
        /* Make sure the two children has been waiting */
-       /*do {
-               sleep(1);
+       do {
                sem_getvalue(sem_1, &val);
                //printf("val = %d\n", val);
        } while (val != 1);
-       */
+
        c_3 = fork();
        if (c_3 == 0)
        {
@@ -191,13 +190,15 @@ int main()
        }
        fprintf(stderr, "P: child_3: %d forked\n", c_3);

+        /* Step 3 Implementation */
        /* Make sure child 3 has been waiting for the lock */
-       /*do {
-               sleep(1);
+       do {
                sem_getvalue(sem_1, &val);
                //printf("val = %d\n", val);
        } while (val != 0);
-       */
+
+       /* Synchronization required before release the lock */
+       sleep(1);
        /* Ok, let's release the lock */
        fprintf(stderr, "P: release lock\n");
        sem_post(sem);


Test script to test 1000 times:
/*****************************************************/
#!/bin/sh

for ((  i = 0 ;  i < 1000;  i++  ))

do

./8-1.test >> /tmp/sem-post-8-1.log
done
/*****************************************************/

Refs:
http://ltp.cvs.sourceforge.net/viewvc/ltp/ltp/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c?view=log

Please review this patch and let me know if you have any issues.

Best regards
Naresh Kamboju

[-- Attachment #2: posix-sem-post-unstable-fix.patch --]
[-- Type: application/octet-stream, Size: 1383 bytes --]

---
 testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c |   15 	8 +	7 -	0 !
 1 file changed, 8 insertions(+), 7 deletions(-)

Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
===================================================================
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
@@ -161,7 +161,6 @@ int main() 
 	}
 	fprintf(stderr, "P: child_1:%d forked\n", c_1);
 	
-	sleep(1);
 	c_2 = fork();
 	if (c_2 == 0)
 	{
@@ -176,13 +175,13 @@ int main() 
 	}
 	fprintf(stderr, "P: child_2: %d forked\n", c_2);
 
+        /* Step 3 Implementation */
 	/* Make sure the two children has been waiting */	
-	/*do { 
-		sleep(1);
+	do {
 		sem_getvalue(sem_1, &val);
 		//printf("val = %d\n", val);
 	} while (val != 1);
-	*/
+
 	c_3 = fork();
 	if (c_3 == 0)
 	{
@@ -191,13 +190,15 @@ int main() 
 	}
 	fprintf(stderr, "P: child_3: %d forked\n", c_3);
 	
+        /* Step 3 Implementation */
 	/* Make sure child 3 has been waiting for the lock */	
-	/*do { 
-		sleep(1);
+	do {
 		sem_getvalue(sem_1, &val);
 		//printf("val = %d\n", val);
 	} while (val != 0);
-	*/
+
+	/* Synchronization required before release the lock */
+	sleep(1);
 	/* Ok, let's release the lock */
 	fprintf(stderr, "P: release lock\n");
 	sem_post(sem);

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
@ 2010-02-25 13:45 ` naresh kamboju
  0 siblings, 0 replies; 22+ messages in thread
From: naresh kamboju @ 2010-02-25 13:45 UTC (permalink / raw)
  To: ltp-list; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2836 bytes --]

Hi,

I have found abnormal behavior of sem_post/8-1.c test case under posix.
This test case passes in some times and failed in many times :-(

After my investigation found synchronization is missing between the
child processes.
Made a patch to fix this issue.

Patch includes
1.	Reverting back changes made by mreed on Sep 25 2006. Making sure
child has been waiting for the lock (below Refs).
2.	using sleep in while loop is not a good idea, so sleep is removed
from while loop
3.	For the synchronization I have added sleep before releasing the lock.


After applying this patch I have tested this test case 1000 times continuously.
All the times test case reported as Test Pass :-)


Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >
---
 testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
|   15    8 +     7 -     0 !
 1 file changed, 8 insertions(+), 7 deletions(-)

Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
===================================================================
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
@@ -161,7 +161,6 @@ int main()
        }
        fprintf(stderr, "P: child_1:%d forked\n", c_1);

-       sleep(1);
        c_2 = fork();
        if (c_2 == 0)
        {
@@ -176,13 +175,13 @@ int main()
        }
        fprintf(stderr, "P: child_2: %d forked\n", c_2);

+        /* Step 3 Implementation */
        /* Make sure the two children has been waiting */
-       /*do {
-               sleep(1);
+       do {
                sem_getvalue(sem_1, &val);
                //printf("val = %d\n", val);
        } while (val != 1);
-       */
+
        c_3 = fork();
        if (c_3 == 0)
        {
@@ -191,13 +190,15 @@ int main()
        }
        fprintf(stderr, "P: child_3: %d forked\n", c_3);

+        /* Step 3 Implementation */
        /* Make sure child 3 has been waiting for the lock */
-       /*do {
-               sleep(1);
+       do {
                sem_getvalue(sem_1, &val);
                //printf("val = %d\n", val);
        } while (val != 0);
-       */
+
+       /* Synchronization required before release the lock */
+       sleep(1);
        /* Ok, let's release the lock */
        fprintf(stderr, "P: release lock\n");
        sem_post(sem);


Test script to test 1000 times:
/*****************************************************/
#!/bin/sh

for ((  i = 0 ;  i < 1000;  i++  ))

do

./8-1.test >> /tmp/sem-post-8-1.log
done
/*****************************************************/

Refs:
http://ltp.cvs.sourceforge.net/viewvc/ltp/ltp/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c?view=log

Please review this patch and let me know if you have any issues.

Best regards
Naresh Kamboju

[-- Attachment #2: posix-sem-post-unstable-fix.patch --]
[-- Type: application/octet-stream, Size: 1383 bytes --]

---
 testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c |   15 	8 +	7 -	0 !
 1 file changed, 8 insertions(+), 7 deletions(-)

Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
===================================================================
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
@@ -161,7 +161,6 @@ int main() 
 	}
 	fprintf(stderr, "P: child_1:%d forked\n", c_1);
 	
-	sleep(1);
 	c_2 = fork();
 	if (c_2 == 0)
 	{
@@ -176,13 +175,13 @@ int main() 
 	}
 	fprintf(stderr, "P: child_2: %d forked\n", c_2);
 
+        /* Step 3 Implementation */
 	/* Make sure the two children has been waiting */	
-	/*do { 
-		sleep(1);
+	do {
 		sem_getvalue(sem_1, &val);
 		//printf("val = %d\n", val);
 	} while (val != 1);
-	*/
+
 	c_3 = fork();
 	if (c_3 == 0)
 	{
@@ -191,13 +190,15 @@ int main() 
 	}
 	fprintf(stderr, "P: child_3: %d forked\n", c_3);
 	
+        /* Step 3 Implementation */
 	/* Make sure child 3 has been waiting for the lock */	
-	/*do { 
-		sleep(1);
+	do {
 		sem_getvalue(sem_1, &val);
 		//printf("val = %d\n", val);
 	} while (val != 0);
-	*/
+
+	/* Synchronization required before release the lock */
+	sleep(1);
 	/* Ok, let's release the lock */
 	fprintf(stderr, "P: release lock\n");
 	sem_post(sem);

[-- Attachment #3: Type: text/plain, Size: 345 bytes --]

------------------------------------------------------------------------------
Download Intel&#174; 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

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
  2010-02-25 13:45 ` [LTP] " naresh kamboju
@ 2010-03-02  8:50   ` Rishikesh K Rajak
  -1 siblings, 0 replies; 22+ messages in thread
From: Rishikesh K Rajak @ 2010-03-02  8:50 UTC (permalink / raw)
  To: naresh kamboju; +Cc: ltp-list, linux-kernel

On Thu, Feb 25, 2010 at 07:15:42PM +0530, naresh kamboju wrote:
> Hi,
> 
> I have found abnormal behavior of sem_post/8-1.c test case under posix.
> This test case passes in some times and failed in many times :-(
> 
> After my investigation found synchronization is missing between the
> child processes.
> Made a patch to fix this issue.
> 
> Patch includes
> 1.	Reverting back changes made by mreed on Sep 25 2006. Making sure
> child has been waiting for the lock (below Refs).
> 2.	using sleep in while loop is not a good idea, so sleep is removed
> from while loop
> 3.	For the synchronization I have added sleep before releasing the lock.
> 
> 
> After applying this patch I have tested this test case 1000 times continuously.
> All the times test case reported as Test Pass :-)
> 
> 
> Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >

Looks good to me though i needed few clarification below.

Acked-By: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com>

> ---
>  testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> |   15    8 +     7 -     0 !
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> ===================================================================
> --- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> @@ -161,7 +161,6 @@ int main()
>         }
>         fprintf(stderr, "P: child_1:%d forked\n", c_1);
> 
> -       sleep(1);
>         c_2 = fork();
>         if (c_2 == 0)
>         {
> @@ -176,13 +175,13 @@ int main()
>         }
>         fprintf(stderr, "P: child_2: %d forked\n", c_2);
> 
> +        /* Step 3 Implementation */
>         /* Make sure the two children has been waiting */
> -       /*do {
> -               sleep(1);
I feel before getting semaphore value, we need to sync first so here
sleep is require,though your point is valid that there is no use of
using sleep inside while loop.

> +       do {
>                 sem_getvalue(sem_1, &val);
>                 //printf("val = %d\n", val);
>         } while (val != 1);
> -       */
> +
>         c_3 = fork();
>         if (c_3 == 0)
>         {
> @@ -191,13 +190,15 @@ int main()
>         }
>         fprintf(stderr, "P: child_3: %d forked\n", c_3);
> 
> +        /* Step 3 Implementation */
>         /* Make sure child 3 has been waiting for the lock */
> -       /*do {
> -               sleep(1);
> +       do {
>                 sem_getvalue(sem_1, &val);
>                 //printf("val = %d\n", val);
>         } while (val != 0);
> -       */
> +
> +       /* Synchronization required before release the lock */
> +       sleep(1);
>         /* Ok, let's release the lock */
>         fprintf(stderr, "P: release lock\n");
>         sem_post(sem);
> 
> 
> Test script to test 1000 times:
> /*****************************************************/
> #!/bin/sh
> 
> for ((  i = 0 ;  i < 1000;  i++  ))
> 
> do
> 
> ./8-1.test >> /tmp/sem-post-8-1.log
> done
> /*****************************************************/
> 
> Refs:
> http://ltp.cvs.sourceforge.net/viewvc/ltp/ltp/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c?view=log
> 
> Please review this patch and let me know if you have any issues.
> 
> Best regards
> Naresh Kamboju


> ------------------------------------------------------------------------------
> Download Intel&#174; 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


-- 
Thanks & Regards
Rishi
LTP Maintainer
IBM, LTC, Bangalore
Please join IRC #ltp @ irc.freenode.net

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
@ 2010-03-02  8:50   ` Rishikesh K Rajak
  0 siblings, 0 replies; 22+ messages in thread
From: Rishikesh K Rajak @ 2010-03-02  8:50 UTC (permalink / raw)
  To: naresh kamboju; +Cc: ltp-list, linux-kernel

On Thu, Feb 25, 2010 at 07:15:42PM +0530, naresh kamboju wrote:
> Hi,
> 
> I have found abnormal behavior of sem_post/8-1.c test case under posix.
> This test case passes in some times and failed in many times :-(
> 
> After my investigation found synchronization is missing between the
> child processes.
> Made a patch to fix this issue.
> 
> Patch includes
> 1.	Reverting back changes made by mreed on Sep 25 2006. Making sure
> child has been waiting for the lock (below Refs).
> 2.	using sleep in while loop is not a good idea, so sleep is removed
> from while loop
> 3.	For the synchronization I have added sleep before releasing the lock.
> 
> 
> After applying this patch I have tested this test case 1000 times continuously.
> All the times test case reported as Test Pass :-)
> 
> 
> Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >

Looks good to me though i needed few clarification below.

Acked-By: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com>

> ---
>  testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> |   15    8 +     7 -     0 !
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> ===================================================================
> --- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> @@ -161,7 +161,6 @@ int main()
>         }
>         fprintf(stderr, "P: child_1:%d forked\n", c_1);
> 
> -       sleep(1);
>         c_2 = fork();
>         if (c_2 == 0)
>         {
> @@ -176,13 +175,13 @@ int main()
>         }
>         fprintf(stderr, "P: child_2: %d forked\n", c_2);
> 
> +        /* Step 3 Implementation */
>         /* Make sure the two children has been waiting */
> -       /*do {
> -               sleep(1);
I feel before getting semaphore value, we need to sync first so here
sleep is require,though your point is valid that there is no use of
using sleep inside while loop.

> +       do {
>                 sem_getvalue(sem_1, &val);
>                 //printf("val = %d\n", val);
>         } while (val != 1);
> -       */
> +
>         c_3 = fork();
>         if (c_3 == 0)
>         {
> @@ -191,13 +190,15 @@ int main()
>         }
>         fprintf(stderr, "P: child_3: %d forked\n", c_3);
> 
> +        /* Step 3 Implementation */
>         /* Make sure child 3 has been waiting for the lock */
> -       /*do {
> -               sleep(1);
> +       do {
>                 sem_getvalue(sem_1, &val);
>                 //printf("val = %d\n", val);
>         } while (val != 0);
> -       */
> +
> +       /* Synchronization required before release the lock */
> +       sleep(1);
>         /* Ok, let's release the lock */
>         fprintf(stderr, "P: release lock\n");
>         sem_post(sem);
> 
> 
> Test script to test 1000 times:
> /*****************************************************/
> #!/bin/sh
> 
> for ((  i = 0 ;  i < 1000;  i++  ))
> 
> do
> 
> ./8-1.test >> /tmp/sem-post-8-1.log
> done
> /*****************************************************/
> 
> Refs:
> http://ltp.cvs.sourceforge.net/viewvc/ltp/ltp/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c?view=log
> 
> Please review this patch and let me know if you have any issues.
> 
> Best regards
> Naresh Kamboju


> ------------------------------------------------------------------------------
> Download Intel&#174; 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


-- 
Thanks & Regards
Rishi
LTP Maintainer
IBM, LTC, Bangalore
Please join IRC #ltp @ irc.freenode.net

------------------------------------------------------------------------------
Download Intel&#174; 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock:  sem_post/8-1.c
  2010-03-02  8:50   ` Rishikesh K Rajak
@ 2010-03-02 15:08     ` naresh kamboju
  -1 siblings, 0 replies; 22+ messages in thread
From: naresh kamboju @ 2010-03-02 15:08 UTC (permalink / raw)
  To: Rishikesh K Rajak; +Cc: linux-kernel, ltp-list

On Tue, Mar 2, 2010 at 2:20 PM, Rishikesh K Rajak
<risrajak@linux.vnet.ibm.com> wrote:
> On Thu, Feb 25, 2010 at 07:15:42PM +0530, naresh kamboju wrote:
>> Hi,
>>
>> I have found abnormal behavior of sem_post/8-1.c test case under posix.
>> This test case passes in some times and failed in many times :-(
>> Patch includes
>> 1.    Reverting back changes made by mreed on Sep 25 2006. Making sure
>> child has been waiting for the lock (below Refs).
>> 2.    using sleep in while loop is not a good idea, so sleep is removed
>> from while loop
>> 3.    For the synchronization I have added sleep before releasing the lock.
>>
>> Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >
>
> Looks good to me though i needed few clarification below.
>
> Acked-By: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com>
>
>> ---
>>  testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> |   15    8 +     7 -     0 !
>>  1 file changed, 8 insertions(+), 7 deletions(-)
>>
>> Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> ===================================================================
>> --- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> +++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> @@ -161,7 +161,6 @@ int main()
>>         }
>>         fprintf(stderr, "P: child_1:%d forked\n", c_1);
>>
>> -       sleep(1);
>>         c_2 = fork();
>>         if (c_2 == 0)
>>         {
>> @@ -176,13 +175,13 @@ int main()
>>         }
>>         fprintf(stderr, "P: child_2: %d forked\n", c_2);
>>
>> +        /* Step 3 Implementation */
>>         /* Make sure the two children has been waiting */
>> -       /*do {
>> -               sleep(1);
> I feel before getting semaphore value, we need to sync first so here
> sleep is require,though your point is valid that there is no use of
> using sleep inside while loop.
I agree with you.
AFAIU, we should call sleep() before calling getting semaphore
value.when we don't have while loop here. Because while loop condition
is depends on val so when ever we call sem_getvalue() it will get
latest value of val.
In addition to this, we are ensuring val is decremented before we do
unlock the sem by while loop condition.

Having sleep() in while loop will not effect the final output. IIUC

Best regards,
Naresh Kamboju
>> Please review this patch and let me know if you have any issues.
>>
>> Best regards
>> Naresh Kamboju
> --
> Thanks & Regards
> Rishi
> LTP Maintainer
> IBM, LTC, Bangalore
> Please join IRC #ltp @ irc.freenode.net

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
@ 2010-03-02 15:08     ` naresh kamboju
  0 siblings, 0 replies; 22+ messages in thread
From: naresh kamboju @ 2010-03-02 15:08 UTC (permalink / raw)
  To: Rishikesh K Rajak; +Cc: ltp-list, linux-kernel

On Tue, Mar 2, 2010 at 2:20 PM, Rishikesh K Rajak
<risrajak@linux.vnet.ibm.com> wrote:
> On Thu, Feb 25, 2010 at 07:15:42PM +0530, naresh kamboju wrote:
>> Hi,
>>
>> I have found abnormal behavior of sem_post/8-1.c test case under posix.
>> This test case passes in some times and failed in many times :-(
>> Patch includes
>> 1.    Reverting back changes made by mreed on Sep 25 2006. Making sure
>> child has been waiting for the lock (below Refs).
>> 2.    using sleep in while loop is not a good idea, so sleep is removed
>> from while loop
>> 3.    For the synchronization I have added sleep before releasing the lock.
>>
>> Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >
>
> Looks good to me though i needed few clarification below.
>
> Acked-By: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com>
>
>> ---
>>  testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> |   15    8 +     7 -     0 !
>>  1 file changed, 8 insertions(+), 7 deletions(-)
>>
>> Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> ===================================================================
>> --- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> +++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> @@ -161,7 +161,6 @@ int main()
>>         }
>>         fprintf(stderr, "P: child_1:%d forked\n", c_1);
>>
>> -       sleep(1);
>>         c_2 = fork();
>>         if (c_2 == 0)
>>         {
>> @@ -176,13 +175,13 @@ int main()
>>         }
>>         fprintf(stderr, "P: child_2: %d forked\n", c_2);
>>
>> +        /* Step 3 Implementation */
>>         /* Make sure the two children has been waiting */
>> -       /*do {
>> -               sleep(1);
> I feel before getting semaphore value, we need to sync first so here
> sleep is require,though your point is valid that there is no use of
> using sleep inside while loop.
I agree with you.
AFAIU, we should call sleep() before calling getting semaphore
value.when we don't have while loop here. Because while loop condition
is depends on val so when ever we call sem_getvalue() it will get
latest value of val.
In addition to this, we are ensuring val is decremented before we do
unlock the sem by while loop condition.

Having sleep() in while loop will not effect the final output. IIUC

Best regards,
Naresh Kamboju
>> Please review this patch and let me know if you have any issues.
>>
>> Best regards
>> Naresh Kamboju
> --
> Thanks & Regards
> Rishi
> LTP Maintainer
> IBM, LTC, Bangalore
> Please join IRC #ltp @ irc.freenode.net

------------------------------------------------------------------------------
Download Intel&#174; 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock:  sem_post/8-1.c
       [not found]     ` <20100303045624.GB10185@linux.vnet.ibm.com>
@ 2010-03-03  6:00         ` naresh kamboju
  0 siblings, 0 replies; 22+ messages in thread
From: naresh kamboju @ 2010-03-03  6:00 UTC (permalink / raw)
  To: Rishikesh K Rajak

[-- Attachment #1: Type: text/plain, Size: 2784 bytes --]

On Wed, Mar 3, 2010 at 10:26 AM, Rishikesh K Rajak
<risrajak@linux.vnet.ibm.com> wrote:
> On Tue, Mar 02, 2010 at 08:38:20PM +0530, naresh kamboju wrote:
>> On Tue, Mar 2, 2010 at 2:20 PM, Rishikesh K Rajak
>> <risrajak@linux.vnet.ibm.com> wrote:
>> > I feel before getting semaphore value, we need to sync first so here
>> > sleep is require,though your point is valid that there is no use of
>> > using sleep inside while loop.
>> I agree with you.
>> AFAIU, we should call sleep() before calling getting semaphore
>> value.when we don't have while loop here. Because while loop condition
>> is depends on val so when ever we call sem_getvalue() it will get
>> latest value of val.
>> In addition to this, we are ensuring val is decremented before we do
>> unlock the sem by while loop condition.
>>
>> Having sleep() in while loop will not effect the final output. IIUC
>>
>
> Hi Naresh,
>
> I am not able to apply your patch against ltp next branch. can you
> please send me patch against next branch of ltp ?
Here I have posted and attached to this e-mail.

Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >

---
 testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
|   15 	8 +	7 -	0 !
 1 file changed, 8 insertions(+), 7 deletions(-)

Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
===================================================================
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
@@ -161,7 +161,6 @@ int main()
 	}
 	fprintf(stderr, "P: child_1:%d forked\n", c_1);
 	
-	sleep(1);
 	c_2 = fork();
 	if (c_2 == 0)
 	{
@@ -176,13 +175,13 @@ int main()
 	}
 	fprintf(stderr, "P: child_2: %d forked\n", c_2);

+        /* Step 3 Implementation */
 	/* Make sure the two children has been waiting */	
-	/*do {
-		sleep(1);
+	do {
 		sem_getvalue(sem_1, &val);
 		//printf("val = %d\n", val);
 	} while (val != 1);
-	*/
+
 	c_3 = fork();
 	if (c_3 == 0)
 	{
@@ -191,13 +190,15 @@ int main()
 	}
 	fprintf(stderr, "P: child_3: %d forked\n", c_3);
 	
+        /* Step 3 Implementation */
 	/* Make sure child 3 has been waiting for the lock */	
-	/*do {
-		sleep(1);
+	do {
 		sem_getvalue(sem_1, &val);
 		//printf("val = %d\n", val);
 	} while (val != 0);
-	*/
+
+	/* Synchronization required before release the lock */
+	sleep(1);
 	/* Ok, let's release the lock */
 	fprintf(stderr, "P: release lock\n");
 	sem_post(sem);

Best regards
Naresh Kamboju
>
> #git clone -b next
> git://ltp.git.sourceforge.net/gitroot/ltp/ltp-dev.git ltp
>
> And then create your patch and send it to ltp-list@
>
> --
> Thanks & Regards
> Rishi
> LTP Maintainer
> IBM, LTC, Bangalore
> Please join IRC #ltp @ irc.freenode.net
>

[-- Attachment #2: posix-sem-post-unstable-fix.patch --]
[-- Type: application/octet-stream, Size: 1383 bytes --]

---
 testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c |   15 	8 +	7 -	0 !
 1 file changed, 8 insertions(+), 7 deletions(-)

Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
===================================================================
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
@@ -161,7 +161,6 @@ int main() 
 	}
 	fprintf(stderr, "P: child_1:%d forked\n", c_1);
 	
-	sleep(1);
 	c_2 = fork();
 	if (c_2 == 0)
 	{
@@ -176,13 +175,13 @@ int main() 
 	}
 	fprintf(stderr, "P: child_2: %d forked\n", c_2);
 
+        /* Step 3 Implementation */
 	/* Make sure the two children has been waiting */	
-	/*do { 
-		sleep(1);
+	do {
 		sem_getvalue(sem_1, &val);
 		//printf("val = %d\n", val);
 	} while (val != 1);
-	*/
+
 	c_3 = fork();
 	if (c_3 == 0)
 	{
@@ -191,13 +190,15 @@ int main() 
 	}
 	fprintf(stderr, "P: child_3: %d forked\n", c_3);
 	
+        /* Step 3 Implementation */
 	/* Make sure child 3 has been waiting for the lock */	
-	/*do { 
-		sleep(1);
+	do {
 		sem_getvalue(sem_1, &val);
 		//printf("val = %d\n", val);
 	} while (val != 0);
-	*/
+
+	/* Synchronization required before release the lock */
+	sleep(1);
 	/* Ok, let's release the lock */
 	fprintf(stderr, "P: release lock\n");
 	sem_post(sem);

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
@ 2010-03-03  6:00         ` naresh kamboju
  0 siblings, 0 replies; 22+ messages in thread
From: naresh kamboju @ 2010-03-03  6:00 UTC (permalink / raw)
  To: Rishikesh K Rajak

[-- Attachment #1: Type: text/plain, Size: 2784 bytes --]

On Wed, Mar 3, 2010 at 10:26 AM, Rishikesh K Rajak
<risrajak@linux.vnet.ibm.com> wrote:
> On Tue, Mar 02, 2010 at 08:38:20PM +0530, naresh kamboju wrote:
>> On Tue, Mar 2, 2010 at 2:20 PM, Rishikesh K Rajak
>> <risrajak@linux.vnet.ibm.com> wrote:
>> > I feel before getting semaphore value, we need to sync first so here
>> > sleep is require,though your point is valid that there is no use of
>> > using sleep inside while loop.
>> I agree with you.
>> AFAIU, we should call sleep() before calling getting semaphore
>> value.when we don't have while loop here. Because while loop condition
>> is depends on val so when ever we call sem_getvalue() it will get
>> latest value of val.
>> In addition to this, we are ensuring val is decremented before we do
>> unlock the sem by while loop condition.
>>
>> Having sleep() in while loop will not effect the final output. IIUC
>>
>
> Hi Naresh,
>
> I am not able to apply your patch against ltp next branch. can you
> please send me patch against next branch of ltp ?
Here I have posted and attached to this e-mail.

Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >

---
 testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
|   15 	8 +	7 -	0 !
 1 file changed, 8 insertions(+), 7 deletions(-)

Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
===================================================================
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
@@ -161,7 +161,6 @@ int main()
 	}
 	fprintf(stderr, "P: child_1:%d forked\n", c_1);
 	
-	sleep(1);
 	c_2 = fork();
 	if (c_2 == 0)
 	{
@@ -176,13 +175,13 @@ int main()
 	}
 	fprintf(stderr, "P: child_2: %d forked\n", c_2);

+        /* Step 3 Implementation */
 	/* Make sure the two children has been waiting */	
-	/*do {
-		sleep(1);
+	do {
 		sem_getvalue(sem_1, &val);
 		//printf("val = %d\n", val);
 	} while (val != 1);
-	*/
+
 	c_3 = fork();
 	if (c_3 == 0)
 	{
@@ -191,13 +190,15 @@ int main()
 	}
 	fprintf(stderr, "P: child_3: %d forked\n", c_3);
 	
+        /* Step 3 Implementation */
 	/* Make sure child 3 has been waiting for the lock */	
-	/*do {
-		sleep(1);
+	do {
 		sem_getvalue(sem_1, &val);
 		//printf("val = %d\n", val);
 	} while (val != 0);
-	*/
+
+	/* Synchronization required before release the lock */
+	sleep(1);
 	/* Ok, let's release the lock */
 	fprintf(stderr, "P: release lock\n");
 	sem_post(sem);

Best regards
Naresh Kamboju
>
> #git clone -b next
> git://ltp.git.sourceforge.net/gitroot/ltp/ltp-dev.git ltp
>
> And then create your patch and send it to ltp-list@
>
> --
> Thanks & Regards
> Rishi
> LTP Maintainer
> IBM, LTC, Bangalore
> Please join IRC #ltp @ irc.freenode.net
>

[-- Attachment #2: posix-sem-post-unstable-fix.patch --]
[-- Type: application/octet-stream, Size: 1383 bytes --]

---
 testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c |   15 	8 +	7 -	0 !
 1 file changed, 8 insertions(+), 7 deletions(-)

Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
===================================================================
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
@@ -161,7 +161,6 @@ int main() 
 	}
 	fprintf(stderr, "P: child_1:%d forked\n", c_1);
 	
-	sleep(1);
 	c_2 = fork();
 	if (c_2 == 0)
 	{
@@ -176,13 +175,13 @@ int main() 
 	}
 	fprintf(stderr, "P: child_2: %d forked\n", c_2);
 
+        /* Step 3 Implementation */
 	/* Make sure the two children has been waiting */	
-	/*do { 
-		sleep(1);
+	do {
 		sem_getvalue(sem_1, &val);
 		//printf("val = %d\n", val);
 	} while (val != 1);
-	*/
+
 	c_3 = fork();
 	if (c_3 == 0)
 	{
@@ -191,13 +190,15 @@ int main() 
 	}
 	fprintf(stderr, "P: child_3: %d forked\n", c_3);
 	
+        /* Step 3 Implementation */
 	/* Make sure child 3 has been waiting for the lock */	
-	/*do { 
-		sleep(1);
+	do {
 		sem_getvalue(sem_1, &val);
 		//printf("val = %d\n", val);
 	} while (val != 0);
-	*/
+
+	/* Synchronization required before release the lock */
+	sleep(1);
 	/* Ok, let's release the lock */
 	fprintf(stderr, "P: release lock\n");
 	sem_post(sem);

[-- Attachment #3: Type: text/plain, Size: 345 bytes --]

------------------------------------------------------------------------------
Download Intel&#174; 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

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
  2010-03-03  6:00         ` naresh kamboju
  (?)
@ 2010-03-03  7:03         ` Rishikesh K Rajak
  2010-03-03  9:18           ` Garrett Cooper
  -1 siblings, 1 reply; 22+ messages in thread
From: Rishikesh K Rajak @ 2010-03-03  7:03 UTC (permalink / raw)
  To: naresh kamboju; +Cc: ltp-list

On Wed, Mar 03, 2010 at 11:30:42AM +0530, naresh kamboju wrote:
> On Wed, Mar 3, 2010 at 10:26 AM, Rishikesh K Rajak
> <risrajak@linux.vnet.ibm.com> wrote:
> > On Tue, Mar 02, 2010 at 08:38:20PM +0530, naresh kamboju wrote:
> >> On Tue, Mar 2, 2010 at 2:20 PM, Rishikesh K Rajak
> >> <risrajak@linux.vnet.ibm.com> wrote:
> >> > I feel before getting semaphore value, we need to sync first so here
> >> > sleep is require,though your point is valid that there is no use of
> >> > using sleep inside while loop.
> >> I agree with you.
> >> AFAIU, we should call sleep() before calling getting semaphore
> >> value.when we don't have while loop here. Because while loop condition
> >> is depends on val so when ever we call sem_getvalue() it will get
> >> latest value of val.
> >> In addition to this, we are ensuring val is decremented before we do
> >> unlock the sem by while loop condition.
> >>
> >> Having sleep() in while loop will not effect the final output. IIUC
> >>
> >
> > Hi Naresh,
> >
> > I am not able to apply your patch against ltp next branch. can you
> > please send me patch against next branch of ltp ?
> Here I have posted and attached to this e-mail.


Apllied to next branch . Thanks for your patch, i will test in
production environment, if it is not creating any regression will merge
with master branch and it will available to next month release.

Thanks
-Rishi
> 
> Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >
> 
> ---
>  testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> |   15 	8 +	7 -	0 !
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> ===================================================================
> --- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> @@ -161,7 +161,6 @@ int main()
>  	}
>  	fprintf(stderr, "P: child_1:%d forked\n", c_1);
>  	
> -	sleep(1);
>  	c_2 = fork();
>  	if (c_2 == 0)
>  	{
> @@ -176,13 +175,13 @@ int main()
>  	}
>  	fprintf(stderr, "P: child_2: %d forked\n", c_2);
> 
> +        /* Step 3 Implementation */
>  	/* Make sure the two children has been waiting */	
> -	/*do {
> -		sleep(1);
> +	do {
>  		sem_getvalue(sem_1, &val);
>  		//printf("val = %d\n", val);
>  	} while (val != 1);
> -	*/
> +
>  	c_3 = fork();
>  	if (c_3 == 0)
>  	{
> @@ -191,13 +190,15 @@ int main()
>  	}
>  	fprintf(stderr, "P: child_3: %d forked\n", c_3);
>  	
> +        /* Step 3 Implementation */
>  	/* Make sure child 3 has been waiting for the lock */	
> -	/*do {
> -		sleep(1);
> +	do {
>  		sem_getvalue(sem_1, &val);
>  		//printf("val = %d\n", val);
>  	} while (val != 0);
> -	*/
> +
> +	/* Synchronization required before release the lock */
> +	sleep(1);
>  	/* Ok, let's release the lock */
>  	fprintf(stderr, "P: release lock\n");
>  	sem_post(sem);
> 
> Best regards
> Naresh Kamboju
> >
> > #git clone -b next
> > git://ltp.git.sourceforge.net/gitroot/ltp/ltp-dev.git ltp
> >
> > And then create your patch and send it to ltp-list@
> >
> > --
> > Thanks & Regards
> > Rishi
> > LTP Maintainer
> > IBM, LTC, Bangalore
> > Please join IRC #ltp @ irc.freenode.net
> >



-- 
Thanks & Regards
Rishi
LTP Maintainer
IBM, LTC, Bangalore
Please join IRC #ltp @ irc.freenode.net

------------------------------------------------------------------------------
Download Intel&#174; 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
  2010-03-03  7:03         ` Rishikesh K Rajak
@ 2010-03-03  9:18           ` Garrett Cooper
  2010-03-03  9:45             ` Rishikesh K Rajak
  0 siblings, 1 reply; 22+ messages in thread
From: Garrett Cooper @ 2010-03-03  9:18 UTC (permalink / raw)
  To: naresh kamboju, ltp-list

Uh, hold on a sec before we call it good...

On Tue, Mar 2, 2010 at 11:03 PM, Rishikesh K Rajak
<risrajak@linux.vnet.ibm.com> wrote:
> On Wed, Mar 03, 2010 at 11:30:42AM +0530, naresh kamboju wrote:
>> On Wed, Mar 3, 2010 at 10:26 AM, Rishikesh K Rajak
>> <risrajak@linux.vnet.ibm.com> wrote:
>> > On Tue, Mar 02, 2010 at 08:38:20PM +0530, naresh kamboju wrote:
>> >> On Tue, Mar 2, 2010 at 2:20 PM, Rishikesh K Rajak
>> >> <risrajak@linux.vnet.ibm.com> wrote:
>> >> > I feel before getting semaphore value, we need to sync first so here
>> >> > sleep is require,though your point is valid that there is no use of
>> >> > using sleep inside while loop.
>> >> I agree with you.
>> >> AFAIU, we should call sleep() before calling getting semaphore
>> >> value.when we don't have while loop here. Because while loop condition
>> >> is depends on val so when ever we call sem_getvalue() it will get
>> >> latest value of val.
>> >> In addition to this, we are ensuring val is decremented before we do
>> >> unlock the sem by while loop condition.
>> >>
>> >> Having sleep() in while loop will not effect the final output. IIUC
>> >>
>> >
>> > Hi Naresh,
>> >
>> > I am not able to apply your patch against ltp next branch. can you
>> > please send me patch against next branch of ltp ?
>> Here I have posted and attached to this e-mail.
>
>
> Apllied to next branch . Thanks for your patch, i will test in
> production environment, if it is not creating any regression will merge
> with master branch and it will available to next month release.
>
> Thanks
> -Rishi
>>
>> Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >
>>
>> ---
>>  testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> |   15        8 +     7 -     0 !
>>  1 file changed, 8 insertions(+), 7 deletions(-)
>>
>> Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> ===================================================================
>> --- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> +++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> @@ -161,7 +161,6 @@ int main()
>>       }
>>       fprintf(stderr, "P: child_1:%d forked\n", c_1);
>>
>> -     sleep(1);
>>       c_2 = fork();
>>       if (c_2 == 0)
>>       {
>> @@ -176,13 +175,13 @@ int main()
>>       }
>>       fprintf(stderr, "P: child_2: %d forked\n", c_2);
>>
>> +        /* Step 3 Implementation */
>>       /* Make sure the two children has been waiting */
>> -     /*do {
>> -             sleep(1);
>> +     do {
>>               sem_getvalue(sem_1, &val);
>>               //printf("val = %d\n", val);
>>       } while (val != 1);
>> -     */

Please provide another patch with a limit to this -- I get annoyed
with tests that have infinite loops in them because the underlying
functionality is broken. Some architectures like mips* will
potentially be affected by this depending on how buggy their
implementation of POSIX semaphores is (this was definitely a problem
with my previous group and certain semctl calls being made on Cavium
hardware with our version of glibc / linux kernel).

>> +
>>       c_3 = fork();
>>       if (c_3 == 0)
>>       {
>> @@ -191,13 +190,15 @@ int main()
>>       }
>>       fprintf(stderr, "P: child_3: %d forked\n", c_3);
>>
>> +        /* Step 3 Implementation */
>>       /* Make sure child 3 has been waiting for the lock */
>> -     /*do {
>> -             sleep(1);
>> +     do {
>>               sem_getvalue(sem_1, &val);
>>               //printf("val = %d\n", val);
>>       } while (val != 0);
>> -     */
>> +

Same as above.

>> +     /* Synchronization required before release the lock */
>> +     sleep(1);
>>       /* Ok, let's release the lock */
>>       fprintf(stderr, "P: release lock\n");
>>       sem_post(sem);

Thanks,
-Garrett

------------------------------------------------------------------------------
Download Intel&#174; 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
  2010-03-03  9:18           ` Garrett Cooper
@ 2010-03-03  9:45             ` Rishikesh K Rajak
  2010-03-03 11:33               ` naresh kamboju
  0 siblings, 1 reply; 22+ messages in thread
From: Rishikesh K Rajak @ 2010-03-03  9:45 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list, naresh kamboju

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
?

Thanks
Rishi
> 
-- 
Thanks & Regards
Rishi
LTP Maintainer
IBM, LTC, Bangalore
Please join IRC #ltp @ irc.freenode.net

------------------------------------------------------------------------------
Download Intel&#174; 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
  2010-03-03  9:45             ` Rishikesh K Rajak
@ 2010-03-03 11:33               ` naresh kamboju
  2010-03-03 11:42                 ` Garrett Cooper
  0 siblings, 1 reply; 22+ messages in thread
From: naresh kamboju @ 2010-03-03 11:33 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list

On Wed, Mar 3, 2010 at 3:15 PM, Rishikesh K Rajak
<risrajak@linux.vnet.ibm.com> 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
> ?
>>>> +        /* Step 3 Implementation */
>>>>       /* Make sure the two children has been waiting */
>>>> -     /*do {
>>>> -             sleep(1);
>>>> +     do {
>>>>               sem_getvalue(sem_1, &val);
>>>>               //printf("val = %d\n", val);
>>>>       } while (val != 1);
>>>> -     */
>>
>> 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’t 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.

Best regards
Naresh Kamboju
>
> Thanks
> Rishi
>>
> --
> Thanks & Regards
> Rishi
> LTP Maintainer
> IBM, LTC, Bangalore
> Please join IRC #ltp @ irc.freenode.net
>
>>Thanks,
>>-Garrett

------------------------------------------------------------------------------
Download Intel&#174; 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
  2010-03-03 11:33               ` naresh kamboju
@ 2010-03-03 11:42                 ` Garrett Cooper
  2010-03-03 11:49                   ` naresh kamboju
  0 siblings, 1 reply; 22+ messages in thread
From: Garrett Cooper @ 2010-03-03 11:42 UTC (permalink / raw)
  To: naresh kamboju; +Cc: ltp-list

On Wed, Mar 3, 2010 at 3:33 AM, naresh kamboju <naresh.kernel@gmail.com> wrote:
> On Wed, Mar 3, 2010 at 3:15 PM, Rishikesh K Rajak
> <risrajak@linux.vnet.ibm.com> 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
>> ?
>>>>> +        /* Step 3 Implementation */
>>>>>       /* Make sure the two children has been waiting */
>>>>> -     /*do {
>>>>> -             sleep(1);
>>>>> +     do {
>>>>>               sem_getvalue(sem_1, &val);
>>>>>               //printf("val = %d\n", val);
>>>>>       } while (val != 1);
>>>>> -     */
>>>
>>> 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’t 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.

    The 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.
Thanks,
-Garrett

------------------------------------------------------------------------------
Download Intel&#174; 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
  2010-03-03 11:42                 ` Garrett Cooper
@ 2010-03-03 11:49                   ` naresh kamboju
  2010-03-03 11:55                     ` Garrett Cooper
  0 siblings, 1 reply; 22+ messages in thread
From: naresh kamboju @ 2010-03-03 11:49 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list

On Wed, Mar 3, 2010 at 5:12 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
> On Wed, Mar 3, 2010 at 3:33 AM, naresh kamboju <naresh.kernel@gmail.com> wrote:
>> On Wed, Mar 3, 2010 at 3:15 PM, Rishikesh K Rajak
>> <risrajak@linux.vnet.ibm.com> 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
>>> ?
>>>>>> +        /* Step 3 Implementation */
>>>>>>       /* Make sure the two children has been waiting */
>>>>>> -     /*do {
>>>>>> -             sleep(1);
>>>>>> +     do {
>>>>>>               sem_getvalue(sem_1, &val);
>>>>>>               //printf("val = %d\n", val);
>>>>>>       } while (val != 1);
>>>>>> -     */
>>>>
>>>> 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’t 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.
>
>    The 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 behavior?

Thanks
naresh

> Thanks,
> -Garrett
>

------------------------------------------------------------------------------
Download Intel&#174; 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
  2010-03-03 11:49                   ` naresh kamboju
@ 2010-03-03 11:55                     ` Garrett Cooper
  2010-03-03 13:45                       ` naresh kamboju
  0 siblings, 1 reply; 22+ messages in thread
From: Garrett Cooper @ 2010-03-03 11:55 UTC (permalink / raw)
  To: naresh kamboju; +Cc: ltp-list

On Wed, Mar 3, 2010 at 3:49 AM, naresh kamboju <naresh.kernel@gmail.com> wrote:
> On Wed, Mar 3, 2010 at 5:12 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
>> On Wed, Mar 3, 2010 at 3:33 AM, naresh kamboju <naresh.kernel@gmail.com> wrote:
>>> On Wed, Mar 3, 2010 at 3:15 PM, Rishikesh K Rajak
>>> <risrajak@linux.vnet.ibm.com> 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
>>>> ?
>>>>>>> +        /* Step 3 Implementation */
>>>>>>>       /* Make sure the two children has been waiting */
>>>>>>> -     /*do {
>>>>>>> -             sleep(1);
>>>>>>> +     do {
>>>>>>>               sem_getvalue(sem_1, &val);
>>>>>>>               //printf("val = %d\n", val);
>>>>>>>       } while (val != 1);
>>>>>>> -     */
>>>>>
>>>>> 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’t 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.
>>
>>    The 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 behavior?

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&#174; 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
  2010-03-03 11:55                     ` Garrett Cooper
@ 2010-03-03 13:45                       ` naresh kamboju
  2010-03-08 10:57                         ` naresh kamboju
  0 siblings, 1 reply; 22+ messages in thread
From: naresh kamboju @ 2010-03-03 13:45 UTC (permalink / raw)
  To: Garrett Cooper, risrajak; +Cc: ltp-list

[-- Attachment #1: Type: text/plain, Size: 4001 bytes --]

On Wed, Mar 3, 2010 at 5:25 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
> On Wed, Mar 3, 2010 at 3:49 AM, naresh kamboju <naresh.kernel@gmail.com> wrote:
>> On Wed, Mar 3, 2010 at 5:12 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
>>> On Wed, Mar 3, 2010 at 3:33 AM, naresh kamboju <naresh.kernel@gmail.com> wrote:
>>>> On Wed, Mar 3, 2010 at 3:15 PM, Rishikesh K Rajak
>>>> <risrajak@linux.vnet.ibm.com> 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
>>>>> ?
>>>>>>>> +        /* Step 3 Implementation */
>>>>>>>>       /* Make sure the two children has been waiting */
>>>>>>>> -     /*do {
>>>>>>>> -             sleep(1);
>>>>>>>> +     do {
>>>>>>>>               sem_getvalue(sem_1, &val);
>>>>>>>>               //printf("val = %d\n", val);
>>>>>>>>       } while (val != 1);
>>>>>>>> -     */
>>>>>>
>>>>>> 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’t 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.
>>>
>>>    The 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 behavior?
>
> 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.

Hey Garrett,

Thanks for you information :-)

I have tested these on MIPS architecture and  reproduced infinite
waiting situation after applying this patch. (with strace no issue
found ex: #strace ./8-1.test)
As you said there may be issues in MIPS-POSIX library. it may take
some time to fix these issues or may not be fixed.
However, I’ll discuss this issue with MIPS folks in different thread.

ATM, my patch is not a good idea for MIPS architectures.
So, after your comments I have modified my patch and tested.
Here in this latest patch i did not change any thing regarding while loop.
I replaced sleep() in an appropriate place.
It is working fine on X86, ARM and MIPS.

Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >
---
 testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
|    2 	1 +	1 -	0 !
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
===================================================================
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
@@ -161,7 +161,6 @@ int main()
 	}
 	fprintf(stderr, "P: child_1:%d forked\n", c_1);
 	
-	sleep(1);
 	c_2 = fork();
 	if (c_2 == 0)
 	{
@@ -198,6 +197,7 @@ int main()
 		//printf("val = %d\n", val);
 	} while (val != 0);
 	*/
+	sleep(1);
 	/* Ok, let's release the lock */
 	fprintf(stderr, "P: release lock\n");
 	sem_post(sem);


please let me know if you have any issues.

Best regards,
Naresh Kamboju
> Thanks,
> -Garrett
>

[-- Attachment #2: sem-post-unstable-8-1-fix.patch --]
[-- Type: application/octet-stream, Size: 794 bytes --]

---
 testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c |    2 	1 +	1 -	0 !
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
===================================================================
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
@@ -161,7 +161,6 @@ int main() 
 	}
 	fprintf(stderr, "P: child_1:%d forked\n", c_1);
 	
-	sleep(1);
 	c_2 = fork();
 	if (c_2 == 0)
 	{
@@ -198,6 +197,7 @@ int main() 
 		//printf("val = %d\n", val);
 	} while (val != 0);
 	*/
+	sleep(1);
 	/* Ok, let's release the lock */
 	fprintf(stderr, "P: release lock\n");
 	sem_post(sem);

[-- Attachment #3: Type: text/plain, Size: 345 bytes --]

------------------------------------------------------------------------------
Download Intel&#174; 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

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
  2010-03-03 13:45                       ` naresh kamboju
@ 2010-03-08 10:57                         ` naresh kamboju
  2010-03-22  8:25                           ` Rishikesh K Rajak
  0 siblings, 1 reply; 22+ messages in thread
From: naresh kamboju @ 2010-03-08 10:57 UTC (permalink / raw)
  To: Rishikesh K Rajak, Garrett Cooper; +Cc: ltp-list

[-- Attachment #1: Type: text/plain, Size: 4531 bytes --]

Hi Rishi and Garrett,

On Wed, Mar 3, 2010 at 7:15 PM, naresh kamboju <naresh.kernel@gmail.com> wrote:
> On Wed, Mar 3, 2010 at 5:25 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
>> On Wed, Mar 3, 2010 at 3:49 AM, naresh kamboju <naresh.kernel@gmail.com> wrote:
>>> On Wed, Mar 3, 2010 at 5:12 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
>>>> On Wed, Mar 3, 2010 at 3:33 AM, naresh kamboju <naresh.kernel@gmail.com> wrote:
>>>>> On Wed, Mar 3, 2010 at 3:15 PM, Rishikesh K Rajak
>>>>> <risrajak@linux.vnet.ibm.com> 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
>>>>>> ?
>>>>>>>>> +        /* Step 3 Implementation */
>>>>>>>>>       /* Make sure the two children has been waiting */
>>>>>>>>> -     /*do {
>>>>>>>>> -             sleep(1);
>>>>>>>>> +     do {
>>>>>>>>>               sem_getvalue(sem_1, &val);
>>>>>>>>>               //printf("val = %d\n", val);
>>>>>>>>>       } while (val != 1);
>>>>>>>>> -     */
>>>>>>>
>>>>>>> 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’t 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.
>>>>
>>>>    The 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 behavior?
>>
>> 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.
>
> Hey Garrett,
>
> Thanks for you information :-)
>
> I have tested these on MIPS architecture and  reproduced infinite
> waiting situation after applying this patch. (with strace no issue
> found ex: #strace ./8-1.test)
> As you said there may be issues in MIPS-POSIX library. it may take
> some time to fix these issues or may not be fixed.
> However, I’ll discuss this issue with MIPS folks in different thread.
>
> ATM, my patch is not a good idea for MIPS architectures.
> So, after your comments I have modified my patch and tested.
> Here in this latest patch i did not change any thing regarding while loop.
> I replaced sleep() in an appropriate place.
> It is working fine on X86, ARM and MIPS.

please review the patch.
I have tested this patch on X86, ARM and MIPS and results are good.

If you feel ok. please commit. otherwise give me your comments.

Best regards
Naresh Kamboju
>
> Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >
> ---
>  testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> |    2  1 +     1 -     0 !
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> ===================================================================
> --- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> @@ -161,7 +161,6 @@ int main()
>        }
>        fprintf(stderr, "P: child_1:%d forked\n", c_1);
>
> -       sleep(1);
>        c_2 = fork();
>        if (c_2 == 0)
>        {
> @@ -198,6 +197,7 @@ int main()
>                //printf("val = %d\n", val);
>        } while (val != 0);
>        */
> +       sleep(1);
>        /* Ok, let's release the lock */
>        fprintf(stderr, "P: release lock\n");
>        sem_post(sem);
>
>
> please let me know if you have any issues.
>
> Best regards,
> Naresh Kamboju
>> Thanks,
>> -Garrett
>>
>

[-- Attachment #2: sem-post-unstable-8-1-fix.patch --]
[-- Type: application/octet-stream, Size: 794 bytes --]

---
 testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c |    2 	1 +	1 -	0 !
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
===================================================================
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
@@ -161,7 +161,6 @@ int main() 
 	}
 	fprintf(stderr, "P: child_1:%d forked\n", c_1);
 	
-	sleep(1);
 	c_2 = fork();
 	if (c_2 == 0)
 	{
@@ -198,6 +197,7 @@ int main() 
 		//printf("val = %d\n", val);
 	} while (val != 0);
 	*/
+	sleep(1);
 	/* Ok, let's release the lock */
 	fprintf(stderr, "P: release lock\n");
 	sem_post(sem);

[-- Attachment #3: Type: text/plain, Size: 345 bytes --]

------------------------------------------------------------------------------
Download Intel&#174; 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

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
  2010-03-08 10:57                         ` naresh kamboju
@ 2010-03-22  8:25                           ` Rishikesh K Rajak
  2010-03-22 15:20                             ` naresh kamboju
  2010-03-22 18:50                             ` naresh kamboju
  0 siblings, 2 replies; 22+ messages in thread
From: Rishikesh K Rajak @ 2010-03-22  8:25 UTC (permalink / raw)
  To: naresh kamboju; +Cc: ltp-list

On Mon, Mar 08, 2010 at 04:27:36PM +0530, naresh kamboju wrote:
> Hi Rishi and Garrett,
> 
> On Wed, Mar 3, 2010 at 7:15 PM, naresh kamboju <naresh.kernel@gmail.com> wrote:
> > On Wed, Mar 3, 2010 at 5:25 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
> >> On Wed, Mar 3, 2010 at 3:49 AM, naresh kamboju <naresh.kernel@gmail.com> wrote:
> >>> On Wed, Mar 3, 2010 at 5:12 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
> >>>> On Wed, Mar 3, 2010 at 3:33 AM, naresh kamboju <naresh.kernel@gmail.com> wrote:
> >>>>> On Wed, Mar 3, 2010 at 3:15 PM, Rishikesh K Rajak
> >>>>> <risrajak@linux.vnet.ibm.com> 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
> >>>>>> ?
> >>>>>>>>> +        /* Step 3 Implementation */
> >>>>>>>>>       /* Make sure the two children has been waiting */
> >>>>>>>>> -     /*do {
> >>>>>>>>> -             sleep(1);
> >>>>>>>>> +     do {
> >>>>>>>>>               sem_getvalue(sem_1, &val);
> >>>>>>>>>               //printf("val = %d\n", val);
> >>>>>>>>>       } while (val != 1);
> >>>>>>>>> -     */
> >>>>>>>
> >>>>>>> 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’t 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.
> >>>>
> >>>>    The 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 behavior?
> >>
> >> 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.
> >
> > Hey Garrett,
> >
> > Thanks for you information :-)
> >
> > I have tested these on MIPS architecture and  reproduced infinite
> > waiting situation after applying this patch. (with strace no issue
> > found ex: #strace ./8-1.test)
> > As you said there may be issues in MIPS-POSIX library. it may take
> > some time to fix these issues or may not be fixed.
> > However, I’ll discuss this issue with MIPS folks in different thread.
> >
> > ATM, my patch is not a good idea for MIPS architectures.
> > So, after your comments I have modified my patch and tested.
> > Here in this latest patch i did not change any thing regarding while loop.
> > I replaced sleep() in an appropriate place.
> > It is working fine on X86, ARM and MIPS.
> 
> please review the patch.
> I have tested this patch on X86, ARM and MIPS and results are good.
> 
> If you feel ok. please commit. otherwise give me your comments.

Hi Naresh,

can you send your patch against today's git ?

-Rishi
> 
> Best regards
> Naresh Kamboju
> >
> > Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >
> > ---
> >  testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> > |    2  1 +     1 -     0 !
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> > ===================================================================
> > --- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> > +++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> > @@ -161,7 +161,6 @@ int main()
> >        }
> >        fprintf(stderr, "P: child_1:%d forked\n", c_1);
> >
> > -       sleep(1);
> >        c_2 = fork();
> >        if (c_2 == 0)
> >        {
> > @@ -198,6 +197,7 @@ int main()
> >                //printf("val = %d\n", val);
> >        } while (val != 0);
> >        */
> > +       sleep(1);
> >        /* Ok, let's release the lock */
> >        fprintf(stderr, "P: release lock\n");
> >        sem_post(sem);
> >
> >
> > please let me know if you have any issues.
> >
> > Best regards,
> > Naresh Kamboju
> >> Thanks,
> >> -Garrett
> >>
> >



-- 
Thanks & Regards
Rishi
LTP Maintainer
IBM, LTC, Bangalore
Please join IRC #ltp @ irc.freenode.net

------------------------------------------------------------------------------
Download Intel&#174; 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
  2010-03-22  8:25                           ` Rishikesh K Rajak
@ 2010-03-22 15:20                             ` naresh kamboju
  2010-03-22 18:50                             ` naresh kamboju
  1 sibling, 0 replies; 22+ messages in thread
From: naresh kamboju @ 2010-03-22 15:20 UTC (permalink / raw)
  To: Rishikesh K Rajak; +Cc: ltp-list

[-- Attachment #1: Type: text/plain, Size: 6204 bytes --]

On Mon, Mar 22, 2010 at 1:55 PM, Rishikesh K Rajak
<risrajak@linux.vnet.ibm.com> wrote:
> On Mon, Mar 08, 2010 at 04:27:36PM +0530, naresh kamboju wrote:
>> Hi Rishi and Garrett,
>>
>> On Wed, Mar 3, 2010 at 7:15 PM, naresh kamboju <naresh.kernel@gmail.com> wrote:
>> > On Wed, Mar 3, 2010 at 5:25 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
>> >> On Wed, Mar 3, 2010 at 3:49 AM, naresh kamboju <naresh.kernel@gmail.com> wrote:
>> >>> On Wed, Mar 3, 2010 at 5:12 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
>> >>>> On Wed, Mar 3, 2010 at 3:33 AM, naresh kamboju <naresh.kernel@gmail.com> wrote:
>> >>>>> On Wed, Mar 3, 2010 at 3:15 PM, Rishikesh K Rajak
>> >>>>> <risrajak@linux.vnet.ibm.com> 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
>> >>>>>> ?
>> >>>>>>>>> +        /* Step 3 Implementation */
>> >>>>>>>>>       /* Make sure the two children has been waiting */
>> >>>>>>>>> -     /*do {
>> >>>>>>>>> -             sleep(1);
>> >>>>>>>>> +     do {
>> >>>>>>>>>               sem_getvalue(sem_1, &val);
>> >>>>>>>>>               //printf("val = %d\n", val);
>> >>>>>>>>>       } while (val != 1);
>> >>>>>>>>> -     */
>> >>>>>>>
>> >>>>>>> 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’t 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.
>> >>>>
>> >>>>    The 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 behavior?
>> >>
>> >> 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.
>> >
>> > Hey Garrett,
>> >
>> > Thanks for you information :-)
>> >
>> > I have tested these on MIPS architecture and  reproduced infinite
>> > waiting situation after applying this patch. (with strace no issue
>> > found ex: #strace ./8-1.test)
>> > As you said there may be issues in MIPS-POSIX library. it may take
>> > some time to fix these issues or may not be fixed.
>> > However, I’ll discuss this issue with MIPS folks in different thread.
>> >
>> > ATM, my patch is not a good idea for MIPS architectures.
>> > So, after your comments I have modified my patch and tested.
>> > Here in this latest patch i did not change any thing regarding while loop.
>> > I replaced sleep() in an appropriate place.
>> > It is working fine on X86, ARM and MIPS.
>>
>> please review the patch.
>> I have tested this patch on X86, ARM and MIPS and results are good.
>>
>> If you feel ok. please commit. otherwise give me your comments.
>
> Hi Naresh,
>
Hi Rishi,
> can you send your patch against today's git ?

please find the patch below and attached to this e-mail.
Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >

---
 testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
|    2 	1 +	1 -	0 !
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
===================================================================
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
@@ -161,7 +161,6 @@ int main()
 	}
 	fprintf(stderr, "P: child_1:%d forked\n", c_1);
 	
-	sleep(1);
 	c_2 = fork();
 	if (c_2 == 0)
 	{
@@ -198,6 +197,7 @@ int main()
 		//printf("val = %d\n", val);
 	} while (val != 0);
 	*/
+	sleep(1);
 	/* Ok, let's release the lock */
 	fprintf(stderr, "P: release lock\n");
 	sem_post(sem);


Best regards
Naresh Kamboju
>
> -Rishi
>>
>> Best regards
>> Naresh Kamboju
>> >
>> > Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >
>> > ---
>> >  testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> > |    2  1 +     1 -     0 !
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> > ===================================================================
>> > --- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> > +++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> > @@ -161,7 +161,6 @@ int main()
>> >        }
>> >        fprintf(stderr, "P: child_1:%d forked\n", c_1);
>> >
>> > -       sleep(1);
>> >        c_2 = fork();
>> >        if (c_2 == 0)
>> >        {
>> > @@ -198,6 +197,7 @@ int main()
>> >                //printf("val = %d\n", val);
>> >        } while (val != 0);
>> >        */
>> > +       sleep(1);
>> >        /* Ok, let's release the lock */
>> >        fprintf(stderr, "P: release lock\n");
>> >        sem_post(sem);
>> >
>> >
>> > please let me know if you have any issues.
>> >
>> > Best regards,
>> > Naresh Kamboju
>> >> Thanks,
>> >> -Garrett
>> >>
>> >
>
>
>
> --
> Thanks & Regards
> Rishi
> LTP Maintainer
> IBM, LTC, Bangalore
> Please join IRC #ltp @ irc.freenode.net
>

[-- Attachment #2: sem-post-unstable-8-1-fix.patch --]
[-- Type: application/octet-stream, Size: 794 bytes --]

---
 testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c |    2 	1 +	1 -	0 !
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
===================================================================
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
@@ -161,7 +161,6 @@ int main() 
 	}
 	fprintf(stderr, "P: child_1:%d forked\n", c_1);
 	
-	sleep(1);
 	c_2 = fork();
 	if (c_2 == 0)
 	{
@@ -198,6 +197,7 @@ int main() 
 		//printf("val = %d\n", val);
 	} while (val != 0);
 	*/
+	sleep(1);
 	/* Ok, let's release the lock */
 	fprintf(stderr, "P: release lock\n");
 	sem_post(sem);

[-- Attachment #3: Type: text/plain, Size: 345 bytes --]

------------------------------------------------------------------------------
Download Intel&#174; 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

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
  2010-03-22  8:25                           ` Rishikesh K Rajak
  2010-03-22 15:20                             ` naresh kamboju
@ 2010-03-22 18:50                             ` naresh kamboju
  2010-03-23  4:39                               ` Rishikesh K Rajak
  1 sibling, 1 reply; 22+ messages in thread
From: naresh kamboju @ 2010-03-22 18:50 UTC (permalink / raw)
  To: Rishikesh K Rajak; +Cc: ltp-list

[-- Attachment #1: Type: text/plain, Size: 6597 bytes --]

On Mon, Mar 22, 2010 at 1:55 PM, Rishikesh K Rajak
<risrajak@linux.vnet.ibm.com> wrote:
> On Mon, Mar 08, 2010 at 04:27:36PM +0530, naresh kamboju wrote:
>> Hi Rishi and Garrett,
>>
>> On Wed, Mar 3, 2010 at 7:15 PM, naresh kamboju <naresh.kernel@gmail.com> wrote:
>> > On Wed, Mar 3, 2010 at 5:25 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
>> >> On Wed, Mar 3, 2010 at 3:49 AM, naresh kamboju <naresh.kernel@gmail.com> wrote:
>> >>> On Wed, Mar 3, 2010 at 5:12 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
>> >>>> On Wed, Mar 3, 2010 at 3:33 AM, naresh kamboju <naresh.kernel@gmail.com> wrote:
>> >>>>> On Wed, Mar 3, 2010 at 3:15 PM, Rishikesh K Rajak
>> >>>>> <risrajak@linux.vnet.ibm.com> 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
>> >>>>>> ?
>> >>>>>>>>> +        /* Step 3 Implementation */
>> >>>>>>>>>       /* Make sure the two children has been waiting */
>> >>>>>>>>> -     /*do {
>> >>>>>>>>> -             sleep(1);
>> >>>>>>>>> +     do {
>> >>>>>>>>>               sem_getvalue(sem_1, &val);
>> >>>>>>>>>               //printf("val = %d\n", val);
>> >>>>>>>>>       } while (val != 1);
>> >>>>>>>>> -     */
>> >>>>>>>
>> >>>>>>> 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’t 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.
>> >>>>
>> >>>>    The 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 behavior?
>> >>
>> >> 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.
>> >
>> > Hey Garrett,
>> >
>> > Thanks for you information :-)
>> >
>> > I have tested these on MIPS architecture and  reproduced infinite
>> > waiting situation after applying this patch. (with strace no issue
>> > found ex: #strace ./8-1.test)
>> > As you said there may be issues in MIPS-POSIX library. it may take
>> > some time to fix these issues or may not be fixed.
>> > However, I’ll discuss this issue with MIPS folks in different thread.
>> >
>> > ATM, my patch is not a good idea for MIPS architectures.
>> > So, after your comments I have modified my patch and tested.
>> > Here in this latest patch i did not change any thing regarding while loop.
>> > I replaced sleep() in an appropriate place.
>> > It is working fine on X86, ARM and MIPS.
>>
>> please review the patch.
>> I have tested this patch on X86, ARM and MIPS and results are good.
>>
>> If you feel ok. please commit. otherwise give me your comments.
>
> Hi Naresh,
>
Hi Rishi,
> can you send your patch against today's git ?
please find the patch below and attached to this e-mail.
Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >

---
 testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
|   11 	6 +	5 -	0 !
 1 file changed, 6 insertions(+), 5 deletions(-)

Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
===================================================================
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
@@ -175,13 +175,13 @@ int main()
 	}
 	fprintf(stderr, "P: child_2: %d forked\n", c_2);

-        /* Step 3 Implementation */
 	/* Make sure the two children has been waiting */	
-	do {
+	/*do {
+		sleep();
 		sem_getvalue(sem_1, &val);
 		//printf("val = %d\n", val);
 	} while (val != 1);
-
+	*/
 	c_3 = fork();
 	if (c_3 == 0)
 	{
@@ -190,12 +190,13 @@ int main()
 	}
 	fprintf(stderr, "P: child_3: %d forked\n", c_3);
 	
-        /* Step 3 Implementation */
 	/* Make sure child 3 has been waiting for the lock */	
-	do {
+	/*do {
+		sleep();
 		sem_getvalue(sem_1, &val);
 		//printf("val = %d\n", val);
 	} while (val != 0);
+	*/

 	/* Synchronization required before release the lock */
 	sleep(1);


Best regards
Naresh Kamboju
>
> -Rishi
>>
>> Best regards
>> Naresh Kamboju
>> >
>> > Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >
>> > ---
>> >  testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> > |    2  1 +     1 -     0 !
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> > ===================================================================
>> > --- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> > +++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
>> > @@ -161,7 +161,6 @@ int main()
>> >        }
>> >        fprintf(stderr, "P: child_1:%d forked\n", c_1);
>> >
>> > -       sleep(1);
>> >        c_2 = fork();
>> >        if (c_2 == 0)
>> >        {
>> > @@ -198,6 +197,7 @@ int main()
>> >                //printf("val = %d\n", val);
>> >        } while (val != 0);
>> >        */
>> > +       sleep(1);
>> >        /* Ok, let's release the lock */
>> >        fprintf(stderr, "P: release lock\n");
>> >        sem_post(sem);
>> >
>> >
>> > please let me know if you have any issues.
>> >
>> > Best regards,
>> > Naresh Kamboju
>> >> Thanks,
>> >> -Garrett
>> >>
>> >
>
>
>
> --
> Thanks & Regards
> Rishi
> LTP Maintainer
> IBM, LTC, Bangalore
> Please join IRC #ltp @ irc.freenode.net
>

[-- Attachment #2: reverse-posix-sem-post-unstable-fix.patch --]
[-- Type: application/octet-stream, Size: 1150 bytes --]

---
 testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c |   11 	6 +	5 -	0 !
 1 file changed, 6 insertions(+), 5 deletions(-)

Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
===================================================================
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
@@ -175,13 +175,13 @@ int main() 
 	}
 	fprintf(stderr, "P: child_2: %d forked\n", c_2);
 
-        /* Step 3 Implementation */
 	/* Make sure the two children has been waiting */	
-	do {
+	/*do {
+		sleep();
 		sem_getvalue(sem_1, &val);
 		//printf("val = %d\n", val);
 	} while (val != 1);
-
+	*/
 	c_3 = fork();
 	if (c_3 == 0)
 	{
@@ -190,12 +190,13 @@ int main() 
 	}
 	fprintf(stderr, "P: child_3: %d forked\n", c_3);
 	
-        /* Step 3 Implementation */
 	/* Make sure child 3 has been waiting for the lock */	
-	do {
+	/*do {
+		sleep();
 		sem_getvalue(sem_1, &val);
 		//printf("val = %d\n", val);
 	} while (val != 0);
+	*/
 
 	/* Synchronization required before release the lock */
 	sleep(1);

[-- Attachment #3: Type: text/plain, Size: 345 bytes --]

------------------------------------------------------------------------------
Download Intel&#174; 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

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
  2010-03-22 18:50                             ` naresh kamboju
@ 2010-03-23  4:39                               ` Rishikesh K Rajak
  2010-03-23  8:04                                 ` naresh kamboju
  0 siblings, 1 reply; 22+ messages in thread
From: Rishikesh K Rajak @ 2010-03-23  4:39 UTC (permalink / raw)
  To: naresh kamboju; +Cc: ltp-list

On Tue, Mar 23, 2010 at 12:20:33AM +0530, naresh kamboju wrote:
> On Mon, Mar 22, 2010 at 1:55 PM, Rishikesh K Rajak
> Hi Rishi,
> > can you send your patch against today's git ?
> please find the patch below and attached to this e-mail.

Hi Naresh,

Still i am not able to apply it cleanly.

In our git repo we are not finding this : 
"
-        /* Step 3 Implementation */
"

Can you pull latest next git branch and then create a patch and send it to me?
-Rishi

> Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >
> 
> ---
>  testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> |   11 	6 +	5 -	0 !
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> ===================================================================
> --- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> @@ -175,13 +175,13 @@ int main()
>  	}
>  	fprintf(stderr, "P: child_2: %d forked\n", c_2);
> 
> -        /* Step 3 Implementation */
>  	/* Make sure the two children has been waiting */	
> -	do {
> +	/*do {
> +		sleep();
>  		sem_getvalue(sem_1, &val);
>  		//printf("val = %d\n", val);
>  	} while (val != 1);
> -
> +	*/
>  	c_3 = fork();
>  	if (c_3 == 0)
>  	{
> @@ -190,12 +190,13 @@ int main()
>  	}
>  	fprintf(stderr, "P: child_3: %d forked\n", c_3);
>  	
> -        /* Step 3 Implementation */
>  	/* Make sure child 3 has been waiting for the lock */	
> -	do {
> +	/*do {
> +		sleep();
>  		sem_getvalue(sem_1, &val);
>  		//printf("val = %d\n", val);
>  	} while (val != 0);
> +	*/
> 
>  	/* Synchronization required before release the lock */
>  	sleep(1);
> 
> 
> Best regards
> Naresh Kamboju
> >
> > -Rishi
> >>
> >> Best regards
> >> Naresh Kamboju
> >> >
> >> > Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >
> >> > ---
> >> >  testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> >> > |    2  1 +     1 -     0 !
> >> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >> >
> >> > Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> >> > ===================================================================
> >> > --- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> >> > +++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
> >> > @@ -161,7 +161,6 @@ int main()
> >> >        }
> >> >        fprintf(stderr, "P: child_1:%d forked\n", c_1);
> >> >
> >> > -       sleep(1);
> >> >        c_2 = fork();
> >> >        if (c_2 == 0)
> >> >        {
> >> > @@ -198,6 +197,7 @@ int main()
> >> >                //printf("val = %d\n", val);
> >> >        } while (val != 0);
> >> >        */
> >> > +       sleep(1);
> >> >        /* Ok, let's release the lock */
> >> >        fprintf(stderr, "P: release lock\n");
> >> >        sem_post(sem);
> >> >
> >> >
> >> > please let me know if you have any issues.
> >> >
> >> > Best regards,
> >> > Naresh Kamboju
> >> >> Thanks,
> >> >> -Garrett
> >> >>
> >> >
> >
> >
> >
> > --
> > Thanks & Regards
> > Rishi
> > LTP Maintainer
> > IBM, LTC, Bangalore
> > Please join IRC #ltp @ irc.freenode.net
> >



-- 
Thanks & Regards
Rishi
LTP Maintainer
IBM, LTC, Bangalore
Please join IRC #ltp @ irc.freenode.net

------------------------------------------------------------------------------
Download Intel&#174; 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [LTP] [PATCH] Synchronization required before release the lock: sem_post/8-1.c
  2010-03-23  4:39                               ` Rishikesh K Rajak
@ 2010-03-23  8:04                                 ` naresh kamboju
  0 siblings, 0 replies; 22+ messages in thread
From: naresh kamboju @ 2010-03-23  8:04 UTC (permalink / raw)
  To: Rishikesh K Rajak; +Cc: ltp-list

[-- Attachment #1: Type: text/plain, Size: 1228 bytes --]

Hi  Rishi,

This patch is prepared by using latest git.
I have placed patch below and attached to this e-mail.

Rishi, please use attached file as patch to apply to master, because
dos2unix file issue may come.

Signed-off-by: Naresh Kamboju < naresh.kernel@gmail.com >

---
 testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
|    4    3 +     1 -     0 !
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
===================================================================
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
@@ -161,7 +161,6 @@ int main()
        }
        fprintf(stderr, "P: child_1:%d forked\n", c_1);

-       sleep(1);
        c_2 = fork();
        if (c_2 == 0)
        {
@@ -198,6 +197,9 @@ int main()
                //printf("val = %d\n", val);
        } while (val != 0);
        */
+
+       /* Synchronization required before release the lock */
+       sleep(1);
        /* Ok, let's release the lock */
        fprintf(stderr, "P: release lock\n");
        sem_post(sem);

Best regards,
Naresh Kamboju

[-- Attachment #2: posix-sem-post-unstable-fix-8-1.patch --]
[-- Type: application/octet-stream, Size: 830 bytes --]

---
 testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c |    4 	3 +	1 -	0 !
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
===================================================================
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
@@ -161,7 +161,6 @@ int main() 
 	}
 	fprintf(stderr, "P: child_1:%d forked\n", c_1);
 	
-	sleep(1);
 	c_2 = fork();
 	if (c_2 == 0)
 	{
@@ -198,6 +197,9 @@ int main() 
 		//printf("val = %d\n", val);
 	} while (val != 0);
 	*/
+
+	/* Synchronization required before release the lock */
+	sleep(1);
 	/* Ok, let's release the lock */
 	fprintf(stderr, "P: release lock\n");
 	sem_post(sem);

[-- Attachment #3: Type: text/plain, Size: 345 bytes --]

------------------------------------------------------------------------------
Download Intel&#174; 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

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2010-03-23  8:20 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-25 13:45 [PATCH] Synchronization required before release the lock: sem_post/8-1.c naresh kamboju
2010-02-25 13:45 ` [LTP] " naresh kamboju
2010-03-02  8:50 ` Rishikesh K Rajak
2010-03-02  8:50   ` Rishikesh K Rajak
2010-03-02 15:08   ` naresh kamboju
2010-03-02 15:08     ` naresh kamboju
     [not found]     ` <20100303045624.GB10185@linux.vnet.ibm.com>
2010-03-03  6:00       ` naresh kamboju
2010-03-03  6:00         ` naresh kamboju
2010-03-03  7:03         ` Rishikesh K Rajak
2010-03-03  9:18           ` Garrett Cooper
2010-03-03  9:45             ` Rishikesh K Rajak
2010-03-03 11:33               ` naresh kamboju
2010-03-03 11:42                 ` Garrett Cooper
2010-03-03 11:49                   ` naresh kamboju
2010-03-03 11:55                     ` Garrett Cooper
2010-03-03 13:45                       ` naresh kamboju
2010-03-08 10:57                         ` naresh kamboju
2010-03-22  8:25                           ` Rishikesh K Rajak
2010-03-22 15:20                             ` naresh kamboju
2010-03-22 18:50                             ` naresh kamboju
2010-03-23  4:39                               ` Rishikesh K Rajak
2010-03-23  8:04                                 ` naresh kamboju

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.