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 16:19:15 +0100 Message-ID: <55803E73.2010603@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.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z4t1S-0002ee-OL for xen-devel@lists.xenproject.org; Tue, 16 Jun 2015 15:43:34 +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 , 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:18, Jan Beulich wrote: >>>> On 15.06.15 at 17:48, wrote: >> @@ -1163,11 +1213,15 @@ int alloc_unbound_xen_event_channel( >> if ( rc ) >> goto out; >> >> + spin_lock(&chn->lock); >> + >> chn->state = ECS_UNBOUND; >> chn->xen_consumer = get_xen_consumer(notification_fn); >> chn->notify_vcpu_id = lvcpu; >> chn->u.unbound.remote_domid = remote_domid; >> >> + spin_unlock(&chn->lock); >> + >> out: >> spin_unlock(&ld->event_lock); > > I don't see why you shouldn't be able to move up this unlock. Because we need to (also) hold ld->event_lock while changing the state from ECS_FREE or a concurrent get_free_port() will find this port again. >> @@ -1221,6 +1277,8 @@ void notify_via_xen_event_channel(struct domain *ld, int lport) >> evtchn_port_set_pending(rd, rchn->notify_vcpu_id, rchn); >> } >> >> + spin_unlock(&lchn->lock); >> + >> spin_unlock(&ld->event_lock); >> } > > Again I think the event lock can be dropped earlier now. Ditto. David