Re: [Xen-devel] [PATCH v2 2/2] block/xen-blkback: allow module to be cleanly unloaded

2019-11-29 Thread Jürgen Groß

On 29.11.19 16:07, Roger Pau Monné wrote:

On Fri, Nov 29, 2019 at 03:02:37PM +, Durrant, Paul wrote:

-Original Message-
From: Roger Pau Monné 
Sent: 29 November 2019 15:00
To: Durrant, Paul 
Cc: linux-bl...@vger.kernel.org; linux-ker...@vger.kernel.org; xen-
de...@lists.xenproject.org; Konrad Rzeszutek Wilk
; Jens Axboe 
Subject: Re: [PATCH v2 2/2] block/xen-blkback: allow module to be cleanly
unloaded

On Fri, Nov 29, 2019 at 01:43:06PM +, Paul Durrant wrote:

Add a module_exit() to perform the necessary clean-up.

Signed-off-by: Paul Durrant 


LGTM:

Reviewed-by: Roger Pau Monné 



Thanks.


AFAICT we should make sure this is not committed before patch 1, or
else you could unload a blkback module that's still in use?



Yes, that's correct.


Given this is a very small change, and not really block related I
think it would be better for both patches to be committed from the Xen
tree, if Jens, Juergen and Boris agree.


I'm fine with that.

And:

Reviewed-by: Juergen Gross 


Juergen


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

Re: [Xen-devel] [PATCH v2 2/2] block/xen-blkback: allow module to be cleanly unloaded

2019-11-29 Thread Roger Pau Monné
On Fri, Nov 29, 2019 at 03:02:37PM +, Durrant, Paul wrote:
> > -Original Message-
> > From: Roger Pau Monné 
> > Sent: 29 November 2019 15:00
> > To: Durrant, Paul 
> > Cc: linux-bl...@vger.kernel.org; linux-ker...@vger.kernel.org; xen-
> > de...@lists.xenproject.org; Konrad Rzeszutek Wilk
> > ; Jens Axboe 
> > Subject: Re: [PATCH v2 2/2] block/xen-blkback: allow module to be cleanly
> > unloaded
> > 
> > On Fri, Nov 29, 2019 at 01:43:06PM +, Paul Durrant wrote:
> > > Add a module_exit() to perform the necessary clean-up.
> > >
> > > Signed-off-by: Paul Durrant 
> > 
> > LGTM:
> > 
> > Reviewed-by: Roger Pau Monné 
> > 
> 
> Thanks.
> 
> > AFAICT we should make sure this is not committed before patch 1, or
> > else you could unload a blkback module that's still in use?
> > 
> 
> Yes, that's correct.

Given this is a very small change, and not really block related I
think it would be better for both patches to be committed from the Xen
tree, if Jens, Juergen and Boris agree.

Thanks, Roger.

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

Re: [Xen-devel] [PATCH v2 2/2] block/xen-blkback: allow module to be cleanly unloaded

2019-11-29 Thread Durrant, Paul
> -Original Message-
> From: Roger Pau Monné 
> Sent: 29 November 2019 15:00
> To: Durrant, Paul 
> Cc: linux-bl...@vger.kernel.org; linux-ker...@vger.kernel.org; xen-
> de...@lists.xenproject.org; Konrad Rzeszutek Wilk
> ; Jens Axboe 
> Subject: Re: [PATCH v2 2/2] block/xen-blkback: allow module to be cleanly
> unloaded
> 
> On Fri, Nov 29, 2019 at 01:43:06PM +, Paul Durrant wrote:
> > Add a module_exit() to perform the necessary clean-up.
> >
> > Signed-off-by: Paul Durrant 
> 
> LGTM:
> 
> Reviewed-by: Roger Pau Monné 
> 

Thanks.

> AFAICT we should make sure this is not committed before patch 1, or
> else you could unload a blkback module that's still in use?
> 

Yes, that's correct.

  Paul

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

Re: [Xen-devel] [PATCH v2 2/2] block/xen-blkback: allow module to be cleanly unloaded

2019-11-29 Thread Roger Pau Monné
On Fri, Nov 29, 2019 at 01:43:06PM +, Paul Durrant wrote:
> Add a module_exit() to perform the necessary clean-up.
> 
> Signed-off-by: Paul Durrant 

LGTM:

Reviewed-by: Roger Pau Monné 

AFAICT we should make sure this is not committed before patch 1, or
else you could unload a blkback module that's still in use?

Thanks, Roger.

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

[Xen-devel] [PATCH v2 2/2] block/xen-blkback: allow module to be cleanly unloaded

2019-11-29 Thread Paul Durrant
Add a module_exit() to perform the necessary clean-up.

Signed-off-by: Paul Durrant 
---
Cc: Konrad Rzeszutek Wilk 
Cc: "Roger Pau Monné" 
Cc: Jens Axboe 

v2:
 - Drop the addition of ad-hoc reference counting as this is now done
   centrally in xenbus
---
 drivers/block/xen-blkback/blkback.c |  8 
 drivers/block/xen-blkback/common.h  |  3 +++
 drivers/block/xen-blkback/xenbus.c  | 11 +++
 3 files changed, 22 insertions(+)

diff --git a/drivers/block/xen-blkback/blkback.c 
b/drivers/block/xen-blkback/blkback.c
index fd1e19f1a49f..e562a7e20c3c 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -1504,5 +1504,13 @@ static int __init xen_blkif_init(void)
 
 module_init(xen_blkif_init);
 
+static void __exit xen_blkif_fini(void)
+{
+   xen_blkif_xenbus_fini();
+   xen_blkif_interface_fini();
+}
+
+module_exit(xen_blkif_fini);
+
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_ALIAS("xen-backend:vbd");
diff --git a/drivers/block/xen-blkback/common.h 
b/drivers/block/xen-blkback/common.h
index 1d3002d773f7..49132b0adbbe 100644
--- a/drivers/block/xen-blkback/common.h
+++ b/drivers/block/xen-blkback/common.h
@@ -375,9 +375,12 @@ struct phys_req {
struct block_device *bdev;
blkif_sector_t  sector_number;
 };
+
 int xen_blkif_interface_init(void);
+void xen_blkif_interface_fini(void);
 
 int xen_blkif_xenbus_init(void);
+void xen_blkif_xenbus_fini(void);
 
 irqreturn_t xen_blkif_be_int(int irq, void *dev_id);
 int xen_blkif_schedule(void *arg);
diff --git a/drivers/block/xen-blkback/xenbus.c 
b/drivers/block/xen-blkback/xenbus.c
index b90dbcd99c03..e8c5c54e1d26 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -333,6 +333,12 @@ int __init xen_blkif_interface_init(void)
return 0;
 }
 
+void xen_blkif_interface_fini(void)
+{
+   kmem_cache_destroy(xen_blkif_cachep);
+   xen_blkif_cachep = NULL;
+}
+
 /*
  *  sysfs interface for VBD I/O requests
  */
@@ -1122,3 +1128,8 @@ int xen_blkif_xenbus_init(void)
 {
return xenbus_register_backend(_blkbk_driver);
 }
+
+void xen_blkif_xenbus_fini(void)
+{
+   xenbus_unregister_driver(_blkbk_driver);
+}
-- 
2.20.1


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