[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.