qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Re: [Qemu-devel] [PATCH v3] glib: fix g_poll early timeout on windows
       [not found] <1397838243-17921-1-git-send-email-s.vorobiov@samsung.com>
@ 2014-05-06 12:23 ` Stefan Hajnoczi
  2014-05-06 12:38   ` Paolo Bonzini
  2014-05-07  8:02 ` Stefan Hajnoczi
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2014-05-06 12:23 UTC (permalink / raw)
  To: Stanislav Vorobiov
  Cc: sw, sangho1206.park, qemu-devel, alex, syeon.hwang, pbonzini

On Fri, Apr 18, 2014 at 08:24:03PM +0400, Stanislav Vorobiov wrote:
> From: Sangho Park <sangho1206.park@samsung.com>
> 
> g_poll has a problem on Windows when using
> timeouts < 10ms, in glib/gpoll.c:
> 
> /* If not, and we have a significant timeout, poll again with
>  * timeout then. Note that this will return indication for only
>  * one event, or only for messages. We ignore timeouts less than
>  * ten milliseconds as they are mostly pointless on Windows, the
>  * MsgWaitForMultipleObjectsEx() call will timeout right away
>  * anyway.
>  */
> if (retval == 0 && (timeout == INFINITE || timeout >= 10))
>   retval = poll_rest (poll_msgs, handles, nhandles, fds, nfds, timeout);
> 
> so whenever g_poll is called with timeout < 10ms it does
> a quick poll instead of wait, this causes significant performance
> degradation of QEMU, thus we should use WaitForMultipleObjectsEx
> directly
> 
> Signed-off-by: Stanislav Vorobiov <s.vorobiov@samsung.com>
> ---
>  include/glib-compat.h |   19 +++++++++
>  include/qemu-common.h |   12 ------
>  util/oslib-win32.c    |  112 +++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 131 insertions(+), 12 deletions(-)

What is the status of this patch?

I haven't followed the discussions around the issue but can review/merge
if there is agreement now.

Stefan

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

* Re: [Qemu-devel] [PATCH v3] glib: fix g_poll early timeout on windows
  2014-05-06 12:23 ` [Qemu-devel] [PATCH v3] glib: fix g_poll early timeout on windows Stefan Hajnoczi
@ 2014-05-06 12:38   ` Paolo Bonzini
  2014-05-06 15:49     ` Alex Bligh
  0 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2014-05-06 12:38 UTC (permalink / raw)
  To: Stefan Hajnoczi, Stanislav Vorobiov
  Cc: sw, syeon.hwang, qemu-devel, alex, sangho1206.park

Il 06/05/2014 14:23, Stefan Hajnoczi ha scritto:
>> > Signed-off-by: Stanislav Vorobiov <s.vorobiov@samsung.com>
>> > ---
>> >  include/glib-compat.h |   19 +++++++++
>> >  include/qemu-common.h |   12 ------
>> >  util/oslib-win32.c    |  112 +++++++++++++++++++++++++++++++++++++++++++++++++
>> >  3 files changed, 131 insertions(+), 12 deletions(-)
> What is the status of this patch?
>
> I haven't followed the discussions around the issue but can review/merge
> if there is agreement now.

The GNOME folks haven't followed up, so I think we should pick it.

Paolo

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

* Re: [Qemu-devel] [PATCH v3] glib: fix g_poll early timeout on windows
  2014-05-06 12:38   ` Paolo Bonzini
@ 2014-05-06 15:49     ` Alex Bligh
  2014-05-06 16:52       ` Stefan Weil
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Bligh @ 2014-05-06 15:49 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Alex Bligh, sw, sangho1206.park, qemu-devel, Stefan Hajnoczi,
	syeon.hwang, Stanislav Vorobiov


On 6 May 2014, at 13:38, Paolo Bonzini wrote:

> Il 06/05/2014 14:23, Stefan Hajnoczi ha scritto:
>>> > Signed-off-by: Stanislav Vorobiov <s.vorobiov@samsung.com>
>>> > ---
>>> >  include/glib-compat.h |   19 +++++++++
>>> >  include/qemu-common.h |   12 ------
>>> >  util/oslib-win32.c    |  112 +++++++++++++++++++++++++++++++++++++++++++++++++
>>> >  3 files changed, 131 insertions(+), 12 deletions(-)
>> What is the status of this patch?
>> 
>> I haven't followed the discussions around the issue but can review/merge
>> if there is agreement now.
> 
> The GNOME folks haven't followed up, so I think we should pick it.

I haven't checked it on win32 but was happy with it otherwise.

-- 
Alex Bligh

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

* Re: [Qemu-devel] [PATCH v3] glib: fix g_poll early timeout on windows
  2014-05-06 15:49     ` Alex Bligh
@ 2014-05-06 16:52       ` Stefan Weil
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Weil @ 2014-05-06 16:52 UTC (permalink / raw)
  To: Alex Bligh, Paolo Bonzini
  Cc: Stanislav Vorobiov, sangho1206.park, qemu-devel, Stefan Hajnoczi,
	syeon.hwang

Am 06.05.2014 17:49, schrieb Alex Bligh:
> 
> On 6 May 2014, at 13:38, Paolo Bonzini wrote:
> 
>> Il 06/05/2014 14:23, Stefan Hajnoczi ha scritto:
>>>>> Signed-off-by: Stanislav Vorobiov <s.vorobiov@samsung.com>
>>>>> ---
>>>>>  include/glib-compat.h |   19 +++++++++
>>>>>  include/qemu-common.h |   12 ------
>>>>>  util/oslib-win32.c    |  112 +++++++++++++++++++++++++++++++++++++++++++++++++
>>>>>  3 files changed, 131 insertions(+), 12 deletions(-)
>>> What is the status of this patch?
>>>
>>> I haven't followed the discussions around the issue but can review/merge
>>> if there is agreement now.
>>
>> The GNOME folks haven't followed up, so I think we should pick it.
> 
> I haven't checked it on win32 but was happy with it otherwise.


There was another patch on the list which moved g_poll code from
qemu-common.h to glib-compat.h, so when both patches get merged I expect
a (trivial) merge conflict.

The patch looks good. I already have applied it to my local queue, but I
won't be able to test it before end of next week. If someone wants to
pick it up earlier, I would not mind.

Cheers,
Stefan

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

* Re: [Qemu-devel] [PATCH v3] glib: fix g_poll early timeout on windows
       [not found] <1397838243-17921-1-git-send-email-s.vorobiov@samsung.com>
  2014-05-06 12:23 ` [Qemu-devel] [PATCH v3] glib: fix g_poll early timeout on windows Stefan Hajnoczi
@ 2014-05-07  8:02 ` Stefan Hajnoczi
  2014-05-07  8:36   ` Stanislav Vorobiov
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2014-05-07  8:02 UTC (permalink / raw)
  To: Stanislav Vorobiov
  Cc: sw, sangho1206.park, qemu-devel, alex, syeon.hwang, pbonzini

On Fri, Apr 18, 2014 at 08:24:03PM +0400, Stanislav Vorobiov wrote:

Please fix the following compiler warning with gcc 4.8.2:

> +        } else if ((res == WAIT_TIMEOUT) || (res == WAIT_IO_COMPLETION) ||
> +                   ((int)res < WAIT_OBJECT_0) ||
> +                   (res >= (WAIT_OBJECT_0 + nhandles))) {
> +            break;
> +        }

util/oslib-win32.c: In function 'g_poll_fixed':
util/oslib-win32.c:324:21: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
                    ((int)res < WAIT_OBJECT_0) ||
		                         ^

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

* Re: [Qemu-devel] [PATCH v3] glib: fix g_poll early timeout on windows
  2014-05-07  8:02 ` Stefan Hajnoczi
@ 2014-05-07  8:36   ` Stanislav Vorobiov
  2014-05-07  8:49     ` Alex Bligh
  0 siblings, 1 reply; 8+ messages in thread
From: Stanislav Vorobiov @ 2014-05-07  8:36 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: sw, sangho1206.park, qemu-devel, alex, syeon.hwang, pbonzini

Hi,

Hm, but (int)res expression is not unsigned, it's signed. I've also had this warning,
but with this expression: (res < WAIT_OBJECT_0), that's why I put (int) there. Could it be that
for some reason your compiler treats "int" and "unsigned int", that would be really strange though...

On 05/07/2014 12:02 PM, Stefan Hajnoczi wrote:
> On Fri, Apr 18, 2014 at 08:24:03PM +0400, Stanislav Vorobiov wrote:
> 
> Please fix the following compiler warning with gcc 4.8.2:
> 
>> +        } else if ((res == WAIT_TIMEOUT) || (res == WAIT_IO_COMPLETION) ||
>> +                   ((int)res < WAIT_OBJECT_0) ||
>> +                   (res >= (WAIT_OBJECT_0 + nhandles))) {
>> +            break;
>> +        }
> 
> util/oslib-win32.c: In function 'g_poll_fixed':
> util/oslib-win32.c:324:21: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
>                     ((int)res < WAIT_OBJECT_0) ||
> 		                         ^
> 

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

* Re: [Qemu-devel] [PATCH v3] glib: fix g_poll early timeout on windows
  2014-05-07  8:36   ` Stanislav Vorobiov
@ 2014-05-07  8:49     ` Alex Bligh
  2014-05-07  9:06       ` Stanislav Vorobiov
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Bligh @ 2014-05-07  8:49 UTC (permalink / raw)
  To: Stanislav Vorobiov
  Cc: Alex Bligh, sw, sangho1206.park, qemu-devel, Stefan Hajnoczi,
	syeon.hwang, pbonzini


