Windows runtime improvements
cover Windows runtime improvements
At Xilinx we have started to run our fork of QEMU on Windows and are starting to distrubute this to customers. As part of this QEMU is launched from an Eclipse based GUI on Windows hosts. This uncovered a few performance issues in QEMU when running on CPU restricted machines.
What we see is that when QEMU is run on a machine where there aren't enough spare CPUs on the host, QEMU is extreamly slow. We especially see this when running our multi-architecture QEMU setup (MicroBlaze and ARM) because we are running two QEMU instances as well as what else is running on the machine.
Generally two instances of QEMU will never reach a Linux login prompt when run on four host CPUs, but will reach the login prompt when run on eight CPUs.
We investigated the issue and realised that it is mostly because QEMU did not block and instead the IO thread just busy looped. This basically locked up two CPUs (two QEMU instances) with IO threads not leaving enough resources on the machine.
This patch series fixed the issue for us on our fork of QEMU. Our fork is based on QEMU 2.8.1 and does not include MTTCG support. I have not tested this on the mainline QEMU or with MTTCG. It is on my todo list to see if I can repdouce the same issue on Windows with mainline QEMU. In the meantime I wanted to send this series to see if anyone else has seen Windows performance issues and if this helps with the problems. In order to see the issue we had to do a full Linux boot, smaller baremetal applications generally don't reproduce the same issue.
Also, most of these patches are editing the QEMU implementation of Glib, obviously these fixes (if applicable) will need to be ported to Glib and applied there as well. I just wanted to start here.
Alistair Francis (4):
util/aio-win32: Only select on what we are actually waiting for util/oslib-win32: Remove invalid check util/oslib-win32: Fix up if conditional util/oslib-win32: Recursivly pass the timeout
util/aio-win32.c | 13 ++++++++++--- util/oslib-win32.c | 25 +++++++++++++++++++------ 2 files changed, 29 insertions(+), 9 deletions(-)
Signature · 1 line
2.11.0
RFC 2/4 util/oslib-win32: Remove invalid check
There is no way nhandles can be zero in this section so that part of the if statement will always be false. Let's just remove it to make the code easier to read.
---
util/oslib-win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
util/oslib-win32.c +1 -1
@@ -414,7 +414,7 @@ static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles,/* If we have a timeout, or no handles to poll, be satisfied * with just noticing we have messages waiting. */ -if (timeout !=0 || nhandles ==0 ) { +if (timeout !=0 ) {return 1 ; }
Signature · 1 line
2.11.0
RFC 3/4 util/oslib-win32: Fix up if conditional
In reply to Alistair Francis---
util/oslib-win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
util/oslib-win32.c +1 -1
@@ -438,7 +438,7 @@ static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles,if (timeout ==0 && nhandles >1 ) {/* Remove the handle that fired */ int i; -if (ready < nhandles -1 ) { +if ((ready -WAIT_OBJECT_0 ) < nhandles -1 ) {for (i = ready -WAIT_OBJECT_0 +1 ; i < nhandles; i++) { handles[i-1 ] = handles[i]; }
Signature · 1 line
2.11.0
RFC 4/4 util/oslib-win32: Recursivly pass the timeout
In reply to Alistair Francis---
util/oslib-win32.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
util/oslib-win32.c +17 -4
@@ -432,10 +432,10 @@ static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles, } } -/* If no timeout and polling several handles, recurse to poll -* the rest of them. +/* We only found one and we are waiting on more then one. Let's try +* again. */ -if (timeout ==0 && nhandles >1 ) { +if (nhandles >1 ) {/* Remove the handle that fired */ int i;if ((ready -WAIT_OBJECT_0 ) < nhandles -1 ) {
@@ -444,7 +444,20 @@ static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles, } } nhandles--; - recursed_result =poll_rest (FALSE, handles, nhandles, fds, nfds,0 ); + +/* If we just had a very small timeout let's increase it when we +* recurse to ensure we don't just busy wait. This ensures we let +* the Windows threads block at least a little. If we previously +* had some wait let's set it to zero to avoid blocking for too +* long. +*/ +if (timeout <10 ) { + timeout = timeout +1 ; + }else { + timeout =0 ; + } + recursed_result =poll_rest (FALSE, handles, nhandles, fds, + nfds, timeout);return (recursed_result ==-1 ) ?-1 :1 + recursed_result; }return 1 ;
Signature · 1 line
2.11.0
RFC 1/4 util/aio-win32: Only select on what we are actually waiting for
In reply to Alistair Francis---
util/aio-win32.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
util/aio-win32.c +10 -3
@@ -71,6 +71,7 @@ void aio_set_fd_handler(AioContext *ctx, } }else {HANDLE event; +long bitmask =0 ;if (node ==NULL ) {/* Alloc and insert if it's not already there */
@@ -95,10 +96,16 @@ void aio_set_fd_handler(AioContext *ctx, node->io_write = io_write; node->is_external = is_external; +if (io_read) { + bitmask |=FD_READ ; + } + +if (io_write) { + bitmask |=FD_WRITE ; + } + event =event_notifier_get_handle (&ctx->notifier); -WSAEventSelect (node->pfd.fd, event, -FD_READ |FD_ACCEPT |FD_CLOSE | -FD_CONNECT |FD_WRITE |FD_OOB ); +WSAEventSelect (node->pfd.fd, event, bitmask); }qemu_lockcnt_unlock (&ctx->list_lock);
Signature · 1 line
2.11.0
Re: [Qemu-devel] [RFC v1 2/4] util/oslib-win32: Remove invalid check
In reply to Alistair FrancisQuoted 6 lines · Alistair Francis
There is no way nhandles can be zero in this section so that part of the if statement will always be false. Let's just remove it to make the code easier to read.
Signed-off-by Alistair Francis <[email protected]>
Quoted 22 lines
---
util/oslib-win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)util/oslib-win32.c +1
-2@@ -414,7 +414,7 @@ static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles,/* If we have a timeout, or no handles to poll, be satisfied * with just noticing we have messages waiting. */ -if (timeout !=0 || nhandles ==0 ) { +if (timeout !=0 ) {return 1 ; } --2.11.0
Re: [Qemu-devel] [RFC v1 1/4] util/aio-win32: Only select on what we are actually waiting for
In reply to Alistair FrancisQuoted 29 lines · Alistair Francis
Signed-off-by Alistair Francis <[email protected]>---
util/aio-win32.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)util/aio-win32.c +7
-0@@ -71,6 +71,7 @@ void aio_set_fd_handler(AioContext *ctx, } }else {HANDLE event; +long bitmask =0 ;if (node ==NULL ) {/* Alloc and insert if it's not already there */ @@ -95,10 +96,16 @@ void aio_set_fd_handler(AioContext *ctx, node->io_write = io_write; node->is_external = is_external; +if (io_read) { + bitmask |=FD_READ ; + } + +if (io_write) { + bitmask |=FD_WRITE ;
util/aio-win32.c void aio_set_fd_handler(AioContext *ctx, · line 111
Quoted 10 lines
util/aio-win32.c +3
-3+ } + event =event_notifier_get_handle (&ctx->notifier); -WSAEventSelect (node->pfd.fd, event, -FD_READ |FD_ACCEPT |FD_CLOSE | -FD_CONNECT |FD_WRITE |FD_OOB ); +WSAEventSelect (node->pfd.fd, event, bitmask); }qemu_lockcnt_unlock (&ctx->list_lock);
Not sure if it's okay to drop accept/close/connect/oob altogether, Cc'ing Paolo who knows Windows stuff.
Fam
Re: [Qemu-devel] [RFC v1 2/4] util/oslib-win32: Remove invalid check
In reply to Alistair FrancisQuoted 27 lines · Alistair Francis
There is no way nhandles can be zero in this section so that part of the if statement will always be false. Let's just remove it to make the code easier to read.
Signed-off-by Alistair Francis <[email protected]>---
util/oslib-win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)util/oslib-win32.c +1
-1@@ -414,7 +414,7 @@ static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles,/* If we have a timeout, or no handles to poll, be satisfied * with just noticing we have messages waiting. */ -if (timeout !=0 || nhandles ==0 ) { +if (timeout !=0 ) {return 1 ; }Signature · 1 line
2.11.0
Re: [Qemu-devel] [RFC v1 3/4] util/oslib-win32: Fix up if conditional
In reply to Alistair FrancisQuoted 23 lines · Alistair Francis
Signed-off-by Alistair Francis <[email protected]>---
util/oslib-win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)util/oslib-win32.c +1
-1@@ -438,7 +438,7 @@ static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles,if (timeout ==0 && nhandles >1 ) {/* Remove the handle that fired */ int i; -if (ready < nhandles -1 ) { +if ((ready -WAIT_OBJECT_0 ) < nhandles -1 ) {for (i = ready -WAIT_OBJECT_0 +1 ; i < nhandles; i++) { handles[i-1 ] = handles[i]; }Signature · 1 line
2.11.0
Re: [Qemu-devel] [RFC v1 4/4] util/oslib-win32: Recursivly pass the timeout
In reply to Alistair FrancisQuoted 50 lines · Alistair Francis
Signed-off-by Alistair Francis <[email protected]>---
util/oslib-win32.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)util/oslib-win32.c +17
-4@@ -432,10 +432,10 @@ static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles, } } -/* If no timeout and polling several handles, recurse to poll -* the rest of them. +/* We only found one and we are waiting on more then one. Let's try +* again. */ -if (timeout ==0 && nhandles >1 ) { +if (nhandles >1 ) {/* Remove the handle that fired */ int i;if ((ready -WAIT_OBJECT_0 ) < nhandles -1 ) {@@ -444,7 +444,20 @@ static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles, } } nhandles--; - recursed_result =poll_rest (FALSE, handles, nhandles, fds, nfds,0 ); + +/* If we just had a very small timeout let's increase it when we +* recurse to ensure we don't just busy wait. This ensures we let +* the Windows threads block at least a little. If we previously +* had some wait let's set it to zero to avoid blocking for too +* long. +*/ +if (timeout <10 ) { + timeout = timeout +1 ; + }else { + timeout =0 ; + } + recursed_result =poll_rest (FALSE, handles, nhandles, fds, + nfds, timeout);return (recursed_result ==-1 ) ?-1 :1 + recursed_result; }return 1 ;Signature · 1 line
2.11.0
This is a hack, can we fix what is the causing the busy wait instead?
Fam
Re: [Qemu-devel] [RFC v1 1/4] util/aio-win32: Only select on what we are actually waiting for
In reply to Alistair FrancisQuoted 20 lines · Alistair Francis
Signed-off-by Alistair Francis <[email protected]>---
util/aio-win32.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)util/aio-win32.c +1
-0@@ -71,6 +71,7 @@ void aio_set_fd_handler(AioContext *ctx, } }else {HANDLE event; +long bitmask =0 ;if (node ==NULL ) {/* Alloc and insert if it's not already there */
util/aio-win32.c void aio_set_fd_handler(AioContext *ctx, · line 105
Quoted 10 lines
util/aio-win32.c +7
-0@@ -95,10 +96,16 @@ void aio_set_fd_handler(AioContext *ctx, node->io_write = io_write; node->is_external = is_external; +if (io_read) { + bitmask |=FD_READ ; + } + +if (io_write) { + bitmask |=FD_WRITE ; + }
The read case should also include FD_ACCEPT, and the write case should also include FD_CONNECT. FD_CLOSE probably also goes under "read", since it's signaled when read()/recv() return 0.
FD_OOB is unnecessary, indeed.
Paolo
Quoted 9 lines
util/aio-win32.c +1
-3event =event_notifier_get_handle (&ctx->notifier); -WSAEventSelect (node->pfd.fd, event, -FD_READ |FD_ACCEPT |FD_CLOSE | -FD_CONNECT |FD_WRITE |FD_OOB ); +WSAEventSelect (node->pfd.fd, event, bitmask); }qemu_lockcnt_unlock (&ctx->list_lock);
Re: [Qemu-devel] [RFC v1 3/4] util/oslib-win32: Fix up if conditional
In reply to Alistair FrancisQuoted 13 lines · Alistair Francis
Signed-off-by Alistair Francis <[email protected]>---
util/oslib-win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)util/oslib-win32.c +0
-0
util/oslib-win32.c static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles, · line 444
Quoted 8 lines
util/oslib-win32.c +1
-1@@ -438,7 +438,7 @@ static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles,if (timeout ==0 && nhandles >1 ) {/* Remove the handle that fired */ int i; -if (ready < nhandles -1 ) { +if ((ready -WAIT_OBJECT_0 ) < nhandles -1 ) {for (i = ready -WAIT_OBJECT_0 +1 ; i < nhandles; i++) { handles[i-1 ] = handles[i]; }
WAIT_OBJECT_0 is zero, but I agree it's better to add it.
However, the condition can be rewritten as ready - WAIT_OBJECT_0 + 1 < nhandles, which is the same as the first iteration's "i < nhandles". So I'd just remove the "if" and "unindent" the for loop.
Paolo
Re: [Qemu-devel] [RFC v1 4/4] util/oslib-win32: Recursivly pass the timeout
In reply to Alistair FrancisQuoted 18 lines · Alistair Francis
util/oslib-win32.c +8
-2+/* We only found one and we are waiting on more then one. Let's try +* again. */ -if (timeout ==0 && nhandles >1 ) { +if (nhandles >1 ) {/* Remove the handle that fired */ int i;if ((ready -WAIT_OBJECT_0 ) < nhandles -1 ) {@@ -444,7 +444,20 @@ static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles, } } nhandles--; - recursed_result =poll_rest (FALSE, handles, nhandles, fds, nfds,0 ); + +/* If we just had a very small timeout let's increase it when we +* recurse to ensure we don't just busy wait. This ensures we let +* the Windows threads block at least a little. If we previously +* had some wait let's set it to zero to avoid blocking for too
util/oslib-win32.c static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles, · line 461
Quoted 10 lines
util/oslib-win32.c +9
-0+* long. +*/ +if (timeout <10 ) { + timeout = timeout +1 ; + }else { + timeout =0 ; + } + recursed_result =poll_rest (FALSE, handles, nhandles, fds, + nfds, timeout);return (recursed_result ==-1 ) ?-1 :1 + recursed_result;
I'm not sure I agree with this change, which is effectively delaying the processing of events. The question to me is which handles are triggering so fast that QEMU effectively busy waits.
Maybe your QEMUs can get some breath with commit 12f8def0e0 ("win32:
replace custom mutex and condition variable with native primitives", 2017-03-27), since the native primitives are more efficient and TCG 2.8 used condvars a lot for qemu_io_proceeded_cond.
Paolo
Re: [Qemu-devel] [RFC v1 2/4] util/oslib-win32: Remove invalid check
In reply to Alistair FrancisQuoted 17 lines · Alistair Francis
There is no way nhandles can be zero in this section so that part of the if statement will always be false. Let's just remove it to make the code easier to read.
Signed-off-by Alistair Francis <[email protected]>---
util/oslib-win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)util/oslib-win32.c +0
-0
util/oslib-win32.c static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles, · line 420
Quoted 8 lines
util/oslib-win32.c +1
-1@@ -414,7 +414,7 @@ static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles,/* If we have a timeout, or no handles to poll, be satisfied * with just noticing we have messages waiting. */ -if (timeout !=0 || nhandles ==0 ) { +if (timeout !=0 ) {return 1 ; }
Hmm, I think it's possible, poll_msgs is true here.
Paolo
Re: [Qemu-devel] [RFC v1 3/4] util/oslib-win32: Fix up if conditional
In reply to Paolo BonziniQuoted 27 lines · Paolo Bonzini
Quoted 13 lines · Alistair Francis
Signed-off-by Alistair Francis <[email protected]>---
util/oslib-win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)util/oslib-win32.c +0
-0util/oslib-win32.c static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles, · line 444
Quoted 8 lines
util/oslib-win32.c +1
-1@@ -438,7 +438,7 @@ static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles,if (timeout ==0 && nhandles >1 ) {/* Remove the handle that fired */ int i; -if (ready < nhandles -1 ) { +if ((ready -WAIT_OBJECT_0 ) < nhandles -1 ) {for (i = ready -WAIT_OBJECT_0 +1 ; i < nhandles; i++) { handles[i-1 ] = handles[i]; }
WAIT_OBJECT_0is zero, but I agree it's better to add it.
Quoted 3 lines
However, the condition can be rewritten as ready -
WAIT_OBJECT_0+ 1 < nhandles, which is the same as the first iteration's "i < nhandles". So I'd just remove the "if" and "unindent" the for loop.
Ah, good spot. I'll remove it.
Thanks,
Alistair
Quoted 2 lines
Paolo
Re: [Qemu-devel] [RFC v1 4/4] util/oslib-win32: Recursivly pass the timeout
In reply to Paolo BonziniQuoted 27 lines · Paolo Bonzini
Quoted 24 lines · Alistair Francis
util/oslib-win32.c +14
-2+/* We only found one and we are waiting on more then one. Let's try +* again. */ -if (timeout ==0 && nhandles >1 ) { +if (nhandles >1 ) {/* Remove the handle that fired */ int i;if ((ready -WAIT_OBJECT_0 ) < nhandles -1 ) {@@ -444,7 +444,20 @@ static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles, } } nhandles--; - recursed_result =poll_rest (FALSE, handles, nhandles, fds, nfds,0 ); + +/* If we just had a very small timeout let's increase it when we +* recurse to ensure we don't just busy wait. This ensures we let +* the Windows threads block at least a little. If we previously +* had some wait let's set it to zero to avoid blocking for too +* long. +*/ +if (timeout <10 ) { + timeout = timeout +1 ; + }else { + timeout =0 ;
Quoted 8 lines
util/oslib-win32.c static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles, · line 461
Quoted 4 lines
util/oslib-win32.c +3
-0+ } + recursed_result =poll_rest (FALSE, handles, nhandles, fds, + nfds, timeout);return (recursed_result ==-1 ) ?-1 :1 + recursed_result;I'm not sure I agree with this change, which is effectively delaying the processing of events. The question to me is which handles are triggering so fast that QEMU effectively busy waits.
Yeah, that is what I was trying to figure out, but didn't make much headway.
I kept seeing zero timeouts, which means that the thread never blocks and this patch helps a lot.
Quoted 5 lines
Maybe your QEMUs can get some breath with commit
12f8def0e0("win32:
replace custom mutex and condition variable with native primitives", 2017-03-27), since the native primitives are more efficient and TCG 2.8 used condvars a lot forqemu_io_proceeded_cond.
Ok, I will try that.
Does this mean you don't see the same slowness on QEMU 2.9?
Thanks,
Alistair
Quoted 2 lines
Paolo
Re: [Qemu-devel] [RFC v1 2/4] util/oslib-win32: Remove invalid check
In reply to Paolo BonziniQuoted 12 lines · Paolo Bonzini
Quoted 11 lines · Alistair Francis
There is no way nhandles can be zero in this section so that part of the if statement will always be false. Let's just remove it to make the code easier to read.
Signed-off-by Alistair Francis <[email protected]>---
util/oslib-win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
Quoted 6 lines
util/oslib-win32.c +0
-0util/oslib-win32.c static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles, · line 420
Quoted 8 lines
util/oslib-win32.c +1
-1@@ -414,7 +414,7 @@ static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles,/* If we have a timeout, or no handles to poll, be satisfied * with just noticing we have messages waiting. */ -if (timeout !=0 || nhandles ==0 ) { +if (timeout !=0 ) {return 1 ; }Hmm, I think it's possible,
poll_msgsis true here.
poll_msgs?
If nhandles is 0 then we have already entered an earlier if statement and set ready to either WAIT_FAILED or WAIT_TIMEOUT in which case we can't enter this part of the if statement.
Thanks,
Alistair
Quoted 2 lines
Paolo
Re: [Qemu-devel] [RFC v1 4/4] util/oslib-win32: Recursivly pass the timeout
In reply to Alistair FrancisQuoted 10 lines · Paolo Bonzini
Quoted 4 lines · Alistair Francis
I'm not sure I agree with this change, which is effectively delaying the processing of events. The question to me is which handles are triggering so fast that QEMU effectively busy waits.
Yeah, that is what I was trying to figure out, but didn't make much headway.
I kept seeing zero timeouts, which means that the thread never blocks and this patch helps a lot.
Perhaps you can use tracepoints? There shouldn't be many handles registered, since on Windows even the GUI actions all go through messages.
Quoted 8 lines
Quoted 4 lines
Maybe your QEMUs can get some breath with commit
12f8def0e0("win32:
replace custom mutex and condition variable with native primitives", 2017-03-27), since the native primitives are more efficient and TCG 2.8 used condvars a lot forqemu_io_proceeded_cond.Ok, I will try that.
Does this mean you don't see the same slowness on QEMU 2.9?
I have not tried, but the patch is only working around the real issue, as Fam pointed out.
Paolo
Re: [Qemu-devel] [RFC v1 4/4] util/oslib-win32: Recursivly pass the timeout
Quoted 6 lines · Paolo Bonzini
Quoted 6 lines · Paolo Bonzini
Quoted 4 lines · Alistair Francis
I'm not sure I agree with this change, which is effectively delaying the processing of events. The question to me is which handles are triggering so fast that QEMU effectively busy waits.
Quoted 14 lines
Quoted 4 lines
Yeah, that is what I was trying to figure out, but didn't make much headway.
I kept seeing zero timeouts, which means that the thread never blocks and this patch helps a lot.
Perhaps you can use tracepoints? There shouldn't be many handles registered, since on Windows even the GUI actions all go through messages.
Quoted 6 lines
Quoted 4 lines
Maybe your QEMUs can get some breath with commit
12f8def0e0("win32:
replace custom mutex and condition variable with native primitives", 2017-03-27), since the native primitives are more efficient and TCG 2.8 used condvars a lot forqemu_io_proceeded_cond.Ok, I will try that.
No luck, I tried applying that and it didn't make any difference.
Quoted 5 lines
Quoted 2 lines
Does this mean you don't see the same slowness on QEMU 2.9?
I have not tried, but the patch is only working around the real issue, as Fam pointed out.
Agreed. I'll keep digging and see what I can find.
Thanks,
Alistair
Quoted 3 lines
Paolo
Re: [Qemu-devel] [RFC v1 2/4] util/oslib-win32: Remove invalid check
In reply to Alistair FrancisQuoted 6 lines · Alistair Francis
Quoted 1 line
Hmm, I think it's possible,
poll_msgsis true here.
poll_msgs?If nhandles is 0 then we have already entered an earlier if statement and set ready to either
WAIT_FAILEDorWAIT_TIMEOUTin which case we can't enter this part of the if statement.
No, that's not correct. The code is:
if (poll_msgs) {
/* Wait for either messages or handles
* -> Use MsgWaitForMultipleObjectsEx
*/
ready = MsgWaitForMultipleObjectsEx(nhandles, handles, timeout,
QS_ALLINPUT, MWMO_ALERTABLE);
if (ready == WAIT_FAILED) {
gchar *emsg = g_win32_error_message(GetLastError());
g_warning("MsgWaitForMultipleObjectsEx failed: %s", emsg);
g_free(emsg);
}
} else if (nhandles == 0) {
/* No handles to wait for, just the timeout */
if (timeout == INFINITE) {
ready = WAIT_FAILED;
} else {
SleepEx(timeout, TRUE);
ready = WAIT_TIMEOUT;
}You can have poll_msgs == TRUE && nhandles == 0. This happens for
GPollFD fds[1] = { .fd = G_WIN32_MSG_HANDLE, .events = G_IO_IN };
g_poll(fds, 1, timeout);Thanks,
Paolo
Re: [Qemu-devel] [RFC v1 2/4] util/oslib-win32: Remove invalid check
Quoted 33 lines · Paolo Bonzini
Quoted 6 lines · Alistair Francis
Quoted 1 line
Hmm, I think it's possible,
poll_msgsis true here.
poll_msgs?If nhandles is 0 then we have already entered an earlier if statement and set ready to either
WAIT_FAILEDorWAIT_TIMEOUTin which case we can't enter this part of the if statement.No, that's not correct. The code is:
if (poll_msgs) { /* Wait for either messages or handles * -> Use MsgWaitForMultipleObjectsEx */ ready = MsgWaitForMultipleObjectsEx(nhandles, handles, timeout, QS_ALLINPUT, MWMO_ALERTABLE); if (ready == WAIT_FAILED) { gchar *emsg = g_win32_error_message(GetLastError()); g_warning("MsgWaitForMultipleObjectsEx failed: %s", emsg); g_free(emsg); } } else if (nhandles == 0) { /* No handles to wait for, just the timeout */ if (timeout == INFINITE) { ready = WAIT_FAILED; } else { SleepEx(timeout, TRUE); ready = WAIT_TIMEOUT; }
Quoted 4 lines
You can have
poll_msgs== TRUE && nhandles == 0. This happens forGPollFD fds[1] = { .fd = G_WIN32_MSG_HANDLE, .events = G_IO_IN }; g_poll(fds, 1, timeout);
Ah. Yeah good point.
Ok, I'll respin the series without this patch then.
Thanks,
Alistair
Quoted 5 lines
Thanks,
Paolo
This series failed automatic build test. Please find the testing commands and their output below. If you have docker installed, you can probably reproduce it locally.
Hi,
This series failed automatic build test. Please find the testing commands and their output below. If you have docker installed, you can probably reproduce it locally.
Subject: [Qemu-devel] [RFC v1 0/4] Windows runtime improvements
Message-id: [email protected]
Type: series
=== TEST SCRIPT BEGIN ===
#!/bin/bash
set -e
git submodule update --init dtc
# Let docker tests dump environment info
export SHOW_ENV=1
export J=8
time make docker-test-quick@centos6
time make docker-test-build@min-glib
time make docker-test-mingw@fedora
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
fatal: Cannot update paths and switch to branch 'test' at the same time.
Did you intend to checkout 'origin/patchew/[email protected]' which can not be resolved as commit? Traceback (most recent call last):
File "/home/fam/bin/patchew", line 440, in test_one
git_clone_repo(clone, r["repo"], r["head"], logf)
File "/home/fam/bin/patchew", line 53, in git_clone_repo
cwd=clone)
File "/usr/lib64/python3.5/subprocess.py", line 271, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['git', 'checkout', 'origin/patchew/[email protected]', '-b', 'test']' returned non-zero exit status 128
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
Quoted 11 lines · On Thu, 07/06 16:48, [email protected] wrote:
Updating
3c8cf5a9c21ff8782164d1def7f44bd888713384
fatal: Cannot update paths and switch to branch 'test' at the same time.
Did you intend to checkout 'origin/patchew/[email protected]' which can not be resolved as commit? Traceback (most recent call last):
File "/home/fam/bin/patchew", line 440, intest_onegit_clone_repo(clone, r["repo"], r["head"], logf)File "
/home/fam/bin/patchew", line 53, ingit_clone_repo
cwd=clone)
File "/usr/lib64/python3.5/subprocess.py", line 271, incheck_call
raiseCalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['git', 'checkout', 'origin/patchew/[email protected]', '-b', 'test']' returned non-zero exit status 128
Ignore this please, patchew is recovering from a bad state.