Skip to content

Commit b11494b

Browse files
Liran Alonbonzini
authored andcommitted
KVM: nVMX: Do not mark vmcs02->apic_access_page as dirty when unpinning
vmcs->apic_access_page is simply a token that the hypervisor puts into the PFN of a 4KB EPTE (or PTE if using shadow-paging) that triggers APIC-access VMExit or APIC virtualization logic whenever a CPU running in VMX non-root mode read/write from/to this PFN. As every write either triggers an APIC-access VMExit or write is performed on vmcs->virtual_apic_page, the PFN pointed to by vmcs->apic_access_page should never actually be touched by CPU. Therefore, there is no need to mark vmcs02->apic_access_page as dirty after unpin it on L2->L1 emulated VMExit or when L1 exit VMX operation. Reviewed-by: Krish Sadhukhan <[email protected]> Reviewed-by: Joao Martins <[email protected]> Reviewed-by: Jim Mattson <[email protected]> Signed-off-by: Liran Alon <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 46f4f0a commit b11494b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/x86/kvm/vmx/nested.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ static void free_nested(struct kvm_vcpu *vcpu)
268268
vmx->nested.cached_shadow_vmcs12 = NULL;
269269
/* Unpin physical memory we referred to in the vmcs02 */
270270
if (vmx->nested.apic_access_page) {
271-
kvm_release_page_dirty(vmx->nested.apic_access_page);
271+
kvm_release_page_clean(vmx->nested.apic_access_page);
272272
vmx->nested.apic_access_page = NULL;
273273
}
274274
kvm_vcpu_unmap(vcpu, &vmx->nested.virtual_apic_map, true);
@@ -3070,7 +3070,7 @@ static bool nested_get_vmcs12_pages(struct kvm_vcpu *vcpu)
30703070
* to it so we can release it later.
30713071
*/
30723072
if (vmx->nested.apic_access_page) { /* shouldn't happen */
3073-
kvm_release_page_dirty(vmx->nested.apic_access_page);
3073+
kvm_release_page_clean(vmx->nested.apic_access_page);
30743074
vmx->nested.apic_access_page = NULL;
30753075
}
30763076
page = kvm_vcpu_gpa_to_page(vcpu, vmcs12->apic_access_addr);
@@ -4267,7 +4267,7 @@ void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
42674267

42684268
/* Unpin physical memory we referred to in vmcs02 */
42694269
if (vmx->nested.apic_access_page) {
4270-
kvm_release_page_dirty(vmx->nested.apic_access_page);
4270+
kvm_release_page_clean(vmx->nested.apic_access_page);
42714271
vmx->nested.apic_access_page = NULL;
42724272
}
42734273
kvm_vcpu_unmap(vcpu, &vmx->nested.virtual_apic_map, true);

0 commit comments

Comments
 (0)