From: "Jan Beulich" Subject: Re: [PATCH] evtchn: don't lose pending state if FIFO event array page is missing Date: Fri, 18 Oct 2013 16:06:02 +0100 Message-ID: <52616A7A02000078000FC258@nat28.tlf.novell.com> References: <1382105218-30287-1-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VXBcr-0006hw-3o for xen-devel@lists.xenproject.org; Fri, 18 Oct 2013 15:06:05 +0000 In-Reply-To: <1382105218-30287-1-git-send-email-david.vrabel@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Vrabel Cc: xen-devel , Keir Fraser List-Id: xen-devel@lists.xenproject.org >>> On 18.10.13 at 16:06, David Vrabel wrote: > @@ -322,16 +330,29 @@ static void cleanup_event_array(struct domain *d) > xfree(d->evtchn_fifo); > } > > -static void set_priority_all(struct domain *d, unsigned int priority) > +static void setup_ports(struct domain *d) > { > unsigned int port; > > + /* > + * For each port that is already bound: > + * > + * - save its pending state. > + * - set default priority. > + */ > for ( port = 1; port < d->max_evtchns; port++ ) > { > + struct evtchn *evtchn; > + > if ( !port_is_valid(d, port) ) > break; > > - evtchn_port_set_priority(d, evtchn_from_port(d, port), priority); > + evtchn = evtchn_from_port(d, port); > + > + if ( test_and_clear_bit(port, &shared_info(d, evtchn_pending)) ) So why test_and_clear rather than just test? Jan > + evtchn->pending = 1; > + > + evtchn_fifo_set_priority(d, evtchn, EVTCHN_FIFO_PRIORITY_DEFAULT); > } > } >