* KVM: mmu_shrink: kvm_mmu_zap_page requires slots_lock to be held
@ 2008-07-03 21:33 Marcelo Tosatti
2008-07-05 12:01 ` Avi Kivity
0 siblings, 1 reply; 2+ messages in thread
From: Marcelo Tosatti @ 2008-07-03 21:33 UTC (permalink / raw)
To: Izik Eidus, Avi Kivity; +Cc: kvm-devel
kvm_mmu_zap_page() needs slots lock held (rmap_remove->gfn_to_memslot,
for example).
Since kvm_lock spinlock is held in mmu_shrink(), do a non-blocking
down_read_trylock().
Untested.
Index: kvm/arch/x86/kvm/mmu.c
===================================================================
--- kvm.orig/arch/x86/kvm/mmu.c
+++ kvm/arch/x86/kvm/mmu.c
@@ -1987,6 +1987,8 @@ static int mmu_shrink(int nr_to_scan, gf
list_for_each_entry(kvm, &vm_list, vm_list) {
int npages;
+ if (!down_read_trylock(&kvm->slots_lock))
+ continue;
spin_lock(&kvm->mmu_lock);
npages = kvm->arch.n_alloc_mmu_pages -
kvm->arch.n_free_mmu_pages;
@@ -1999,6 +2001,7 @@ static int mmu_shrink(int nr_to_scan, gf
nr_to_scan--;
spin_unlock(&kvm->mmu_lock);
+ up_read(&kvm->slots_lock);
}
if (kvm_freed)
list_move_tail(&kvm_freed->vm_list, &vm_list);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: KVM: mmu_shrink: kvm_mmu_zap_page requires slots_lock to be held
2008-07-03 21:33 KVM: mmu_shrink: kvm_mmu_zap_page requires slots_lock to be held Marcelo Tosatti
@ 2008-07-05 12:01 ` Avi Kivity
0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2008-07-05 12:01 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: Izik Eidus, kvm-devel
Marcelo Tosatti wrote:
> kvm_mmu_zap_page() needs slots lock held (rmap_remove->gfn_to_memslot,
> for example).
>
> Since kvm_lock spinlock is held in mmu_shrink(), do a non-blocking
> down_read_trylock().
>
Applied, thanks.
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-07-05 12:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-03 21:33 KVM: mmu_shrink: kvm_mmu_zap_page requires slots_lock to be held Marcelo Tosatti
2008-07-05 12:01 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox