From patchwork Tue May 12 21:55:44 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 23358 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n4CMDsp5029789 for ; Tue, 12 May 2009 22:13:54 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755219AbZELWNs (ORCPT ); Tue, 12 May 2009 18:13:48 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754829AbZELWNr (ORCPT ); Tue, 12 May 2009 18:13:47 -0400 Received: from mx2.redhat.com ([66.187.237.31]:45589 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754660AbZELWNq (ORCPT ); Tue, 12 May 2009 18:13:46 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n4CMDm4V013372 for ; Tue, 12 May 2009 18:13:48 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n4CMDlCB013256; Tue, 12 May 2009 18:13:47 -0400 Received: from amt.cnet (vpn-10-31.str.redhat.com [10.32.10.31]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n4CMDjXF006048; Tue, 12 May 2009 18:13:46 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id CFE6D6800DA; Tue, 12 May 2009 18:59:46 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id n4CLxjFF022934; Tue, 12 May 2009 18:59:45 -0300 Message-Id: <20090512215641.585790036@amt.cnet> User-Agent: quilt/0.47-1 Date: Tue, 12 May 2009 18:55:44 -0300 From: mtosatti@redhat.com To: avi@redhat.com Cc: kvm@vger.kernel.org, Marcelo Tosatti Subject: [patch 2/3] KVM: take mmu_lock when updating a deleted slot References: <20090512215542.687077672@amt.cnet> Content-Disposition: inline; filename=slot-delete-update-mmu-lock X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org kvm_handle_hva relies on mmu_lock protection to safely access the memslot structures. Signed-off-by: Marcelo Tosatti --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);