hv: Don't OOPS when can't init vmbus
PATCH 1/1 hv: Don't OOPS when can't init vmbus
The hv vmbus driver was causing an OOPS since it was trying to register drivers on top of the bus even if initialization of the bus has failed for some reason (such as the odd chance someone would run a hv enabled kernel in a non-hv environment).
The following OOPS was happening:
[ 2.822634] kernel BUG at drivers/base/driver.c:227! [ 2.822734] invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC [ 2.822734] CPU 0 [ 2.822734] Pid: 1, comm: swapper Not tainted 3.2.0-rc2-sasha-00146-gc729049-dirty #13 [ 2.822734] RIP: 0010:[<ffffffff81769563>] [<ffffffff81769563>] driver_register+0x1f/0x104 [ 2.822734] RSP: 0018:ffff880012499e00 EFLAGS: 00010246 [ 2.822734] RAX: ffffffff822f9fc0 RBX: ffffffff822fa5e0 RCX: 0000000046494648 [ 2.822734] RDX: 0000000000000000 RSI: 0000000000000003 RDI: ffffffff822fa5e0 [ 2.822734] RBP: ffff880012499e30 R08: 0000000000000002 R09: ffffffff8221ab98 [ 2.822734] R10: ffff880012499c20 R11: 0000000000000000 R12: 0000000000000000 [ 2.822734] R13: ffffffff81ff810a R14: 0000000000000000 R15: 0000000000000000 [ 2.822734] FS: 0000000000000000(0000) GS:ffff880013a00000(0000) knlGS:0000000000000000 [ 2.822734] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 2.822734] CR2: 0000000000000000 CR3: 0000000002205000 CR4: 00000000000406f0 [ 2.822734] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2.822734] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 2.822734] Process swapper (pid: 1, threadinfo ffff880012498000, task ffff880012490000) [ 2.822734] Stack: [ 2.822734] ffff880012499e60 ffffffff822fa5c0 0000000000000000 ffffffff81ff810a [ 2.822734] 0000000000000000 0000000000000000 ffff880012499e60 ffffffff8190f991 [ 2.822734] ffffffff83388110 ffffffff8274d4a8 ffffffff8269a649 0000000000000000 [ 2.822734] Call Trace: [ 2.822734] [<ffffffff8190f991>] __vmbus_driver_register+0x47/0x59 [ 2.822734] [<ffffffff8269a649>] ? hv_acpi_init+0x199/0x199 [ 2.822734] [<ffffffff8269a670>] init_hyperv_utils+0x27/0x29 [ 2.822734] [<ffffffff82656c02>] do_one_initcall+0x7a/0x135 [ 2.822734] [<ffffffff82656da7>] kernel_init+0xea/0x16f [ 2.822734] [<ffffffff81b99144>] kernel_thread_helper+0x4/0x10 [ 2.822734] [<ffffffff81b966b8>] ? retint_restore_args+0x13/0x13 [ 2.822734] [<ffffffff82656cbd>] ? do_one_initcall+0x135/0x135 [ 2.822734] [<ffffffff81b99140>] ? gs_change+0x13/0x13 [ 2.822734] Code: d2 74 07 48 8b 82 d0 00 00 00 c9 c3 55 48 89 e5 41 57 41 56 41 55 41 54 53 48 89 fb 48 83 ec 08 48 8b 47 08 48 83 78 68 00 75 02 <0f> 0b 48 83 78 30 00 74 07 48 83 7f 30 00 75 1c 48 83 78 38 00 [ 2.822734] RIP [<ffffffff81769563>] driver_register+0x1f/0x104 [ 2.822734] RSP <ffff880012499e00>
---
btw, It would be nice if it could also get a MAINTAINERS entry.
I'm pretty sure Greg isn't the maintainer, but his name was on top of the commit signers.
drivers/hv/vmbus_drv.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
drivers/hv/vmbus_drv.c +16 -0
@@ -62,6 +62,14 @@ struct hv_device_info {struct hv_dev_port_info outbound; }; +static int vmbus_exists (void ) +{ +if (hv_acpi_dev ==NULL ) +return -ENODEV ; + +return 0 ; +} +static void get_channel_info (struct hv_device *device,struct hv_device_info *info)
@@ -590,6 +598,10 @@ int __vmbus_driver_register(struct hv_driver *hv_driver, struct module *owner, cpr_info ("registering driver %s\n" , hv_driver->name); + ret =vmbus_exists (); +if (ret <0 ) +return ret; + hv_driver->driver.name = hv_driver->name; hv_driver->driver.owner = owner; hv_driver->driver.mod_name = mod_name;
@@ -614,6 +626,9 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver) {pr_info ("unregistering driver %s\n" , hv_driver->name); +if (!vmbus_exists ()) +return ; +driver_unregister (&hv_driver->driver); }
@@ -776,6 +791,7 @@ static int __init hv_acpi_init(void) cleanup:acpi_bus_unregister_driver (&vmbus_acpi_driver); + hv_acpi_dev =NULL ;return ret; }
Signature · 1 line
1.7.8.rc1
Quoted 9 lines
-----Original Message-----
From: Sasha Levin [mailto:[email protected]]
Sent: Sunday, November 20, 2011 7:48 PM
To: [email protected]
Cc: Sasha Levin; Greg Kroah-Hartman; KY Srinivasan
Subject: [PATCH] hv: Don't OOPS when can't init vmbus
Quoted 4 lines
The hv vmbus driver was causing an OOPS since it was trying to register drivers on top of the bus even if initialization of the bus has failed for some reason (such as the odd chance someone would run a hv enabled kernel in a non-hv environment).
I suspect this must have been the case where the drivers were being built into the kernel?
Quoted 52 lines
The following OOPS was happening:
[ 2.822634] kernel BUG at drivers/base/driver.c:227! [ 2.822734] invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC [ 2.822734] CPU 0 [ 2.822734] Pid: 1, comm: swapper Not tainted 3.2.0-rc2-sasha-00146-gc729049- dirty #13 [ 2.822734] RIP: 0010:[<ffffffff81769563>] [<ffffffff81769563>] driver_register+0x1f/0x104 [ 2.822734] RSP: 0018:ffff880012499e00 EFLAGS: 00010246 [ 2.822734] RAX: ffffffff822f9fc0 RBX: ffffffff822fa5e0 RCX: 0000000046494648 [ 2.822734] RDX: 0000000000000000 RSI: 0000000000000003 RDI: ffffffff822fa5e0 [ 2.822734] RBP: ffff880012499e30 R08: 0000000000000002 R09: ffffffff8221ab98 [ 2.822734] R10: ffff880012499c20 R11: 0000000000000000 R12: 0000000000000000 [ 2.822734] R13: ffffffff81ff810a R14: 0000000000000000 R15: 0000000000000000 [ 2.822734] FS: 0000000000000000(0000) GS:ffff880013a00000(0000) knlGS:0000000000000000 [ 2.822734] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 2.822734] CR2: 0000000000000000 CR3: 0000000002205000 CR4: 00000000000406f0 [ 2.822734] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2.822734] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 2.822734] Process swapper (pid: 1, threadinfo ffff880012498000, task ffff880012490000) [ 2.822734] Stack: [ 2.822734] ffff880012499e60 ffffffff822fa5c0 0000000000000000 ffffffff81ff810a [ 2.822734] 0000000000000000 0000000000000000 ffff880012499e60 ffffffff8190f991 [ 2.822734] ffffffff83388110 ffffffff8274d4a8 ffffffff8269a649 0000000000000000 [ 2.822734] Call Trace: [ 2.822734] [<ffffffff8190f991>] __vmbus_driver_register+0x47/0x59 [ 2.822734] [<ffffffff8269a649>] ? hv_acpi_init+0x199/0x199 [ 2.822734] [<ffffffff8269a670>] init_hyperv_utils+0x27/0x29 [ 2.822734] [<ffffffff82656c02>] do_one_initcall+0x7a/0x135 [ 2.822734] [<ffffffff82656da7>] kernel_init+0xea/0x16f [ 2.822734] [<ffffffff81b99144>] kernel_thread_helper+0x4/0x10 [ 2.822734] [<ffffffff81b966b8>] ? retint_restore_args+0x13/0x13 [ 2.822734] [<ffffffff82656cbd>] ? do_one_initcall+0x135/0x135 [ 2.822734] [<ffffffff81b99140>] ? gs_change+0x13/0x13 [ 2.822734] Code: d2 74 07 48 8b 82 d0 00 00 00 c9 c3 55 48 89 e5 41 57 41 56 41 55 41 54 53 48 89 fb 48 83 ec 08 48 8b 47 08 48 83 78 68 00 75 02 <0f> 0b 48 83 78 30 00 74 07 48 83 7f 30 00 75 1c 48 83 78 38 00 [ 2.822734] RIP [<ffffffff81769563>] driver_register+0x1f/0x104 [ 2.822734] RSP <ffff880012499e00>Cc Greg Kroah-Hartman <[email protected]>Cc "K. Y. Srinivasan" <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 6 lines
---
btw, It would be nice if it could also get a
MAINTAINERSentry.I'm pretty sure Greg isn't the maintainer, but his name was on top of the commit signers.
Yes; I am going to fix this very shortly.
Quoted 45 lines
drivers/hv/vmbus_drv.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)drivers/hv/vmbus_drv.c +12
-0@@ -62,6 +62,14 @@ struct hv_device_info {struct hv_dev_port_info outbound; }; +static int vmbus_exists (void ) +{ +if (hv_acpi_dev ==NULL ) +return -ENODEV ; + +return 0 ; +} +static void get_channel_info (struct hv_device *device,struct hv_device_info *info)@@ -590,6 +598,10 @@ int __vmbus_driver_register(struct hv_driver *hv_driver, struct module *owner, cpr_info ("registering driver %s\n" , hv_driver->name); + ret =vmbus_exists (); +if (ret <0 ) +return ret; + hv_driver->driver.name = hv_driver->name; hv_driver->driver.owner = owner;drivers/hv/vmbus_drv.c +3
-0hv_driver->driver.mod_name = mod_name;@@ -614,6 +626,9 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver) {pr_info ("unregistering driver %s\n" , hv_driver->name); +if (!vmbus_exists ()) +return ; +driver_unregister (&hv_driver->driver);
Quoted 1 line
}
While this is harmless; I think this might be redundant. Once register succeeds, unregister cannot fail.
Quoted 10 lines
drivers/hv/vmbus_drv.c +1
-1@@ -776,6 +791,7 @@ static int __init hv_acpi_init(void) cleanup:acpi_bus_unregister_driver (&vmbus_acpi_driver); + hv_acpi_dev =NULL ;return ret; } --1.7.8.rc1
Thanks Sasha.
Regards,
K. Y
Quoted 8 lines · KY Srinivasan
Quoted 8 lines
-----Original Message-----
From: Sasha Levin [mailto:[email protected]]
Sent: Sunday, November 20, 2011 7:48 PM
To: [email protected]
Cc: Sasha Levin; Greg Kroah-Hartman; KY Srinivasan
Subject: [PATCH] hv: Don't OOPS when can't init vmbus
Quoted 6 lines
Quoted 4 lines
The hv vmbus driver was causing an OOPS since it was trying to register drivers on top of the bus even if initialization of the bus has failed for some reason (such as the odd chance someone would run a hv enabled kernel in a non-hv environment).
I suspect this must have been the case where the drivers were being built into the kernel?
Yup.
Quoted 107 lines
Quoted 53 lines
The following OOPS was happening:
[ 2.822634] kernel BUG at drivers/base/driver.c:227! [ 2.822734] invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC [ 2.822734] CPU 0 [ 2.822734] Pid: 1, comm: swapper Not tainted 3.2.0-rc2-sasha-00146-gc729049- dirty #13 [ 2.822734] RIP: 0010:[<ffffffff81769563>] [<ffffffff81769563>] driver_register+0x1f/0x104 [ 2.822734] RSP: 0018:ffff880012499e00 EFLAGS: 00010246 [ 2.822734] RAX: ffffffff822f9fc0 RBX: ffffffff822fa5e0 RCX: 0000000046494648 [ 2.822734] RDX: 0000000000000000 RSI: 0000000000000003 RDI: ffffffff822fa5e0 [ 2.822734] RBP: ffff880012499e30 R08: 0000000000000002 R09: ffffffff8221ab98 [ 2.822734] R10: ffff880012499c20 R11: 0000000000000000 R12: 0000000000000000 [ 2.822734] R13: ffffffff81ff810a R14: 0000000000000000 R15: 0000000000000000 [ 2.822734] FS: 0000000000000000(0000) GS:ffff880013a00000(0000) knlGS:0000000000000000 [ 2.822734] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 2.822734] CR2: 0000000000000000 CR3: 0000000002205000 CR4: 00000000000406f0 [ 2.822734] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2.822734] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 2.822734] Process swapper (pid: 1, threadinfo ffff880012498000, task ffff880012490000) [ 2.822734] Stack: [ 2.822734] ffff880012499e60 ffffffff822fa5c0 0000000000000000 ffffffff81ff810a [ 2.822734] 0000000000000000 0000000000000000 ffff880012499e60 ffffffff8190f991 [ 2.822734] ffffffff83388110 ffffffff8274d4a8 ffffffff8269a649 0000000000000000 [ 2.822734] Call Trace: [ 2.822734] [<ffffffff8190f991>] __vmbus_driver_register+0x47/0x59 [ 2.822734] [<ffffffff8269a649>] ? hv_acpi_init+0x199/0x199 [ 2.822734] [<ffffffff8269a670>] init_hyperv_utils+0x27/0x29 [ 2.822734] [<ffffffff82656c02>] do_one_initcall+0x7a/0x135 [ 2.822734] [<ffffffff82656da7>] kernel_init+0xea/0x16f [ 2.822734] [<ffffffff81b99144>] kernel_thread_helper+0x4/0x10 [ 2.822734] [<ffffffff81b966b8>] ? retint_restore_args+0x13/0x13 [ 2.822734] [<ffffffff82656cbd>] ? do_one_initcall+0x135/0x135 [ 2.822734] [<ffffffff81b99140>] ? gs_change+0x13/0x13 [ 2.822734] Code: d2 74 07 48 8b 82 d0 00 00 00 c9 c3 55 48 89 e5 41 57 41 56 41 55 41 54 53 48 89 fb 48 83 ec 08 48 8b 47 08 48 83 78 68 00 75 02 <0f> 0b 48 83 78 30 00 74 07 48 83 7f 30 00 75 1c 48 83 78 38 00 [ 2.822734] RIP [<ffffffff81769563>] driver_register+0x1f/0x104 [ 2.822734] RSP <ffff880012499e00>Cc Greg Kroah-Hartman <[email protected]>Cc "K. Y. Srinivasan" <[email protected]>Signed-off-by Sasha Levin <[email protected]>Quoted 6 lines
---
btw, It would be nice if it could also get a
MAINTAINERSentry.I'm pretty sure Greg isn't the maintainer, but his name was on top of the commit signers.
Yes; I am going to fix this very shortly.
Quoted 45 lines
drivers/hv/vmbus_drv.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)drivers/hv/vmbus_drv.c +12
-0@@ -62,6 +62,14 @@ struct hv_device_info {struct hv_dev_port_info outbound; }; +static int vmbus_exists (void ) +{ +if (hv_acpi_dev ==NULL ) +return -ENODEV ; + +return 0 ; +} +static void get_channel_info (struct hv_device *device,struct hv_device_info *info)@@ -590,6 +598,10 @@ int __vmbus_driver_register(struct hv_driver *hv_driver, struct module *owner, cpr_info ("registering driver %s\n" , hv_driver->name); + ret =vmbus_exists (); +if (ret <0 ) +return ret; + hv_driver->driver.name = hv_driver->name; hv_driver->driver.owner = owner;drivers/hv/vmbus_drv.c +3
-0hv_driver->driver.mod_name = mod_name;@@ -614,6 +626,9 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver) {pr_info ("unregistering driver %s\n" , hv_driver->name); +if (!vmbus_exists ()) +return ; +driver_unregister (&hv_driver->driver);
Quoted 4 lines
Quoted 1 line
}
While this is harmless; I think this might be redundant. Once register succeeds, unregister cannot fail.
driver_unregister() is supposed to trigger a warning if you're trying to unregister a non-registered driver. So even if it can't fail we should avoid a possible warning.
Quoted 20 lines
Quoted 11 lines
drivers/hv/vmbus_drv.c +1
-1@@ -776,6 +791,7 @@ static int __init hv_acpi_init(void) cleanup:acpi_bus_unregister_driver (&vmbus_acpi_driver); + hv_acpi_dev =NULL ;return ret; } --1.7.8.rc1
Thanks Sasha.
Regards,
K. Y
Signature · 1 line
Sasha.
Ping? Did it go anywhere?
Quoted 155 lines · Sasha Levin
Quoted 8 lines · KY Srinivasan
Quoted 8 lines
-----Original Message-----
From: Sasha Levin [mailto:[email protected]]
Sent: Sunday, November 20, 2011 7:48 PM
To: [email protected]
Cc: Sasha Levin; Greg Kroah-Hartman; KY Srinivasan
Subject: [PATCH] hv: Don't OOPS when can't init vmbusQuoted 6 lines
Quoted 4 lines
The hv vmbus driver was causing an OOPS since it was trying to register drivers on top of the bus even if initialization of the bus has failed for some reason (such as the odd chance someone would run a hv enabled kernel in a non-hv environment).
I suspect this must have been the case where the drivers were being built into the kernel?
Yup.
Quoted 107 lines
Quoted 53 lines
The following OOPS was happening:
[ 2.822634] kernel BUG at drivers/base/driver.c:227! [ 2.822734] invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC [ 2.822734] CPU 0 [ 2.822734] Pid: 1, comm: swapper Not tainted 3.2.0-rc2-sasha-00146-gc729049- dirty #13 [ 2.822734] RIP: 0010:[<ffffffff81769563>] [<ffffffff81769563>] driver_register+0x1f/0x104 [ 2.822734] RSP: 0018:ffff880012499e00 EFLAGS: 00010246 [ 2.822734] RAX: ffffffff822f9fc0 RBX: ffffffff822fa5e0 RCX: 0000000046494648 [ 2.822734] RDX: 0000000000000000 RSI: 0000000000000003 RDI: ffffffff822fa5e0 [ 2.822734] RBP: ffff880012499e30 R08: 0000000000000002 R09: ffffffff8221ab98 [ 2.822734] R10: ffff880012499c20 R11: 0000000000000000 R12: 0000000000000000 [ 2.822734] R13: ffffffff81ff810a R14: 0000000000000000 R15: 0000000000000000 [ 2.822734] FS: 0000000000000000(0000) GS:ffff880013a00000(0000) knlGS:0000000000000000 [ 2.822734] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 2.822734] CR2: 0000000000000000 CR3: 0000000002205000 CR4: 00000000000406f0 [ 2.822734] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2.822734] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 2.822734] Process swapper (pid: 1, threadinfo ffff880012498000, task ffff880012490000) [ 2.822734] Stack: [ 2.822734] ffff880012499e60 ffffffff822fa5c0 0000000000000000 ffffffff81ff810a [ 2.822734] 0000000000000000 0000000000000000 ffff880012499e60 ffffffff8190f991 [ 2.822734] ffffffff83388110 ffffffff8274d4a8 ffffffff8269a649 0000000000000000 [ 2.822734] Call Trace: [ 2.822734] [<ffffffff8190f991>] __vmbus_driver_register+0x47/0x59 [ 2.822734] [<ffffffff8269a649>] ? hv_acpi_init+0x199/0x199 [ 2.822734] [<ffffffff8269a670>] init_hyperv_utils+0x27/0x29 [ 2.822734] [<ffffffff82656c02>] do_one_initcall+0x7a/0x135 [ 2.822734] [<ffffffff82656da7>] kernel_init+0xea/0x16f [ 2.822734] [<ffffffff81b99144>] kernel_thread_helper+0x4/0x10 [ 2.822734] [<ffffffff81b966b8>] ? retint_restore_args+0x13/0x13 [ 2.822734] [<ffffffff82656cbd>] ? do_one_initcall+0x135/0x135 [ 2.822734] [<ffffffff81b99140>] ? gs_change+0x13/0x13 [ 2.822734] Code: d2 74 07 48 8b 82 d0 00 00 00 c9 c3 55 48 89 e5 41 57 41 56 41 55 41 54 53 48 89 fb 48 83 ec 08 48 8b 47 08 48 83 78 68 00 75 02 <0f> 0b 48 83 78 30 00 74 07 48 83 7f 30 00 75 1c 48 83 78 38 00 [ 2.822734] RIP [<ffffffff81769563>] driver_register+0x1f/0x104 [ 2.822734] RSP <ffff880012499e00>Cc Greg Kroah-Hartman <[email protected]>Cc "K. Y. Srinivasan" <[email protected]>Signed-off-by Sasha Levin <[email protected]>Quoted 6 lines
---
btw, It would be nice if it could also get a
MAINTAINERSentry.I'm pretty sure Greg isn't the maintainer, but his name was on top of the commit signers.
Yes; I am going to fix this very shortly.
Quoted 45 lines
drivers/hv/vmbus_drv.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)drivers/hv/vmbus_drv.c +12
-0@@ -62,6 +62,14 @@ struct hv_device_info {struct hv_dev_port_info outbound; }; +static int vmbus_exists (void ) +{ +if (hv_acpi_dev ==NULL ) +return -ENODEV ; + +return 0 ; +} +static void get_channel_info (struct hv_device *device,struct hv_device_info *info)@@ -590,6 +598,10 @@ int __vmbus_driver_register(struct hv_driver *hv_driver, struct module *owner, cpr_info ("registering driver %s\n" , hv_driver->name); + ret =vmbus_exists (); +if (ret <0 ) +return ret; + hv_driver->driver.name = hv_driver->name; hv_driver->driver.owner = owner;drivers/hv/vmbus_drv.c +3
-0hv_driver->driver.mod_name = mod_name;@@ -614,6 +626,9 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver) {pr_info ("unregistering driver %s\n" , hv_driver->name); +if (!vmbus_exists ()) +return ; +driver_unregister (&hv_driver->driver);Quoted 4 lines
Quoted 1 line
}
While this is harmless; I think this might be redundant. Once register succeeds, unregister cannot fail.
driver_unregister()is supposed to trigger a warning if you're trying to unregister a non-registered driver. So even if it can't fail we should avoid a possible warning.Quoted 20 lines
Quoted 11 lines
drivers/hv/vmbus_drv.c +1
-1@@ -776,6 +791,7 @@ static int __init hv_acpi_init(void) cleanup:acpi_bus_unregister_driver (&vmbus_acpi_driver); + hv_acpi_dev =NULL ;return ret; } --1.7.8.rc1
Thanks Sasha.
Regards,
K. Y
Signature · 1 line
Sasha.
Quoted 10 lines
-----Original Message-----
From: Sasha Levin [mailto:[email protected]]
Sent: Thursday, December 01, 2011 10:38 AM
To: KY Srinivasan
Cc: [email protected]; Greg Kroah-Hartman
Subject: RE: [PATCH] hv: Don't OOPS when can't init vmbusPing? Did it go anywhere?
I think I acked it; if not I am acking it now. I don't know if Greg dropped this patch.
Regards,
K. Y
Quoted 174 lines · Sasha Levin
Quoted 10 lines · KY Srinivasan
Quoted 9 lines
Quoted 9 lines
-----Original Message-----
From: Sasha Levin [mailto:[email protected]]
Sent: Sunday, November 20, 2011 7:48 PM
To: [email protected]
Cc: Sasha Levin; Greg Kroah-Hartman; KY Srinivasan
Subject: [PATCH] hv: Don't OOPS when can't init vmbusThe hv vmbus driver was causing an OOPS since it was trying to register
drivers
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
on top of the bus even if initialization of the bus has failed for some reason (such as the odd chance someone would run a hv enabled kernel in
a
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
non-hv environment).
I suspect this must have been the case where the drivers were being built
into the kernel?
Quoted 11 lines
Yup.
Quoted 8 lines
Quoted 8 lines
The following OOPS was happening:
[ 2.822634] kernel BUG at drivers/base/driver.c:227! [ 2.822734] invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC [ 2.822734] CPU 0 [ 2.822734] Pid: 1, comm: swapper Not tainted 3.2.0-rc2-sasha-00146-gc729049-
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
dirty #13
[ 2.822734] RIP: 0010:[<ffffffff81769563>] [<ffffffff81769563>] driver_register+0x1f/0x104 [ 2.822734] RSP: 0018:ffff880012499e00 EFLAGS: 00010246 [ 2.822734] RAX: ffffffff822f9fc0 RBX: ffffffff822fa5e0 RCX:0000000046494648
Quoted 1 line
Quoted 1 line
Quoted 1 line
[ 2.822734] RDX: 0000000000000000 RSI: 0000000000000003 RDI:
ffffffff822fa5e0Quoted 1 line
Quoted 1 line
Quoted 1 line
[ 2.822734] RBP: ffff880012499e30 R08: 0000000000000002 R09:
ffffffff8221ab98Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[ 2.822734] R10: ffff880012499c20 R11: 0000000000000000 R12: 0000000000000000 [ 2.822734] R13: ffffffff81ff810a R14: 0000000000000000 R15:0000000000000000
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
[ 2.822734] FS: 0000000000000000(0000) GS:ffff880013a00000(0000) knlGS:0000000000000000 [ 2.822734] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 2.822734] CR2: 0000000000000000 CR3: 0000000002205000 CR4:
00000000000406f0Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
[ 2.822734] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2.822734] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 2.822734] Process swapper (pid: 1, threadinfo ffff880012498000, task ffff880012490000) [ 2.822734] Stack: [ 2.822734] ffff880012499e60 ffffffff822fa5c0 0000000000000000
ffffffff81ff810aQuoted 3 lines
Quoted 3 lines
Quoted 3 lines
[ 2.822734] 0000000000000000 0000000000000000 ffff880012499e60 ffffffff8190f991 [ 2.822734] ffffffff83388110 ffffffff8274d4a8 ffffffff8269a6490000000000000000
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
[ 2.822734] Call Trace: [ 2.822734] [<ffffffff8190f991>] __vmbus_driver_register+0x47/0x59 [ 2.822734] [<ffffffff8269a649>] ? hv_acpi_init+0x199/0x199 [ 2.822734] [<ffffffff8269a670>] init_hyperv_utils+0x27/0x29 [ 2.822734] [<ffffffff82656c02>] do_one_initcall+0x7a/0x135 [ 2.822734] [<ffffffff82656da7>] kernel_init+0xea/0x16f [ 2.822734] [<ffffffff81b99144>] kernel_thread_helper+0x4/0x10 [ 2.822734] [<ffffffff81b966b8>] ? retint_restore_args+0x13/0x13 [ 2.822734] [<ffffffff82656cbd>] ? do_one_initcall+0x135/0x135 [ 2.822734] [<ffffffff81b99140>] ? gs_change+0x13/0x13 [ 2.822734] Code: d2 74 07 48 8b 82 d0 00 00 00 c9 c3 55 48 89 e5 41 57 41 5641 55
Quoted 1 line
Quoted 1 line
Quoted 1 line
41 54 53 48 89 fb 48 83 ec 08 48 8b 47 08 48 83 78 68 00 75 02 <0f> 0b 48 83 78
30 00
Quoted 61 lines
Quoted 61 lines
Quoted 7 lines
74 07 48 83 7f 30 00 75 1c 48 83 78 38 00
[ 2.822734] RIP [<ffffffff81769563>] driver_register+0x1f/0x104 [ 2.822734] RSP <ffff880012499e00>Cc Greg Kroah-Hartman <[email protected]>Cc "K. Y. Srinivasan" <[email protected]>Signed-off-by Sasha Levin <[email protected]>Quoted 6 lines
---
btw, It would be nice if it could also get a
MAINTAINERSentry.I'm pretty sure Greg isn't the maintainer, but his name was on top of the commit signers.
Yes; I am going to fix this very shortly.
Quoted 45 lines
drivers/hv/vmbus_drv.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)drivers/hv/vmbus_drv.c +12
-0@@ -62,6 +62,14 @@ struct hv_device_info {struct hv_dev_port_info outbound; }; +static int vmbus_exists (void ) +{ +if (hv_acpi_dev ==NULL ) +return -ENODEV ; + +return 0 ; +} +static void get_channel_info (struct hv_device *device,struct hv_device_info *info)@@ -590,6 +598,10 @@ int __vmbus_driver_register(struct hv_driver *hv_driver, struct module *owner, cpr_info ("registering driver %s\n" , hv_driver->name); + ret =vmbus_exists (); +if (ret <0 ) +return ret; + hv_driver->driver.name = hv_driver->name; hv_driver->driver.owner = owner;drivers/hv/vmbus_drv.c +3
-0hv_driver->driver.mod_name = mod_name;@@ -614,6 +626,9 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver) {pr_info ("unregistering driver %s\n" , hv_driver->name); +if (!vmbus_exists ()) +return ; +driver_unregister (&hv_driver->driver);Quoted 30 lines
Quoted 4 lines
Quoted 1 line
}
While this is harmless; I think this might be redundant. Once register succeeds, unregister cannot fail.
driver_unregister()is supposed to trigger a warning if you're trying to unregister a non-registered driver. So even if it can't fail we should avoid a possible warning.Quoted 20 lines
Quoted 11 lines
drivers/hv/vmbus_drv.c +1
-1@@ -776,6 +791,7 @@ static int __init hv_acpi_init(void) cleanup:acpi_bus_unregister_driver (&vmbus_acpi_driver); + hv_acpi_dev =NULL ;return ret; } --1.7.8.rc1
Thanks Sasha.
Regards,
K. Y
--
Sasha.
Quoted 9 lines · KY Srinivasan
Quoted 9 lines
-----Original Message-----
From: Sasha Levin [mailto:[email protected]]
Sent: Thursday, December 01, 2011 10:38 AM
To: KY Srinivasan
Cc: [email protected]; Greg Kroah-Hartman
Subject: RE: [PATCH] hv: Don't OOPS when can't init vmbus
Quoted 4 lines
Quoted 1 line
Ping? Did it go anywhere?
I think I acked it; if not I am acking it now. I don't know if Greg dropped this patch.
I did as I thought you said you would take care of it.
KY, can you please resend it with your ack?
thanks,
greg k-h
Quoted 19 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Thursday, December 01, 2011 10:48 AM
To: KY Srinivasan
Cc: Sasha Levin; [email protected]
Subject: Re: [PATCH] hv: Don't OOPS when can't init vmbusQuoted 9 lines · KY Srinivasan
Quoted 9 lines
-----Original Message-----
From: Sasha Levin [mailto:[email protected]]
Sent: Thursday, December 01, 2011 10:38 AM
To: KY Srinivasan
Cc: [email protected]; Greg Kroah-Hartman
Subject: RE: [PATCH] hv: Don't OOPS when can't init vmbus
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Ping? Did it go anywhere?
I think I acked it; if not I am acking it now. I don't know if Greg dropped this patch.
I did as I thought you said you would take care of it.
KY, can you please resend it with your ack?
Sasha,
Do you want to resend the patch to Greg with my ack.
Regards,
K. Y
Quoted 24 lines · KY Srinivasan
Quoted 24 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Thursday, December 01, 2011 10:48 AM
To: KY Srinivasan
Cc: Sasha Levin; [email protected]
Subject: Re: [PATCH] hv: Don't OOPS when can't init vmbusQuoted 13 lines · KY Srinivasan
Quoted 10 lines
-----Original Message-----
From: Sasha Levin [mailto:[email protected]]
Sent: Thursday, December 01, 2011 10:38 AM
To: KY Srinivasan
Cc: [email protected]; Greg Kroah-Hartman
Subject: RE: [PATCH] hv: Don't OOPS when can't init vmbusPing? Did it go anywhere?
I think I acked it; if not I am acking it now. I don't know if Greg dropped this patch.
Quoted 7 lines
Quoted 3 lines
I did as I thought you said you would take care of it.
KY, can you please resend it with your ack?
Sasha,
Do you want to resend the patch to Greg with my ack.
Um, the maintainers job (i.e. you) is to collect stuff like this and push it upstream (i.e. to me), is this not going to be possible for some reason with this, and future patches?
thanks,
greg k-h
Quoted 38 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Thursday, December 01, 2011 11:21 AM
To: KY Srinivasan
Cc: Sasha Levin; [email protected]
Subject: Re: [PATCH] hv: Don't OOPS when can't init vmbusQuoted 28 lines · KY Srinivasan
Quoted 27 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Thursday, December 01, 2011 10:48 AM
To: KY Srinivasan
Cc: Sasha Levin; [email protected]
Subject: Re: [PATCH] hv: Don't OOPS when can't init vmbusQuoted 9 lines · KY Srinivasan
Quoted 9 lines
-----Original Message-----
From: Sasha Levin [mailto:[email protected]]
Sent: Thursday, December 01, 2011 10:38 AM
To: KY Srinivasan
Cc: [email protected]; Greg Kroah-Hartman
Subject: RE: [PATCH] hv: Don't OOPS when can't init vmbusQuoted 4 lines
Quoted 1 line
Ping? Did it go anywhere?
I think I acked it; if not I am acking it now. I don't know if Greg dropped this patch.
I did as I thought you said you would take care of it.
KY, can you please resend it with your ack?
Quoted 7 lines
Quoted 3 lines
Sasha,
Do you want to resend the patch to Greg with my ack.
Um, the maintainers job (i.e. you) is to collect stuff like this and push it upstream (i.e. to me), is this not going to be possible for some reason with this, and future patches?
Ok; I was not sure of the workflow here. I will send you the patch shortly. Sorry for the confusion.
Regards,
K. Y