From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCH] evtchn: don't lose pending state if FIFO event array page is missing Date: Fri, 18 Oct 2013 17:19:04 +0100 Message-ID: <52615F78.20001@citrix.com> References: <1382105218-30287-1-git-send-email-david.vrabel@citrix.com> <52616A7A02000078000FC258@nat28.tlf.novell.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 1VXClZ-0002VH-Cj for xen-devel@lists.xenproject.org; Fri, 18 Oct 2013 16:19:09 +0000 In-Reply-To: <52616A7A02000078000FC258@nat28.tlf.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 Cc: xen-devel , Keir Fraser List-Id: xen-devel@lists.xenproject.org On 18/10/13 16:06, Jan Beulich wrote: >>>> 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? I thought of it as moving the bit, but it's not necessary so I'll replace it with a plain test_bit(). Similarly, the evtchn->pending = 0 isn't needed either. David