[Qemu-block] util/aio-posix: Use RCU for handler insertion.

2018-11-16 Thread remy . noel
From: Remy Noel get rid of the delete attribute. We still need to get rid of the context list lock. Signed-off-by: Remy Noel --- util/aio-posix.c | 75 ++-- util/aio-win32.c | 43 ++- 2 files changed, 49 insertions(+), 69

[Qemu-block] aio: Do not use list_lock as a sync mechanism for aio_handlers anymore.

2018-11-16 Thread remy . noel
From: Remy Noel It is still used for bottom halves though and to avoid concurent set_fd_handlers (We could probably decorrelate the two, but set_fd_handlers are quite rare so it probably isn't worth it). Signed-off-by: Remy Noel --- include/block/aio.h | 4 +++- util/aio-posix.c

[Qemu-block] aio-posix: Fix concurrent aio_poll/set_fd_handler.

2018-11-16 Thread remy . noel
From: Remy Noel We no longer modify existing handlers entries and instead, always insert those after having properly initialized those. Also, we do not call aio_epoll_update for deleted handlers as this has no impact whastoever. Signed-off-by: Remy Noel --- util/aio-posix.c | 85

Re: [Qemu-block] util/aio-posix: Use RCU for handler insertion.

2018-12-06 Thread Remy NOEL
I did some tests and noticed the second and third patch to incur some performance loss (on a scenario using virtio device) I will therefore resubmit just the first patch alone. On 11/16/18 8:02 PM, remy.n...@blade-group.com wrote: From: Remy Noel get rid of the delete attribute. We still

[Qemu-block] [QEMU-devel][PATCH v2] aio-posix: Fix concurrent aio_poll/set_fd_handler.

2018-12-06 Thread remy . noel
From: Remy Noel It is possible for an io_poll callback to be concurrently executed along with an aio_set_fd_handlers. This can cause all sorts of problems, like a NULL callback or a bad opaque pointer. This changes set_fd_handlers so that it no longer modify existing handlers entries and

Re: [Qemu-block] [QEMU-devel][PATCH v2] aio-posix: Fix concurrent aio_poll/set_fd_handler.

2018-12-11 Thread Remy NOEL
On 12/10/18 8:05 PM, Stefan Hajnoczi wrote: On Thu, Dec 06, 2018 at 11:14:23AM +0100, remy.n...@blade-group.com wrote: +if (is_new) { +new_node->pfd.fd = fd; +} else { +deleted = aio_remove_fd_handler(ctx, node); +new_node->pfd = node->pfd; D

[Qemu-block] [QEMU-devel][PATCH v3] aio-posix: Fix concurrent aio_poll/set_fd_handler.

2018-12-17 Thread remy . noel
From: Remy Noel It is possible for an io_poll callback to be concurrently executed along with an aio_set_fd_handlers. This can cause all sorts of problems, like a NULL callback or a bad opaque pointer. This changes set_fd_handlers so that it no longer modify existing handlers entries and

Re: [Qemu-block] [QEMU-devel][PATCH v3] aio-posix: Fix concurrent aio_poll/set_fd_handler.

2018-12-19 Thread Remy NOEL
On 12/18/18 6:39 PM, Paolo Bonzini wrote: On 17/12/18 17:48, remy.n...@blade-group.com wrote: Also, we do not call aio_epoll_update for deleted handlers as this has no impact whatsoever. Why? epoll is used in level-triggered mode, so you do have to remove the file descriptor...

Re: [Qemu-block] [QEMU-devel][PATCH v3] aio-posix: Fix concurrent aio_poll/set_fd_handler.

2018-12-19 Thread Remy NOEL
On 12/18/18 3:14 PM, Stefan Hajnoczi wrote: Please include a changelog in future patches. For example: v3: * Don't drop revents when a handler is modified [Stefan] That way reviewers know what to look for and which issues you have addressed. Sorry, wasn't sure i had to do this in single com

Re: [Qemu-block] [QEMU-devel][PATCH v3] aio-posix: Fix concurrent aio_poll/set_fd_handler.

2018-12-20 Thread Remy NOEL
On 12/19/18 8:32 PM, Paolo Bonzini wrote: You found another bug then. :) K. Will fix.

[Qemu-block] [QEMU-devel][PATCH v4 1/2] aio-posix: Unregister fd from ctx epoll when removing fd_handler.

2018-12-20 Thread remy . noel
From: Remy Noel Cleaning the events will cause aio_epoll_update to unregister the fd. Otherwise, the fd is kept registered until it is destroyed. Signed-off-by: Remy Noel --- util/aio-posix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/util/aio-posix.c b/util/aio-posix.c index

[Qemu-block] [QEMU-devel][PATCH v4 2/2] aio-posix: Fix concurrent aio_poll/set_fd_handler.

2018-12-20 Thread remy . noel
From: Remy Noel It is possible for an io_poll callback to be concurrently executed along with an aio_set_fd_handlers. This can cause all sorts of problems, like a NULL callback or a bad opaque pointer. This changes set_fd_handlers so that it no longer modify existing handlers entries and