All of lore.kernel.org
 help / color / mirror / Atom feed
From: Uri Lublin <uril@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] migration: adding migration to/from a file (v2)
Date: Thu, 19 Feb 2009 22:45:21 +0200	[thread overview]
Message-ID: <499DC4E1.6040006@redhat.com> (raw)
In-Reply-To: <499DBB8E.6030705@codemonkey.ws>

Anthony Liguori wrote:
> Uri Lublin wrote:
>> Anthony Liguori wrote:
>>> Uri Lublin wrote:
>>>> Anthony Liguori wrote:
>>>>> Uri Lublin wrote:
>>>>>>
>>>>>> Migration to file, uses migration-to-fd (supports live migration).
>>>>>> Migration from file, uses qemu-fopen directly.
>>>>>
>>>>> Eh?  Haven't we already talked about why this doesn't work?  Maybe 
>>>>> there's a v3 that you meant to send?
>>>>>
>>>>
>>>> Actually I do have a v3 which uses posix-aio-compat.c
>>>> It's a much more complicated solution then just writing to a file 
>>>> though.
>>>> Also I am not sure if I need to use a signal or not as the migration 
>>>> (to-fd) code is polling. And if I use signal should I use SIGUSR2 or 
>>>> a different one and use a pipe similar to block-raw-posix.c ?
>>>
>>> How is the migration code polling?  It will attempt to do writes 
>>> until a write returns EAGAIN.  At this point, it will wait for 
>>> notification that the more writes are available.  Remember, migration 
>>> is a streaming protocol, not a random access, so it only makes sense 
>>> to have one outstanding request at a time.
>>>
>>> Your code would look something like:
>>>
>>> write() -> submit aio request
>>> until aio completes, write returns EAGAIN
>>> when aio completes, notify migration code that we are writable again
>>>
>>
>> Basically that's what I've done in my v3.
>> But since I fake EAGAIN, and the fd is writeable by select, the 
>> scenario is as follows:
> 
> Oh, yes, this is a problem.  You cannot use the existing migrate_fd code 
> unfortunately :-(
> 
> Or maybe you can.  If you change all instances of  
> qemu_set_fd_handler2() in migrate.c (in the migrate_fd_ routines) to 
> basically, s->set_fd_handler(), you can introduce a simple wrapper that 
> calls qemu_set_fd_handler2() for everything else, but for yourself, use 
> it as a mechanism to keep track of what the "writable" callback should 
> be.  This is the callback you would invoke when the aio request completes.
> 

So it looks simpler to just (v4 implementation) spawn a single writing thread, 
and use a pipe to "connect" it to the migration code (as the pipe supports 
non-blocking write).

Would that be acceptable, or you prefer I'll implement s->set_fd_handler() ?
In that case will need another thread and pipe for compatfd (qemu_signalfd), and 
allocate a buffer to hold the data until it's written (as the original buffer 
may change).

Thanks,
     Uri.

  parent reply	other threads:[~2009-02-19 20:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-19 11:45 [Qemu-devel] migration: adding migration to/from a file (v2) Uri Lublin
2009-02-19 13:57 ` Anthony Liguori
2009-02-19 16:14   ` Uri Lublin
2009-02-19 16:51     ` Anthony Liguori
2009-02-19 19:06       ` Uri Lublin
2009-02-19 20:05         ` Anthony Liguori
2009-02-19 20:28           ` Jamie Lokier
2009-02-19 23:36             ` M. Warner Losh
2009-02-19 23:59               ` Anthony Liguori
2009-02-20  0:36                 ` M. Warner Losh
2009-02-19 20:45           ` Uri Lublin [this message]
2009-02-19 19:37       ` Jamie Lokier
2009-02-19 20:06         ` Anthony Liguori
2009-02-19 19:33     ` Jamie Lokier

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=499DC4E1.6040006@redhat.com \
    --to=uril@redhat.com \
    --cc=anthony@codemonkey.ws \
    --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.