From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCHv2 4/5] evtchn: remove the locking when unmasking an event channel Date: Tue, 16 Jun 2015 10:40:48 +0100 Message-ID: <557FEF20.5010002@citrix.com> References: <1434383299-21833-1-git-send-email-david.vrabel@citrix.com> <1434383299-21833-5-git-send-email-david.vrabel@citrix.com> <5580065E02000078000855B7@mail.emea.novell.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 1Z4nMV-0001xH-RM for xen-devel@lists.xenproject.org; Tue, 16 Jun 2015 09:40:55 +0000 In-Reply-To: <5580065E02000078000855B7@mail.emea.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: xen-devel@lists.xenproject.org, Keir Fraser , Ian Campbell , Tim Deegan List-Id: xen-devel@lists.xenproject.org On 16/06/15 10:19, Jan Beulich wrote: >>>> On 15.06.15 at 17:48, wrote: >> --- a/xen/common/event_channel.c >> +++ b/xen/common/event_channel.c >> @@ -977,9 +977,7 @@ int evtchn_unmask(unsigned int port) >> struct domain *d = current->domain; >> struct evtchn *evtchn; >> >> - ASSERT(spin_is_locked(&d->event_lock)); >> - >> - if ( unlikely(!port_is_valid(d, port)) ) >> + if ( port >= read_atomic(&d->valid_evtchns) ) >> return -EINVAL; > > Again this partial open coding looks wrong to me. Again, d->valid_evtchns is the only field we can safely check without d->event_lock. I think this is fine because unmasking an unbound event channel is harmless. David