qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [6631] Avoid infinite loop around timed condition variable
@ 2009-02-21  5:48 malc
       [not found] ` <9D64DDB2-3C4E-457D-B1E6-4B56ED65331C@hotmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: malc @ 2009-02-21  5:48 UTC (permalink / raw)
  To: qemu-devel

Revision: 6631
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6631
Author:   malc
Date:     2009-02-21 05:48:13 +0000 (Sat, 21 Feb 2009)

Log Message:
-----------
Avoid infinite loop around timed condition variable

This can happen due to spurious wakeups

Modified Paths:
--------------
    trunk/posix-aio-compat.c

Modified: trunk/posix-aio-compat.c
===================================================================
--- trunk/posix-aio-compat.c	2009-02-21 05:48:11 UTC (rev 6630)
+++ trunk/posix-aio-compat.c	2009-02-21 05:48:13 UTC (rev 6631)
@@ -14,7 +14,7 @@
 #include <pthread.h>
 #include <unistd.h>
 #include <errno.h>
-#include <sys/time.h>
+#include <time.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -86,16 +86,17 @@
         struct qemu_paiocb *aiocb;
         size_t offset;
         int ret = 0;
+        qemu_timeval tv;
+        struct timespec ts;
 
+        qemu_gettimeofday(&tv);
+        ts.tv_sec = tv.tv_sec + 10;
+        ts.tv_nsec = 0;
+
         mutex_lock(&lock);
 
         while (TAILQ_EMPTY(&request_list) &&
                !(ret == ETIMEDOUT)) {
-            struct timespec ts = { 0 };
-            qemu_timeval tv;
-
-            qemu_gettimeofday(&tv);
-            ts.tv_sec = tv.tv_sec + 10;
             ret = cond_timedwait(&cond, &lock, &ts);
         }
 

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

* Re: [Qemu-devel] [6631] Avoid infinite loop around timed condition variable
       [not found] ` <9D64DDB2-3C4E-457D-B1E6-4B56ED65331C@hotmail.com>
@ 2009-02-21  5:58   ` C.W. Betts
  2009-02-21  6:43     ` malc
                       ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: C.W. Betts @ 2009-02-21  5:58 UTC (permalink / raw)
  To: qemu-devel

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

Will these patches help with the OS X hang?
On Feb 20, 2009, at 10:48 PM, malc wrote:

> Revision: 6631
>          http://svn.sv.gnu.org/viewvc/? 
> view=rev&root=qemu&revision=6631
> Author:   malc
> Date:     2009-02-21 05:48:13 +0000 (Sat, 21 Feb 2009)
>
> Log Message:
> -----------
> Avoid infinite loop around timed condition variable
>
> This can happen due to spurious wakeups
>
> Modified Paths:
> --------------
>    trunk/posix-aio-compat.c
>
> Modified: trunk/posix-aio-compat.c
> ===================================================================
> --- trunk/posix-aio-compat.c	2009-02-21 05:48:11 UTC (rev 6630)
> +++ trunk/posix-aio-compat.c	2009-02-21 05:48:13 UTC (rev 6631)
> @@ -14,7 +14,7 @@
> #include <pthread.h>
> #include <unistd.h>
> #include <errno.h>
> -#include <sys/time.h>
> +#include <time.h>
> #include <string.h>
> #include <stdlib.h>
> #include <stdio.h>
> @@ -86,16 +86,17 @@
>         struct qemu_paiocb *aiocb;
>         size_t offset;
>         int ret = 0;
> +        qemu_timeval tv;
> +        struct timespec ts;
>
> +        qemu_gettimeofday(&tv);
> +        ts.tv_sec = tv.tv_sec + 10;
> +        ts.tv_nsec = 0;
> +
>         mutex_lock(&lock);
>
>         while (TAILQ_EMPTY(&request_list) &&
>                !(ret == ETIMEDOUT)) {
> -            struct timespec ts = { 0 };
> -            qemu_timeval tv;
> -
> -            qemu_gettimeofday(&tv);
> -            ts.tv_sec = tv.tv_sec + 10;
>             ret = cond_timedwait(&cond, &lock, &ts);
>         }
>
>
>
>
>


