Can't start VM when vif set and udev version is greater than 151
A message that is not in the archive (sent off-list or not yet received): [email protected]/bugzilla/
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines
------- Comment #28 from [email protected] 2010-07-05 10:20 ------- (In reply to comment #26)
Quoted 5 lines
(In reply to comment #25)
Quoted 4 lines
Great,
Will it be applyed in every xen kernel, or only from 2.6.32 ?
Quoted 8 lines
Quoted 4 lines
The policy is to stick bug-fixes in xen/next which are then pulled in xen/stable-2.6.32.x. But this being such a serious issue, and a small patch that I think Jeremy would stick it in 2.6.31 once it has passed review.
Its been a few weeks now, do you know when this patch will be included in jeremy's repository ? If not can you paste a link here to this patch ?
Soooo.. the last I remember it was that the patch for this was not appropiate. But I don't remember the details - is there a forthcoming patch that can fix the outstanding issue?
Or is the patch ready and we forgot about it?
Quoted 17 lines
Quoted 8 lines
Quoted 1 line · Konrad Rzeszutek Wilk
------- Comment #28 from [email protected] 2010-07-05 10:20 ------- (In reply to comment #26)
Quoted 5 lines
(In reply to comment #25)
Quoted 4 lines
Great,
Will it be applyed in every xen kernel, or only from 2.6.32 ?
Quoted 8 lines
Quoted 4 lines
The policy is to stick bug-fixes in xen/next which are then pulled in xen/stable-2.6.32.x. But this being such a serious issue, and a small patch that I think Jeremy would stick it in 2.6.31 once it has passed review.
Its been a few weeks now, do you know when this patch will be included in jeremy's repository ? If not can you paste a link here to this patch ?
Quoted 5 lines
Soooo.. the last I remember it was that the patch for this was not appropiate. But I don't remember the details - is there a forthcoming patch that can fix the outstanding issue?
Or is the patch ready and we forgot about it?
For reference, below is the diff for what we're now using.
Jan
drivers/xen/netback/xenbus.c +23 -13
@@ -19,6 +19,7 @@#include <stdarg.h> #include <linux/module.h> +#include <linux/rwsem.h> #include <xen/xenbus.h> #include "common.h"
@@ -28,6 +29,7 @@ printk("netback/xenbus (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args) #endif +static DECLARE_RWSEM(teardown_sem);static int connect_rings (struct backend_info *);static void connect (struct backend_info *);
@@ -39,13 +41,18 @@ static int netback_remove(struct xenbus_netback_remove_accelerators (be, dev); -if (be->netif) { +if (be->netif)kobject_uevent (&dev->dev.kobj,KOBJ_OFFLINE ); + +down_write (&teardown_sem); +if (be->netif) {netif_disconnect (be->netif); be->netif =NULL ; } -kfree (be);dev_set_drvdata (&dev->dev,NULL ); +up_write (&teardown_sem); +kfree (be); +return 0 ; }
@@ -151,8 +158,7 @@ fail:*/ static int netback_uevent (struct xenbus_device *xdev,struct kobj_uevent_env *env) { -struct backend_info *be =dev_get_drvdata (&xdev->dev); -netif_t *netif = be->netif; +struct backend_info *be;char *val;DPRINTK ("netback_uevent" );
@@ -163,12 +169,15 @@ static int netback_uevent(struct xenbus_xenbus_dev_fatal (xdev, err,"reading script" );return err; } -else { -add_uevent_var (env,"script=%s" , val); -kfree (val); - } -add_uevent_var (env,"vif=%s" , netif->dev->name); +add_uevent_var (env,"script=%s" , val); +kfree (val); + +down_read (&teardown_sem); + be =dev_get_drvdata (&xdev->dev); +if (be && be->netif) +add_uevent_var (env,"vif=%s" , be->netif->dev->name); +up_read (&teardown_sem);return 0 ; }
@@ -179,6 +188,7 @@ static void backend_create_netif(structint err;long handle;struct xenbus_device *dev = be->dev; +netif_t *netif;if (be->netif !=NULL )return ;
@@ -189,13 +199,13 @@ static void backend_create_netif(structreturn ; } - be->netif =netif_alloc (&dev->dev, dev->otherend_id, handle); -if (IS_ERR (be->netif)) { - err =PTR_ERR (be->netif); - be->netif =NULL ; + netif =netif_alloc (&dev->dev, dev->otherend_id, handle); +if (IS_ERR (netif)) { + err =PTR_ERR (netif);xenbus_dev_fatal (dev, err,"creating interface" );return ; } + be->netif = netif;kobject_uevent (&dev->dev.kobj,KOBJ_ONLINE ); }
Quoted 7 lines
Quoted 5 lines
Soooo.. the last I remember it was that the patch for this was not appropiate. But I don't remember the details - is there a forthcoming patch that can fix the outstanding issue?
Or is the patch ready and we forgot about it?
For reference, below is the diff for what we're now using.
Ah nice..
I get this:
patch -p1 --dry-run < ~/p.patch
patching file drivers/xen/netback/xenbus.c
Hunk #1 succeeded at 19 with fuzz 1.
Hunk #2 FAILED at 29.
Hunk #3 FAILED at 40.
patch: **** malformed patch at line 120: nv *env)
If it would not be too much trouble, can you attach it as an attachment?
Quoted 106 lines
Jan
drivers/xen/netback/xenbus.c +23
-13@@ -19,6 +19,7 @@#include <stdarg.h> #include <linux/module.h> +#include <linux/rwsem.h> #include <xen/xenbus.h> #include "common.h" @@ -28,6 +29,7 @@ printk("netback/xenbus (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args) #endif +static DECLARE_RWSEM(teardown_sem);static int connect_rings (struct backend_info *);static void connect (struct backend_info *);@@ -39,13 +41,18 @@ static int netback_remove(struct xenbus_netback_remove_accelerators (be, dev); -if (be->netif) { +if (be->netif)kobject_uevent (&dev->dev.kobj,KOBJ_OFFLINE ); + +down_write (&teardown_sem); +if (be->netif) {netif_disconnect (be->netif); be->netif =NULL ; } -kfree (be);dev_set_drvdata (&dev->dev,NULL ); +up_write (&teardown_sem); +kfree (be); +return 0 ; }@@ -151,8 +158,7 @@ fail:*/ static int netback_uevent (struct xenbus_device *xdev,struct kobj_uevent_env *env) { -struct backend_info *be =dev_get_drvdata (&xdev->dev); -netif_t *netif = be->netif; +struct backend_info *be;char *val;DPRINTK ("netback_uevent" );@@ -163,12 +169,15 @@ static int netback_uevent(struct xenbus_xenbus_dev_fatal (xdev, err,"reading script" );return err; } -else { -add_uevent_var (env,"script=%s" , val); -kfree (val); - } -add_uevent_var (env,"vif=%s" , netif->dev->name); +add_uevent_var (env,"script=%s" , val); +kfree (val); + +down_read (&teardown_sem); + be =dev_get_drvdata (&xdev->dev); +if (be && be->netif) +add_uevent_var (env,"vif=%s" , be->netif->dev->name); +up_read (&teardown_sem);return 0 ; }@@ -179,6 +188,7 @@ static void backend_create_netif(structint err;long handle;struct xenbus_device *dev = be->dev; +netif_t *netif;if (be->netif !=NULL )return ;@@ -189,13 +199,13 @@ static void backend_create_netif(structreturn ; } - be->netif =netif_alloc (&dev->dev, dev->otherend_id, handle); -if (IS_ERR (be->netif)) { - err =PTR_ERR (be->netif); - be->netif =NULL ; + netif =netif_alloc (&dev->dev, dev->otherend_id, handle); +if (IS_ERR (netif)) { + err =PTR_ERR (netif);xenbus_dev_fatal (dev, err,"creating interface" );return ; } + be->netif = netif;kobject_uevent (&dev->dev.kobj,KOBJ_ONLINE ); }_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 13 lines
Quoted 2 lines
Quoted 1 line · Konrad Rzeszutek Wilk
For reference, below is the diff for what we're now using.
Ah nice..
I get this:
patch -p1 --dry-run <~/p.patch
patching filedrivers/xen/netback/xenbus.c
Hunk #1 succeeded at 19 with fuzz 1.
Hunk #2 FAILED at 29.
Hunk #3 FAILED at 40.
patch: **** malformed patch at line 120: nv *env)
Quoted 1 line
If it would not be too much trouble, can you attach it as an attachment?
Sure, here you go.
Jan
kernel/head-2010-06-22/drivers/xen/netback/xenbus.c renamed from kernel/head-2010-05-12/drivers/xen/netback/xenbus.c +23 -13
@@ -19,6 +19,7 @@#include <stdarg.h> #include <linux/module.h> +#include <linux/rwsem.h> #include <xen/xenbus.h> #include "common.h"
@@ -28,6 +29,7 @@ printk("netback/xenbus (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args) #endif +static DECLARE_RWSEM(teardown_sem);static int connect_rings (struct backend_info *);static void connect (struct backend_info *);
@@ -39,13 +41,18 @@ static int netback_remove(struct xenbus_netback_remove_accelerators (be, dev); -if (be->netif) { +if (be->netif)kobject_uevent (&dev->dev.kobj,KOBJ_OFFLINE ); + +down_write (&teardown_sem); +if (be->netif) {netif_disconnect (be->netif); be->netif =NULL ; } -kfree (be);dev_set_drvdata (&dev->dev,NULL ); +up_write (&teardown_sem); +kfree (be); +return 0 ; }
@@ -151,8 +158,7 @@ fail:*/ static int netback_uevent (struct xenbus_device *xdev,struct kobj_uevent_env *env) { -struct backend_info *be =dev_get_drvdata (&xdev->dev); -netif_t *netif = be->netif; +struct backend_info *be;char *val;DPRINTK ("netback_uevent" );
@@ -163,12 +169,15 @@ static int netback_uevent(struct xenbus_xenbus_dev_fatal (xdev, err,"reading script" );return err; } -else { -add_uevent_var (env,"script=%s" , val); -kfree (val); - } -add_uevent_var (env,"vif=%s" , netif->dev->name); +add_uevent_var (env,"script=%s" , val); +kfree (val); + +down_read (&teardown_sem); + be =dev_get_drvdata (&xdev->dev); +if (be && be->netif) +add_uevent_var (env,"vif=%s" , be->netif->dev->name); +up_read (&teardown_sem);return 0 ; }
@@ -179,6 +188,7 @@ static void backend_create_netif(structint err;long handle;struct xenbus_device *dev = be->dev; +netif_t *netif;if (be->netif !=NULL )return ;
@@ -189,13 +199,13 @@ static void backend_create_netif(structreturn ; } - be->netif =netif_alloc (&dev->dev, dev->otherend_id, handle); -if (IS_ERR (be->netif)) { - err =PTR_ERR (be->netif); - be->netif =NULL ; + netif =netif_alloc (&dev->dev, dev->otherend_id, handle); +if (IS_ERR (netif)) { + err =PTR_ERR (netif);xenbus_dev_fatal (dev, err,"creating interface" );return ; } + be->netif = netif;kobject_uevent (&dev->dev.kobj,KOBJ_ONLINE ); }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 2 lines
Quoted 1 line · Konrad Rzeszutek Wilk
For reference, below is the diff for what we're now using.
Ah nice..
I get this:
patch -p1 --dry-run <~/p.patch
patching filedrivers/xen/netback/xenbus.c
Hunk #1 succeeded at 19 with fuzz 1.
Hunk #2 FAILED at 29.
Hunk #3 FAILED at 40.
patch: **** malformed patch at line 120: nv *env)
Quoted 3 lines
Quoted 1 line
If it would not be too much trouble, can you attach it as an attachment?
Sure, here you go.
And attached is it redone against the pv-ops kernel. Let me poke the folks on the BZ to see if they would be willing to test this.
drivers/xen/netback/xenbus.c +23 -10
@@ -19,6 +19,7 @@#include <stdarg.h> #include <linux/module.h> +#include <linux/rwsem.h> #include <xen/xenbus.h> #include "common.h"
@@ -28,6 +29,7 @@ printk("netback/xenbus (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args) #endif +static DECLARE_RWSEM(teardown_sem);static int connect_rings (struct backend_info *);static void connect (struct backend_info *);
@@ -41,14 +43,19 @@ static int netback_remove(struct xenbus_device *dev)//netback_remove_accelerators(be, dev); unregister_hotplug_status_watch (be); -if (be->netif) { +if (be->netif)kobject_uevent (&dev->dev.kobj,KOBJ_OFFLINE ); + +down_write (&teardown_sem); +if (be->netif) {xenbus_rm (XBT_NIL , dev->nodename,"hotplug-status" );netif_disconnect (be->netif); be->netif =NULL ; } -kfree (be);dev_set_drvdata (&dev->dev,NULL ); +up_write (&teardown_sem); +kfree (be); +return 0 ; }
@@ -168,7 +175,7 @@ static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *enDPRINTK ("netback_uevent" ); - be =dev_get_drvdata (&xdev->dev); + be = dev_get_drvdata(&xdev->dev);/if (!be)return 0 ; netif = be->netif;
@@ -187,9 +194,14 @@ static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *enkfree (val); } -if (add_uevent_var (env,"vif=%s" , netif->dev->name)) -return -ENOMEM ; - +down_read (&teardown_sem); + be =dev_get_drvdata (&xdev->dev); +if (be && be->netif) +if (add_uevent_var (env,"vif=%s" , netif->dev->name)) { +up_read (&teardown_sem); +return -ENOMEM ; + } +up_read (&teardown_sem);return 0 ; }
@@ -199,6 +211,7 @@ static void backend_create_netif(struct backend_info *be)int err;long handle;struct xenbus_device *dev = be->dev; +netif_t *netif;if (be->netif !=NULL )return ;
@@ -209,13 +222,13 @@ static void backend_create_netif(struct backend_info *be)return ; } - be->netif =netif_alloc (&dev->dev, dev->otherend_id, handle); -if (IS_ERR (be->netif)) { - err =PTR_ERR (be->netif); - be->netif =NULL ; + netif =netif_alloc (&dev->dev, dev->otherend_id, handle); +if (IS_ERR (netif)) { + err =PTR_ERR (netif);xenbus_dev_fatal (dev, err,"creating interface" );return ; } + be->netif = netif;kobject_uevent (&dev->dev.kobj,KOBJ_ONLINE ); }
drivers/xen/netback/xenbus.c +23 -10
@@ -19,6 +19,7 @@#include <stdarg.h> #include <linux/module.h> +#include <linux/rwsem.h> #include <xen/xenbus.h> #include "common.h"
@@ -28,6 +29,7 @@ printk("netback/xenbus (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args) #endif +static DECLARE_RWSEM(teardown_sem);static int connect_rings (struct backend_info *);static void connect (struct backend_info *);
@@ -41,14 +43,19 @@ static int netback_remove(struct xenbus_device *dev)//netback_remove_accelerators(be, dev); unregister_hotplug_status_watch (be); -if (be->netif) { +if (be->netif)kobject_uevent (&dev->dev.kobj,KOBJ_OFFLINE ); + +down_write (&teardown_sem); +if (be->netif) {xenbus_rm (XBT_NIL , dev->nodename,"hotplug-status" );netif_disconnect (be->netif); be->netif =NULL ; } -kfree (be);dev_set_drvdata (&dev->dev,NULL ); +up_write (&teardown_sem); +kfree (be); +return 0 ; }
@@ -168,7 +175,7 @@ static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *enDPRINTK ("netback_uevent" ); - be =dev_get_drvdata (&xdev->dev); + be = dev_get_drvdata(&xdev->dev);/if (!be)return 0 ; netif = be->netif;
@@ -187,9 +194,14 @@ static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *enkfree (val); } -if (add_uevent_var (env,"vif=%s" , netif->dev->name)) -return -ENOMEM ; - +down_read (&teardown_sem); + be =dev_get_drvdata (&xdev->dev); +if (be && be->netif) +if (add_uevent_var (env,"vif=%s" , netif->dev->name)) { +up_read (&teardown_sem); +return -ENOMEM ; + } +up_read (&teardown_sem);return 0 ; }
@@ -199,6 +211,7 @@ static void backend_create_netif(struct backend_info *be)int err;long handle;struct xenbus_device *dev = be->dev; +netif_t *netif;if (be->netif !=NULL )return ;
@@ -209,13 +222,13 @@ static void backend_create_netif(struct backend_info *be)return ; } - be->netif =netif_alloc (&dev->dev, dev->otherend_id, handle); -if (IS_ERR (be->netif)) { - err =PTR_ERR (be->netif); - be->netif =NULL ; + netif =netif_alloc (&dev->dev, dev->otherend_id, handle); +if (IS_ERR (netif)) { + err =PTR_ERR (netif);xenbus_dev_fatal (dev, err,"creating interface" );return ; } + be->netif = netif;kobject_uevent (&dev->dev.kobj,KOBJ_ONLINE ); }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 67 lines · Konrad Rzeszutek Wilk
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 4 lines
Quoted 2 lines · Konrad Rzeszutek Wilk
For reference, below is the diff for what we're now using.
Ah nice..
I get this:
patch -p1 --dry-run <~/p.patch
patching filedrivers/xen/netback/xenbus.c
Hunk #1 succeeded at 19 with fuzz 1.
Hunk #2 FAILED at 29.
Hunk #3 FAILED at 40.
patch: **** malformed patch at line 120: nv *env)Quoted 4 lines
Quoted 2 lines
If it would not be too much trouble, can you attach it as an attachment?
Sure, here you go.
And attached is it redone against the pv-ops kernel. Let me poke the folks on the BZ to see if they would be willing to test this.
drivers/xen/netback/xenbus.c +9
-2@@ -19,6 +19,7 @@#include <stdarg.h> #include <linux/module.h> +#include <linux/rwsem.h> #include <xen/xenbus.h> #include "common.h" @@ -28,6 +29,7 @@ printk("netback/xenbus (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args) #endif +static DECLARE_RWSEM(teardown_sem);static int connect_rings (struct backend_info *);static void connect (struct backend_info *);@@ -41,14 +43,19 @@ static int netback_remove(struct xenbus_device *dev)//netback_remove_accelerators(be, dev); unregister_hotplug_status_watch (be); -if (be->netif) { +if (be->netif)kobject_uevent (&dev->dev.kobj,KOBJ_OFFLINE ); + +down_write (&teardown_sem); +if (be->netif) {xenbus_rm (XBT_NIL , dev->nodename,"hotplug-status" );netif_disconnect (be->netif); be->netif =NULL ; } -kfree (be);dev_set_drvdata (&dev->dev,NULL ); +up_write (&teardown_sem); +kfree (be); +return 0 ; }
drivers/xen/netback/xenbus.c static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *en · line 179
Quoted 6 lines
drivers/xen/netback/xenbus.c +1
-1@@ -168,7 +175,7 @@ static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *enDPRINTK ("netback_uevent" ); - be =dev_get_drvdata (&xdev->dev); + be = dev_get_drvdata(&xdev->dev);/
Hm. Post-compile typo?
Quoted 5 lines
drivers/xen/netback/xenbus.c +0
-0if (!be)return 0 ;drivers/xen/netback/xenbus.c +0
-0netif = be->netif;@@ -187,9 +194,14 @@ static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *enkfree (val);
drivers/xen/netback/xenbus.c static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *en · line 201
Quoted 10 lines
drivers/xen/netback/xenbus.c +4
-3} -if (add_uevent_var (env,"vif=%s" , netif->dev->name)) -return -ENOMEM ; - +down_read (&teardown_sem); + be =dev_get_drvdata (&xdev->dev); +if (be && be->netif) +if (add_uevent_var (env,"vif=%s" , netif->dev->name)) {
I would tend to fold these into a single if(); the double if looks odd.
Quoted 24 lines
drivers/xen/netback/xenbus.c +5
-4+up_read (&teardown_sem); +return -ENOMEM ; + } +up_read (&teardown_sem);return 0 ; }@@ -199,6 +211,7 @@ static void backend_create_netif(struct backend_info *be)int err;long handle;struct xenbus_device *dev = be->dev; +netif_t *netif;if (be->netif !=NULL )return ;@@ -209,13 +222,13 @@ static void backend_create_netif(struct backend_info *be)return ; } - be->netif =netif_alloc (&dev->dev, dev->otherend_id, handle); -if (IS_ERR (be->netif)) { - err =PTR_ERR (be->netif); - be->netif =NULL ;
drivers/xen/netback/xenbus.c static void backend_create_netif(struct backend_info *be) · line 234
Quoted 10 lines
drivers/xen/netback/xenbus.c +4
-0+ netif =netif_alloc (&dev->dev, dev->otherend_id, handle); +if (IS_ERR (netif)) { + err =PTR_ERR (netif);xenbus_dev_fatal (dev, err,"creating interface" );return ; } + be->netif = netif;kobject_uevent (&dev->dev.kobj,KOBJ_ONLINE ); }
J
Quoted 17 lines · Jeremy Fitzhardinge
Quoted 16 lines · Konrad Rzeszutek Wilk
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 4 lines
Quoted 2 lines · Konrad Rzeszutek Wilk
For reference, below is the diff for what we're now using.
Ah nice..
I get this:
patch -p1 --dry-run <~/p.patch
patching filedrivers/xen/netback/xenbus.c
Hunk #1 succeeded at 19 with fuzz 1.
Hunk #2 FAILED at 29.
Hunk #3 FAILED at 40.
patch: **** malformed patch at line 120: nv *env)
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
If it would not be too much trouble, can you attach it as an attachment?
Sure, here you go.
And attached is it redone against the pv-ops kernel. Let me poke the folks on the BZ to see if they would be willing to test this.
Here is a redux that is compile and regression tested. And I've addressed your concerns Jeremy. Putting this on the BZ to solicit some testing from folks.
drivers/xen/netback/xenbus.c +23 -9
@@ -19,6 +19,7 @@#include <stdarg.h> #include <linux/module.h> +#include <linux/rwsem.h> #include <xen/xenbus.h> #include "common.h"
@@ -28,6 +29,7 @@ printk("netback/xenbus (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args) #endif +static DECLARE_RWSEM(teardown_sem);static int connect_rings (struct backend_info *);static void connect (struct backend_info *);
@@ -41,14 +43,19 @@ static int netback_remove(struct xenbus_device *dev)//netback_remove_accelerators(be, dev); unregister_hotplug_status_watch (be); -if (be->netif) { +if (be->netif)kobject_uevent (&dev->dev.kobj,KOBJ_OFFLINE ); + +down_write (&teardown_sem); +if (be->netif) {xenbus_rm (XBT_NIL , dev->nodename,"hotplug-status" );netif_disconnect (be->netif); be->netif =NULL ; } -kfree (be);dev_set_drvdata (&dev->dev,NULL ); +up_write (&teardown_sem); +kfree (be); +return 0 ; }
@@ -187,9 +194,15 @@ static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *enkfree (val); } -if (add_uevent_var (env,"vif=%s" , netif->dev->name)) -return -ENOMEM ; - +down_read (&teardown_sem); + be =dev_get_drvdata (&xdev->dev); +if (be && be->netif) { +if (add_uevent_var (env,"vif=%s" , netif->dev->name)) { +up_read (&teardown_sem); +return -ENOMEM ; + } + } +up_read (&teardown_sem);return 0 ; }
@@ -199,6 +212,7 @@ static void backend_create_netif(struct backend_info *be)int err;long handle;struct xenbus_device *dev = be->dev; +struct xen_netif *netif;if (be->netif !=NULL )return ;
@@ -209,13 +223,13 @@ static void backend_create_netif(struct backend_info *be)return ; } - be->netif =netif_alloc (&dev->dev, dev->otherend_id, handle); -if (IS_ERR (be->netif)) { - err =PTR_ERR (be->netif); - be->netif =NULL ; + netif =netif_alloc (&dev->dev, dev->otherend_id, handle); +if (IS_ERR (netif)) { + err =PTR_ERR (netif);xenbus_dev_fatal (dev, err,"creating interface" );return ; } + be->netif = netif;kobject_uevent (&dev->dev.kobj,KOBJ_ONLINE ); }
drivers/xen/netback/xenbus.c +23 -9
@@ -19,6 +19,7 @@#include <stdarg.h> #include <linux/module.h> +#include <linux/rwsem.h> #include <xen/xenbus.h> #include "common.h"
@@ -28,6 +29,7 @@ printk("netback/xenbus (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args) #endif +static DECLARE_RWSEM(teardown_sem);static int connect_rings (struct backend_info *);static void connect (struct backend_info *);
@@ -41,14 +43,19 @@ static int netback_remove(struct xenbus_device *dev)//netback_remove_accelerators(be, dev); unregister_hotplug_status_watch (be); -if (be->netif) { +if (be->netif)kobject_uevent (&dev->dev.kobj,KOBJ_OFFLINE ); + +down_write (&teardown_sem); +if (be->netif) {xenbus_rm (XBT_NIL , dev->nodename,"hotplug-status" );netif_disconnect (be->netif); be->netif =NULL ; } -kfree (be);dev_set_drvdata (&dev->dev,NULL ); +up_write (&teardown_sem); +kfree (be); +return 0 ; }
@@ -187,9 +194,15 @@ static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *enkfree (val); } -if (add_uevent_var (env,"vif=%s" , netif->dev->name)) -return -ENOMEM ; - +down_read (&teardown_sem); + be =dev_get_drvdata (&xdev->dev); +if (be && be->netif) { +if (add_uevent_var (env,"vif=%s" , netif->dev->name)) { +up_read (&teardown_sem); +return -ENOMEM ; + } + } +up_read (&teardown_sem);return 0 ; }
@@ -199,6 +212,7 @@ static void backend_create_netif(struct backend_info *be)int err;long handle;struct xenbus_device *dev = be->dev; +struct xen_netif *netif;if (be->netif !=NULL )return ;
@@ -209,13 +223,13 @@ static void backend_create_netif(struct backend_info *be)return ; } - be->netif =netif_alloc (&dev->dev, dev->otherend_id, handle); -if (IS_ERR (be->netif)) { - err =PTR_ERR (be->netif); - be->netif =NULL ; + netif =netif_alloc (&dev->dev, dev->otherend_id, handle); +if (IS_ERR (netif)) { + err =PTR_ERR (netif);xenbus_dev_fatal (dev, err,"creating interface" );return ; } + be->netif = netif;kobject_uevent (&dev->dev.kobj,KOBJ_ONLINE ); }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 48 lines · Konrad Rzeszutek Wilk
Here is a redux that is compile and regression tested. And I've addressed your concerns Jeremy. Putting this on the BZ to solicit some testing from folks.
drivers/xen/netback/xenbus.c +9
-2@@ -19,6 +19,7 @@#include <stdarg.h> #include <linux/module.h> +#include <linux/rwsem.h> #include <xen/xenbus.h> #include "common.h" @@ -28,6 +29,7 @@ printk("netback/xenbus (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args) #endif +static DECLARE_RWSEM(teardown_sem);static int connect_rings (struct backend_info *);static void connect (struct backend_info *);@@ -41,14 +43,19 @@ static int netback_remove(struct xenbus_device *dev)//netback_remove_accelerators(be, dev); unregister_hotplug_status_watch (be); -if (be->netif) { +if (be->netif)kobject_uevent (&dev->dev.kobj,KOBJ_OFFLINE ); + +down_write (&teardown_sem); +if (be->netif) {xenbus_rm (XBT_NIL , dev->nodename,"hotplug-status" );netif_disconnect (be->netif); be->netif =NULL ; } -kfree (be);dev_set_drvdata (&dev->dev,NULL ); +up_write (&teardown_sem); +kfree (be); +return 0 ; }@@ -187,9 +194,15 @@ static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *enkfree (val);
drivers/xen/netback/xenbus.c static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *en · line 201
Quoted 10 lines
drivers/xen/netback/xenbus.c +4
-3} -if (add_uevent_var (env,"vif=%s" , netif->dev->name)) -return -ENOMEM ; - +down_read (&teardown_sem); + be =dev_get_drvdata (&xdev->dev); +if (be && be->netif) { +if (add_uevent_var (env,"vif=%s" , netif->dev->name)) {
The extra {} helps, but I was thinking more along the lines of:
if (be && be->netif && add_uevent_var(env, "vif=%s", netif->dev->name)) {
...(with line break after the second && if that's too long).
Quoted 35 lines
drivers/xen/netback/xenbus.c +10
-4+up_read (&teardown_sem); +return -ENOMEM ; + } + } +up_read (&teardown_sem);return 0 ; }@@ -199,6 +212,7 @@ static void backend_create_netif(struct backend_info *be)int err;long handle;struct xenbus_device *dev = be->dev; +struct xen_netif *netif;if (be->netif !=NULL )return ;@@ -209,13 +223,13 @@ static void backend_create_netif(struct backend_info *be)return ; } - be->netif =netif_alloc (&dev->dev, dev->otherend_id, handle); -if (IS_ERR (be->netif)) { - err =PTR_ERR (be->netif); - be->netif =NULL ; + netif =netif_alloc (&dev->dev, dev->otherend_id, handle); +if (IS_ERR (netif)) { + err =PTR_ERR (netif);xenbus_dev_fatal (dev, err,"creating interface" );return ; } + be->netif = netif;kobject_uevent (&dev->dev.kobj,KOBJ_ONLINE ); }
Set up bridging under Xen 4.1-unstable ( 2.6.31.15 pvops) on top of Ubuntu 10.04 Server
In reply to Konrad Rzeszutek WilkAfter services
1.xencommons
2.xend
3.xendomains
startup xen bridge declaration via /etc/xen/xend-config.sxp completely ignored.
Bridging setup manually via /etc/network/interfaces :-
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
# auto eth0 # iface eth0 inet dhcp auto br0 iface br0 inet static address 192.168.1.7 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 bridge_ports eth0 bridge_stp on bridge_maxwait 0
# /etc/init.d/networking restart
Am i missing something here ?
Boris.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Re: Set up bridging under Xen 4.1-unstable ( 2.6.31.15 pvops) on top of Ubuntu 10.04 Server
Hello Boris,
Dont the default vif scripts connect to xen_br0 and not br0 ?
I specify a different bridge name in the domU config files vif line with bridge=
--
Sander
Quoted 36 lines · you
After services
1.xencommons
2.xend
3.xendomains
startup xen bridge declaration via/etc/xen/xend-config.sxpcompletely ignored.Bridging setup manually via
/etc/network/interfaces:-# The loopback network interface
auto lo
iface lo inet loopback# The primary network interface
# auto eth0 # iface eth0 inet dhcp auto br0 iface br0 inet static address 192.168.1.7 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 bridge_ports eth0 bridge_stp on bridge_maxwait 0# /etc/init.d/networking restartAm i missing something here ?
Boris.
Signature · 2 lines
Best regards, Sander mailto:[email protected]
Re: Set up bridging under Xen 4.1-unstable ( 2.6.31.15 pvops) on top of Ubuntu 10.04 Server
Sander,
I believe, my question is a bit different . I can work with br0 with no problems for DomUs networking.
Up to 4.0.1 i could define bridge in /etc/xen/xend-config.sxp and get this bridge reported by "brctl show" , but now i cannot do that. Seems like manual intervention in Ubuntu /etc/network/interfaces is required.
Boris.
--- On Wed, 7/7/10, Sander Eikelenboom <[email protected]> wrote:
From: Sander Eikelenboom <[email protected]>
Subject: Re: [Xen-devel] Set up bridging under Xen 4.1-unstable ( 2.6.31.15 pvops) on top of Ubuntu 10.04 Server
To: "Boris Derzhavets" <[email protected]>
Cc: "Jeremy Fitzhardinge" <[email protected]>, [email protected], "Konrad Rzeszutek Wilk" <[email protected]>
Date: Wednesday, July 7, 2010, 2:21 PM
Hello Boris,
Dont the default vif scripts connect to xen_br0 and not br0 ?
I specify a different bridge name in the domU config files vif line with bridge=
--
Sander
Quoted 36 lines · you
After services
1.xencommons
2.xend
3.xendomains
startup xen bridge declaration via/etc/xen/xend-config.sxpcompletely ignored.Bridging setup manually via
/etc/network/interfaces:-# The loopback network interface
auto lo
iface lo inet loopback# The primary network interface
# auto eth0 # iface eth0 inet dhcp auto br0 iface br0 inet static address 192.168.1.7 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 bridge_ports eth0 bridge_stp on bridge_maxwait 0# /etc/init.d/networking restartAm i missing something here ?
Boris.
Signature · 8 lines
Best regards, Sander mailto:[email protected] _______________________________________________ Xen-devel mailing list [email protected] http://lists.xensource.com/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Re: Set up bridging under Xen 4.1-unstable ( 2.6.31.15 pvops) on top of Ubuntu 10.04 Server
Quoted 7 lines · Boris Derzhavets
Sander,
I believe, my question is a bit different . I can work with br0 with no problems for DomUs networking.
Up to 4.0.1 i could define bridge in/etc/xen/xend-config.sxpand get this bridge reported by "brctl show" , but now i cannot do that. Seems like manual intervention in Ubuntu/etc/network/interfacesis required.
Yes, a little while ago there was a discussion on the list and the outcome was that the proper way to setup bridges is to use the tools provided by the distro.
However users can still call the old script manually, that is /etc/xen/scripts/network-bridge.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel