From: "Jan Beulich" Subject: Re: [PATCH] x86: fix domain cleanup Date: Tue, 28 Oct 2008 10:05:40 +0000 Message-ID: <4906F204.76E4.0078.0@novell.com> References: <4906E8C0.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: Content-Disposition: inline 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 List-Id: xen-devel@lists.xenproject.org >>> Keir Fraser 28.10.08 10:36 >>> >On 28/10/08 09:26, "Jan Beulich" wrote: > >> But how would one distinguish the two (or three at present, due to >> DOMAIN_DESTRUCT_AVOID_RECURSION) cases? > >I'm not sure. Do they need to be distinguished? At least the PGT_partial case needs to be, especially if we agree that leaving a type reference without a page reference pending in that case is broken. Luckily, that case *is* easily recognizable. >> Also, where is the >> matching put_page() for the type refcount decrement in free_page_type() >> in the circular case (in free_page_type(A) -> put_page_and_type(B) -> >> free_page_type(B) -> put_page_and_type(A) we'll have the type refcount >> decremented twice, but the page refcount just once)? Or is this = decrement >> invalid in that case (I don't think it is, as get_lN_linear_pagetable() >> increments it along with keeping the page reference it obtained in the >> success case, but if it is, it again poses the question of how to = recognize >> that case)? > >Ah, looks like it's been broken since the preemptible page_type patch = went >in. Perhaps the tail of free_page_type() should go into __put_page_type(),= >as it's not needed by the call site in relinquish_memory(): the caller >doesn't really hold a type reference to be dropped; and the logic for = being >preempted doesn't apply since relinquish_memory() requests no preemption. It doesn't at present, but it should (in favor of DOMAIN_DESTRUCT_AVOID_REC= URSION), including the put_page_and_type() earlier in that function. But of course, it may still turn out that cleaning up after preemption here must be = handled differently from the __put_page_type() case. I'll give moving that part (and removing the put_page() added yesterday) a try. Jan