[-- Attachment #2: Type: text/html, Size: 2966 bytes --]

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

* Re: [Qemu-devel] [6631] Avoid infinite loop around timed condition variable
  2009-02-21  5:58   ` C.W. Betts
@ 2009-02-21  6:43     ` malc
  2009-02-23 15:16     ` Anthony Liguori
  2009-02-23 15:19     ` Anthony Liguori
  2 siblings, 0 replies; 5+ messages in thread
From: malc @ 2009-02-21  6:43 UTC (permalink / raw)
  To: qemu-devel

On Fri, 20 Feb 2009, C.W. Betts wrote:

> Will these patches help with the OS X hang?

No idea.

-- 
mailto:av1474@comtv.ru

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

* Re: [Qemu-devel] [6631] Avoid infinite loop around timed condition variable
  2009-02-21  5:58   ` C.W. Betts
  2009-02-21  6:43     ` malc
@ 2009-02-23 15:16     ` Anthony Liguori
  2009-02-23 15:19     ` Anthony Liguori
  2 siblings, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2009-02-23 15:16 UTC (permalink / raw)
  To: qemu-devel

C.W. Betts wrote:
> Will these patches help with the OS X hang?

No.  I thought that got resolved?  Maybe I forgot to push the patch?

Regards,

Anthony Liguori

> On Feb 20, 2009, at 10:48 PM, malc wrote:
>
>> Revision: 6631
>>          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6631 
>> <http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6631>
>> Author:   malc
>> Date:     2009-02-21 05:48:13 +0000 (Sat, 21 Feb 2009)
>>
>> Log Message:
>> -----------
>> Avoid infinite loop around timed condition variable
>>
>> This can happen due to spurious wakeups
>>
>> Modified Paths:
>> --------------
>>    trunk/posix-aio-compat.c
>>
>> Modified: trunk/posix-aio-compat.c
>> ===================================================================
>> --- trunk/posix-aio-compat.c 2009-02-21 05:48:11 UTC (rev 6630)
>> +++ trunk/posix-aio-compat.c 2009-02-21 05:48:13 UTC (rev 6631)
>> @@ -14,7 +14,7 @@
>> #include <pthread.h>
>> #include <unistd.h>
>> #include <errno.h>
>> -#include <sys/time.h>
>> +#include <time.h>
>> #include <string.h>
>> #include <stdlib.h>
>> #include <stdio.h>
>> @@ -86,16 +86,17 @@
>>         struct qemu_paiocb *aiocb;
>>         size_t offset;
>>         int ret = 0;
>> +        qemu_timeval tv;
>> +        struct timespec ts;
>>
>> +        qemu_gettimeofday(&tv);
>> +        ts.tv_sec = tv.tv_sec + 10;
>> +        ts.tv_nsec = 0;
>> +
>>         mutex_lock(&lock);
>>
>>         while (TAILQ_EMPTY(&request_list) &&
>>                !(ret == ETIMEDOUT)) {
>> -            struct timespec ts = { 0 };
>> -            qemu_timeval tv;
>> -
>> -            qemu_gettimeofday(&tv);
>> -            ts.tv_sec = tv.tv_sec + 10;
>>             ret = cond_timedwait(&cond, &lock, &ts);
>>         }
>>
>>
>>
>>
>>
>

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

* Re: [Qemu-devel] [6631] Avoid infinite loop around timed condition variable
  2009-02-21  5:58   ` C.W. Betts
  2009-02-21  6:43     ` malc
  2009-02-23 15:16     ` Anthony Liguori
@ 2009-02-23 15:19     ` Anthony Liguori
  2 siblings, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2009-02-23 15:19 UTC (permalink / raw)
  To: qemu-devel

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

C.W. Betts wrote:
> Will these patches help with the OS X hang?

Can you try the attached patch?  I never got any feedback about whether 
it fixed the problem.

Regards,

Anthony Liguori

> On Feb 20, 2009, at 10:48 PM, malc wrote
>>
>


[-- Attachment #2: posix-aio-pipe.patch --]
[-- Type: application/mbox, Size: 3232 bytes --]

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

end of thread, other threads:[~2009-02-23 15:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-21  5:48 [Qemu-devel] [6631] Avoid infinite loop around timed condition variable malc
     [not found] ` <9D64DDB2-3C4E-457D-B1E6-4B56ED65331C@hotmail.com>
2009-02-21  5:58   ` C.W. Betts
2009-02-21  6:43     ` malc
2009-02-23 15:16     ` Anthony Liguori
2009-02-23 15:19     ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).