From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCHv1] evtchn: don't reuse ports that are still "busy" Date: Tue, 1 Dec 2015 14:04:10 +0000 Message-ID: <565DA8DA.4030503@citrix.com> References: <1448906348-5805-1-git-send-email-david.vrabel@citrix.com> <565DA55002000078000BAB85@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1a3lXX-0005kb-Ur for xen-devel@lists.xenproject.org; Tue, 01 Dec 2015 14:04:20 +0000 In-Reply-To: <565DA55002000078000BAB85@prv-mh.provo.novell.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: Jan Beulich , David Vrabel Cc: Ross Lagerwall , Ian Campbell , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On 01/12/15 12:49, Jan Beulich wrote: >>>> On 30.11.15 at 18:59, wrote: >> --- a/xen/common/event_channel.c >> +++ b/xen/common/event_channel.c >> @@ -170,7 +170,8 @@ static int get_free_port(struct domain *d) >> { >> if ( port > d->max_evtchn_port ) >> return -ENOSPC; >> - if ( evtchn_from_port(d, port)->state == ECS_FREE ) >> + chn = evtchn_from_port(d, port); >> + if ( chn->state == ECS_FREE && !evtchn_port_is_busy(d, chn) ) > > Despite the reasonable arguments you give this looks very wrong: > How can a free port still be busy? Could we have a new ECS_* and > require guests to notify the hypervisor when they unlinked an > already closed port (while "close" would transition busy ports into > that new state)? I would look at it as: The channel object is free, but the corresponding ABI specific port object is busy. So it doesn't seem unreasonable to check the state of both objects. What you suggest (adding an additional call) would break all existing guests that would not make the unlinked call, leaving the event channel in a state where it cannot be reused. David