mmu fixes
cover mmu fixes
See patches for details.
PATCH 1/2 KVM: MMU: make __kvm_mmu_free_some_pages handle empty list
From: Izik Eidus <[email protected]>
First check if the list is empty before attempting to look at list entries.
arch/x86/kvm/mmu.c +2 -1
@@ -2625,7 +2625,8 @@ EXPORT_SYMBOL_GPL(kvm_mmu_unprotect_pagevoid __kvm_mmu_free_some_pages (struct kvm_vcpu *vcpu) { -while (vcpu->kvm->arch.n_free_mmu_pages <KVM_REFILL_PAGES ) { +while (vcpu->kvm->arch.n_free_mmu_pages <KVM_REFILL_PAGES && + !list_empty (&vcpu->kvm->arch.active_mmu_pages)) {struct kvm_mmu_page *sp; sp = container_of(vcpu->kvm->arch.active_mmu_pages.prev,
Re: [patch 1/2] KVM: MMU: make __kvm_mmu_free_some_pages handle empty list
Quoted 16 lines · Marcelo Tosatti
From: Izik Eidus <[email protected]>
First check if the list is empty before attempting to look at list entries.
Signed-off-by Izik Eidus <[email protected]>Signed-off-by Marcelo Tosatti <[email protected]>Index:
kvm/arch/x86/kvm/mmu.c
===================================================================
arch/x86/kvm/mmu.c EXPORT_SYMBOL_GPL(kvm_mmu_unprotect_page · line 2632
Quoted 9 lines
arch/x86/kvm/mmu.c +2
-1@@ -2625,7 +2625,8 @@ EXPORT_SYMBOL_GPL(kvm_mmu_unprotect_pagevoid __kvm_mmu_free_some_pages (struct kvm_vcpu *vcpu) { -while (vcpu->kvm->arch.n_free_mmu_pages <KVM_REFILL_PAGES ) { +while (vcpu->kvm->arch.n_free_mmu_pages <KVM_REFILL_PAGES && + !list_empty (&vcpu->kvm->arch.active_mmu_pages)) {struct kvm_mmu_page *sp; sp = container_of(vcpu->kvm->arch.active_mmu_pages.prev,
ack
PATCH 2/2 KVM: MMU: fix bogus alloc_mmu_pages assignment
In reply to Marcelo TosattiRemove the bogus n_free_mmu_pages assignment from alloc_mmu_pages.
It breaks accounting of mmu pages, since n_free_mmu_pages is modified but the real number of pages remains the same.
arch/x86/kvm/mmu.c +0 -8
@@ -2706,14 +2706,6 @@ static int alloc_mmu_pages(struct kvm_vcASSERT (vcpu); -spin_lock (&vcpu->kvm->mmu_lock); -if (vcpu->kvm->arch.n_requested_mmu_pages) - vcpu->kvm->arch.n_free_mmu_pages = - vcpu->kvm->arch.n_requested_mmu_pages; -else - vcpu->kvm->arch.n_free_mmu_pages = - vcpu->kvm->arch.n_alloc_mmu_pages; -spin_unlock (&vcpu->kvm->mmu_lock);/* * When emulating 32-bit mode, cr3 is only 32 bits even on x86_64. * Therefore we need to allocate shadow page tables in the first
Re: [patch 2/2] KVM: MMU: fix bogus alloc_mmu_pages assignment
Quoted 19 lines · Marcelo Tosatti
Remove the bogus
n_free_mmu_pagesassignment fromalloc_mmu_pages.It breaks accounting of mmu pages, since
n_free_mmu_pagesis modified but the real number of pages remains the same.Signed-off-by Marcelo Tosatti <[email protected]>Index:
kvm/arch/x86/kvm/mmu.c
===================================================================arch/x86/kvm/mmu.c +0
-1@@ -2706,14 +2706,6 @@ static int alloc_mmu_pages(struct kvm_vcASSERT (vcpu); -spin_lock (&vcpu->kvm->mmu_lock);
arch/x86/kvm/mmu.c static int alloc_mmu_pages(struct kvm_vc · line 2711
Quoted 10 lines
arch/x86/kvm/mmu.c +0
-7-if (vcpu->kvm->arch.n_requested_mmu_pages) - vcpu->kvm->arch.n_free_mmu_pages = - vcpu->kvm->arch.n_requested_mmu_pages; -else - vcpu->kvm->arch.n_free_mmu_pages = - vcpu->kvm->arch.n_alloc_mmu_pages; -spin_unlock (&vcpu->kvm->mmu_lock);/* * When emulating 32-bit mode, cr3 is only 32 bits even on x86_64. * Therefore we need to allocate shadow page tables in the first
ack
Avi Kivity
AppliedQuoted 3 lines · Marcelo Tosatti
See patches for details.
Applied, thanks.
Please add the failure scenario to the changelog in the future.
Signature · 1 line
error compiling committee.c: too many arguments to function