[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCHv2 3/5] evtchn: use a per-event channel lock for sending events



>>> On 15.06.15 at 17:48, <david.vrabel@xxxxxxxxxx> 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.

> @@ -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.

And then - no change to free_xen_event_channel()?

> @@ -1214,6 +1268,8 @@ void notify_via_xen_event_channel(struct domain *ld, 
> int lport)
>      lchn = evtchn_from_port(ld, lport);
>      ASSERT(consumer_is_xen(lchn));
>  
> +    spin_lock(&lchn->lock);
> +
>      if ( likely(lchn->state == ECS_INTERDOMAIN) )
>      {
>          rd    = lchn->u.interdomain.remote_dom;
> @@ -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.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.