From: Paolo Bonzini <pbonzini@redhat.com> To: Liran Alon <liran.alon@oracle.com>, qemu-devel@nongnu.org, rth@twiddle.net, ehabkost@redhat.com Cc: idan.brown@oracle.com, mtosatti@redhat.com, kvm@vger.kernel.org, jmattson@google.com Subject: Re: [PATCH 2/2] KVM: i386: Add support for save and restore nested state Date: Fri, 14 Sep 2018 09:16:12 +0200 [thread overview] Message-ID: <4e7316db-c24a-6dd5-9e62-1ccc93bf1ee1@redhat.com> (raw) In-Reply-To: <20180914003827.124570-3-liran.alon@oracle.com> On 14/09/2018 02:38, Liran Alon wrote: > Kernel commit 8fcc4b5923af ("kvm: nVMX: Introduce KVM_CAP_NESTED_STATE") > introduced new IOCTLs to extract and restore KVM internal state used to > run a VM that is in VMX operation. > > Utilize these IOCTLs to add support of migration of VMs which are > running nested hypervisors. > > Reviewed-by: Nikita Leshchenko <nikita.leshchenko@oracle.com> > Reviewed-by: Patrick Colp <patrick.colp@oracle.com> > Signed-off-by: Liran Alon <liran.alon@oracle.com> Heh, I was going to send a similar patch. However, things are a bit more complex for two reason. First, I'd prefer to reuse the hflags and hflags2 fields that we already have, and only store the VMCS blob in the subsection. For example, HF_SVMI_MASK is really the same as HF_GUEST_MASK in KVM source code and KVM_STATE_NESTED_GUEST_MODE in the nested virt state. More important, this: > > +static int nested_state_post_load(void *opaque, int version_id) > +{ > + X86CPU *cpu = opaque; > + CPUX86State *env = &cpu->env; > + > + /* > + * Verify that the size specified in given struct is set > + * to no more than the size that our kernel support > + */ > + if (env->nested_state->size > env->nested_state_len) { > + return -EINVAL; > + } > + > + return 0; > +} > + > +static bool nested_state_needed(void *opaque) doesn't work if nested_state_len differs between source and destination, and could overflow the nested_state buffer if nested_state_len is larger on the source. I'll send my version today or next Monday. Thanks, Paolo
WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com> To: Liran Alon <liran.alon@oracle.com>, qemu-devel@nongnu.org, rth@twiddle.net, ehabkost@redhat.com Cc: mtosatti@redhat.com, kvm@vger.kernel.org, jmattson@google.com, idan.brown@oracle.com Subject: Re: [Qemu-devel] [PATCH 2/2] KVM: i386: Add support for save and restore nested state Date: Fri, 14 Sep 2018 09:16:12 +0200 [thread overview] Message-ID: <4e7316db-c24a-6dd5-9e62-1ccc93bf1ee1@redhat.com> (raw) In-Reply-To: <20180914003827.124570-3-liran.alon@oracle.com> On 14/09/2018 02:38, Liran Alon wrote: > Kernel commit 8fcc4b5923af ("kvm: nVMX: Introduce KVM_CAP_NESTED_STATE") > introduced new IOCTLs to extract and restore KVM internal state used to > run a VM that is in VMX operation. > > Utilize these IOCTLs to add support of migration of VMs which are > running nested hypervisors. > > Reviewed-by: Nikita Leshchenko <nikita.leshchenko@oracle.com> > Reviewed-by: Patrick Colp <patrick.colp@oracle.com> > Signed-off-by: Liran Alon <liran.alon@oracle.com> Heh, I was going to send a similar patch. However, things are a bit more complex for two reason. First, I'd prefer to reuse the hflags and hflags2 fields that we already have, and only store the VMCS blob in the subsection. For example, HF_SVMI_MASK is really the same as HF_GUEST_MASK in KVM source code and KVM_STATE_NESTED_GUEST_MODE in the nested virt state. More important, this: > > +static int nested_state_post_load(void *opaque, int version_id) > +{ > + X86CPU *cpu = opaque; > + CPUX86State *env = &cpu->env; > + > + /* > + * Verify that the size specified in given struct is set > + * to no more than the size that our kernel support > + */ > + if (env->nested_state->size > env->nested_state_len) { > + return -EINVAL; > + } > + > + return 0; > +} > + > +static bool nested_state_needed(void *opaque) doesn't work if nested_state_len differs between source and destination, and could overflow the nested_state buffer if nested_state_len is larger on the source. I'll send my version today or next Monday. Thanks, Paolo
next prev parent reply other threads:[~2018-09-14 7:16 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-09-14 0:38 [PATCH 0/2]: KVM: i386: Add support for save and restore nested state Liran Alon 2018-09-14 0:38 ` [Qemu-devel] " Liran Alon 2018-09-14 0:38 ` [PATCH 1/2] i386: Compile CPUX86State xsave_buf only when support KVM or HVF Liran Alon 2018-09-14 0:38 ` [Qemu-devel] " Liran Alon 2018-09-14 0:38 ` [PATCH 2/2] KVM: i386: Add support for save and restore nested state Liran Alon 2018-09-14 0:38 ` [Qemu-devel] " Liran Alon 2018-09-14 7:16 ` Paolo Bonzini [this message] 2018-09-14 7:16 ` Paolo Bonzini 2018-09-14 9:54 Liran Alon 2018-09-14 10:59 ` Paolo Bonzini 2018-09-14 14:31 ` Liran Alon 2018-09-14 15:08 ` Paolo Bonzini 2018-09-15 20:48 ` Liran Alon 2018-09-15 20:57 ` Liran Alon 2018-09-17 14:35 ` Paolo Bonzini
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=4e7316db-c24a-6dd5-9e62-1ccc93bf1ee1@redhat.com \ --to=pbonzini@redhat.com \ --cc=ehabkost@redhat.com \ --cc=idan.brown@oracle.com \ --cc=jmattson@google.com \ --cc=kvm@vger.kernel.org \ --cc=liran.alon@oracle.com \ --cc=mtosatti@redhat.com \ --cc=qemu-devel@nongnu.org \ --cc=rth@twiddle.net \ /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: linkBe 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.