From: Ian Campbell Subject: Re: [PATCH] evtchn: make EVTCHNOP_reset suitable for kexec Date: Mon, 28 Jul 2014 10:26:56 +0100 Message-ID: <1406539616.24842.86.camel@kazak.uk.xensource.com> References: <1406303329-21724-1-git-send-email-vkuznets@redhat.com> <53D29D5F020000780002622D@mail.emea.novell.com> <8738dpjswb.fsf@vitty.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XBhDO-0005y0-FE for xen-devel@lists.xenproject.org; Mon, 28 Jul 2014 09:27:30 +0000 In-Reply-To: <8738dpjswb.fsf@vitty.brq.redhat.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: Vitaly Kuznetsov Cc: Andrew Cooper , Andrew Jones , David Vrabel , Jan Beulich , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Fri, 2014-07-25 at 18:38 +0200, Vitaly Kuznetsov wrote: > "Jan Beulich" writes: > > >>>> On 25.07.14 at 17:48, wrote: > >> @@ -954,8 +955,20 @@ static long evtchn_reset(evtchn_reset_t *r) > >> if ( rc ) > >> goto out; > >> > >> - for ( i = 0; port_is_valid(d, i); i++ ) > >> - (void)__evtchn_close(d, i); > >> + for ( i = 1; port_is_valid(d, i); i++ ) > >> + { > >> + /* > >> + * Leave all interdomain connections to Dom0 untouched as we need to > >> + * preserve store/console channels. > >> + */ > >> + chn = evtchn_from_port(d, i); > >> + if ( chn->state != ECS_INTERDOMAIN || > >> + chn->u.interdomain.remote_dom->domain_id != 0 ) > >> + (void)__evtchn_close(d, i); > >> + } > > > > You can't alter the behavior of an existing hypercall like this. Did > > you at all check why it closes all channels, i.e. for what purpose > > it got introduced? > > Originally I though about introducing new hypercall to cleans up all > control blocks when FIFO-based event channel ABI is being used (see > "[PATCH RFC] evtchn: introduce EVTCHNOP_fifo_destroy hypercall" > email). Andrew and Ian convinced me to reuse EVTCHNOP_reset to be > ABI-agnostic here. > > I'm not sure how to check the purpose of introduction but I did check > that EVTCHNOP_reset is not being used neither in Linux kernel nor in > http://xenbits.xensource.com/ext/win-pvdrivers/. The original commit > which introduces it is: > commit 115209d91bcd3734ddaaf58a4a1cdbb4c44cd4fa > Author: kfraser@localhost.localdomain > Date: Fri Jan 19 17:20:57 2007 +0000 > > [XEN] New event-channel reset operation. > Plumbed through libxenctrl to python. > > From: Andrei Petrov > Signed-off-by: Keir Fraser > > It would be great if you can point out EVTCHNOP_reset usages I'm not > aware of. We can revise the descision of reusing EVTCHNOP_reset in case > we break things. Hrm, it's a long time ago but thinking back I *think* this was added for the use of the toolstack, e.g. on slow/non-cooperative suspend resume xend would use it. This works in that case because the toolstack can then setup a new console etc. I suspect that the in-guest usecase may not have been considered back then. > > And apart from that blindly leaving all interdomain channels intact > > doesn't seem reasonable either. > > I agree here, see my reply to Andrew. We need to preserve console/store > channels only and any suggestion on how to distinguish them from other > interdomain mappings to Dom0 on hypervisor side are welcome. Rather than evtchn_reset perhaps the guest explicitly unbind whichever evtchns it doesn't want to carry over the kexec? Ian.