qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
	pbonzini@redhat.com, qemu-devel@nongnu.org,
	anthony@codemonkey.ws
Subject: Re: [Qemu-devel] [PATCH] eventfd: making it thread safe
Date: Mon, 06 Aug 2012 17:05:57 +0300	[thread overview]
Message-ID: <501FCF45.4010003@redhat.com> (raw)
In-Reply-To: <1343793936-28000-1-git-send-email-david@gibson.dropbear.id.au>

On 08/01/2012 07:05 AM, David Gibson wrote:
> From: Alexey Kardashevskiy <aik@ozlabs.ru>
> 
> QEMU uses IO handlers to run select() in the main loop.
> The handlers list is managed by qemu_set_fd_handler() helper
> which works fine when called from the main thread as it is
> called when select() is not waiting.
> 
> However IO handlers list can be changed in the thread other than
> the main one doing os_host_main_loop_wait(), for example, as a result
> of a hypercall which changes PCI config space (VFIO on POWER is the case)
> and enables/disabled MSI/MSIX which creates eventfd handles.
> As the main loop should be waiting on the newly created eventfds,
> it has to be restarted.
> 
> The patch adds the qemu_notify_event() call to interrupt select()
> to make main_loop() restart select() with the updated IO handlers
> list.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  iohandler.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/iohandler.c b/iohandler.c
> index 3c74de6..dea4355 100644
> --- a/iohandler.c
> +++ b/iohandler.c
> @@ -77,6 +77,7 @@ int qemu_set_fd_handler2(int fd,
>          ioh->fd_write = fd_write;
>          ioh->opaque = opaque;
>          ioh->deleted = 0;
> +        qemu_notify_event();
>      }
>      return 0;
>  }

Perhaps it's better to do this unconditionally (on the delete path too)
so that removals are processed without delay and we don't have closed
fds hanging around in select().

-- 
error compiling committee.c: too many arguments to function

  reply	other threads:[~2012-08-06 14:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-01  4:05 [Qemu-devel] [PATCH] eventfd: making it thread safe David Gibson
2012-08-06 14:05 ` Avi Kivity [this message]
2012-08-07  4:02   ` David Gibson
2012-08-07  6:25     ` Paolo Bonzini
  -- strict thread matches above, loose matches on Subject: below --
2012-08-22  3:01 David Gibson
2012-07-26  4:30 Alexey Kardashevskiy
2012-07-01 19:48 [Qemu-devel] [PATCH] eventfd: making it rhread safe Alexey Kardashevskiy
2012-07-18 12:08 ` [Qemu-devel] [PATCH] eventfd: making it thread safe Alexey Kardashevskiy
2012-07-18 12:22   ` Michael S. Tsirkin
2012-07-18 12:58     ` Alexey Kardashevskiy
2012-07-18 12:52   ` Alexey Kardashevskiy

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=501FCF45.4010003@redhat.com \
    --to=avi@redhat.com \
    --cc=aik@ozlabs.ru \
    --cc=anthony@codemonkey.ws \
    --cc=david@gibson.dropbear.id.au \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 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).