qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 1/1] util/aio-win32: Only select on what we are actually waiting for
@ 2017-07-06 20:15 Alistair Francis
  2017-07-06 23:13 ` Paolo Bonzini
  2017-07-07 12:36 ` Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Alistair Francis @ 2017-07-06 20:15 UTC (permalink / raw)
  To: qemu-devel, stefanha, famz
  Cc: alistair.francis, alistair23, edgar.iglesias, qemu-block,
	philippe, pbonzini

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
Changes in V2:
 - Rebase on master
Changes since RFC:
 - Include more bitmasks for the select call

 util/aio-win32.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/util/aio-win32.c b/util/aio-win32.c
index bca496a47a..d6d5e02f00 100644
--- a/util/aio-win32.c
+++ b/util/aio-win32.c
@@ -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 | FD_ACCEPT | FD_CLOSE;
+        }
+
+        if (io_write) {
+            bitmask |= FD_WRITE | FD_CONNECT;
+        }
+
         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);
-- 
2.11.0

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

* Re: [Qemu-devel] [PATCH v2 1/1] util/aio-win32: Only select on what we are actually waiting for
  2017-07-06 20:15 [Qemu-devel] [PATCH v2 1/1] util/aio-win32: Only select on what we are actually waiting for Alistair Francis
@ 2017-07-06 23:13 ` Paolo Bonzini
  2017-07-07 12:36 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2017-07-06 23:13 UTC (permalink / raw)
  To: Alistair Francis
  Cc: qemu-devel, stefanha, famz, alistair23, edgar iglesias,
	qemu-block, philippe

Looks good, but I noticed now that you may want to do that for
qio_channel_create_socket_watch too.

Paolo

----- Original Message -----
> From: "Alistair Francis" <alistair.francis@xilinx.com>
> To: qemu-devel@nongnu.org, stefanha@redhat.com, famz@redhat.com
> Cc: "alistair francis" <alistair.francis@xilinx.com>, alistair23@gmail.com, "edgar iglesias"
> <edgar.iglesias@xilinx.com>, qemu-block@nongnu.org, philippe@mathieu-daude.net, pbonzini@redhat.com
> Sent: Thursday, July 6, 2017 10:15:14 PM
> Subject: [PATCH v2 1/1] util/aio-win32: Only select on what we are actually waiting for
> 
> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
> Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Changes in V2:
>  - Rebase on master
> Changes since RFC:
>  - Include more bitmasks for the select call
> 
>  util/aio-win32.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/util/aio-win32.c b/util/aio-win32.c
> index bca496a47a..d6d5e02f00 100644
> --- a/util/aio-win32.c
> +++ b/util/aio-win32.c
> @@ -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 | FD_ACCEPT | FD_CLOSE;
> +        }
> +
> +        if (io_write) {
> +            bitmask |= FD_WRITE | FD_CONNECT;
> +        }
> +
>          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);
> --
> 2.11.0
> 
> 

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

* Re: [Qemu-devel] [PATCH v2 1/1] util/aio-win32: Only select on what we are actually waiting for
  2017-07-06 20:15 [Qemu-devel] [PATCH v2 1/1] util/aio-win32: Only select on what we are actually waiting for Alistair Francis
  2017-07-06 23:13 ` Paolo Bonzini
@ 2017-07-07 12:36 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2017-07-07 12:36 UTC (permalink / raw)
  To: Alistair Francis
  Cc: qemu-devel, famz, alistair23, edgar.iglesias, qemu-block,
	philippe, pbonzini

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

On Thu, Jul 06, 2017 at 01:15:14PM -0700, Alistair Francis wrote:
> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
> Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Changes in V2:
>  - Rebase on master
> Changes since RFC:
>  - Include more bitmasks for the select call
> 
>  util/aio-win32.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

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

end of thread, other threads:[~2017-07-07 12:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-06 20:15 [Qemu-devel] [PATCH v2 1/1] util/aio-win32: Only select on what we are actually waiting for Alistair Francis
2017-07-06 23:13 ` Paolo Bonzini
2017-07-07 12:36 ` Stefan Hajnoczi

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