All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: remy.noel@blade-group.com
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	Fam Zheng <famz@redhat.com>, Stefan Weil <sw@weilnetz.de>,
	"open list:Block I/O path" <qemu-block@nongnu.org>
Subject: Re: [Qemu-devel] [QEMU-devel][PATCH v3] aio-posix: Fix concurrent aio_poll/set_fd_handler.
Date: Tue, 18 Dec 2018 14:14:01 +0000	[thread overview]
Message-ID: <20181218141401.GF18767@stefanha-x1.localdomain> (raw)
In-Reply-To: <20181217164847.24411-1-remy.noel@blade-group.com>

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

On Mon, Dec 17, 2018 at 05:48:47PM +0100, remy.noel@blade-group.com wrote:
> From: Remy Noel <remy.noel@blade-group.com>
> 
> 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 instead, always insert those after having proper initialisation.
> 
> Also, we do not call aio_epoll_update for deleted handlers as this has
> no impact whatsoever.
> 
> Signed-off-by: Remy Noel <remy.noel@blade-group.com>
> ---

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.

>  util/aio-posix.c | 86 ++++++++++++++++++++++++++++--------------------
>  util/aio-win32.c | 67 ++++++++++++++++---------------------
>  2 files changed, 79 insertions(+), 74 deletions(-)
> 
> diff --git a/util/aio-posix.c b/util/aio-posix.c
> index 51c41ed3c9..d658cf3007 100644
> --- a/util/aio-posix.c
> +++ b/util/aio-posix.c

Thanks!  The worst case I can now imagine is if an fd is handled twice
due to a concurrent aio_set_fd_handler() call, but spurious
->io_read()/->io_write() should not cause problems.

I will wait for Paolo to review this because he is most familiar with
the lockcnt abstraction.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

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

  reply	other threads:[~2018-12-18 14:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-17 16:48 [Qemu-devel] [QEMU-devel][PATCH v3] aio-posix: Fix concurrent aio_poll/set_fd_handler remy.noel
2018-12-18 14:14 ` Stefan Hajnoczi [this message]
2018-12-19 16:36   ` Remy NOEL
2018-12-18 15:32 ` Stefan Hajnoczi
2018-12-18 17:39 ` Paolo Bonzini
2018-12-19 16:29   ` Remy NOEL
2018-12-19 19:32     ` Paolo Bonzini
2018-12-20  9:35       ` Remy NOEL

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181218141401.GF18767@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=famz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=remy.noel@blade-group.com \
    --cc=sw@weilnetz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.