public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
To: Avi Kivity <avi@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>,
	kvm@vger.kernel.org, Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: Question on skip_emulated_instructions()
Date: Thu, 08 Apr 2010 18:14:44 +0900	[thread overview]
Message-ID: <4BBD9E84.6040307@lab.ntt.co.jp> (raw)
In-Reply-To: <4BBD966D.7060801@redhat.com>

Avi Kivity wrote:
 > On 04/08/2010 11:30 AM, Yoshiaki Tamura wrote:
 >>
 >> If I transferred a VM after I/O operations, let's say the VM sent an
 >> TCP ACK to the client, and if a hardware failure occurred to the
 >> primary during the VM transferring *but the client received the TCP
 >> ACK*, the secondary will resume from the previous state, and it may
 >> need to receive some data from the client. However, because the client
 >> has already receiver TCP ACK, it won't resend the data to the
 >> secondary. It looks this data is going to be dropped. Am I missing
 >> some point here?
 >>
 >
 > I think you should block I/O not at the cpu/device boundary (that's
 > inefficient as many cpu I/O instructions don't necessarily cause
 > externally visible I/O) but at the device level. Whenever the network
 > device wants to send out a packet, halt the guest (letting any I/O
 > instructions complete), synchronize the secondary, and then release the
 > pending I/O. This ensures that the secondary has all of the data prior
 > to the ack being sent out.

Although I was thinking to clean up my current code, maybe I should post the 
current status for explanation now.  As you mentioned, I'm capturing I/O at the 
device level, by inserting a hook inside of PIO/MMIO handler in virtio-blk, 
virtio-net and e1000 emulator.  Since it's implemented naively, it'll stop 
(meaning I/O instructions will be delayed) until transferring the VM is done.
So what I can do here is,

1. Let I/O instructions to complete both at qemu and kvm.
2. Transfer the guest state.
# VCPU and device model thinks I/O emulation is already done.
3. Finally release the pending output to the real world.

>>>> If the responses to the mmio or pio request are exactly the same,
>>>> then the replay will happen exactly the same.
>>
>>
>> I agree. What I'm wondering is how can we guarantee that the responses
>> are the same...
>
> I don't think you can in the general case. But if you gate output at the
> device level, instead of the instruction level, the problem goes away, no?

Yes, it should.
To implement this, we need to make No.3 to be called asynchronously.  If qemu is 
already handling I/O asynchronously, it would be relatively easy to make this.

  reply	other threads:[~2010-04-08  9:15 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-06  4:11 Question on skip_emulated_instructions() Yoshiaki Tamura
2010-04-06 10:05 ` Gleb Natapov
2010-04-07  6:25   ` Yoshiaki Tamura
2010-04-07 15:43     ` Gleb Natapov
2010-04-07 17:21       ` Yoshiaki Tamura
2010-04-07 17:37         ` Avi Kivity
2010-04-08  5:27           ` Yoshiaki Tamura
2010-04-08  5:41             ` Gleb Natapov
2010-04-08  6:18               ` Yoshiaki Tamura
2010-04-08  6:56             ` Gleb Natapov
2010-04-08  7:30               ` Yoshiaki Tamura
2010-04-08  7:37                 ` Avi Kivity
2010-04-08  8:30                   ` Yoshiaki Tamura
2010-04-08  8:38                     ` Avi Kivity
2010-04-08  7:17             ` Avi Kivity
2010-04-08  7:19               ` Gleb Natapov
2010-04-08  8:10                 ` Yoshiaki Tamura
2010-04-08  8:40                   ` Avi Kivity
2010-04-08  9:14                     ` Yoshiaki Tamura [this message]
2010-04-08 11:49                       ` Avi Kivity
2010-04-08 13:42                         ` Yoshiaki Tamura
2010-04-08 13:47                           ` Avi Kivity

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=4BBD9E84.6040307@lab.ntt.co.jp \
    --to=tamura.yoshiaki@lab.ntt.co.jp \
    --cc=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /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