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

Re: [Xen-devel] [PATCH RFC 5/6] xen-access: add support for slotted channel vm_events



On Wed, 2018-11-28 at 21:24 +0200, Razvan Cojocaru wrote:
> On 11/28/18 5:29 PM, Petre Pircalabu wrote:
> > Signed-off-by: Petre Pircalabu <ppircalabu@xxxxxxxxxxxxxxx>
> > ---
> > 
> > +static int xenaccess_evtchn_bind(xenaccess_t *xenaccess)
> > +{
> +    int rc, i = 0;
> > +
> > +    rc = xenaccess_evtchn_bind_port(xenaccess->vm_event.ring-
> > >evtchn_port,
> > +                                    xenaccess->vm_event.domain_id,
> > +                                    &xenaccess->vm_event.ring-
> > >xce_handle,
> > +                                    &xenaccess->vm_event.ring-
> > >port);
> > +    if ( rc < 0 )
> > +    {
> > +        ERROR("Failed to bind ring events\n");
> > +        return rc;
> > +    }
> +
> +    if ( xenaccess->vm_event.channel == NULL)
> > +        return 0;
> > +
> > +    for ( i = 0; i < xenaccess->vm_event.num_vcpus; i++ )
> > +    {
> > +        rc = xenaccess_evtchn_bind_port(xenaccess-
> > >vm_event.channel->evtchn_ports[i],
> > +                                        xenaccess-
> > >vm_event.domain_id,
> > +                                        &xenaccess-
> > >vm_event.channel->xce_handles[i],
> > +                                        &xenaccess-
> > >vm_event.channel->ports[i]);
> > +        if ( rc < 0 )
> >          {
> > -            ERROR("Failed to unmask event channel port");
> > +            ERROR("Failed to bind channel events\n");
> >              goto err;
> >          }
> >      }
> > -    else
> > -        port = -1;
> >  
> > -    return port;
> > +    evtchn_bind = true;
> > +    return 0;
> >  
> > - err:
> > -    return -errno;
> > +err:
> > +    xenaccess_evtchn_unbind_port(xenaccess->vm_event.ring-
> > >evtchn_port,
> > +                                 &xenaccess->vm_event.ring-
> > >xce_handle,
> +                                 &xenaccess->vm_event.ring->port);
> > +
> > +    for ( i--; i >= 0; i-- )
> 
> This for() looks peculiar.
> 
In case of an error "i" will point to the xce_handles index for which
"bind" failed. "unbind" has to be called for the xce_handles 0 to (i-1) 
.
> 
> Thanks,
> Razvan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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