On Sun, Oct 17, 2010, Avi Kivity wrote about "Re: [PATCH 15/27] nVMX: Prepare vmcs02 from vmcs01 and vmcs12": > On 10/17/2010 12:11 PM, Nadav Har'El wrote: > >This patch contains code to prepare the VMCS which can be used to actually > >run the L2 guest, vmcs02. prepare_vmcs02 appropriately merges the > >information > >in vmcs12 (the vmcs that L1 built for L2) and in vmcs01 (the vmcs that we > >built for L1). > > > >VMREAD/WRITE can only access one VMCS at a time (the "current" VMCS), which > >makes it difficult for us to read from vmcs01 while writing to vmcs12. This > >is why we first make a copy of vmcs01 in memory (vmcs01_fields) and then > >read that memory copy while writing to vmcs12. > > > > I believe I commented on this before - you can call the same functions > kvm uses to initialize the normal vmcs to get the common parts filled > in. Hi, I'm finally attending to this issue, and you're right, for almost all fields there's hardly a reason to read them from VMCS into a memory structure vmcs01, when it was KVM who set these fields in the first place and can set them again when needed in vmcs02. I'm slowly removing the fields in the vmcs01 in- memory structure (only about a dozen left at this point!), and finally the "vmcs12" structure contains all its fields, without another substructure (as you asked once). But while doing this, I came across a question that I wonder if you can clarify for me: Among the other things it sets up, vmx_vcpu_setup() sets rdmsrl(MSR_IA32_SYSENTER_ESP, a); vmcs_writel(HOST_IA32_SYSENTER_ESP, a); /* 22.2.3 */ Why is this needed here? In vmx_vcpu_load(), when a cpu is known (or changed), we again have: rdmsrl(MSR_IA32_SYSENTER_ESP, sysenter_esp); vmcs_writel(HOST_IA32_SYSENTER_ESP, sysenter_esp); /* 22.2.3 */ So isn't the first setting, in vmx_vcpu_setup(), redundant? Thanks, Nadav. -- Nadav Har'El | Tuesday, Feb 8 2011, 4 Adar I 5771 nyh@xxxxxxxxxxxxxxxxxxx |----------------------------------------- Phone +972-523-790466, ICQ 13349191 |Earth First! We can strip-mine the other http://nadav.harel.org.il |planets later... -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html