virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0000/0004] Drivers: hv: Fixes
@ 2011-12-12 17:28 K. Y. Srinivasan
  2011-12-12 17:29 ` [PATCH 1/4] Drivers: hv: Fix a memory leak K. Y. Srinivasan
  2011-12-12 22:28 ` [PATCH 0000/0004] Drivers: hv: Fixes Greg KH
  0 siblings, 2 replies; 11+ messages in thread
From: K. Y. Srinivasan @ 2011-12-12 17:28 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization, ohering; +Cc: K. Y. Srinivasan

Some fixes to the vmbus driver:

	1. Fix a memory leak in a failure path.

	2. Make vmbus driver unloadable.

	3. Get rid of an unnecessary check in hv_init()
	   in preparation for supporting kexec().

	4. Make it possible to build the vmbus driver as part of the
	   kernel. This patch was submitted earlier, but seems to have been 
	   lost.

Regards,

K. Y

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

* [PATCH 1/4] Drivers: hv: Fix a memory leak
  2011-12-12 17:28 [PATCH 0000/0004] Drivers: hv: Fixes K. Y. Srinivasan
@ 2011-12-12 17:29 ` K. Y. Srinivasan
  2011-12-12 17:29   ` [PATCH 2/4] Drivers: hv: Make the vmbus driver unloadable K. Y. Srinivasan
                     ` (2 more replies)
  2011-12-12 22:28 ` [PATCH 0000/0004] Drivers: hv: Fixes Greg KH
  1 sibling, 3 replies; 11+ messages in thread
From: K. Y. Srinivasan @ 2011-12-12 17:29 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization, ohering
  Cc: K. Y. Srinivasan, Haiyang Zhang

There was a memory leak in a failure path in vmbus_process_offer().
Fix it.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
---
 drivers/hv/channel_mgmt.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 12b85ff..b91af50 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -287,6 +287,7 @@ static void vmbus_process_offer(struct work_struct *work)
 		spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
 		list_del(&newchannel->listentry);
 		spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
+		kfree(newchannel->device_obj);
 
 		free_channel(newchannel);
 	} else {
-- 
1.7.4.1

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

* [PATCH 2/4] Drivers: hv: Make the vmbus driver unloadable
  2011-12-12 17:29 ` [PATCH 1/4] Drivers: hv: Fix a memory leak K. Y. Srinivasan
@ 2011-12-12 17:29   ` K. Y. Srinivasan
  2011-12-12 17:29   ` [PATCH 3/4] Drivers: hv: Get rid of an unnecessary check in hv.c K. Y. Srinivasan
  2011-12-12 17:29   ` [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of the kernel K. Y. Srinivasan
  2 siblings, 0 replies; 11+ messages in thread
From: K. Y. Srinivasan @ 2011-12-12 17:29 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization, ohering
  Cc: K. Y. Srinivasan, Haiyang Zhang

It turns out that the vmbus driver can be made unloadable. Make it
unloadable.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
---
 drivers/hv/channel_mgmt.c |   11 +++++++++++
 drivers/hv/hv.c           |    3 +++
 drivers/hv/hyperv_vmbus.h |    1 +
 drivers/hv/vmbus_drv.c    |   11 +++++++++++
 4 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index b91af50..36484db 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -223,6 +223,17 @@ static void vmbus_process_rescind_offer(struct work_struct *work)
 	vmbus_device_unregister(channel->device_obj);
 }
 
+void vmbus_free_channels(void)
+{
+	struct vmbus_channel *channel;
+
+	list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
+		vmbus_device_unregister(channel->device_obj);
+		kfree(channel->device_obj);
+		free_channel(channel);
+	}
+}
+
 /*
  * vmbus_process_offer - Process the offer by creating a channel/device
  * associated with this offer
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 0fb100e..f8a77d0 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -237,6 +237,9 @@ void hv_cleanup(void)
 {
 	union hv_x64_msr_hypercall_contents hypercall_msr;
 
+	/* Reset our OS id */
+	wrmsrl(HV_X64_MSR_GUEST_OS_ID, 0);
+
 	kfree(hv_context.signal_event_buffer);
 	hv_context.signal_event_buffer = NULL;
 	hv_context.signal_event_param = NULL;
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 0aee112..6d7d286 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -611,6 +611,7 @@ void vmbus_device_unregister(struct hv_device *device_obj);
 
 struct vmbus_channel *relid2channel(u32 relid);
 
+void vmbus_free_channels(void);
 
 /* Connection interface */
 
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 0c048dd..aafee6b 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -779,8 +779,19 @@ cleanup:
 	return ret;
 }
 
+static void __exit vmbus_exit(void)
+{
+
+	free_irq(irq, hv_acpi_dev);
+	vmbus_free_channels();
+	bus_unregister(&hv_bus);
+	hv_cleanup();
+	acpi_bus_unregister_driver(&vmbus_acpi_driver);
+}
+
 
 MODULE_LICENSE("GPL");
 MODULE_VERSION(HV_DRV_VERSION);
 
 module_init(hv_acpi_init);
+module_exit(vmbus_exit);
-- 
1.7.4.1

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

* [PATCH 3/4] Drivers: hv: Get rid of an unnecessary check in hv.c
  2011-12-12 17:29 ` [PATCH 1/4] Drivers: hv: Fix a memory leak K. Y. Srinivasan
  2011-12-12 17:29   ` [PATCH 2/4] Drivers: hv: Make the vmbus driver unloadable K. Y. Srinivasan
@ 2011-12-12 17:29   ` K. Y. Srinivasan
  2011-12-12 17:29   ` [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of the kernel K. Y. Srinivasan
  2 siblings, 0 replies; 11+ messages in thread
From: K. Y. Srinivasan @ 2011-12-12 17:29 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization, ohering
  Cc: K. Y. Srinivasan, Haiyang Zhang

In preparation for eventually supporting kexec in Linux VMs on Hyper-V,
get rid of an unnecessary check in hv_init().

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
---
 drivers/hv/hv.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index f8a77d0..12aa97f 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -164,11 +164,6 @@ int hv_init(void)
 
 	max_leaf = query_hypervisor_info();
 
-	rdmsrl(HV_X64_MSR_GUEST_OS_ID, hv_context.guestid);
-
-	if (hv_context.guestid != 0)
-		goto cleanup;
-
 	/* Write our OS info */
 	wrmsrl(HV_X64_MSR_GUEST_OS_ID, HV_LINUX_GUEST_ID);
 	hv_context.guestid = HV_LINUX_GUEST_ID;
-- 
1.7.4.1

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

* [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of the kernel
  2011-12-12 17:29 ` [PATCH 1/4] Drivers: hv: Fix a memory leak K. Y. Srinivasan
  2011-12-12 17:29   ` [PATCH 2/4] Drivers: hv: Make the vmbus driver unloadable K. Y. Srinivasan
  2011-12-12 17:29   ` [PATCH 3/4] Drivers: hv: Get rid of an unnecessary check in hv.c K. Y. Srinivasan
@ 2011-12-12 17:29   ` K. Y. Srinivasan
  2011-12-12 22:27     ` Greg KH
  2 siblings, 1 reply; 11+ messages in thread
From: K. Y. Srinivasan @ 2011-12-12 17:29 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization, ohering
  Cc: K. Y. Srinivasan, Haiyang Zhang

Support building the vmbus driver as part of the kernel. 

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
---
 drivers/hv/vmbus_drv.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index aafee6b..1d3d809 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -793,5 +793,5 @@ static void __exit vmbus_exit(void)
 MODULE_LICENSE("GPL");
 MODULE_VERSION(HV_DRV_VERSION);
 
-module_init(hv_acpi_init);
+subsys_initcall(hv_acpi_init);
 module_exit(vmbus_exit);
-- 
1.7.4.1

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

* Re: [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of the kernel
  2011-12-12 17:29   ` [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of the kernel K. Y. Srinivasan
@ 2011-12-12 22:27     ` Greg KH
  2011-12-12 23:44       ` KY Srinivasan
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2011-12-12 22:27 UTC (permalink / raw)
  To: K. Y. Srinivasan
  Cc: gregkh, linux-kernel, devel, virtualization, ohering,
	Haiyang Zhang

On Mon, Dec 12, 2011 at 09:29:19AM -0800, K. Y. Srinivasan wrote:
> Support building the vmbus driver as part of the kernel. 
> 
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>

This was already applied to my tree, I don't know why you missed it...

greg k-h

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

* Re: [PATCH 0000/0004] Drivers: hv: Fixes
  2011-12-12 17:28 [PATCH 0000/0004] Drivers: hv: Fixes K. Y. Srinivasan
  2011-12-12 17:29 ` [PATCH 1/4] Drivers: hv: Fix a memory leak K. Y. Srinivasan
@ 2011-12-12 22:28 ` Greg KH
  2011-12-12 23:50   ` KY Srinivasan
  1 sibling, 1 reply; 11+ messages in thread
From: Greg KH @ 2011-12-12 22:28 UTC (permalink / raw)
  To: K. Y. Srinivasan; +Cc: gregkh, linux-kernel, devel, virtualization, ohering

On Mon, Dec 12, 2011 at 09:28:51AM -0800, K. Y. Srinivasan wrote:
> Some fixes to the vmbus driver:
> 
> 	1. Fix a memory leak in a failure path.
> 
> 	2. Make vmbus driver unloadable.
> 
> 	3. Get rid of an unnecessary check in hv_init()
> 	   in preparation for supporting kexec().
> 
> 	4. Make it possible to build the vmbus driver as part of the
> 	   kernel. This patch was submitted earlier, but seems to have been 
> 	   lost.

No, it was not lost, it was applied to my driver-core-next tree a while
ago.  Because of this, I had to hand-edit patch 2 above and skip patch 4
here.

greg k-h

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

* RE: [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of the kernel
  2011-12-12 22:27     ` Greg KH
@ 2011-12-12 23:44       ` KY Srinivasan
  2011-12-12 23:49         ` Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: KY Srinivasan @ 2011-12-12 23:44 UTC (permalink / raw)
  To: Greg KH
  Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
	devel@linuxdriverproject.org, virtualization@lists.osdl.org,
	ohering@suse.com, Haiyang Zhang



> -----Original Message-----
> From: Greg KH [mailto:greg@kroah.com]
> Sent: Monday, December 12, 2011 5:27 PM
> To: KY Srinivasan
> Cc: gregkh@suse.de; linux-kernel@vger.kernel.org;
> devel@linuxdriverproject.org; virtualization@lists.osdl.org; ohering@suse.com;
> Haiyang Zhang
> Subject: Re: [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of
> the kernel
> 
> On Mon, Dec 12, 2011 at 09:29:19AM -0800, K. Y. Srinivasan wrote:
> > Support building the vmbus driver as part of the kernel.
> >
> > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> 
> This was already applied to my tree, I don't know why you missed it...

Thanks Greg. I pulled down your tree yesterday (staging.git) and checked out
the staging-next branch and did not find the fix needed to build this driver
as part of the kernel. I will check again.

Thanks,

K. Y

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

* Re: [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of the kernel
  2011-12-12 23:44       ` KY Srinivasan
@ 2011-12-12 23:49         ` Greg KH
  2011-12-12 23:54           ` KY Srinivasan
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2011-12-12 23:49 UTC (permalink / raw)
  To: KY Srinivasan
  Cc: Greg KH, linux-kernel@vger.kernel.org,
	devel@linuxdriverproject.org, virtualization@lists.osdl.org,
	ohering@suse.com, Haiyang Zhang

On Mon, Dec 12, 2011 at 11:44:30PM +0000, KY Srinivasan wrote:
> 
> 
> > -----Original Message-----
> > From: Greg KH [mailto:greg@kroah.com]
> > Sent: Monday, December 12, 2011 5:27 PM
> > To: KY Srinivasan
> > Cc: gregkh@suse.de; linux-kernel@vger.kernel.org;
> > devel@linuxdriverproject.org; virtualization@lists.osdl.org; ohering@suse.com;
> > Haiyang Zhang
> > Subject: Re: [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of
> > the kernel
> > 
> > On Mon, Dec 12, 2011 at 09:29:19AM -0800, K. Y. Srinivasan wrote:
> > > Support building the vmbus driver as part of the kernel.
> > >
> > > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > > Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> > 
> > This was already applied to my tree, I don't know why you missed it...
> 
> Thanks Greg. I pulled down your tree yesterday (staging.git) and checked out
> the staging-next branch and did not find the fix needed to build this driver
> as part of the kernel. I will check again.

That is because I'm not applying these patches to the staging.git tree,
as the commit messages you get show...

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

* RE: [PATCH 0000/0004] Drivers: hv: Fixes
  2011-12-12 22:28 ` [PATCH 0000/0004] Drivers: hv: Fixes Greg KH
@ 2011-12-12 23:50   ` KY Srinivasan
  0 siblings, 0 replies; 11+ messages in thread
From: KY Srinivasan @ 2011-12-12 23:50 UTC (permalink / raw)
  To: Greg KH
  Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
	devel@linuxdriverproject.org, virtualization@lists.osdl.org,
	ohering@suse.com



> -----Original Message-----
> From: Greg KH [mailto:greg@kroah.com]
> Sent: Monday, December 12, 2011 5:28 PM
> To: KY Srinivasan
> Cc: gregkh@suse.de; linux-kernel@vger.kernel.org;
> devel@linuxdriverproject.org; virtualization@lists.osdl.org; ohering@suse.com
> Subject: Re: [PATCH 0000/0004] Drivers: hv: Fixes
> 
> On Mon, Dec 12, 2011 at 09:28:51AM -0800, K. Y. Srinivasan wrote:
> > Some fixes to the vmbus driver:
> >
> > 	1. Fix a memory leak in a failure path.
> >
> > 	2. Make vmbus driver unloadable.
> >
> > 	3. Get rid of an unnecessary check in hv_init()
> > 	   in preparation for supporting kexec().
> >
> > 	4. Make it possible to build the vmbus driver as part of the
> > 	   kernel. This patch was submitted earlier, but seems to have been
> > 	   lost.
> 
> No, it was not lost, it was applied to my driver-core-next tree a while
> ago.  Because of this, I had to hand-edit patch 2 above and skip patch 4
> here.

Thanks Greg. I will check to see why I got some stale bits yesterday.

Regards,

K. Y

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

* RE: [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of the kernel
  2011-12-12 23:49         ` Greg KH
@ 2011-12-12 23:54           ` KY Srinivasan
  0 siblings, 0 replies; 11+ messages in thread
From: KY Srinivasan @ 2011-12-12 23:54 UTC (permalink / raw)
  To: Greg KH
  Cc: Greg KH, linux-kernel@vger.kernel.org,
	devel@linuxdriverproject.org, virtualization@lists.osdl.org,
	ohering@suse.com, Haiyang Zhang



> -----Original Message-----
> From: Greg KH [mailto:gregkh@suse.de]
> Sent: Monday, December 12, 2011 6:49 PM
> To: KY Srinivasan
> Cc: Greg KH; linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> virtualization@lists.osdl.org; ohering@suse.com; Haiyang Zhang
> Subject: Re: [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of
> the kernel
> 
> On Mon, Dec 12, 2011 at 11:44:30PM +0000, KY Srinivasan wrote:
> >
> >
> > > -----Original Message-----
> > > From: Greg KH [mailto:greg@kroah.com]
> > > Sent: Monday, December 12, 2011 5:27 PM
> > > To: KY Srinivasan
> > > Cc: gregkh@suse.de; linux-kernel@vger.kernel.org;
> > > devel@linuxdriverproject.org; virtualization@lists.osdl.org;
> ohering@suse.com;
> > > Haiyang Zhang
> > > Subject: Re: [PATCH 4/4] Drivers: hv: Support building the vmbus driver as
> part of
> > > the kernel
> > >
> > > On Mon, Dec 12, 2011 at 09:29:19AM -0800, K. Y. Srinivasan wrote:
> > > > Support building the vmbus driver as part of the kernel.
> > > >
> > > > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > > > Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> > >
> > > This was already applied to my tree, I don't know why you missed it...
> >
> > Thanks Greg. I pulled down your tree yesterday (staging.git) and checked out
> > the staging-next branch and did not find the fix needed to build this driver
> > as part of the kernel. I will check again.
> 
> That is because I'm not applying these patches to the staging.git tree,
> as the commit messages you get show...

Oops! Thanks Greg.

Regards,

K. Y
 

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

end of thread, other threads:[~2011-12-12 23:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-12 17:28 [PATCH 0000/0004] Drivers: hv: Fixes K. Y. Srinivasan
2011-12-12 17:29 ` [PATCH 1/4] Drivers: hv: Fix a memory leak K. Y. Srinivasan
2011-12-12 17:29   ` [PATCH 2/4] Drivers: hv: Make the vmbus driver unloadable K. Y. Srinivasan
2011-12-12 17:29   ` [PATCH 3/4] Drivers: hv: Get rid of an unnecessary check in hv.c K. Y. Srinivasan
2011-12-12 17:29   ` [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of the kernel K. Y. Srinivasan
2011-12-12 22:27     ` Greg KH
2011-12-12 23:44       ` KY Srinivasan
2011-12-12 23:49         ` Greg KH
2011-12-12 23:54           ` KY Srinivasan
2011-12-12 22:28 ` [PATCH 0000/0004] Drivers: hv: Fixes Greg KH
2011-12-12 23:50   ` KY Srinivasan

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).