From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCHv2 3/5] evtchn: use a per-event channel lock for sending events Date: Tue, 16 Jun 2015 10:34:43 +0100 Message-ID: <557FEDB3.2090601@citrix.com> References: <1434383299-21833-1-git-send-email-david.vrabel@citrix.com> <1434383299-21833-4-git-send-email-david.vrabel@citrix.com> <5580060502000078000855A9@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 1Z4nGb-0000xd-En for xen-devel@lists.xenproject.org; Tue, 16 Jun 2015 09:34:49 +0000 In-Reply-To: <5580060502000078000855A9@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 Cc: xen-devel@lists.xenproject.org, Keir Fraser , Ian Campbell , Tim Deegan List-Id: xen-devel@lists.xenproject.org On 16/06/15 10:18, Jan Beulich wrote: >>>> On 15.06.15 at 17:48, wrote: >> @@ -609,21 +662,18 @@ int evtchn_send(struct domain *ld, unsigned int lport) >> struct domain *rd; >> int rport, ret = 0; >> >> - spin_lock(&ld->event_lock); >> - >> - if ( unlikely(!port_is_valid(ld, lport)) ) >> - { >> - spin_unlock(&ld->event_lock); >> + if ( unlikely(lport >= read_atomic(&ld->valid_evtchns)) ) >> return -EINVAL; >> - } > > I don't think you really want to open code part of port_is_valid() > (and avoid other parts of it) here? Or if really so, I think a comment > should be added to explain it. The ld->valid_evtchns is the only field we can safely check without ld->event_lock. We do check the channel state and the code that set this state uses the full port_is_valid() call. I'll add a comment. > And then - no change to free_xen_event_channel()? It looked alright to me, but now I see the clear of xen_consumer needs to be done under the channel lock. Probably by moving it to __evtchn_close(). David