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] xenheap pages mapped by dom0

To: Jan Beulich <JBeulich@xxxxxxxxxx>
Subject: Re: [Xen-devel] xenheap pages mapped by dom0
From: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
Date: Fri, 18 Dec 2009 16:19:03 +0000
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <Keir.Fraser@xxxxxxxxxxxxx>
Delivery-date: Fri, 18 Dec 2009 08:19:24 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4B2BB16C0200007800026AB5@xxxxxxxxxxxxxxxxxx>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4B2B9FC50200007800026A53@xxxxxxxxxxxxxxxxxx> <C7514F4A.4C35%keir.fraser@xxxxxxxxxxxxx> <4B2BB16C0200007800026AB5@xxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.23 (X11/20090817)
Jan Beulich wrote:
Keir Fraser <keir.fraser@xxxxxxxxxxxxx> 18.12.09 16:24 >>>
I think the right thing to do would be very roughly:
On allocation:
page = alloc_xenheap_page();
share_xen_page_with_guest(page);
On deallocation:
if (test_and_clear(PGC_allocated)) put_page();
if (page->count_info & PGC_count_mask) return -EBUSY;

Hmm, and how would you recover from that? I don't think George wants
his enclosing operation to fail because of a page still being mapped. On
x86-64, at least, it might be possible to play with PGC_xen_heap, to
convert a Xen heap page to a domain heap one, but that wouldn't
cover anyone else (and would seem rather hackish, if it works at all).
I wouldn't really mind the op failing; I just want it to fail cleanly. All-or-nothing would be optimal IMHO. Failing such that everything will automatically clean itself up if/when dom0 does unmap the pages would be OK too. Having half the pages freed / marked unallocated, but some still allocated doesn't seem very good.

Anyway, I care more about allocating larger buffers than I do about re-allocating, so maybe I'll just punt on freeing maybe-mapped buffers for now.

However, that brings up another point: suppose that I do several allocations, one per cpu, and one fails. Now I want to go and free the buffers I've just allocated (which shouldn't be mapped in dom0 yet). Can I not just call free_xenheap_pages()? Do I need to clear PGC_allocated before calling?

Is any of this stuff written down somewhere? :-)

-George

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