[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1707051421470.2919@sstabellini-ThinkPad-X260>
Date: Wed, 5 Jul 2017 14:22:13 -0700 (PDT)
From: Stefano Stabellini <sstabellini@...nel.org>
To: Juergen Gross <jgross@...e.com>
cc: Stefano Stabellini <sstabellini@...nel.org>,
xen-devel@...ts.xen.org, linux-kernel@...r.kernel.org,
boris.ostrovsky@...cle.com,
Stefano Stabellini <stefano@...reto.com>
Subject: Re: [PATCH v6 14/18] xen/pvcalls: disconnect and module_exit
On Tue, 4 Jul 2017, Juergen Gross wrote:
> On 03/07/17 23:08, Stefano Stabellini wrote:
> > Implement backend_disconnect. Call pvcalls_back_release_active on active
> > sockets and pvcalls_back_release_passive on passive sockets.
> >
> > Implement module_exit by calling backend_disconnect on frontend
> > connections.
> >
> > Signed-off-by: Stefano Stabellini <stefano@...reto.com>
> > CC: boris.ostrovsky@...cle.com
> > CC: jgross@...e.com
> > ---
> > drivers/xen/pvcalls-back.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 52 insertions(+)
> >
> > diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
> > index 9f4247f..71a42fc 100644
> > --- a/drivers/xen/pvcalls-back.c
> > +++ b/drivers/xen/pvcalls-back.c
> > @@ -807,6 +807,42 @@ static int backend_connect(struct xenbus_device *dev)
> >
> > static int backend_disconnect(struct xenbus_device *dev)
> > {
> > + struct pvcalls_fedata *fedata;
> > + struct sock_mapping *map, *n;
> > + struct sockpass_mapping *mappass;
> > + struct radix_tree_iter iter;
> > + void **slot;
> > +
> > +
> > + fedata = dev_get_drvdata(&dev->dev);
> > +
> > + down(&fedata->socket_lock);
> > + list_for_each_entry_safe(map, n, &fedata->socket_mappings, list) {
> > + list_del(&map->list);
> > + pvcalls_back_release_active(dev, fedata, map);
> > + }
> > +
> > + radix_tree_for_each_slot(slot, &fedata->socketpass_mappings, &iter, 0) {
> > + mappass = radix_tree_deref_slot(slot);
> > + if (!mappass)
> > + continue;
> > + if (radix_tree_exception(mappass)) {
> > + if (radix_tree_deref_retry(mappass))
> > + slot = radix_tree_iter_retry(&iter);
> > + } else {
> > + radix_tree_delete(&fedata->socketpass_mappings, mappass->id);
> > + pvcalls_back_release_passive(dev, fedata, mappass);
> > + }
> > + }
> > + up(&fedata->socket_lock);
> > +
> > + xenbus_unmap_ring_vfree(dev, fedata->sring);
> > + unbind_from_irqhandler(fedata->irq, dev);
>
> Swap above two lines to avoid irq being handled after releasing
> ring?
Will do
Powered by blists - more mailing lists