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

Gleb Natapov wrote:
> On Thu, Apr 08, 2010 at 02:27:53PM +0900, Yoshiaki Tamura wrote:
>> Avi Kivity wrote:
>>> On 04/07/2010 08:21 PM, Yoshiaki Tamura wrote:
>>>>
>>>> The problem here is that, I needed to transfer the VM state which is
>>>> just *before* the output to the devices. Otherwise, the VM state has
>>>> already been proceeded, and after failover, some I/O didn't work as I
>>>> expected.
>>>> I tracked down this issue, and figured out rip was already proceeded
>>>> in KVM,
>>>> and transferring this VCPU state was meaningless.
>>>>
>>>> I'm planning to post the patch set of Kemari soon, but I would like to
>>>> solve
>>>> this rip issue before that. If there is no drawback, I'm happy to work
>>>> and post a patch.
>>>
>>> vcpu state is undefined when an mmio operation is pending,
>>> Documentation/kvm/api.txt says the following:
>>>
>>>> NOTE: For KVM_EXIT_IO, KVM_EXIT_MMIO and KVM_EXIT_OSI, the corresponding
>>>> operations are complete (and guest state is consistent) only after
>>>> userspace
>>>> has re-entered the kernel with KVM_RUN. The kernel side will first finish
>>>> incomplete operations and then check for pending signals. Userspace
>>>> can re-enter the guest with an unmasked signal pending to complete
>>>> pending operations.
>>
>> Thanks for the information.
>>
>> So the point is the vcpu state that can been observed from qemu upon
>> KVM_EXIT_IO, KVM_EXIT_MMIO and KVM_EXIT_OSI should not be used
>> because it's not complete/consistent?
>>
> Definitely. VCPU is in the middle of an instruction execution, so the
> state is undefined. One instruction may generate more then one IO exit
> during its execution BTW.

Regarding the multiple IO exits, we're paying attention too.  Although it 
depends on the guest behavior, if we limit the device model, one IO exit per one 
instruction may be practical at beggining.  But thanks for pointing out.

To solve the undefined VCPU state, how about keeping a copy of initial state 
upon VMEXIT?  I guess there already is a similar shadow state in KVM.  If 
possible we can allocate another one for this purpose.

  reply	other threads:[~2010-04-08  6:19 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 [this message]
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
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=4BBD7546.7080400@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