From patchwork Tue Jul 28 18:26:58 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 37882 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 n6SIRt5u023262 for ; Tue, 28 Jul 2009 18:27:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755389AbZG1S1w (ORCPT ); Tue, 28 Jul 2009 14:27:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755373AbZG1S1w (ORCPT ); Tue, 28 Jul 2009 14:27:52 -0400 Received: from mx2.redhat.com ([66.187.237.31]:36493 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755369AbZG1S1v (ORCPT ); Tue, 28 Jul 2009 14:27:51 -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 n6SIRpKc026033 for ; Tue, 28 Jul 2009 14:27:51 -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 n6SIRovi027918; Tue, 28 Jul 2009 14:27:50 -0400 Received: from amt.cnet (vpn-51-15.sfbay.redhat.com [10.14.51.15]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6SIRmAl026243; Tue, 28 Jul 2009 14:27:49 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 5ACFF6801DE; Tue, 28 Jul 2009 15:27:41 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id n6SIRdQ3010201; Tue, 28 Jul 2009 15:27:39 -0300 Message-Id: <20090728182726.079993317@amt.cnet> User-Agent: quilt/0.47-1 Date: Tue, 28 Jul 2009 15:26:58 -0300 From: Marcelo Tosatti To: Avi Kivity Cc: Izik Eidus , kvm@vger.kernel.org, Marcelo Tosatti Subject: [patch 1/2] KVM: MMU: make __kvm_mmu_free_some_pages handle empty list References: <20090728182657.694401826@amt.cnet> Content-Disposition: inline; filename=izik-fix 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 From: Izik Eidus First check if the list is empty before attempting to look at list entries. Signed-off-by: Izik Eidus 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/arch/x86/kvm/mmu.c =================================================================== --- kvm.orig/arch/x86/kvm/mmu.c +++ kvm/arch/x86/kvm/mmu.c @@ -2625,7 +2625,8 @@ EXPORT_SYMBOL_GPL(kvm_mmu_unprotect_page void __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,