Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1664567 > unrolled thread
| Started by | Juergen Gross <jgross@suse.com> |
|---|---|
| First post | 2017-06-13 09:50 +0200 |
| Last post | 2017-06-14 21:20 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v3 14/18] xen/pvcalls: disconnect and module_exit Juergen Gross <jgross@suse.com> - 2017-06-13 09:50 +0200
Re: [PATCH v3 14/18] xen/pvcalls: disconnect and module_exit Stefano Stabellini <sstabellini@kernel.org> - 2017-06-14 03:00 +0200
Re: [PATCH v3 14/18] xen/pvcalls: disconnect and module_exit Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-06-14 16:00 +0200
Re: [PATCH v3 14/18] xen/pvcalls: disconnect and module_exit Stefano Stabellini <sstabellini@kernel.org> - 2017-06-14 21:20 +0200
| From | Juergen Gross <jgross@suse.com> |
|---|---|
| Date | 2017-06-13 09:50 +0200 |
| Subject | Re: [PATCH v3 14/18] xen/pvcalls: disconnect and module_exit |
| Message-ID | <tROKm-59U-23@gated-at.bofh.it> |
On 02/06/17 21:31, 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@aporeto.com>
> CC: boris.ostrovsky@oracle.com
> CC: jgross@suse.com
> ---
> drivers/xen/pvcalls-back.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 49 insertions(+)
>
> diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
> index b541887..6afe7a0 100644
> --- a/drivers/xen/pvcalls-back.c
> +++ b/drivers/xen/pvcalls-back.c
> @@ -800,6 +800,38 @@ static int backend_connect(struct xenbus_device *dev)
>
> static int backend_disconnect(struct xenbus_device *dev)
> {
> + struct pvcalls_fedata *priv;
> + struct sock_mapping *map, *n;
> + struct sockpass_mapping *mappass;
> + struct radix_tree_iter iter;
> + void **slot;
> +
> +
> + priv = dev_get_drvdata(&dev->dev);
> +
> + list_for_each_entry_safe(map, n, &priv->socket_mappings, list) {
> + pvcalls_back_release_active(dev, priv, map);
> + }
You can drop the {}
> +
> + radix_tree_for_each_slot(slot, &priv->socketpass_mappings, &iter, 0) {
> + mappass = radix_tree_deref_slot(slot);
> + if (!mappass || radix_tree_exception(mappass)) {
This looks fishy.
You might call radix_tree_deref_retry(NULL). Right now this is okay,
but you depend on the radix tree internals here.
> + if (radix_tree_deref_retry(mappass)) {
> + slot = radix_tree_iter_retry(&iter);
> + continue;
The continue; statement is pointless here.
> + }
> + } else
> + pvcalls_back_release_passive(dev, priv, mappass);
> + }
> +
> + xenbus_unmap_ring_vfree(dev, (void *)priv->sring);
Drop the cast.
> + unbind_from_irqhandler(priv->irq, dev);
> +
> + list_del(&priv->list);
> + destroy_workqueue(priv->wq);
> + kfree(priv);
> + dev_set_drvdata(&dev->dev, NULL);
> +
> return 0;
> }
>
> @@ -993,3 +1025,20 @@ static int __init pvcalls_back_init(void)
> return 0;
> }
> module_init(pvcalls_back_init);
> +
> +static void __exit pvcalls_back_fin(void)
> +{
> + struct pvcalls_fedata *priv, *npriv;
> +
> + down(&pvcalls_back_global.frontends_lock);
> + list_for_each_entry_safe(priv, npriv, &pvcalls_back_global.frontends,
> + list) {
> + backend_disconnect(priv->dev);
> + }
> + up(&pvcalls_back_global.frontends_lock);
> +
> + xenbus_unregister_driver(&pvcalls_back_driver);
> + memset(&pvcalls_back_global, 0, sizeof(pvcalls_back_global));
Why?
Juergen
> +}
> +
> +module_exit(pvcalls_back_fin);
>
[toc] | [next] | [standalone]
| From | Stefano Stabellini <sstabellini@kernel.org> |
|---|---|
| Date | 2017-06-14 03:00 +0200 |
| Message-ID | <tS4P8-6AG-13@gated-at.bofh.it> |
| In reply to | #1664567 |
On Tue, 13 Jun 2017, Juergen Gross wrote:
> On 02/06/17 21:31, 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@aporeto.com>
> > CC: boris.ostrovsky@oracle.com
> > CC: jgross@suse.com
> > ---
> > drivers/xen/pvcalls-back.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 49 insertions(+)
> >
> > diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
> > index b541887..6afe7a0 100644
> > --- a/drivers/xen/pvcalls-back.c
> > +++ b/drivers/xen/pvcalls-back.c
> > @@ -800,6 +800,38 @@ static int backend_connect(struct xenbus_device *dev)
> >
> > static int backend_disconnect(struct xenbus_device *dev)
> > {
> > + struct pvcalls_fedata *priv;
> > + struct sock_mapping *map, *n;
> > + struct sockpass_mapping *mappass;
> > + struct radix_tree_iter iter;
> > + void **slot;
> > +
> > +
> > + priv = dev_get_drvdata(&dev->dev);
> > +
> > + list_for_each_entry_safe(map, n, &priv->socket_mappings, list) {
> > + pvcalls_back_release_active(dev, priv, map);
> > + }
>
> You can drop the {}
OK
> > +
> > + radix_tree_for_each_slot(slot, &priv->socketpass_mappings, &iter, 0) {
> > + mappass = radix_tree_deref_slot(slot);
> > + if (!mappass || radix_tree_exception(mappass)) {
>
> This looks fishy.
>
> You might call radix_tree_deref_retry(NULL). Right now this is okay,
> but you depend on the radix tree internals here.
I'll avoid id
> > + if (radix_tree_deref_retry(mappass)) {
> > + slot = radix_tree_iter_retry(&iter);
> > + continue;
>
> The continue; statement is pointless here.
I'll remove it
> > + }
> > + } else
> > + pvcalls_back_release_passive(dev, priv, mappass);
> > + }
> > +
> > + xenbus_unmap_ring_vfree(dev, (void *)priv->sring);
>
> Drop the cast.
OK
> > + unbind_from_irqhandler(priv->irq, dev);
> > +
> > + list_del(&priv->list);
> > + destroy_workqueue(priv->wq);
> > + kfree(priv);
> > + dev_set_drvdata(&dev->dev, NULL);
> > +
> > return 0;
> > }
> >
> > @@ -993,3 +1025,20 @@ static int __init pvcalls_back_init(void)
> > return 0;
> > }
> > module_init(pvcalls_back_init);
> > +
> > +static void __exit pvcalls_back_fin(void)
> > +{
> > + struct pvcalls_fedata *priv, *npriv;
> > +
> > + down(&pvcalls_back_global.frontends_lock);
> > + list_for_each_entry_safe(priv, npriv, &pvcalls_back_global.frontends,
> > + list) {
> > + backend_disconnect(priv->dev);
> > + }
> > + up(&pvcalls_back_global.frontends_lock);
> > +
> > + xenbus_unregister_driver(&pvcalls_back_driver);
> > + memset(&pvcalls_back_global, 0, sizeof(pvcalls_back_global));
>
> Why?
legacy code, I'll remove it
> Juergen
>
> > +}
> > +
> > +module_exit(pvcalls_back_fin);
> >
>
[toc] | [prev] | [next] | [standalone]
| From | Boris Ostrovsky <boris.ostrovsky@oracle.com> |
|---|---|
| Date | 2017-06-14 16:00 +0200 |
| Message-ID | <tSgZY-5S3-31@gated-at.bofh.it> |
| In reply to | #1665338 |
>>> static int backend_disconnect(struct xenbus_device *dev)
>>> {
>>> + struct pvcalls_fedata *priv;
>>> + struct sock_mapping *map, *n;
>>> + struct sockpass_mapping *mappass;
>>> + struct radix_tree_iter iter;
>>> + void **slot;
>>> +
>>> +
>>> + priv = dev_get_drvdata(&dev->dev);
Can you also rename priv to something else (like fedata)? And in other
routines too.
-boris
[toc] | [prev] | [next] | [standalone]
| From | Stefano Stabellini <sstabellini@kernel.org> |
|---|---|
| Date | 2017-06-14 21:20 +0200 |
| Message-ID | <tSlZE-Jv-11@gated-at.bofh.it> |
| In reply to | #1665861 |
On Wed, 14 Jun 2017, Boris Ostrovsky wrote:
> >>> static int backend_disconnect(struct xenbus_device *dev)
> >>> {
> >>> + struct pvcalls_fedata *priv;
> >>> + struct sock_mapping *map, *n;
> >>> + struct sockpass_mapping *mappass;
> >>> + struct radix_tree_iter iter;
> >>> + void **slot;
> >>> +
> >>> +
> >>> + priv = dev_get_drvdata(&dev->dev);
>
> Can you also rename priv to something else (like fedata)? And in other
> routines too.
Yes, done
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web