On 7 May 2014, at 09:36, Stanislav Vorobiov wrote:

> Hi,
> 
> Hm, but (int)res expression is not unsigned, it's signed. I've also had this warning,
> but with this expression: (res < WAIT_OBJECT_0), that's why I put (int) there. Could it be that
> for some reason your compiler treats "int" and "unsigned int", that would be really strange though...

I suspect the problem is that WAIT_OBJECT_0 is defined as an unsigned long:

#define WAIT_OBJECT_0       ((STATUS_WAIT_0 ) + 0 )

#define STATUS_WAIT_0       ((DWORD)0x00000000L)

So IIRC under the 'usual conversions', and int compared with it will be cast to an unsigned long too.

I think you want to cast WAIT_OBJECT_0 to a long or similar.

Alex


> On 05/07/2014 12:02 PM, Stefan Hajnoczi wrote:
>> On Fri, Apr 18, 2014 at 08:24:03PM +0400, Stanislav Vorobiov wrote:
>> 
>> Please fix the following compiler warning with gcc 4.8.2:
>> 
>>> +        } else if ((res == WAIT_TIMEOUT) || (res == WAIT_IO_COMPLETION) ||
>>> +                   ((int)res < WAIT_OBJECT_0) ||
>>> +                   (res >= (WAIT_OBJECT_0 + nhandles))) {
>>> +            break;
>>> +        }
>> 
>> util/oslib-win32.c: In function 'g_poll_fixed':
>> util/oslib-win32.c:324:21: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
>>                    ((int)res < WAIT_OBJECT_0) ||
>> 		                         ^
>> 
> 
> 
> 

-- 
Alex Bligh

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

* Re: [Qemu-devel] [PATCH v3] glib: fix g_poll early timeout on windows
  2014-05-07  8:49     ` Alex Bligh
@ 2014-05-07  9:06       ` Stanislav Vorobiov
  0 siblings, 0 replies; 8+ messages in thread
From: Stanislav Vorobiov @ 2014-05-07  9:06 UTC (permalink / raw)
  To: Alex Bligh
  Cc: sw, sangho1206.park, qemu-devel, Stefan Hajnoczi, syeon.hwang,
	pbonzini

Hi,

Yes it's probably the cause, thanks.

On 05/07/2014 12:49 PM, Alex Bligh wrote:
> 
> On 7 May 2014, at 09:36, Stanislav Vorobiov wrote:
> 
>> Hi,
>>
>> Hm, but (int)res expression is not unsigned, it's signed. I've also had this warning,
>> but with this expression: (res < WAIT_OBJECT_0), that's why I put (int) there. Could it be that
>> for some reason your compiler treats "int" and "unsigned int", that would be really strange though...
> 
> I suspect the problem is that WAIT_OBJECT_0 is defined as an unsigned long:
> 
> #define WAIT_OBJECT_0       ((STATUS_WAIT_0 ) + 0 )
> 
> #define STATUS_WAIT_0       ((DWORD)0x00000000L)
> 
> So IIRC under the 'usual conversions', and int compared with it will be cast to an unsigned long too.
> 
> I think you want to cast WAIT_OBJECT_0 to a long or similar.
> 
> Alex
> 
> 
>> On 05/07/2014 12:02 PM, Stefan Hajnoczi wrote:
>>> On Fri, Apr 18, 2014 at 08:24:03PM +0400, Stanislav Vorobiov wrote:
>>>
>>> Please fix the following compiler warning with gcc 4.8.2:
>>>
>>>> +        } else if ((res == WAIT_TIMEOUT) || (res == WAIT_IO_COMPLETION) ||
>>>> +                   ((int)res < WAIT_OBJECT_0) ||
>>>> +                   (res >= (WAIT_OBJECT_0 + nhandles))) {
>>>> +            break;
>>>> +        }
>>>
>>> util/oslib-win32.c: In function 'g_poll_fixed':
>>> util/oslib-win32.c:324:21: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
>>>                    ((int)res < WAIT_OBJECT_0) ||
>>> 		                         ^
>>>
>>
>>
>>
> 

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

end of thread, other threads:[~2014-05-07  9:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1397838243-17921-1-git-send-email-s.vorobiov@samsung.com>
2014-05-06 12:23 ` [Qemu-devel] [PATCH v3] glib: fix g_poll early timeout on windows Stefan Hajnoczi
2014-05-06 12:38   ` Paolo Bonzini
2014-05-06 15:49     ` Alex Bligh
2014-05-06 16:52       ` Stefan Weil
2014-05-07  8:02 ` Stefan Hajnoczi
2014-05-07  8:36   ` Stanislav Vorobiov
2014-05-07  8:49     ` Alex Bligh
2014-05-07  9:06       ` Stanislav Vorobiov

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).