From: Avi Kivity <avi@qumranet.com>
To: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Marcelo Tosatti <mtosatti@redhat.com>
Subject: [PATCH 10/19] KVM: mmu_shrink: kvm_mmu_zap_page requires slots_lock to be held
Date: Tue, 15 Jul 2008 15:12:29 +0300 [thread overview]
Message-ID: <1216123958-10717-11-git-send-email-avi@qumranet.com> (raw)
In-Reply-To: <1216123958-10717-1-git-send-email-avi@qumranet.com>
From: Marcelo Tosatti <mtosatti@redhat.com>
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.
Signed-off-by: Avi Kivity <avi@qumranet.com>
---
arch/x86/kvm/mmu.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 1fd8e3b..ff7cf63 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1987,6 +1987,8 @@ static int mmu_shrink(int nr_to_scan, gfp_t gfp_mask)
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, gfp_t gfp_mask)
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);
--
1.5.6.1
next prev parent reply other threads:[~2008-07-15 12:16 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-15 12:12 [PATCH 00/19] KVM Updates for the 2.6.27 (supplemental) Avi Kivity
2008-07-15 12:12 ` [PATCH 01/19] KVM: VMX: Fix a wrong usage of vmcs_config Avi Kivity
2008-07-15 12:12 ` [PATCH 02/19] KVM: VMX: Fake emulate Intel perfctr MSRs Avi Kivity
2008-07-15 12:12 ` [PATCH 03/19] KVM: move slots_lock acquision down to vapic_exit Avi Kivity
2008-07-15 12:12 ` [PATCH 04/19] KVM: s390: dont allocate dirty bitmap Avi Kivity
2008-07-15 12:12 ` [PATCH 05/19] KVM: Fix memory leak on guest exit Avi Kivity
2008-07-15 12:12 ` [PATCH 06/19] KVM: s390: Set guest storage limit and offset to sane values Avi Kivity
2008-07-15 12:12 ` [PATCH 07/19] KVM: s390: rename private structures Avi Kivity
2008-07-15 12:12 ` [PATCH 08/19] KVM: SVM: fix suspend/resume support Avi Kivity
2008-07-15 12:12 ` [PATCH 09/19] x86: KVM guest: make kvm_smp_prepare_boot_cpu() static Avi Kivity
2008-07-15 12:12 ` Avi Kivity [this message]
2008-07-15 12:12 ` [PATCH 11/19] KVM: VMX: Add ept_sync_context in flush_tlb Avi Kivity
2008-07-15 12:12 ` [PATCH 12/19] KVM: Apply the kernel sigmask to vcpus blocked due to being uninitialized Avi Kivity
2008-07-15 12:12 ` [PATCH 13/19] KVM: x86 emulator: Fix HLT instruction Avi Kivity
2008-07-15 12:12 ` [PATCH 14/19] KVM: check injected pic irq within valid pic irqs Avi Kivity
2008-07-15 12:12 ` [PATCH 15/19] KVM: Prefix some x86 low level function with kvm_, to avoid namespace issues Avi Kivity
2008-07-15 12:12 ` [PATCH 16/19] KVM: MMU: nuke shadowed pgtable pages and ptes on memslot destruction Avi Kivity
2008-07-15 12:12 ` [PATCH 17/19] KVM: MMU: improve invalid shadow root page handling Avi Kivity
2008-07-15 12:12 ` [PATCH 18/19] KVM: x86 emulator: emulate clflush Avi Kivity
2008-07-15 12:12 ` [PATCH 19/19] KVM: MMU: Fix potential race setting upper shadow ptes on nonpae hosts Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1216123958-10717-11-git-send-email-avi@qumranet.com \
--to=avi@qumranet.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®