linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Drivers: hv: vmbus: fix hv_vmbus load/unload path (again)
@ 2015-04-13 10:56 Vitaly Kuznetsov
  2015-04-13 10:56 ` [PATCH 1/2] Drivers: hv: vmbus: introduce vmbus_acpi_remove Vitaly Kuznetsov
  2015-04-13 10:56 ` [PATCH 2/2] Drivers: hv: vmbus: unregister panic notifier on module unload Vitaly Kuznetsov
  0 siblings, 2 replies; 3+ messages in thread
From: Vitaly Kuznetsov @ 2015-04-13 10:56 UTC (permalink / raw)
  To: K. Y. Srinivasan
  Cc: Haiyang Zhang, devel, linux-kernel, Dexuan Cui, Jake Oshins, Nick Meier

"Drivers: hv: vmbus: introduce vmbus_acpi_remove" patch was sent a while ago
but it wasn't accepted as it collided with Jake's MMIO work. As this work is
still ongoing I suggest we have this small fix for the meantime in the mainline.

"Drivers: hv: vmbus: unregister panic notifier on module unload" patch prevents
a crash on module unload/load back path brought by recently introduced VMbus crash
notifier.

With these two patches I was able to successfuly load/unload/load back hv_vmbus
module under Win2012R2.

Vitaly Kuznetsov (2):
  Drivers: hv: vmbus: introduce vmbus_acpi_remove
  Drivers: hv: vmbus: unregister panic notifier on module unload

 drivers/hv/vmbus_drv.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

-- 
1.9.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] Drivers: hv: vmbus: introduce vmbus_acpi_remove
  2015-04-13 10:56 [PATCH 0/2] Drivers: hv: vmbus: fix hv_vmbus load/unload path (again) Vitaly Kuznetsov
@ 2015-04-13 10:56 ` Vitaly Kuznetsov
  2015-04-13 10:56 ` [PATCH 2/2] Drivers: hv: vmbus: unregister panic notifier on module unload Vitaly Kuznetsov
  1 sibling, 0 replies; 3+ messages in thread
From: Vitaly Kuznetsov @ 2015-04-13 10:56 UTC (permalink / raw)
  To: K. Y. Srinivasan
  Cc: Haiyang Zhang, devel, linux-kernel, Dexuan Cui, Jake Oshins, Nick Meier

In case we do request_resource() in vmbus_acpi_add() we need to tear it down
to be able to load the driver again. Otherwise the following crash in observed
when hv_vmbus unload/load sequence is performed on a Generation2 instance:

[   38.165701] BUG: unable to handle kernel paging request at ffffffffa00075a0
[   38.166315] IP: [<ffffffff8107dc5f>] __request_resource+0x2f/0x50
[   38.166315] PGD 1f34067 PUD 1f35063 PMD 3f723067 PTE 0
[   38.166315] Oops: 0000 [#1] SMP
[   38.166315] Modules linked in: hv_vmbus(+) [last unloaded: hv_vmbus]
[   38.166315] CPU: 0 PID: 267 Comm: modprobe Not tainted 3.19.0-rc5_bug923184+ #486
[   38.166315] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v1.0 11/26/2012
[   38.166315] task: ffff88003f401cb0 ti: ffff88003f60c000 task.ti: ffff88003f60c000
[   38.166315] RIP: 0010:[<ffffffff8107dc5f>]  [<ffffffff8107dc5f>] __request_resource+0x2f/0x50
[   38.166315] RSP: 0018:ffff88003f60fb58  EFLAGS: 00010286
...

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 drivers/hv/vmbus_drv.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index c85235e..0d8d1d7 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1035,6 +1035,15 @@ acpi_walk_err:
 	return ret_val;
 }
 
+static int vmbus_acpi_remove(struct acpi_device *device)
+{
+	int ret = 0;
+
+	if (hyperv_mmio.start && hyperv_mmio.end)
+		ret = release_resource(&hyperv_mmio);
+	return ret;
+}
+
 static const struct acpi_device_id vmbus_acpi_device_ids[] = {
 	{"VMBUS", 0},
 	{"VMBus", 0},
@@ -1047,6 +1056,7 @@ static struct acpi_driver vmbus_acpi_driver = {
 	.ids = vmbus_acpi_device_ids,
 	.ops = {
 		.add = vmbus_acpi_add,
+		.remove = vmbus_acpi_remove,
 	},
 };
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] Drivers: hv: vmbus: unregister panic notifier on module unload
  2015-04-13 10:56 [PATCH 0/2] Drivers: hv: vmbus: fix hv_vmbus load/unload path (again) Vitaly Kuznetsov
  2015-04-13 10:56 ` [PATCH 1/2] Drivers: hv: vmbus: introduce vmbus_acpi_remove Vitaly Kuznetsov
@ 2015-04-13 10:56 ` Vitaly Kuznetsov
  1 sibling, 0 replies; 3+ messages in thread
From: Vitaly Kuznetsov @ 2015-04-13 10:56 UTC (permalink / raw)
  To: K. Y. Srinivasan
  Cc: Haiyang Zhang, devel, linux-kernel, Dexuan Cui, Jake Oshins, Nick Meier

Commit 96c1d0581d00f7abe033350edb021a9d947d8d81 ("Drivers: hv: vmbus: Add
support for VMBus panic notifier handler") introduced
atomic_notifier_chain_register() call on module load. We also need to call
atomic_notifier_chain_unregister() on module unload as otherwise the following
crash is observed when we bring hv_vmbus back:

[   39.788877] BUG: unable to handle kernel paging request at ffffffffa00078a8
[   39.788877] IP: [<ffffffff8109d63f>] notifier_call_chain+0x3f/0x80
...
[   39.788877] Call Trace:
[   39.788877]  [<ffffffff8109de7d>] __atomic_notifier_call_chain+0x5d/0x90
...
[   39.788877]  [<ffffffff8109d788>] ? atomic_notifier_chain_register+0x38/0x70
[   39.788877]  [<ffffffff8109d767>] ? atomic_notifier_chain_register+0x17/0x70
[   39.788877]  [<ffffffffa002814f>] hv_acpi_init+0x14f/0x1000 [hv_vmbus]
[   39.788877]  [<ffffffff81002144>] do_one_initcall+0xd4/0x210
...
[   39.788877] RIP  [<ffffffff8109d63f>] notifier_call_chain+0x3f/0x80

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 drivers/hv/vmbus_drv.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 0d8d1d7..7870a90 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1108,6 +1108,10 @@ static void __exit vmbus_exit(void)
 	hv_synic_clockevents_cleanup();
 	hv_remove_vmbus_irq();
 	vmbus_free_channels();
+	if (ms_hyperv.features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) {
+		atomic_notifier_chain_unregister(&panic_notifier_list,
+						 &hyperv_panic_block);
+	}
 	bus_unregister(&hv_bus);
 	hv_cleanup();
 	for_each_online_cpu(cpu)
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-13 10:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-13 10:56 [PATCH 0/2] Drivers: hv: vmbus: fix hv_vmbus load/unload path (again) Vitaly Kuznetsov
2015-04-13 10:56 ` [PATCH 1/2] Drivers: hv: vmbus: introduce vmbus_acpi_remove Vitaly Kuznetsov
2015-04-13 10:56 ` [PATCH 2/2] Drivers: hv: vmbus: unregister panic notifier on module unload Vitaly Kuznetsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).