Re: [PATCH 05/15] KVM: nVMX: Don't rewrite GUEST_PML_INDEX during nested VM-Entry

Paolo Bonzini
2019-06-06T15:49:50Z

On 07/05/19 18:06, Sean Christopherson wrote:
> - if (enable_pml)
> + /*
> + * Conceptually we want to copy the PML address and index from vmcs01
> + * here, and then back to vmcs01 on nested vmexit. But since we always
> + * flush the log on each vmexit and never change the PML address (once
> + * set), both fields are effectively constant in vmcs02.
> + */
> + if (enable_pml) {
> vmcs_write64(PML_ADDRESS, page_to_phys(vmx->pml_pg));
> + vmcs_write16(GUEST_PML_INDEX, PML_ENTITY_NUM - 1);
> + }

Yeah, it will be rewritten in vmx_flush_pml_buffer.

Just a little rephrasing of the comment:

+ * The PML address never changes, so it is constant in vmcs02.
+ * Conceptually we want to copy the PML index from vmcs01 here,
+ * and then back to vmcs01 on nested vmexit. But since we flush
+ * the log and reset GUEST_PML_INDEX on each vmexit, the PML
+ * index is also effectively constant in vmcs02.

Paolo