WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

RE: [Xen-devel] Will hap_alloc fail?

To: "Tim Deegan" <Tim.Deegan@xxxxxxxxxxxxx>, "Li, Xin B" <xin.b.li@xxxxxxxxx>
Subject: RE: [Xen-devel] Will hap_alloc fail?
From: "Huang2, Wei" <Wei.Huang2@xxxxxxx>
Date: Thu, 12 Jul 2007 11:34:26 -0500
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 12 Jul 2007 09:33:27 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20070712095651.GC2993@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <B30DA1341B0CFA4893EF8A36B40B5C5D01634178@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <B30DA1341B0CFA4893EF8A36B40B5C5D0163417A@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20070712095651.GC2993@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcfEawOh5185uj8wSYuprlamnbXocAANzipw
Thread-topic: [Xen-devel] Will hap_alloc fail?
Tim Deegan wrote:
> At 17:37 +0800 on 12 Jul (1184261836), Li, Xin B wrote:
>> And it seems better to let it return page_info * instead of mfn_t.
> 
> ?  Most of its call-sites want an MFN.
> 
> But yes, it ought to handle running out of pages.
> 
> Cheers,
> 
> Tim.

How does this fix sound?



diff -r 552bfb5f589b xen/arch/x86/mm/hap/hap.c
--- a/xen/arch/x86/mm/hap/hap.c Wed Jul 11 12:09:10 2007 -0500
+++ b/xen/arch/x86/mm/hap/hap.c Thu Jul 12 01:15:14 2007 -0500
@@ -94,9 +94,13 @@ mfn_t hap_alloc(struct domain *d)
 
     ASSERT(hap_locked_by_me(d));
 
+    if ( list_empty(&d->arch.paging.hap.freelists) ) {
+         HAP_PRINTK("Can not allocate hap page!\n");
+         BUG();
+    }
     sp = list_entry(d->arch.paging.hap.freelists.next, struct
page_info, list);
     list_del(&sp->list);
-    d->arch.paging.hap.free_pages -= 1;
+    d->arch.paging.hap.free_pages--;
 
     /* Now safe to clear the page for reuse */
     p = hap_map_domain_page(page_to_mfn(sp));




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel