Drivers: hv: Fixes
Subsystems (2)
cover Drivers: hv: Fixes
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
PATCH 1/4 Drivers: hv: Fix a memory leak
There was a memory leak in a failure path in vmbus_process_offer(). Fix it.
--- drivers/hv/channel_mgmt.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/hv/channel_mgmt.c +1 -0
@@ -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 {
Signature · 1 line
1.7.4.1
PATCH 2/4 Drivers: hv: Make the vmbus driver unloadable
It turns out that the vmbus driver can be made unloadable. Make it unloadable.
--- 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(-)
drivers/hv/channel_mgmt.c +11 -0
@@ -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
drivers/hv/hv.c +3 -0
@@ -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 ;
drivers/hv/hyperv_vmbus.h +1 -0
@@ -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 */
drivers/hv/vmbus_drv.c +11 -0
@@ -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);
Signature · 1 line
1.7.4.1
PATCH 3/4 Drivers: hv: Get rid of an unnecessary check in hv.c
In reply to K. Y. SrinivasanIn preparation for eventually supporting kexec in Linux VMs on Hyper-V, get rid of an unnecessary check in hv_init().
--- drivers/hv/hv.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
drivers/hv/hv.c +0 -5
@@ -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 ;
Signature · 1 line
1.7.4.1
PATCH 4/4 Drivers: hv: Support building the vmbus driver as part of the kernel
In reply to K. Y. SrinivasanSupport building the vmbus driver as part of the kernel.
--- drivers/hv/vmbus_drv.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hv/vmbus_drv.c +1 -1
@@ -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);
Signature · 1 line
1.7.4.1
Re: [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of the kernel
Quoted 4 lines · K. Y. Srinivasan
Support building the vmbus driver as part of the kernel.
Signed-off-by K. Y. Srinivasan <[email protected]>Signed-off-by Haiyang Zhang <[email protected]>
This was already applied to my tree, I don't know why you missed it...
greg k-h
RE: [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of the kernel
Quoted 12 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Monday, December 12, 2011 5:27 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang
Subject: Re: [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of the kernel
Quoted 7 lines
Quoted 4 lines · K. Y. Srinivasan
Support building the vmbus driver as part of the kernel.
Signed-off-by K. Y. Srinivasan <[email protected]>Signed-off-by Haiyang Zhang <[email protected]>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
Re: [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of the kernel
Quoted 15 lines · KY Srinivasan
Quoted 15 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Monday, December 12, 2011 5:27 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang
Subject: Re: [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of the kernelQuoted 2 lines · K. Y. Srinivasan
Support building the vmbus driver as part of the kernel.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Signed-off-by K. Y. Srinivasan <[email protected]>Signed-off-by Haiyang Zhang <[email protected]>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...
RE: [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of the kernel
Quoted 32 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Monday, December 12, 2011 6:49 PM
To: KY Srinivasan
Cc: Greg KH; [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang
Subject: Re: [PATCH 4/4] Drivers: hv: Support building the vmbus driver as part of the kernelQuoted 8 lines · KY Srinivasan
Quoted 8 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Monday, December 12, 2011 5:27 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected];Quoted 2 lines
Quoted 2 lines
Haiyang Zhang
Subject: Re: [PATCH 4/4] Drivers: hv: Support building the vmbus driver aspart of
Quoted 8 lines
Quoted 8 lines
the kernel
Quoted 4 lines · K. Y. Srinivasan
Support building the vmbus driver as part of the kernel.
Signed-off-by K. Y. Srinivasan <[email protected]>Signed-off-by Haiyang Zhang <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
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
Quoted 4 lines · K. Y. Srinivasan
Some fixes to the vmbus driver:
1. Fix a memory leak in a failure path.
Quoted 8 lines
2. Make vmbus driver unloadable.
3. Get rid of an unnecessary check in
hv_init()in preparation for supportingkexec().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
Quoted 20 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Monday, December 12, 2011 5:28 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 0000/0004] Drivers: hv: FixesQuoted 9 lines · 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 supportingkexec().
Quoted 7 lines
Quoted 3 lines
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