All of lore.kernel.org
 help / color / mirror / Atom feed
From: mtosatti@redhat.com
To: kvm@vger.kernel.org
Cc: avi@redhat.com, Marcelo Tosatti <mtosatti@redhat.com>
Subject: [patch 2/4] KVM: take mmu_lock when updating a deleted slot
Date: Thu, 07 May 2009 18:03:33 -0300	[thread overview]
Message-ID: <20090507210534.015670838@amt.cnet> (raw)
In-Reply-To: <20090507210331.370806285@amt.cnet>

[-- Attachment #1: slot-delete-update-mmu-lock --]
[-- Type: text/plain, Size: 716 bytes --]

kvm_handle_hva relies on mmu_lock protection to safely access 
the memslot structures.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Index: kvm-pending/virt/kvm/kvm_main.c
===================================================================
--- kvm-pending.orig/virt/kvm/kvm_main.c
+++ kvm-pending/virt/kvm/kvm_main.c
@@ -1199,8 +1199,10 @@ int __kvm_set_memory_region(struct kvm *
 
 	kvm_free_physmem_slot(&old, npages ? &new : NULL);
 	/* Slot deletion case: we have to update the current slot */
+	spin_lock(&kvm->mmu_lock);
 	if (!npages)
 		*memslot = old;
+	spin_unlock(&kvm->mmu_lock);
 #ifdef CONFIG_DMAR
 	/* map the pages in iommu page table */
 	r = kvm_iommu_map_pages(kvm, base_gfn, npages);



  parent reply	other threads:[~2009-05-07 21:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-27 20:06 [patch 0/4] set_memory_region locking fixes / vcpu->arch.cr3 + removal of memslots mtosatti
2009-04-27 20:06 ` [patch 1/4] KVM: MMU: protect kvm_mmu_change_mmu_pages with mmu_lock mtosatti
2009-04-27 20:06 ` [patch 2/4] KVM: take mmu_lock when updating a deleted slot mtosatti
2009-04-27 20:06 ` [patch 3/4] KVM: introduce kvm_arch_can_free_memslot, disallow slot deletion if cached cr3 mtosatti
2009-05-07 14:16   ` Avi Kivity
2009-05-07 18:58     ` Marcelo Tosatti
2009-05-07 21:03     ` [patch 0/4] set_memory_region locking fixes / cr3 vs removal of memslots v2 mtosatti
2009-05-07 21:03       ` [patch 1/4] KVM: MMU: protect kvm_mmu_change_mmu_pages with mmu_lock mtosatti
2009-05-07 21:03       ` mtosatti [this message]
2009-05-07 21:03       ` [patch 3/4] KVM: introduce kvm_arch_can_free_memslot, disallow slot deletion if cached cr3 mtosatti
2009-05-10 16:40         ` Avi Kivity
2009-05-12 21:55           ` [patch 0/3] locking fixes / cr3 validation v3 mtosatti
2009-05-12 21:55             ` [patch 1/3] KVM: MMU: protect kvm_mmu_change_mmu_pages with mmu_lock mtosatti
2009-05-12 21:55             ` [patch 2/3] KVM: take mmu_lock when updating a deleted slot mtosatti
2009-05-12 21:55             ` [patch 3/3] KVM: x86: check for cr3 validity in mmu_alloc_roots mtosatti
2009-05-13  7:40             ` [patch 0/3] locking fixes / cr3 validation v3 Avi Kivity
2009-05-07 21:03       ` [patch 4/4] KVM: x86: disallow changing a slots size mtosatti
2009-04-27 20:06 ` mtosatti

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=20090507210534.015670838@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --subject='Re: [patch 2/4] KVM: take mmu_lock when updating a deleted slot' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.