From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hongkaixing Subject: Re: [PATCH] xenpaging:close domU's event channel and free port Date: Fri, 17 Feb 2012 18:28:01 +0800 Message-ID: <002401cced5e$d3cb3340$7b6199c0$@com> References: <9f4640e40d4f31563885.1328777634@h00166998.china.huawei.com> <20120210164010.GA10009@aepfle.de> <002201ccea12$e83c0420$b8b40c60$@com> <1329135113.31256.77.camel@zakaz.uk.xensource.com> <003001cceb88$f7302930$e5907b90$@com> <1329298049.31256.277.camel@zakaz.uk.xensource.com> <004201cced3c$73b1baf0$5b1530d0$@com> <1329466831.8012.6.camel@dagon.hellion.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-reply-to: <1329466831.8012.6.camel@dagon.hellion.org.uk> Content-language: zh-cn List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: 'Ian Campbell' Cc: xiaowei.yang@huawei.com, 'Olaf Hering' , xen-devel@lists.xensource.com, hanweidong@huawei.com, yanqiangjun@huawei.com, bicky.shi@huawei.com List-Id: xen-devel@lists.xenproject.org > -----Original Message----- > From: Ian Campbell [mailto:Ian.Campbell@citrix.com] > Sent: Friday, February 17, 2012 4:21 PM > To: Hongkaixing > Cc: 'Olaf Hering'; bicky.shi@huawei.com; xiaowei.yang@huawei.com; xen-devel@lists.xensource.com; yanqiangjun@huawei.com; > hanweidong@huawei.com > Subject: RE: [Xen-devel] [PATCH] xenpaging:close domU's event channel and free port > > On Fri, 2012-02-17 at 06:21 +0000, Hongkaixing wrote: > > > > > -----Original Message----- > > > From: Ian Campbell [mailto:Ian.Campbell@citrix.com] > > > Sent: Wednesday, February 15, 2012 5:27 PM > > > To: Hongkaixing > > > Cc: 'Olaf Hering'; bicky.shi@huawei.com; xiaowei.yang@huawei.com; xen-devel@lists.xensource.com; yanqiangjun@huawei.com; > > > hanweidong@huawei.com > > > Subject: RE: [Xen-devel] [PATCH] xenpaging:close domU's event channel and free port > > > > > > On Wed, 2012-02-15 at 02:24 +0000, Hongkaixing wrote: > > > > > > > > > -----Original Message----- > > > > > From: Ian Campbell [mailto:Ian.Campbell@citrix.com] > > > > > Perhaps I'm misunderstanding something and/or showing my ignorance about > > > > > how xenpaging works but why does paging need a domU event channel > > > > > anyway? Surely paging is transparent to the guest. > > > > > > > > > > Or is this really a dom0<->Xen event channel which just appears to be > > > > > assigned to the guest? > > > > > > > > In xenpaging source code, there is an inter-domain event channel between dom0 and domU. > > > [...] > > > > > Who assigns this remote domain port? Shouldn't it either be closed when > > > > > the dom0 end is closed or retained such that it can be reused each time > > > > > instead of leaking? > > > > > > > > In mem_event_enable(), the function alloc_unbound_xen_event_channel() allocates a free port for domU, > > > > and assigns to xen_consumer;When xenpaging tears down, it just frees dom0's event channel port by xc_evtchn_unbind(), > > > > leaves domU's port still occupied. So we should add the patch to free domU's port when xenpaging exits. > > > > > > The two ends of that event channel are actually dom0 and Xen, because > > > chn->xen_consumer is not NULL, even though the Xen end does live in the > > > domU evtchn address space. It is not exactly dom0 and domU as you > > > suggest, which is where my confused question arose. > > > > See what xenpaging_init() does when xenpaging is launched: > > xc_mem_paging_enable() ---> this function allocate a event channel of domain U, the remote port is stored in > paging->mem_event.shared_page->port > > | > > V > > Xc_event_bind_interdomain() --> this function bind dom0 with domU port allocated above > > > > But when xenpaging is tear down: > > xc_mem_paging_disable() --> do nothing about event channel > > | > > V > > xc_evtchn_unbind() --> free the dom0 port, but leave remote port(domU ) ECS_UNBOUND > > I wasn't querying the presence of the leak or the validity of the fix, I > was asking what the domU event channel was even for (i.e. why does it > exist at all?). Sorry! The event channel is used to wake domU up when its page has already been paged in. > > I answered that myself in my previous mail -- it's actually a Xen event > channel not a guest visible one. > > Ian. > > > > > > > Hong Kaixing. > > > > > > > > Ian. > >