From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: Re: xenheap pages mapped by dom0 Date: Fri, 18 Dec 2009 15:29:15 +0000 Message-ID: <4B2B9FCB.6010309@eu.citrix.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: "xen-devel@lists.xensource.com" , Jan Beulich List-Id: xen-devel@lists.xenproject.org Keir Fraser wrote: > 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; > free_xenheap_page(page); > Hmm, the first two should probably happen in the opposite order, no? I.e., we should check to see that for each page we want to deallocate, page->count_info & PGC_count_mask == 0, returning -EBUSY if that fails; then unmark allocate and call free xenheap page? -George