From: Ian Campbell Subject: Re: page refcount on pages mapped by the toolstack.. Date: Thu, 6 Dec 2012 09:25:31 +0000 Message-ID: <1354785931.17165.46.camel@zakaz.uk.xensource.com> References: <20121205174153.76fa5dd1@mantra.us.oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20121205174153.76fa5dd1@mantra.us.oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Mukesh Rathor Cc: "Xen-devel@lists.xensource.com" , Jan Beulich List-Id: xen-devel@lists.xenproject.org On Thu, 2012-12-06 at 01:41 +0000, Mukesh Rathor wrote: > Hi, > > I observed something that doesn't seem right to me: > > PV dom0 booting PV guest (say domid 1). (no PVH). > > xl cr vm.cfg.pv > > Take some mfn from domid 1. It's refcnt is 1 as expected. Any arbitrary mfn or some particular mfn? > Now, the lib > wants to map it via xen_remap_domain_mfn_range(). The call goes thru > do_mmu_update(), and upon returning the refcnt is 2, as expected. > > Now, I noticed the refcnt doesn't go back to 1 after the guest is > created/booted. I'd have expected the process exit somewhere to have > resulted in the refcnt going down to 1 (which is what would happen in case > of PVH dom0). Which process exit? xl will daemonize and keep running in the background. I'm not sure which pages it will keep mapped, might it actually be xenstored or something similar which has the extra reference? Do privcmd mappings show up in /proc/map? > The guest is up, I notice the refcnt is 2. I shutdown the guest, the > refcnt goes to 0 and the page is freed via relinquish_memory() called > from domain_relinquish_resources(). I would have expected the page > to hang with refcnt 1, what if the user process still has it mapped? > > What am I missing? Doesn't the user process exit when the domain shuts down, thereby releasing the other mapping? Ian.