public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Mohammed Gamal" <mmorsy@redhat.com>,
	"Stephen Hemminger" <sthemmin@microsoft.com>,
	"kvm list" <kvm@vger.kernel.org>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Haiyang Zhang" <haiyangz@microsoft.com>,
	"the arch/x86 maintainers" <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Michael Kelley (EOSG)" <Michael.H.Kelley@microsoft.com>,
	"Bandan Das" <bsd@redhat.com>,
	"Roman Kagan" <rkagan@virtuozzo.com>,
	devel@linuxdriverproject.org, "Jim Mattson" <jmattson@google.com>
Subject: Re: [PATCH RFC 2/7] KVM: nVMX: modify vmcs12 fields to match Hyper-V enlightened VMCS
Date: Thu, 21 Dec 2017 14:02:05 +0100	[thread overview]
Message-ID: <87r2row7xu.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <db52a041-adb6-f108-efac-86378b7206be@redhat.com> (Paolo Bonzini's message of "Tue, 19 Dec 2017 13:37:49 +0100")

Paolo Bonzini <pbonzini@redhat.com> writes:

> On 19/12/2017 13:25, Vitaly Kuznetsov wrote:
>> 
>>> At this point in time, I don't think you can just blithely change the
>>> virtual VMCS layout and revision number. Existing VMs using the old
>>> layout and revision number must continue to work on versions of kvm
>>> past this point. You could tie the layout and revision number changes
>>> to KVM_CAP_HYPERV_ENLIGHTENED_VMCS if you like, but kvm must be able
>>> to continue to service VMs using the previous layout and revision
>>> number in perpetuity.
>>>
>> I see what you mean. In case we need to keep migration of nested
>> workloads working between KVMs of different versions we can't (ever)
>> touch vmcs12.
>
> Actually we can, for two reasons.
>
> First, the active VMCS is stored in host RAM (not in guest RAM).  This
> means there are clear points where to do the translation, namely vmptrld
> and the (not yet upstream) ioctl to set VMX state.
>
> Therefore you only need to keep an (offset, type) map from old to new
> layout map; at those two points if you detect an old VMCS12_REVISION you
> copy the fields one by one instead of doing a memcpy.  The next vmclear
> or vmptrld or get-VMX-state ioctl will automatically update to the new
> VMCS12_REVISION.  Of course, this is a one-way street unless you also
> add support for writing old VMCS12_REVISIONs.
>
> But, second, VMX state migration is not upstream yet, so nested
> hypervisors are currently not migratable: the active VMCS12 state will
> not be migrated at all!  So in upstream KVM we wouldn't even need to
> upgrade the VMCS12_REVISION to make changes to vmcs12.
>
> That said...
>
>> The way to go in this case, I think, is to create a completely separate
>> enlightened_vmcs12 struct and use it when appropriate. We can't possibly
>> support migrating workloads which use enlightened VMCS to an old KVM
>> which doesn't support it.
>
> ... this is probably a good idea as well.
>

One other thing I was thinking about is the shared definition of
enlightened vmcs which we'll use for both KVM-on-Hyper-V and Hyper-V on
KVM and for that purpose I'd like it to be placed outside of struct
vmcs12. We can, of course, embed it at the beginning of vmcs12.

Thinking long term (and having in mind that Microsoft will be updating
enlightened VMCS on its own schedule) -- what would be the preferred way
to go? It seems that personally I'm leaning towards untangling and
keeping it separate from vmcs12 but I can't really find a convincing
argument...

-- 
  Vitaly

  parent reply	other threads:[~2017-12-21 13:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18 17:17 [PATCH RFC 0/7] KVM: nVMX: enlightened VMCS initial implementation Vitaly Kuznetsov
2017-12-18 17:17 ` [PATCH RFC 1/7] KVM: x86: rename HV_X64_MSR_APIC_ASSIST_PAGE to HV_X64_MSR_VP_ASSIST_PAGE Vitaly Kuznetsov
2017-12-18 17:17 ` [PATCH RFC 2/7] KVM: nVMX: modify vmcs12 fields to match Hyper-V enlightened VMCS Vitaly Kuznetsov
2017-12-18 20:23   ` Jim Mattson
2017-12-18 21:28     ` Jim Mattson
2017-12-19 12:25       ` Vitaly Kuznetsov
2017-12-19 12:37         ` Paolo Bonzini
2017-12-19 17:40           ` Jim Mattson
2017-12-19 21:19             ` Paolo Bonzini
2017-12-21 13:02           ` Vitaly Kuznetsov [this message]
2017-12-19 17:44         ` Jim Mattson
2017-12-18 17:17 ` [PATCH RFC 3/7] KVM: nVMX: add I/O exit ECX, ESI, EDI, EIP vmcs12 fields Vitaly Kuznetsov
2017-12-18 17:17 ` [PATCH RFC 4/7] KVM: hyperv: define VP assist page structure and add helpers Vitaly Kuznetsov
2017-12-18 17:17 ` [PATCH RFC 5/7] KVM: nVMX: add KVM_CAP_HYPERV_ENLIGHTENED_VMCS capability Vitaly Kuznetsov
2017-12-18 17:17 ` [PATCH RFC 6/7] KVM: nVMX: add enlightened VMCS state Vitaly Kuznetsov
2017-12-18 17:17 ` [PATCH RFC 7/7] KVM: nVMX: implement enlightened VMPTRLD Vitaly Kuznetsov
2017-12-19 12:41 ` [PATCH RFC 0/7] KVM: nVMX: enlightened VMCS initial implementation Paolo Bonzini
2017-12-19 13:21   ` Vitaly Kuznetsov
2017-12-21 12:50     ` Vitaly Kuznetsov
2017-12-21 14:32       ` Paolo Bonzini
2017-12-21 15:08         ` Vitaly Kuznetsov

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=87r2row7xu.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.com \
    --cc=Michael.H.Kelley@microsoft.com \
    --cc=bsd@redhat.com \
    --cc=devel@linuxdriverproject.org \
    --cc=haiyangz@microsoft.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmorsy@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkagan@virtuozzo.com \
    --cc=rkrcmar@redhat.com \
    --cc=sthemmin@microsoft.com \
    --cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox