From: Paolo Bonzini Subject: Re: [RFC 0/6] Enlightened VMCS support for KVM on Hyper-V Date: Tue, 16 Jan 2018 14:47:41 +0100 Message-ID: <803dc5d1-90e1-4650-0882-43755394501a@redhat.com> References: <20180115173105.31845-1-vkuznets@redhat.com> <87inc2huux.fsf@vitty.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: kvm , the arch/x86 maintainers , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley (EOSG)" , Mohammed Gamal , Cathy Avery , Bandan Das , linux-kernel@vger.kernel.org To: David Hildenbrand , Vitaly Kuznetsov , Wanpeng Li Return-path: In-Reply-To: Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 16/01/2018 14:39, David Hildenbrand wrote: > On 16.01.2018 13:05, Vitaly Kuznetsov wrote: >> Wanpeng Li writes: >> >>> 2018-01-16 1:30 GMT+08:00 Vitaly Kuznetsov : >>>> Early RFC. I'll refer to this patchset in my DevConf/FOSDEM >>>> presentations. >>>> >>>> When running nested KVM on Hyper-V it's possible to use so called >>>> 'Enlightened VMCS' and do normal memory reads/writes instead of >>>> doing VMWRITE/VMREAD instructions. Tests show that this speeds up >>>> tight CPUID loop almost 3 times: >>>> >>>> Before: >>>> ./cpuid_tight >>>> 20459 >>>> >>>> After: >>>> ./cpuid_tight >>>> 7698 >>> >>> Maybe you can apply a similar idea to kvm nested on kvm. >>> >> >> Yes we can. Basically, that would mean directly accessing 'struct >> vmcs12' from L1 hypervisor. >> > > Haven't looked into the details, but we have to watch out for other > VCPUs trying to modify that vmcs12. > > Basically because other VCPUs could try to modify values in vmcs12 while > we are currently building vmcs02. Nasty races could result in us copying > stuff (probably unchecked) into vmcs02 and therefore running something > that was not intended. Yes, the vmcs12 would have to be copied from memory to internal hypervisor data before prepare_vmcs02. I'm curious how well the "clean" flags overlap with the choice of fields for which we allow shadow VMCS vmread/vmwrite. Paolo