All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] eventfd: making it thread safe
Date: Wed, 18 Jul 2012 22:58:23 +1000	[thread overview]
Message-ID: <5006B2EF.9040609@ozlabs.ru> (raw)
In-Reply-To: <20120718122202.GA5292@redhat.com>

On 18/07/12 22:22, Michael S. Tsirkin wrote:
> On Wed, Jul 18, 2012 at 10:08:53PM +1000, Alexey Kardashevskiy wrote:
>> 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 not when select() is waiting.
> 
> 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)
> 
> So the problem is only with VFIO? Can it affect vhost-net?

Honestly I have no idea about vhost-net as I never tried it.


>> and enables/disabled MSI/MSIX which closes/creates eventfd handles.
> 
> There doesn't seem to be a notification in case an fd is
> deleted. It's probably not at all urgent to remove
> an fd from select - why do you mention closing handles?

Agrhh. I missed this comment in the patch I just reposted.
Mentioned because the file* is still open when there is no need in it.
It has no effect for eventfd but may have for somebody else so we probably
want to add a notification on deletion. Dunno.


>> If the main loop is waiting on such eventfd, it has to be restarted.
> 
> Do you really mean 'should be waiting on the newly created
> eventfd'?
> 
>> The patch adds the qemu_notify_event() call to interrupt select()
>> and make main_loop() to restart select()
> 
> s/and make main_loop() to restart/to make main_loop() restart/?

Thanks for the comments. David used to polish my english but he is vacation
now :)


>> 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;
>>  }
>> -- 
>> 1.7.10.4


-- 
Alexey

  reply	other threads:[~2012-07-18 12:58 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-01 11:06 [Qemu-devel] QEMU question: is eventfd not thread safe? Alexey Kardashevskiy
2012-07-01 12:43 ` Michael S. Tsirkin
2012-07-01 12:57   ` Alexey Kardashevskiy
2012-07-01 23:07     ` Benjamin Herrenschmidt
2012-07-02  0:06       ` Alexey Kardashevskiy
2012-07-02  0:42         ` ronnie sahlberg
2012-07-02  0:45           ` Benjamin Herrenschmidt
2012-07-02  0:44         ` Benjamin Herrenschmidt
2012-07-02  0:49         ` Benjamin Herrenschmidt
2012-07-01 22:30   ` Benjamin Herrenschmidt
2012-07-01 13:32 ` Paolo Bonzini
2012-07-01 13:40   ` Alexey Kardashevskiy
2012-07-01 14:46     ` Alexey Kardashevskiy
2012-07-01 15:03       ` Paolo Bonzini
2012-07-01 19:48         ` [Qemu-devel] [PATCH] eventfd: making it rhread safe Alexey Kardashevskiy
2012-07-09  3:10           ` Alexey Kardashevskiy
2012-07-18  8:25             ` Alexey Kardashevskiy
2012-07-18 11:47           ` Michael S. Tsirkin
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 [this message]
2012-07-18 12:52             ` Alexey Kardashevskiy
2012-07-26  4:30 Alexey Kardashevskiy
2012-08-01  4:05 David Gibson
2012-08-06 14:05 ` Avi Kivity
2012-08-07  4:02   ` David Gibson
2012-08-07  6:25     ` Paolo Bonzini
2012-08-22  3:01 David Gibson

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=5006B2EF.9040609@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=mst@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 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.