Staging: hv: Driver cleanup
Subsystems (2)
cover Staging: hv: Driver cleanup
Further cleanup of the hv drivers:
1) Continue to cleanup our drivers to conform to the Linux Driver Model.
2) Fix some long standing bugs with regards to unloading and reloading the drivers - block, net and stor.
3) VMBUS is an ACPI enumerated device; make VMBUS an ACPI bus driver.
4) Get rid of channel polling code; instead the channel receive paths will be purely interrupt drive.
5) Cleanup error return values in the vmbus driver and general cleanup.
6) Fix memory barrier calls in the ring buffer code.
7) Increase the timeout values for some critical guest to host calls.
Regads,
K. Y
PATCH 1/49 Staging: hv: vmbus: In vmbus_child_driver_unregister() don't set the bus field to NULL
As part of conforming to the Linux Driver Model, do not set the bus field to NULL when the driver un-registers.
--- drivers/staging/hv/vmbus_drv.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/hv/vmbus_drv.c +0 -1
@@ -631,7 +631,6 @@ void vmbus_child_driver_unregister(struct device_driver *drv)driver_unregister (drv); - drv->bus =NULL ; }EXPORT_SYMBOL (vmbus_child_driver_unregister);
Signature · 1 line
1.7.4.1
PATCH 2/49 Staging: hv: storvsc: Cleanup the exit function in storvsc_drv.c
Get rid of unnecessary layering in the module exit path.
--- drivers/staging/hv/storvsc_drv.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-)
drivers/staging/hv/storvsc_drv.c +2 -7
@@ -792,7 +792,7 @@ static int storvsc_drv_init(void)return ret; } -static void storvsc_drv_exit (void ) +static void __exit storvsc_drv_exit(void) {vmbus_child_driver_unregister (&storvsc_drv.driver); }
@@ -806,13 +806,8 @@ static int __init storvsc_init(void)return ret; } -static void __exit storvsc_exit(void) -{ -storvsc_drv_exit (); -} -MODULE_LICENSE ("GPL" );MODULE_VERSION (HV_DRV_VERSION );MODULE_DESCRIPTION ("Microsoft Hyper-V virtual storage driver" );module_init (storvsc_init); -module_exit (storvsc_exit); +module_exit (storvsc_drv_exit);
Signature · 1 line
1.7.4.1
PATCH 3/49 Staging: hv: storvsc: Cleanup the module init function in storvsc_drv.c
In reply to K. Y. SrinivasanGet rid of unnecessary layering in the module init path.
--- drivers/staging/hv/storvsc_drv.c | 13 ++----------- 1 files changed, 2 insertions(+), 11 deletions(-)
drivers/staging/hv/storvsc_drv.c +2 -11
@@ -756,7 +756,7 @@ static struct hv_driver storvsc_drv = {/* * storvsc_drv_init - StorVsc driver initialization. */ -static int storvsc_drv_init (void ) +static int __init storvsc_drv_init (void ) {int ret;struct hv_driver *drv = &storvsc_drv;
@@ -797,17 +797,8 @@ static void __exit storvsc_drv_exit(void)vmbus_child_driver_unregister (&storvsc_drv.driver); } -static int __init storvsc_init (void ) -{ -int ret; - -DPRINT_INFO (STORVSC_DRV ,"Storvsc initializing...." ); - ret =storvsc_drv_init (); -return ret; -} -MODULE_LICENSE ("GPL" );MODULE_VERSION (HV_DRV_VERSION );MODULE_DESCRIPTION ("Microsoft Hyper-V virtual storage driver" ); -module_init (storvsc_init); +module_init (storvsc_drv_init);module_exit (storvsc_drv_exit);
Signature · 1 line
1.7.4.1
PATCH 4/49 Staging: hv: storvsc: Fix a bug in the storvsc_remove() function
In reply to K. Y. SrinivasanWhen the storvs driver unloads, we need to accomodate disk cache flushes. Re-order the code to permit this.
--- drivers/staging/hv/storvsc_drv.c | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-)
drivers/staging/hv/storvsc_drv.c +5 -7
@@ -317,22 +317,20 @@ static int storvsc_remove(struct hv_device *dev)struct hv_host_device *host_dev = (struct hv_host_device *)host->hostdata; +DPRINT_INFO (STORVSC ,"removing host adapter (%p)..." , host); +scsi_remove_host (host); + +DPRINT_INFO (STORVSC ,"releasing host adapter (%p)..." , host); +scsi_host_put (host);/* * Call to the vsc driver to let it know that the device is being * removed */ storvsc_dev_remove (dev); -if (host_dev->request_pool) {kmem_cache_destroy (host_dev->request_pool); host_dev->request_pool =NULL ; } - -DPRINT_INFO (STORVSC ,"removing host adapter (%p)..." , host); -scsi_remove_host (host); - -DPRINT_INFO (STORVSC ,"releasing host adapter (%p)..." , host); -scsi_host_put (host);return 0 ; }
Signature · 1 line
1.7.4.1
PATCH 5/49 Staging: hv: storvsc: Cleanup some dated/unnecessary comments
In reply to K. Y. SrinivasanCleanup some dated/unnecessary comments.
--- drivers/staging/hv/storvsc_drv.c | 14 +------------- 1 files changed, 1 insertions(+), 13 deletions(-)
drivers/staging/hv/storvsc_drv.c +1 -13
@@ -308,9 +308,6 @@ static unsigned int copy_to_bounce_buffer(struct scatterlist *orig_sgl, } -/* -* storvsc_remove - Callback when our device is removed -*/ static int storvsc_remove (struct hv_device *dev) {struct Scsi_Host *host =dev_get_drvdata (&dev->device);
@@ -322,10 +319,7 @@ static int storvsc_remove(struct hv_device *dev)DPRINT_INFO (STORVSC ,"releasing host adapter (%p)..." , host);scsi_host_put (host); -/* -* Call to the vsc driver to let it know that the device is being -* removed -*/ +storvsc_dev_remove (dev);if (host_dev->request_pool) {kmem_cache_destroy (host_dev->request_pool);
@@ -423,7 +417,6 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)DPRINT_INFO (STORVSC_DRV ,"sdev (%p) dev obj (%p) - host resetting..." , scmnd->device, dev); -/* Invokes the vsc to reset the host/bus */ ret =storvsc_host_reset (dev);if (ret !=0 )return ret;
@@ -477,7 +470,6 @@ static void storvsc_commmand_completion(struct hv_storvsc_request *request) scmnd->host_scribble =NULL ; scmnd->scsi_done =NULL ; -/* !!DO NOT MODIFY the scmnd after this call */ scsi_done_fn (scmnd);kmem_cache_free (host_dev->request_pool, cmd_request);
@@ -750,10 +742,6 @@ static struct hv_driver storvsc_drv = { .remove = storvsc_remove, }; - -/* -* storvsc_drv_init - StorVsc driver initialization. -*/ static int __init storvsc_drv_init (void ) {int ret;
Signature · 1 line
1.7.4.1
PATCH 6/49 Staging: hv: stor: Get rid of unnecessary DPRINTs in stor vsc_drv.c
In reply to K. Y. SrinivasanGet rid of unnecessary DPRINTs in stor vsc_drv.c.
--- drivers/staging/hv/storvsc_drv.c | 19 ------------------- 1 files changed, 0 insertions(+), 19 deletions(-)
drivers/staging/hv/storvsc_drv.c +0 -19
@@ -92,12 +92,8 @@ static int storvsc_device_configure(struct scsi_device *sdevice)scsi_adjust_queue_depth (sdevice,MSG_SIMPLE_TAG ,STORVSC_MAX_IO_REQUESTS ); -DPRINT_INFO (STORVSC_DRV ,"sdev (%p) - setting max segment size to %ld" , - sdevice,PAGE_SIZE );blk_queue_max_segment_size (sdevice->request_queue,PAGE_SIZE ); -DPRINT_INFO (STORVSC_DRV ,"sdev (%p) - adding merge bio vec routine" , - sdevice);blk_queue_merge_bvec (sdevice->request_queue, storvsc_merge_bvec);blk_queue_bounce_limit (sdevice->request_queue,BLK_BOUNCE_ANY );
@@ -314,10 +310,8 @@ static int storvsc_remove(struct hv_device *dev)struct hv_host_device *host_dev = (struct hv_host_device *)host->hostdata; -DPRINT_INFO (STORVSC ,"removing host adapter (%p)..." , host);scsi_remove_host (host); -DPRINT_INFO (STORVSC ,"releasing host adapter (%p)..." , host);scsi_host_put (host);storvsc_dev_remove (dev);
@@ -349,9 +343,6 @@ static int storvsc_get_chs(struct scsi_device *sdev, struct block_device * bdev, info[1 ] = sectors_pt; info[2 ] = (int )cylinders; -DPRINT_INFO (STORVSC_DRV ,"CHS (%d, %d, %d)" , (int )cylinders, heads, - sectors_pt); -return 0 ; }
@@ -362,7 +353,6 @@ static int storvsc_host_reset(struct hv_device *device)struct vstor_packet *vstor_packet;int ret, t; -DPRINT_INFO (STORVSC ,"resetting host adapter..." ); stor_device =get_stor_device (device);if (!stor_device)
@@ -391,7 +381,6 @@ static int storvsc_host_reset(struct hv_device *device) goto cleanup; } -DPRINT_INFO (STORVSC ,"host adapter reset completed" );/* * At this point, all outstanding requests in the adapter
@@ -414,16 +403,10 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd) (struct hv_host_device *)scmnd->device->host->hostdata;struct hv_device *dev = host_dev->dev; -DPRINT_INFO (STORVSC_DRV ,"sdev (%p) dev obj (%p) - host resetting..." , - scmnd->device, dev); - ret =storvsc_host_reset (dev);if (ret !=0 )return ret; -DPRINT_INFO (STORVSC_DRV ,"sdev (%p) dev obj (%p) - host reseted" , - scmnd->device, dev); -return ret; }
@@ -500,8 +483,6 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd, cmd_request = (struct storvsc_cmd_request *)scmnd->host_scribble; -DPRINT_INFO (STORVSC_DRV ,"retrying scmnd %p cmd_request %p" , - scmnd, cmd_request); goto retry_request; }
Signature · 1 line
1.7.4.1
PATCH 7/49 Staging: hv: stor: Rename the vriable gStorVscDeviceType in storvsc_drv.c
In reply to K. Y. SrinivasanRename the vriable gStorVscDeviceType in storvsc_drv.c.
--- drivers/staging/hv/storvsc_drv.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/hv/storvsc_drv.c +2 -2
@@ -44,7 +44,7 @@ MODULE_PARM_DESC(storvsc_ringbuffer_size, "Ring buffer size (bytes)");static const char *driver_name ="storvsc" ;/* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */ -static const struct hv_guid gStorVscDeviceType = { +static const struct hv_guid stor_vsci_device_type = { .data = {0xd9 ,0x63 ,0x61 ,0xba ,0xa1 ,0x04 ,0x29 ,0x4d ,0xb6 ,0x05 ,0x72 ,0xe2 ,0xff ,0xb1 ,0xdc ,0x7f
@@ -742,7 +742,7 @@ static int __init storvsc_drv_init(void)sizeof (struct vstor_packet ) +sizeof (u64), sizeof(u64))); -memcpy (&drv->dev_type, &gStorVscDeviceType, +memcpy (&drv->dev_type, &stor_vsci_device_type,sizeof (struct hv_guid )); if (max_outstanding_req_per_channel <
Signature · 1 line
1.7.4.1
PATCH 8/49 Staging: hv: stor: Get rid of the unused initialization of the name field
In reply to K. Y. SrinivasanThe name field of hv_driver is unused in storvsc_drv.c; get rid of it.
--- drivers/staging/hv/storvsc_drv.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/hv/storvsc_drv.c +0 -1
@@ -749,7 +749,6 @@ static int __init storvsc_drv_init(void) STORVSC_MAX_IO_REQUESTS)return -1 ; - drv->name = driver_name; drv->driver.name = driver_name;
Signature · 1 line
1.7.4.1
PATCH 9/49 Staging: hv: blk: Get rid of the unused initialization of the name field
In reply to K. Y. SrinivasanThe name field of hv_driver is unused in blkvsc_drv.c; get rid of it.
--- drivers/staging/hv/blkvsc_drv.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/hv/blkvsc_drv.c +0 -1
@@ -824,7 +824,6 @@ static int blkvsc_drv_init(void)BUILD_BUG_ON (sizeof (sector_t) !=8 );memcpy (&drv->dev_type, &dev_type,sizeof (struct hv_guid )); - drv->name = drv_name; drv->driver.name = drv_name;/* The driver belongs to vmbus */
Signature · 1 line
1.7.4.1
PATCH 10/49 Staging: hv: mouse: Get rid of the unused initialization of the name field
In reply to K. Y. SrinivasanThe name field of hv_driver is unused in hv_mouse.c; get rid of it.
--- drivers/staging/hv/hv_mouse.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/hv/hv_mouse.c +0 -1
@@ -936,7 +936,6 @@ static int __init mousevsc_init(void) sizeof(struct hv_guid)); drv->driver.name = driver_name; - drv->name = driver_name;/* The driver belongs to vmbus */ vmbus_child_driver_register (&drv->driver);
Signature · 1 line
1.7.4.1
PATCH 11/49 Staging: hv: vmbus: Don't free the channel when the channel is closed
In reply to K. Y. SrinivasanWhen the driver unloads, the device must persist. A channel represents the device and so we should not free the channel when the channel is closed as part of the driver unloading.
--- drivers/staging/hv/channel.c | 14 -------------- 1 files changed, 0 insertions(+), 14 deletions(-)
drivers/staging/hv/channel.c +0 -14
@@ -552,7 +552,6 @@ void vmbus_close(struct vmbus_channel *channel) {struct vmbus_channel_close_channel *msg;struct vmbus_channel_msginfo *info; -unsigned long flags;int ret;/* Stop callback and cancel the timer asap */
@@ -591,19 +590,6 @@ void vmbus_close(struct vmbus_channel *channel)kfree (info); -/* -* If we are closing the channel during an error path in -* opening the channel, don't free the channel since the -* caller will free the channel -*/ - -if (channel->state ==CHANNEL_OPEN_STATE ) { -spin_lock_irqsave (&vmbus_connection.channel_lock, flags); -list_del (&channel->listentry); -spin_unlock_irqrestore (&vmbus_connection.channel_lock, flags); - -free_channel (channel); - } }EXPORT_SYMBOL_GPL (vmbus_close);
Signature · 1 line
1.7.4.1
PATCH 12/49 Staging: hv: storvsc: Add a DMI signature to support auto-loading
In reply to K. Y. SrinivasanTo support auto-loading the storvsc driver, add a DMI signature.
--- drivers/staging/hv/storvsc_drv.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)
drivers/staging/hv/storvsc_drv.c +22 -0
@@ -24,6 +24,7 @@#include <linux/module.h> #include <linux/device.h> #include <linux/blkdev.h> +#include <linux/dmi.h> #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> #include <scsi/scsi_host.h>
@@ -723,6 +724,27 @@ static struct hv_driver storvsc_drv = { .remove = storvsc_remove, }; +/* +* We use a DMI table to determine if we should autoload this driver This is +* needed by distro tools to determine if the hyperv drivers should be +* installed and/or configured. We don't do anything else with the table, but +* it needs to be present. +*/ + +static const struct dmi_system_id __initconst +hv_stor_dmi_table[]__maybe_unused = { + { + .ident ="Hyper-V" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Microsoft Corporation" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Virtual Machine" ), +DMI_MATCH (DMI_BOARD_NAME ,"Virtual Machine" ), + }, + }, + { }, +}; +MODULE_DEVICE_TABLE (dmi, hv_stor_dmi_table); +static int __init storvsc_drv_init (void ) {int ret;
Signature · 1 line
1.7.4.1
Re: [PATCH 12/49] Staging: hv: storvsc: Add a DMI signature to support auto-loading
Quoted 1 line · K. Y. Srinivasan
To support auto-loading the storvsc driver, add a DMI signature.
The storvsc driver is not a DMI driver, but a vmbus driver. As such it should have a vmbus table that is used for autoloading, not a dmi one.
RE: [PATCH 12/49] Staging: hv: storvsc: Add a DMI signature to support auto-loading
Quoted 12 lines
-----Original Message-----
From: Christoph Hellwig [mailto:[email protected]]
Sent: Monday, June 06, 2011 7:13 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 12/49] Staging: hv: storvsc: Add a DMI signature to support auto-loading
Quoted 6 lines
Quoted 1 line · K. Y. Srinivasan
To support auto-loading the storvsc driver, add a DMI signature.
The storvsc driver is not a DMI driver, but a vmbus driver. As such it should have a vmbus table that is used for autoloading, not a dmi one.
A while ago, Greg introduced DMI signatures to these drivers to support auto-loading. This signature is not used for anything else. For some reason, this storvsc driver was missing this signature. I added it again to only support auto-loading.
Regards,
K. Y
Re: [PATCH 12/49] Staging: hv: storvsc: Add a DMI signature to support auto-loading
Quoted 15 lines · KY Srinivasan
Quoted 15 lines
-----Original Message-----
From: Christoph Hellwig [mailto:[email protected]]
Sent: Monday, June 06, 2011 7:13 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 12/49] Staging: hv: storvsc: Add a DMI signature to support auto-loadingQuoted 1 line · K. Y. Srinivasan
To support auto-loading the storvsc driver, add a DMI signature.
Quoted 8 lines
Quoted 3 lines
The storvsc driver is not a DMI driver, but a vmbus driver. As such it should have a vmbus table that is used for autoloading, not a dmi one.
A while ago, Greg introduced DMI signatures to these drivers to support auto-loading. This signature is not used for anything else. For some reason, this storvsc driver was missing this signature. I added it again to only support auto-loading.
Yes, that was there to solve the original problem of autoloading the driver.
But Christoph is correct here, the vmbus needs a way to autoload its own drivers based on the GUID signatures of the devices it finds on the hyperv bus. So the correct thing to do in the long-run is to implement this (which is one of the things the bus needs to do before it can move out of staging).
I'll take this patch as-is for now though, as it does solve the immediate issue.
thanks,
greg k-h
RE: [PATCH 12/49] Staging: hv: storvsc: Add a DMI signature to support auto-loading
Quoted 41 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, June 07, 2011 2:58 PM
To: KY Srinivasan
Cc: Christoph Hellwig; [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 12/49] Staging: hv: storvsc: Add a DMI signature to support auto-loadingQuoted 10 lines · KY Srinivasan
Quoted 10 lines
-----Original Message-----
From: Christoph Hellwig [mailto:[email protected]]
Sent: Monday, June 06, 2011 7:13 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 12/49] Staging: hv: storvsc: Add a DMI signature tosupport
Quoted 5 lines
Quoted 5 lines
auto-loading
Quoted 1 line · K. Y. Srinivasan
To support auto-loading the storvsc driver, add a DMI signature.
Quoted 8 lines
Quoted 3 lines
The storvsc driver is not a DMI driver, but a vmbus driver. As such it should have a vmbus table that is used for autoloading, not a dmi one.
A while ago, Greg introduced DMI signatures to these drivers to support auto-loading. This signature is not used for anything else. For some reason, this storvsc driver was missing this signature. I added it again to only support auto-loading.
Yes, that was there to solve the original problem of autoloading the driver.
Quoted 8 lines
But Christoph is correct here, the vmbus needs a way to autoload its own drivers based on the GUID signatures of the devices it finds on the hyperv bus. So the correct thing to do in the long-run is to implement this (which is one of the things the bus needs to do before it can move out of staging).
I'll take this patch as-is for now though, as it does solve the immediate issue.
Thanks Greg. Can you give me some pointers here as to what needs to be done here. Looking at the code for virtio, it looks like I would need to add stuff to scripts/mod/file2alias.c as well as to include/linux/mod_devicetable.h. Will you accept patches for these files to support an ID space for Hyper-V vmbus drivers.
Regards,
K. Y
Re: [PATCH 12/49] Staging: hv: storvsc: Add a DMI signature to support auto-loading
Quoted 4 lines · KY Srinivasan
Thanks Greg. Can you give me some pointers here as to what needs to be done here. Looking at the code for virtio, it looks like I would need to add stuff to
scripts/mod/file2alias.cas well as toinclude/linux/mod_devicetable.h. Will you accept patches for these files to support an ID space for Hyper-V vmbus drivers.
Yes, I will take patches for those files to implement this.
Along with those files, you also need a way to tell userspace that new UIDS are found before the individual drivers are loaded. Hopefully you can do that now, but if not, it will need to be implemented.
thanks,
greg k-h
RE: [PATCH 12/49] Staging: hv: storvsc: Add a DMI signature to support auto-loading
Quoted 16 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, June 07, 2011 6:25 PM
To: KY Srinivasan
Cc: Christoph Hellwig; [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 12/49] Staging: hv: storvsc: Add a DMI signature to support auto-loadingQuoted 3 lines · KY Srinivasan
Thanks Greg. Can you give me some pointers here as to what needs to be done here. Looking at the code for virtio, it looks like I would need to add stuff to
scripts/mod/file2alias.cas well as toinclude/linux/mod_devicetable.h. Will
Quoted 8 lines
you
Quoted 1 line
accept patches for these files to support an ID space for Hyper-V vmbus drivers.
Yes, I will take patches for those files to implement this.
Along with those files, you also need a way to tell userspace that new UIDS are found before the individual drivers are loaded. Hopefully you can do that now, but if not, it will need to be implemented.
Could you elaborate on what user level changes I will have to do.
Thanks,
K. Y
Re: [PATCH 12/49] Staging: hv: storvsc: Add a DMI signature to support auto-loading
Quoted 7 lines · KY Srinivasan
Quoted 7 lines · KY Srinivasan
Quoted 3 lines
Thanks Greg. Can you give me some pointers here as to what needs to be done here. Looking at the code for virtio, it looks like I would need to add stuff to
scripts/mod/file2alias.cas well as toinclude/linux/mod_devicetable.h. Willyou
Quoted 1 line
accept patches for these files to support an ID space for Hyper-V vmbus drivers.
Quoted 7 lines
Quoted 5 lines
Yes, I will take patches for those files to implement this.
Along with those files, you also need a way to tell userspace that new UIDS are found before the individual drivers are loaded. Hopefully you can do that now, but if not, it will need to be implemented.
Could you elaborate on what user level changes I will have to do.
It's all kernel code, but you need to be emiting "device found" messages to userspace through the hotplug bus event when you find the devices. Just fill in the correct fields in your hotplug callback and you should be fine.
Look at the PCI bus hotplug callback as an example of what is needed if you need an example.
hope this helps,
greg k-h
PATCH 13/49 Staging: hv: vmbus: Change the signature of vmbus_bus_init()
In reply to K. Y. SrinivasanIn preparation for making the vmbus driver an ACPI bus driver, change the signature of vmbus_bus_init() to accept the irq value.
--- drivers/staging/hv/vmbus_drv.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/hv/vmbus_drv.c +7 -7
@@ -528,7 +528,7 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)* - get the irq resource * - retrieve the channel offers */ -static int vmbus_bus_init (struct pci_dev *pdev) +static int vmbus_bus_init (int irq) {int ret;unsigned int vector;
@@ -552,13 +552,13 @@ static int vmbus_bus_init(struct pci_dev *pdev) }/* Get the interrupt resource */ - ret =request_irq (pdev->irq, vmbus_isr, + ret =request_irq (irq, vmbus_isr,IRQF_SHARED |IRQF_SAMPLE_RANDOM , - driver_name, pdev); + driver_name, hv_pci_dev);if (ret !=0 ) {pr_err ("Unable to request IRQ %d\n" , - pdev->irq); + irq);bus_unregister (&hv_bus);
@@ -566,7 +566,7 @@ static int vmbus_bus_init(struct pci_dev *pdev) goto cleanup; } - vector =IRQ0_VECTOR + pdev->irq; + vector =IRQ0_VECTOR + irq;/* * Notify the hypervisor of our irq and
@@ -575,7 +575,7 @@ static int vmbus_bus_init(struct pci_dev *pdev)on_each_cpu (hv_synic_init, (void *)&vector,1 ); ret =vmbus_connect ();if (ret) { -free_irq (pdev->irq, pdev); +free_irq (irq, hv_pci_dev);bus_unregister (&hv_bus); goto cleanup; }
@@ -795,7 +795,7 @@ static int __devinit hv_pci_probe(struct pci_dev *pdev,if (pdev->irq ==0 ) pdev->irq = irq; - pci_probe_error =vmbus_bus_init (pdev); + pci_probe_error =vmbus_bus_init (pdev->irq);if (pci_probe_error)pci_disable_device (pdev);
Signature · 1 line
1.7.4.1
PATCH 14/49 Staging: hv: vmbus: Use the DSDT specified irq for vmbus
In reply to K. Y. SrinivasanDSDT specifies the irq value for the vmbus driver; use it unconditionally. This is an exclusive interrupt line dedicated for the vmbus driver.
--- drivers/staging/hv/vmbus_drv.c | 15 +++------------ 1 files changed, 3 insertions(+), 12 deletions(-)
drivers/staging/hv/vmbus_drv.c +3 -12
@@ -552,9 +552,8 @@ static int vmbus_bus_init(int irq) }/* Get the interrupt resource */ - ret =request_irq (irq, vmbus_isr, -IRQF_SHARED |IRQF_SAMPLE_RANDOM , - driver_name, hv_pci_dev); + ret =request_irq (irq, vmbus_isr,IRQF_SAMPLE_RANDOM , + driver_name, hv_pci_dev);if (ret !=0 ) { pr_err("Unable to request IRQ %d\n",
@@ -787,15 +786,7 @@ static int __devinit hv_pci_probe(struct pci_dev *pdev,if (pci_probe_error) goto probe_cleanup; -/* -* If the PCI sub-sytem did not assign us an -* irq, use the bios provided one. -*/ - -if (pdev->irq ==0 ) - pdev->irq = irq; - - pci_probe_error =vmbus_bus_init (pdev->irq); + pci_probe_error =vmbus_bus_init (irq);if (pci_probe_error)pci_disable_device (pdev);
Signature · 1 line
1.7.4.1
PATCH 15/49 Staging: hv: vmbus: Make vmbus an acpi bus driver
In reply to K. Y. SrinivasanNow, make the vmbus driver an ACPI bus driver.
--- drivers/staging/hv/vmbus_drv.c | 56 ++++++--------------------------------- 1 files changed, 9 insertions(+), 47 deletions(-)
drivers/staging/hv/vmbus_drv.c +9 -47
@@ -39,7 +39,7 @@#include "hyperv_vmbus.h" -static struct pci_dev *hv_pci_dev; +static struct acpi_device *hv_acpi_dev;static struct tasklet_struct msg_dpc;static struct tasklet_struct event_dpc;
@@ -49,7 +49,6 @@ EXPORT_SYMBOL(vmbus_loglevel);/* (ALL_MODULES << 16 | DEBUG_LVL_ENTEREXIT); */ /* (((VMBUS | VMBUS_DRV)<<16) | DEBUG_LVL_ENTEREXIT); */ -static int pci_probe_error;static struct completion probe_event;static int irq;
@@ -553,7 +552,7 @@ static int vmbus_bus_init(int irq)/* Get the interrupt resource */ ret =request_irq (irq, vmbus_isr,IRQF_SAMPLE_RANDOM , - driver_name, hv_pci_dev); + driver_name, hv_acpi_dev);if (ret !=0 ) { pr_err("Unable to request IRQ %d\n",
@@ -574,7 +573,7 @@ static int vmbus_bus_init(int irq)on_each_cpu (hv_synic_init, (void *)&vector,1 ); ret =vmbus_connect ();if (ret) { -free_irq (irq, hv_pci_dev); +free_irq (irq, hv_acpi_dev);bus_unregister (&hv_bus); goto cleanup; }
@@ -674,7 +673,7 @@ int vmbus_child_device_register(struct hv_device *child_device_obj)/* The new device belongs to this bus */ child_device_obj->device.bus = &hv_bus;/* device->dev.bus; */ - child_device_obj->device.parent = &hv_pci_dev->dev; + child_device_obj->device.parent = &hv_acpi_dev->dev; child_device_obj->device.release = vmbus_device_release;/*
@@ -731,6 +730,8 @@ static int vmbus_acpi_add(struct acpi_device *device) {acpi_status result; + hv_acpi_dev = device; + result =acpi_walk_resources (device->handle,METHOD_NAME__CRS , vmbus_walk_resources, &irq);
@@ -777,25 +778,6 @@ static void vmbus_acpi_exit(void) } -static int __devinit hv_pci_probe (struct pci_dev *pdev, -const struct pci_device_id *ent) -{ - hv_pci_dev = pdev; - - pci_probe_error =pci_enable_device (pdev); -if (pci_probe_error) - goto probe_cleanup; - - pci_probe_error =vmbus_bus_init (irq); - -if (pci_probe_error) -pci_disable_device (pdev); - -probe_cleanup: -complete (&probe_event); -return pci_probe_error; -} -/* * We use a PCI table to determine if we should autoload this driver This is * needed by distro tools to determine if the hyperv drivers should be
@@ -808,13 +790,7 @@ static const struct pci_device_id microsoft_hv_pci_table[] = { };MODULE_DEVICE_TABLE (pci, microsoft_hv_pci_table); -static struct pci_driver hv_bus_driver = { - .name ="hv_bus" , - .probe = hv_pci_probe, - .id_table = microsoft_hv_pci_table, -}; - -static int __init hv_pci_init (void ) +static int __init hv_acpi_init (void ) {int ret;
@@ -835,21 +811,7 @@ static int __init hv_pci_init(void)return -ENODEV ; } -vmbus_acpi_exit (); -init_completion (&probe_event); - ret =pci_register_driver (&hv_bus_driver); -if (ret) -return ret; -/* -* All the vmbus initialization occurs within the -* hv_pci_probe() function. Wait for hv_pci_probe() -* to complete. -*/ -wait_for_completion (&probe_event); - -if (pci_probe_error) -pci_unregister_driver (&hv_bus_driver); -return pci_probe_error; +return vmbus_bus_init (irq); }
@@ -857,4 +819,4 @@ MODULE_LICENSE("GPL");MODULE_VERSION (HV_DRV_VERSION );module_param (vmbus_loglevel, int,S_IRUGO |S_IWUSR ); -module_init (hv_pci_init); +module_init (hv_acpi_init);
Signature · 1 line
1.7.4.1
Re: [PATCH 15/49] Staging: hv: vmbus: Make vmbus an acpi bus driver
Quoted 1 line · K. Y. Srinivasan
Now, make the vmbus driver an ACPI bus driver.
Why an ACPI bus driver and not a PCI one? Is that what this really is? For some reason, I thought it was a PCI device that we hooked our bus off of, is that not true?
greg k-h
PATCH 16/49 Staging: hv: vmbus: Get rid of vmbus_acpi_init() by inlining the code
In reply to K. Y. SrinivasanStaging: hv: vmbus: Get rid of vmbus_acpi_init() by inlining the code.
--- drivers/staging/hv/vmbus_drv.c | 15 ++------------- 1 files changed, 2 insertions(+), 13 deletions(-)
drivers/staging/hv/vmbus_drv.c +2 -13
@@ -758,18 +758,6 @@ static struct acpi_driver vmbus_acpi_driver = { }, }; -static int vmbus_acpi_init (void ) -{ -int result; - - - result =acpi_bus_register_driver (&vmbus_acpi_driver); -if (result <0 ) -return result; - -return 0 ; -} -static void vmbus_acpi_exit (void ) {acpi_bus_unregister_driver (&vmbus_acpi_driver);
@@ -800,7 +788,8 @@ static int __init hv_acpi_init(void)* Get irq resources first. */ - ret =vmbus_acpi_init (); + ret =acpi_bus_register_driver (&vmbus_acpi_driver); +if (ret)return ret;
Signature · 1 line
1.7.4.1
PATCH 17/49 Staging: hv: vmbus: Get rid of vmbus_acpi_exit() by inlining the code
In reply to K. Y. SrinivasanGet rid of vmbus_acpi_exit() by inlining the code.
--- drivers/staging/hv/vmbus_drv.c | 10 +--------- 1 files changed, 1 insertions(+), 9 deletions(-)
drivers/staging/hv/vmbus_drv.c +1 -9
@@ -758,14 +758,6 @@ static struct acpi_driver vmbus_acpi_driver = { }, }; -static void vmbus_acpi_exit (void ) -{ -acpi_bus_unregister_driver (&vmbus_acpi_driver); - -return ; -} - -/* * We use a PCI table to determine if we should autoload this driver This is * needed by distro tools to determine if the hyperv drivers should be
@@ -796,7 +788,7 @@ static int __init hv_acpi_init(void)wait_for_completion (&probe_event);if (irq <=0 ) { -vmbus_acpi_exit (); +acpi_bus_unregister_driver (&vmbus_acpi_driver);return -ENODEV ; }
Signature · 1 line
1.7.4.1
PATCH 18/49 Staging: hv: vmbus: Add the DSDT _HID name as well
In reply to K. Y. SrinivasanAdd the DSDT _HID name as well, in addition to the _DDN name.
--- drivers/staging/hv/vmbus_drv.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/staging/hv/vmbus_drv.c +1 -0
@@ -746,6 +746,7 @@ static int vmbus_acpi_add(struct acpi_device *device)static const struct acpi_device_id vmbus_acpi_device_ids[] = { {"VMBUS" ,0 }, + {"VMBus" ,0 }, {"" ,0 }, };MODULE_DEVICE_TABLE (acpi, vmbus_acpi_device_ids);
Signature · 1 line
1.7.4.1
PATCH 19/49 Staging: hv: blkvsc: Fix bugs in the module unload path
In reply to K. Y. SrinivasanFix bugs in the module unload path for the blkvsc driver.
--- drivers/staging/hv/blkvsc_drv.c | 40 ++++++++++++++++++++++---------------- 1 files changed, 23 insertions(+), 17 deletions(-)
drivers/staging/hv/blkvsc_drv.c +23 -17
@@ -518,22 +518,18 @@ static int blkvsc_remove(struct hv_device *dev)blkvsc_do_operation (blkdev,DO_FLUSH ); -blk_cleanup_queue (blkdev->gd->queue); +if (blkdev->users ==0 ) { +del_gendisk (blkdev->gd); +put_disk (blkdev->gd); +blk_cleanup_queue (blkdev->gd->queue); -/* -* Call to the vsc driver to let it know that the device is being -* removed -*/ -storvsc_dev_remove (dev); - -del_gendisk (blkdev->gd); +storvsc_dev_remove (blkdev->device_ctx); -kmem_cache_destroy (blkdev->request_pool); - -kfree (blkdev); +kmem_cache_destroy (blkdev->request_pool); +kfree (blkdev); + }return 0 ; - }static void blkvsc_shutdown (struct hv_device *dev)
@@ -568,13 +564,23 @@ static int blkvsc_release(struct gendisk *disk, fmode_t mode)struct block_device_context *blkdev = disk->private_data;unsigned long flags; -if (blkdev->users ==1 ) { +spin_lock_irqsave (&blkdev->lock, flags); + +if ((--blkdev->users ==0 ) && (blkdev->shutting_down)) { +blk_stop_queue (blkdev->gd->queue); +spin_unlock_irqrestore (&blkdev->lock, flags); +blkvsc_do_operation (blkdev,DO_FLUSH ); - } +del_gendisk (blkdev->gd); +put_disk (blkdev->gd); +blk_cleanup_queue (blkdev->gd->queue); -spin_lock_irqsave (&blkdev->lock, flags); - blkdev->users--; -spin_unlock_irqrestore (&blkdev->lock, flags); +storvsc_dev_remove (blkdev->device_ctx); + +kmem_cache_destroy (blkdev->request_pool); +kfree (blkdev); + }else +spin_unlock_irqrestore (&blkdev->lock, flags);return 0 ; }
Signature · 1 line
1.7.4.1
PATCH 20/49 Staging: hv: blkvsc: We don't support removable media; get rid of unnecessary state
In reply to K. Y. SrinivasanWe don't support removable media; get rid of unnecessary state.
--- drivers/staging/hv/blkvsc_drv.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/hv/blkvsc_drv.c +0 -1
@@ -926,7 +926,6 @@ static int blkvsc_probe(struct hv_device *dev)else blkdev->gd->first_minor =0 ; blkdev->gd->fops = &block_ops; - blkdev->gd->events =DISK_EVENT_MEDIA_CHANGE ; blkdev->gd->private_data = blkdev; blkdev->gd->driverfs_dev = &(blkdev->device_ctx->device);sprintf (blkdev->gd->disk_name,"hd%c" ,'a' + major_info.index);
Signature · 1 line
1.7.4.1
PATCH 21/49 Staging: hv: vmbus: Get rid of the timer based handling of channel events
In reply to K. Y. SrinivasanGet rid of the timer based handling of channel events.
--- drivers/staging/hv/channel.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/hv/channel.c +0 -1
@@ -889,7 +889,6 @@ void vmbus_onchannel_event(struct vmbus_channel *channel) channel->onchannel_callback (channel->channel_callback_context); -mod_timer (&channel->poll_timer, jiffies +usecs_to_jiffies (100 )); }/*
Signature · 1 line
1.7.4.1
PATCH 22/49 Staging: hv: vmbus: Get rid of the call to dump channel state in channel event handler
In reply to K. Y. SrinivasanGet rid of the call to dump channel state in channel event handler.
--- drivers/staging/hv/channel.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/hv/channel.c +0 -1
@@ -885,7 +885,6 @@ EXPORT_SYMBOL_GPL(vmbus_recvpacket_raw);*/ void vmbus_onchannel_event (struct vmbus_channel *channel) { -dump_vmbus_channel (channel); channel->onchannel_callback (channel->channel_callback_context);
Signature · 1 line
1.7.4.1
PATCH 23/49 Staging: hv: vmbus: Directly invoke the channel callback
In reply to K. Y. SrinivasanNow, directly invoke the channel callback.
--- drivers/staging/hv/connection.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/hv/connection.c +1 -1
@@ -262,7 +262,7 @@ static void process_chn_event(u32 relid) channel =relid2channel (relid);if (channel) { -vmbus_onchannel_event (channel); + channel->onchannel_callback (channel->channel_callback_context); }else {pr_err ("channel not found for relid - %u\n" , relid); }
Signature · 1 line
1.7.4.1
PATCH 24/49 Staging: hv: vmbus: Get rid of the unused wrapper - vmbus_onchannel_event()
In reply to K. Y. SrinivasanNow, get rid of the unused wrapper - vmbus_onchannel_event().
--- drivers/staging/hv/channel.c | 10 ---------- drivers/staging/hv/hyperv.h | 1 - 2 files changed, 0 insertions(+), 11 deletions(-)
drivers/staging/hv/channel.c +0 -10
@@ -881,16 +881,6 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer,EXPORT_SYMBOL_GPL (vmbus_recvpacket_raw);/* -* vmbus_onchannel_event - Channel event callback -*/ -void vmbus_onchannel_event (struct vmbus_channel *channel) -{ - - channel->onchannel_callback (channel->channel_callback_context); - -} - -/* * vmbus_ontimer - Timer event callback */ void vmbus_ontimer (unsigned long data)
drivers/staging/hv/hyperv.h +0 -1
@@ -691,7 +691,6 @@ extern int vmbus_recvpacket_raw(struct vmbus_channel *channel, u32 *buffer_actual_len, u64 *requestid); -extern void vmbus_onchannel_event (struct vmbus_channel *channel);extern void vmbus_get_debug_info (struct vmbus_channel *channel,struct vmbus_channel_debug_info *debug);
Signature · 1 line
1.7.4.1
Re: [PATCH 24/49] Staging: hv: vmbus: Get rid of the unused wrapper - vmbus_onchannel_event()
Quoted 1 line · K. Y. Srinivasan
Now, get rid of the unused wrapper -
vmbus_onchannel_event().
I'd merge this into the previous patch. In general your patch split seem a little too fine grained to me in general. When you remove a wrapper you can inline it into the callsite directly, if you clean up a function directly inlining it into the helper is fine, etc.
RE: [PATCH 24/49] Staging: hv: vmbus: Get rid of the unused wrapper - vmbus_onchannel_event()
Quoted 12 lines
-----Original Message-----
From: Christoph Hellwig [mailto:[email protected]]
Sent: Monday, June 06, 2011 7:15 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 24/49] Staging: hv: vmbus: Get rid of the unused wrapper -vmbus_onchannel_event()
Quoted 8 lines
Quoted 1 line · K. Y. Srinivasan
Now, get rid of the unused wrapper -
vmbus_onchannel_event().I'd merge this into the previous patch. In general your patch split seem a little too fine grained to me in general. When you remove a wrapper you can inline it into the callsite directly, if you clean up a function directly inlining it into the helper is fine, etc.
I agree with you that some of these patches are too fine grained; but I thought that was what was expected - "one change per patch".
Regards,
K. Y
Re: [PATCH 24/49] Staging: hv: vmbus: Get rid of the unused wrapper - vmbus_onchannel_event()
Quoted 15 lines · KY Srinivasan
Quoted 15 lines
-----Original Message-----
From: Christoph Hellwig [mailto:[email protected]]
Sent: Monday, June 06, 2011 7:15 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 24/49] Staging: hv: vmbus: Get rid of the unused wrapper -vmbus_onchannel_event()Quoted 1 line · K. Y. Srinivasan
Now, get rid of the unused wrapper -
vmbus_onchannel_event().
Quoted 7 lines
Quoted 5 lines
I'd merge this into the previous patch. In general your patch split seem a little too fine grained to me in general. When you remove a wrapper you can inline it into the callsite directly, if you clean up a function directly inlining it into the helper is fine, etc.
I agree with you that some of these patches are too fine grained; but I thought that was what was expected - "one change per patch".
Yes, but don't take it to an extreme, like you have done here :)
thanks,
greg k-h
RE: [PATCH 24/49] Staging: hv: vmbus: Get rid of the unused wrapper - vmbus_onchannel_event()
Quoted 34 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, June 07, 2011 2:59 PM
To: KY Srinivasan
Cc: Christoph Hellwig; [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 24/49] Staging: hv: vmbus: Get rid of the unused wrapper -vmbus_onchannel_event()Quoted 10 lines · KY Srinivasan
Quoted 10 lines
-----Original Message-----
From: Christoph Hellwig [mailto:[email protected]]
Sent: Monday, June 06, 2011 7:15 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 24/49] Staging: hv: vmbus: Get rid of the unused wrapper-
Quoted 10 lines
Quoted 10 lines
vmbus_onchannel_event()Quoted 1 line · K. Y. Srinivasan
Now, get rid of the unused wrapper -
vmbus_onchannel_event().I'd merge this into the previous patch. In general your patch split seem a little too fine grained to me in general. When you remove a wrapper you can inline it into the callsite directly, if you clean up a function directly inlining it into the helper is fine, etc.
Quoted 4 lines
Quoted 2 lines
I agree with you that some of these patches are too fine grained; but I thought that was what was expected - "one change per patch".
Yes, but don't take it to an extreme, like you have done here :)
Will do in the future. Should I re-spin any of the patches in this set to make them less "fine-grained".
Regards,
K. Y
Re: [PATCH 24/49] Staging: hv: vmbus: Get rid of the unused wrapper - vmbus_onchannel_event()
Quoted 34 lines · KY Srinivasan
Quoted 34 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, June 07, 2011 2:59 PM
To: KY Srinivasan
Cc: Christoph Hellwig; [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 24/49] Staging: hv: vmbus: Get rid of the unused wrapper -vmbus_onchannel_event()Quoted 10 lines · KY Srinivasan
Quoted 10 lines
-----Original Message-----
From: Christoph Hellwig [mailto:[email protected]]
Sent: Monday, June 06, 2011 7:15 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 24/49] Staging: hv: vmbus: Get rid of the unused wrapper-
Quoted 10 lines
Quoted 10 lines
vmbus_onchannel_event()Quoted 1 line · K. Y. Srinivasan
Now, get rid of the unused wrapper -
vmbus_onchannel_event().I'd merge this into the previous patch. In general your patch split seem a little too fine grained to me in general. When you remove a wrapper you can inline it into the callsite directly, if you clean up a function directly inlining it into the helper is fine, etc.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
I agree with you that some of these patches are too fine grained; but I thought that was what was expected - "one change per patch".
Yes, but don't take it to an extreme, like you have done here :)
Will do in the future. Should I re-spin any of the patches in this set to make them less "fine-grained".
No, they are fine as-is.
PATCH 25/49 Staging: hv: vmbus: Get rid of unneeded calls to dump_vmbus_channel
In reply to K. Y. SrinivasanGet rid of unneeded calls to dump_vmbus_channel and get rid of the unused static function that dumps the channel.
--- drivers/staging/hv/channel.c | 13 ------------- 1 files changed, 0 insertions(+), 13 deletions(-)
drivers/staging/hv/channel.c +0 -13
@@ -39,7 +39,6 @@ static int create_gpadl_header(u32 size,/* page-size multiple */ struct vmbus_channel_msginfo **msginfo, u32 *messagecount); -static void dump_vmbus_channel (struct vmbus_channel *channel);static void vmbus_setevent (struct vmbus_channel *channel);/*
@@ -618,7 +617,6 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer,u64 aligned_data =0 ;int ret; -dump_vmbus_channel (channel);/* Setup the descriptor */ desc.type = type;/* VmbusPacketTypeDataInBand; */
@@ -665,7 +663,6 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,if (pagecount >MAX_PAGE_BUFFER_COUNT )return -EINVAL ; -dump_vmbus_channel (channel);/* * Adjust the size down since vmbus_channel_packet_page_buffer is the
@@ -725,7 +722,6 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,u32 pfncount =NUM_PAGES_SPANNED (multi_pagebuffer->offset, multi_pagebuffer->len); -dump_vmbus_channel (channel);if ((pfncount <0 ) || (pfncount >MAX_MULTIPAGE_BUFFER_COUNT ))return -EINVAL ;
@@ -891,12 +887,3 @@ void vmbus_ontimer(unsigned long data) channel->onchannel_callback (channel->channel_callback_context); } -/* -* dump_vmbus_channel- Dump vmbus channel info to the console -*/ -static void dump_vmbus_channel (struct vmbus_channel *channel) -{ -DPRINT_DBG (VMBUS ,"Channel (%d)" , channel->offermsg.child_relid); -hv_dump_ring_info (&channel->outbound,"Outbound " ); -hv_dump_ring_info (&channel->inbound,"Inbound " ); -}
Signature · 1 line
1.7.4.1
PATCH 26/49 Staging: hv: vmbus: Get rid of the poll timer in the channel state
In reply to K. Y. SrinivasanSince tis is not used anymore, get rid of the poll timer in the channel state.
--- drivers/staging/hv/channel.c | 1 - drivers/staging/hv/channel_mgmt.c | 5 ----- drivers/staging/hv/hyperv.h | 1 - 3 files changed, 0 insertions(+), 7 deletions(-)
drivers/staging/hv/channel.c +0 -1
@@ -555,7 +555,6 @@ void vmbus_close(struct vmbus_channel *channel)/* Stop callback and cancel the timer asap */ channel->onchannel_callback =NULL ; -del_timer_sync (&channel->poll_timer);/* Send a closing message */ info = kmalloc(sizeof(*info) +
drivers/staging/hv/channel_mgmt.c +0 -5
@@ -283,10 +283,6 @@ static struct vmbus_channel *alloc_channel(void)spin_lock_init (&channel->inbound_lock); -init_timer (&channel->poll_timer); - channel->poll_timer.data = (unsigned long )channel; - channel->poll_timer.function = vmbus_ontimer; - channel->controlwq =create_workqueue ("hv_vmbus_ctl" );if (!channel->controlwq) {kfree (channel);
@@ -315,7 +311,6 @@ static void release_channel(struct work_struct *work)*/ void free_channel (struct vmbus_channel *channel) { -del_timer_sync (&channel->poll_timer);/* * We have to release the channel's workqueue/thread in the vmbus's
drivers/staging/hv/hyperv.h +0 -1
@@ -528,7 +528,6 @@ struct vmbus_channel {struct hv_device *device_obj; -struct timer_list poll_timer;/* SA-111 workaround */ struct work_struct work;enum vmbus_channel_state state;
Signature · 1 line
1.7.4.1
Re: [PATCH 26/49] Staging: hv: vmbus: Get rid of the poll timer in the channel state
Quoted 1 line · K. Y. Srinivasan
Since tis is not used anymore, get rid of the poll timer in the channel state.
This would be more useful together with the patch that removes the use of the timer.
PATCH 27/49 Staging: hv: vmbus: Fix the memory barrier in hv_ringbuffer_read()
In reply to K. Y. SrinivasanUse the correct barrier interface.
--- drivers/staging/hv/ring_buffer.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/hv/ring_buffer.c +1 -1
@@ -513,7 +513,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,/* Make sure all reads are done before we update the read index since */ /* the writer may start writing to the read area once the read index */ /*is updated */ -mb (); +smp_mb ();/* Update the read index */ hv_set_next_read_location (inring_info, next_read_location);
Signature · 1 line
1.7.4.1
PATCH 28/49 Staging: hv: vmbus: Introduce read dependency in hv_get_ringbuffer_availbytes()
In reply to K. Y. SrinivasanIntroduce read dependency in hv_get_ringbuffer_availbytes().
--- drivers/staging/hv/ring_buffer.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/staging/hv/ring_buffer.c +2 -0
@@ -50,6 +50,8 @@ hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi, {u32 read_loc, write_loc; +smp_read_barrier_depends (); +/* Capture the read/write indices before they changed */ read_loc = rbi->ring_buffer->read_index; write_loc = rbi->ring_buffer->write_index;
Signature · 1 line
1.7.4.1
PATCH 29/49 Staging: hv: vmbus: Change the memory barrier in hv_ringbuffer_write()
In reply to K. Y. SrinivasanUse the correct memory barrier interface in Change the memory barrier in hv_ringbuffer_write().
--- drivers/staging/hv/ring_buffer.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/hv/ring_buffer.c +1 -1
@@ -413,7 +413,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info, sizeof(u64));/* Make sure we flush all writes before updating the writeIndex */ -mb (); +smp_wmb ();/* Now, update the write location */ hv_set_next_write_location (outring_info, next_write_location);
Signature · 1 line
1.7.4.1
PATCH 30/49 Staging: hv: vmbus: Get rid of the unused function vmbus_ontimer()
In reply to K. Y. SrinivasanNow, get rid of the unused function vmbus_ontimer().
--- drivers/staging/hv/channel.c | 12 ------------ 1 files changed, 0 insertions(+), 12 deletions(-)
drivers/staging/hv/channel.c +0 -12
@@ -874,15 +874,3 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer,return 0 ; }EXPORT_SYMBOL_GPL (vmbus_recvpacket_raw); - -/* -* vmbus_ontimer - Timer event callback -*/ -void vmbus_ontimer (unsigned long data) -{ -struct vmbus_channel *channel = (struct vmbus_channel *)data; - -if (channel->onchannel_callback) - channel->onchannel_callback (channel->channel_callback_context); -} -
Signature · 1 line
1.7.4.1
PATCH 31/49 Staging: hv: vmbus: Get rid of some dated comments in channel.c
In reply to K. Y. SrinivasanGet rid of some dated comments in channel.c.
--- drivers/staging/hv/channel.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/staging/hv/channel.c +0 -3
@@ -633,7 +633,6 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer, ret =hv_ringbuffer_write (&channel->outbound, bufferlist,3 ); -/* TODO: We should determine if this is optional */ if (ret ==0 && !hv_get_ringbuffer_interrupt_mask (&channel->outbound))vmbus_setevent (channel);
@@ -695,7 +694,6 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel, ret =hv_ringbuffer_write (&channel->outbound, bufferlist,3 ); -/* TODO: We should determine if this is optional */ if (ret ==0 && !hv_get_ringbuffer_interrupt_mask (&channel->outbound))vmbus_setevent (channel);
@@ -758,7 +756,6 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel, ret =hv_ringbuffer_write (&channel->outbound, bufferlist,3 ); -/* TODO: We should determine if this is optional */ if (ret ==0 && !hv_get_ringbuffer_interrupt_mask (&channel->outbound))vmbus_setevent (channel);
Signature · 1 line
1.7.4.1
PATCH 32/49 Staging: hv: vmbus: Correct some dated comments in channel.c
In reply to K. Y. SrinivasanCorrect some dated comments in channel.c.
--- drivers/staging/hv/channel.c | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-)
drivers/staging/hv/channel.c +4 -7
@@ -185,12 +185,12 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, openMsg = (struct vmbus_channel_open_channel *)openInfo->msg; openMsg->header.msgtype =CHANNELMSG_OPENCHANNEL ; - openMsg->openid = newchannel->offermsg.child_relid;/* FIXME */ + openMsg->openid = newchannel->offermsg.child_relid; openMsg->child_relid = newchannel->offermsg.child_relid; openMsg->ringbuffer_gpadlhandle = newchannel->ringbuffer_gpadlhandle; openMsg->downstream_ringbuffer_pageoffset = send_ringbuffer_size >>PAGE_SHIFT ; - openMsg->server_contextarea_gpadlhandle =0 ;/* TODO */ + openMsg->server_contextarea_gpadlhandle =0 ;if (userdatalen >MAX_USER_DEFINED_BYTES ) { err = -EINVAL ;
@@ -364,11 +364,11 @@ static int create_gpadl_header(void *kbuffer, u32 size, (struct vmbus_channel_gpadl_body *)msgbody->msg;/* -* FIXME: * Gpadl is u32 and we are using a pointer which could * be 64-bit +* This is governed by the guest/host protocol and +* so the hypervisor gurantees that this is ok. */ -/* gpadl_body->Gpadl = kbuffer; */ for (i =0 ; i < pfncurr; i++) gpadl_body->pfn[i] = pfn + pfnsum + i;
@@ -462,7 +462,6 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,if (msgcount >1 ) {list_for_each (curr, &msginfo->submsglist) { -/* FIXME: should this use list_entry() instead ? */ submsginfo = (struct vmbus_channel_msginfo *)curr; gpadl_body = (struct vmbus_channel_gpadl_body *)submsginfo->msg;
@@ -577,8 +576,6 @@ void vmbus_close(struct vmbus_channel *channel)vmbus_teardown_gpadl (channel, channel->ringbuffer_gpadlhandle); -/* TODO: Send a msg to release the childRelId */ -/* Cleanup the ring buffers for this channel */ hv_ringbuffer_cleanup (&channel->outbound);hv_ringbuffer_cleanup (&channel->inbound);
Signature · 1 line
1.7.4.1
PATCH 33/49 Staging: hv: vmbus: Move the definition of struct vmbus_channel
In reply to K. Y. SrinivasanIn preparation for embedding the state needed to close the channel, move the definition of struct vmbus_channel.
--- drivers/staging/hv/hyperv.h | 77 +++++++++++++++++++++---------------------- 1 files changed, 38 insertions(+), 39 deletions(-)
drivers/staging/hv/hyperv.h +38 -39
@@ -523,45 +523,6 @@ enum vmbus_channel_state { CHANNEL_OPEN_STATE, }; -struct vmbus_channel { -struct list_head listentry; - -struct hv_device *device_obj; - -struct work_struct work; - -enum vmbus_channel_state state; -/* -* For util channels, stash the -* the service index for easy access. -*/ -s8 util_index; - -struct vmbus_channel_offer_channel offermsg; -/* -* These are based on the OfferMsg.MonitorId. -* Save it here for easy access. -*/ -u8 monitor_grp; -u8 monitor_bit; - -u32 ringbuffer_gpadlhandle; - -/* Allocated memory for ring buffer */ -void *ringbuffer_pages; -u32 ringbuffer_pagecount; -struct hv_ring_buffer_info outbound;/* send to parent */ -struct hv_ring_buffer_info inbound;/* receive from parent */ -spinlock_t inbound_lock; -struct workqueue_struct *controlwq; - -/* Channel callback are invoked in this workqueue context */ -/* HANDLE dataWorkQueue; */ - -void (*onchannel_callback)(void *context); -void *channel_callback_context; -}; -struct vmbus_channel_debug_info {u32 relid;enum vmbus_channel_state state;
@@ -608,6 +569,44 @@ struct vmbus_channel_msginfo {unsigned char msg[0 ]; }; +struct vmbus_channel { +struct list_head listentry; + +struct hv_device *device_obj; + +struct work_struct work; + +enum vmbus_channel_state state; +/* +* For util channels, stash the +* the service index for easy access. +*/ +s8 util_index; + +struct vmbus_channel_offer_channel offermsg; +/* +* These are based on the OfferMsg.MonitorId. +* Save it here for easy access. +*/ +u8 monitor_grp; +u8 monitor_bit; + +u32 ringbuffer_gpadlhandle; + +/* Allocated memory for ring buffer */ +void *ringbuffer_pages; +u32 ringbuffer_pagecount; +struct hv_ring_buffer_info outbound;/* send to parent */ +struct hv_ring_buffer_info inbound;/* receive from parent */ +spinlock_t inbound_lock; +struct workqueue_struct *controlwq; + +/* Channel callback are invoked in this workqueue context */ +/* HANDLE dataWorkQueue; */ + +void (*onchannel_callback)(void *context); +void *channel_callback_context; +};void free_channel (struct vmbus_channel *channel);
Signature · 1 line
1.7.4.1
PATCH 34/49 Staging: hv: vmbus: Embed the state needed to close the channel
In reply to K. Y. SrinivasanNow, embed the state needed to close the channel - so we would not have to allocate memory in the channel close path.
--- drivers/staging/hv/hyperv.h | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/staging/hv/hyperv.h +7 -0
@@ -569,6 +569,11 @@ struct vmbus_channel_msginfo {unsigned char msg[0 ]; }; +struct vmbus_close_msg { +struct vmbus_channel_msginfo info; +struct vmbus_channel_close_channel msg; +}; +struct vmbus_channel {struct list_head listentry;
@@ -601,6 +606,8 @@ struct vmbus_channel {spinlock_t inbound_lock;struct workqueue_struct *controlwq; +struct vmbus_close_msg close_msg; +/* Channel callback are invoked in this workqueue context */ /* HANDLE dataWorkQueue; */
Signature · 1 line
1.7.4.1
PATCH 35/49 Staging: hv: vmbus: Use the newly introduced state in closing the channel
In reply to K. Y. SrinivasanNow, use the newly introduced state in closing the channel and eliminate a potential failure condition (that currently was not being handled correctly).
--- drivers/staging/hv/channel.c | 10 +--------- 1 files changed, 1 insertions(+), 9 deletions(-)
drivers/staging/hv/channel.c +1 -9
@@ -549,22 +549,15 @@ EXPORT_SYMBOL_GPL(vmbus_teardown_gpadl);void vmbus_close (struct vmbus_channel *channel) {struct vmbus_channel_close_channel *msg; -struct vmbus_channel_msginfo *info;int ret;/* Stop callback and cancel the timer asap */ channel->onchannel_callback =NULL ;/* Send a closing message */ - info =kmalloc (sizeof (*info) + -sizeof (struct vmbus_channel_close_channel ),GFP_KERNEL ); -/* FIXME: can't do anything other than return here because the -* function is void */ -if (!info) -return ; + msg = &channel->close_msg.msg; - msg = (struct vmbus_channel_close_channel *)info->msg; msg->header.msgtype =CHANNELMSG_CLOSECHANNEL ; msg->child_relid = channel->offermsg.child_relid;
@@ -583,7 +576,6 @@ void vmbus_close(struct vmbus_channel *channel)free_pages ((unsigned long )channel->ringbuffer_pages,get_order (channel->ringbuffer_pagecount *PAGE_SIZE )); -kfree (info); }EXPORT_SYMBOL_GPL (vmbus_close);
Signature · 1 line
1.7.4.1
PATCH 36/49 Staging: hv: vmbus: Get rid of a dated comment in vmbus_drv.c
In reply to K. Y. SrinivasanGet rid of a dated comment in vmbus_drv.c.
--- drivers/staging/hv/vmbus_drv.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/hv/vmbus_drv.c +0 -1
@@ -486,7 +486,6 @@ static int vmbus_on_isr(void)if (msg->header.message_type !=HVMSG_NONE ) ret |=0x1 ; -/* TODO: Check if there are events to be process */ page_addr = hv_context.synic_event_page[cpu]; event = (union hv_synic_event_flags *)page_addr +VMBUS_MESSAGE_SINT ;
Signature · 1 line
1.7.4.1
PATCH 37/49 Staging: hv: vmbus: Get rid of an unused function in connection.c
In reply to K. Y. SrinivasanGet rid of an unused function in connection.c
--- drivers/staging/hv/connection.c | 38 ------------------------------------- drivers/staging/hv/hyperv_vmbus.h | 2 - 2 files changed, 0 insertions(+), 40 deletions(-)
drivers/staging/hv/connection.c +0 -38
@@ -185,44 +185,6 @@ cleanup:return ret; } -/* -* vmbus_disconnect - -* Sends a disconnect request on the partition service connection -*/ -int vmbus_disconnect (void ) -{ -int ret =0 ; -struct vmbus_channel_message_header *msg; - -/* Make sure we are connected */ -if (vmbus_connection.conn_state !=CONNECTED ) -return -1 ; - - msg =kzalloc (sizeof (struct vmbus_channel_message_header ),GFP_KERNEL ); -if (!msg) -return -ENOMEM ; - - msg->msgtype =CHANNELMSG_UNLOAD ; - - ret =vmbus_post_msg (msg, -sizeof (struct vmbus_channel_message_header )); -if (ret !=0 ) - goto cleanup; - -free_pages ((unsigned long )vmbus_connection.int_page,0 ); -free_pages ((unsigned long )vmbus_connection.monitor_pages,1 ); - -/* TODO: iterate thru the msg list and free up */ -destroy_workqueue (vmbus_connection.work_queue); - - vmbus_connection.conn_state =DISCONNECTED ; - -pr_info ("hv_vmbus disconnected\n" ); - -cleanup: -kfree (msg); -return ret; -}/* * relid2channel - Get the channel object given its
drivers/staging/hv/hyperv_vmbus.h +0 -2
@@ -619,8 +619,6 @@ struct vmbus_channel *relid2channel(u32 relid);int vmbus_connect (void ); -int vmbus_disconnect (void ); -int vmbus_post_msg (void *buffer,size_t buflen);int vmbus_set_event (u32 child_relid);
Signature · 1 line
1.7.4.1
PATCH 38/49 Staging: hv: vmbus: Get rid of a dated comment in channel_mgmt.c
In reply to K. Y. SrinivasanStaging: hv: vmbus: Get rid of a dated comment in channel_mgmt.c.
--- drivers/staging/hv/channel_mgmt.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/hv/channel_mgmt.c +0 -1
@@ -477,7 +477,6 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr) newchannel->monitor_grp = (u8 )offer->monitorid /32 ; newchannel->monitor_bit = (u8 )offer->monitorid %32 ; -/* TODO: Make sure the offer comes from our parent partition */ INIT_WORK (&newchannel->work, vmbus_process_offer);queue_work (newchannel->controlwq, &newchannel->work); }
Signature · 1 line
1.7.4.1
PATCH 39/49 Staging: hv: vmbus: Fix a memory barrier call in vmbus_drv.c
In reply to K. Y. SrinivasanUse the correct memory barrier call in vmbus_drv.c
--- drivers/staging/hv/vmbus_drv.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/hv/vmbus_drv.c +1 -1
@@ -455,7 +455,7 @@ static void vmbus_on_msg_dpc(unsigned long data)* will not deliver any more messages since there is * no empty slot */ -mb (); +smp_mb ();if (msg->header.message_flags.msg_pending) {/*
Signature · 1 line
1.7.4.1
PATCH 40/49 Staging: hv: vmbus: Rename local variables in vmbus_drv.c
In reply to K. Y. SrinivasanRename local variables in vmbus_drv.c.
--- drivers/staging/hv/vmbus_drv.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/hv/vmbus_drv.c +6 -6
@@ -107,12 +107,12 @@ static ssize_t vmbus_show_device_attr(struct device *dev,struct device_attribute *dev_attr, char *buf) { - struct hv_device *device_ctx = device_to_hv_device(dev); + struct hv_device *hv_dev = device_to_hv_device(dev);struct hv_device_info device_info;memset (&device_info,0 ,sizeof (struct hv_device_info )); -get_channel_info (device_ctx, &device_info); +get_channel_info (hv_dev, &device_info);if (!strcmp (dev_attr->attr.name,"class_id" )) { return sprintf(buf, "{%02x%02x%02x%02x-%02x%02x-%02x%02x-"
@@ -300,10 +300,10 @@ static int vmbus_match(struct device *device, struct device_driver *driver) {int match =0 ;struct hv_driver *drv =drv_to_hv_drv (driver); -struct hv_device *device_ctx =device_to_hv_device (device); +struct hv_device *hv_dev =device_to_hv_device (device);/* We found our driver ? */ -if (memcmp (&device_ctx->dev_type, &drv->dev_type, +if (memcmp (&hv_dev->dev_type, &drv->dev_type,sizeof (struct hv_guid )) ==0 ) match =1 ;
@@ -387,9 +387,9 @@ static void vmbus_shutdown(struct device *child_device)*/ static void vmbus_device_release (struct device *device) { -struct hv_device *device_ctx =device_to_hv_device (device); +struct hv_device *hv_dev =device_to_hv_device (device); -kfree (device_ctx); +kfree (hv_dev); }
Signature · 1 line
1.7.4.1
PATCH 41/49 Staging: hv: vmbus: Increase the timeout for some critical calls
In reply to K. Y. SrinivasanIncrease the timeout for some critical calls. In testing we discovered that the current timeout of 1 second was insufficient under some conditions.
--- drivers/staging/hv/channel.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/hv/channel.c +2 -2
@@ -480,7 +480,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, } } - t =wait_for_completion_timeout (&msginfo->waitevent,HZ ); + t =wait_for_completion_timeout (&msginfo->waitevent,5 *HZ );BUG_ON (t ==0 );
@@ -530,7 +530,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) sizeof(struct vmbus_channel_gpadl_teardown));BUG_ON (ret !=0 ); - t =wait_for_completion_timeout (&info->waitevent,HZ ); + t =wait_for_completion_timeout (&info->waitevent,5 *HZ );BUG_ON (t ==0 );/* Received a torndown response */
Signature · 1 line
1.7.4.1
PATCH 42/49 Staging: hv: vmbus: Properly handle memory allocation failure in channel.c
In reply to K. Y. SrinivasanProperly handle memory allocation failure in channel.c.
--- drivers/staging/hv/channel.c | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-)
drivers/staging/hv/channel.c +17 -2
@@ -355,9 +355,24 @@ static int create_gpadl_header(void *kbuffer, u32 size,sizeof (struct vmbus_channel_gpadl_body ) + pfncurr *sizeof (u64); msgbody =kzalloc (msgsize,GFP_KERNEL ); -/* FIXME: we probably need to more if this fails */ -if (!msgbody) + +if (!msgbody) { +struct vmbus_channel_msginfo *pos =NULL ; +struct vmbus_channel_msginfo *tmp =NULL ; +/* +* Free up all the allocated messages. +*/ +list_for_each_entry_safe (pos, tmp, + &msgheader->submsglist, + msglistentry) { + +list_del (&pos->msglistentry); +kfree (pos); + } + goto nomem; + } + msgbody->msgsize = msgsize; (*messagecount)++; gpadl_body =
Signature · 1 line
1.7.4.1
PATCH 43/49 Staging: hv: vmbus: Cleanup some error codes in vmbus_drv.c
In reply to K. Y. SrinivasanCleanup some error codes in vmbus_drv.c
--- drivers/staging/hv/vmbus_drv.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/hv/vmbus_drv.c +2 -2
@@ -329,7 +329,7 @@ static int vmbus_probe(struct device *child_device) }else {pr_err ("probe not set for driver %s\n" ,dev_name (child_device)); - ret =-1 ; + ret = -ENODEV ; }return ret; }
@@ -352,7 +352,7 @@ static int vmbus_remove(struct device *child_device) }else {pr_err ("remove not set for driver %s\n" ,dev_name (child_device)); - ret =-1 ; + ret = -ENODEV ; } }
Signature · 1 line
1.7.4.1
PATCH 44/49 Staging: hv: vmbus: Cleanup error handling in vmbus_bus_init()
In reply to K. Y. SrinivasanCleanup error handling in vmbus_bus_init().
--- drivers/staging/hv/vmbus_drv.c | 16 ++++++---------- 1 files changed, 6 insertions(+), 10 deletions(-)
drivers/staging/hv/vmbus_drv.c +6 -10
@@ -535,7 +535,7 @@ static int vmbus_bus_init(int irq) ret =hv_init ();if (ret !=0 ) {pr_err ("Unable to initialize the hypervisor - 0x%x\n" , ret); - goto cleanup; +return ret; }/* Initialize the bus context */
@@ -544,10 +544,8 @@ static int vmbus_bus_init(int irq)/* Now, register the bus with LDM */ ret =bus_register (&hv_bus); -if (ret) { - ret =-1 ; - goto cleanup; - } +if (ret) +return ret;/* Get the interrupt resource */ ret = request_irq(irq, vmbus_isr, IRQF_SAMPLE_RANDOM,
@@ -559,8 +557,7 @@ static int vmbus_bus_init(int irq)bus_unregister (&hv_bus); - ret =-1 ; - goto cleanup; +return ret; } vector =IRQ0_VECTOR + irq;
@@ -574,14 +571,13 @@ static int vmbus_bus_init(int irq)if (ret) {free_irq (irq, hv_acpi_dev);bus_unregister (&hv_bus); - goto cleanup; +return ret; }vmbus_request_offers (); -cleanup: -return ret; +return 0 ; }/**
Signature · 1 line
1.7.4.1
PATCH 45/49 Staging: hv: vmbus: Cleanup error codes in hv.c
In reply to K. Y. SrinivasanCleanup error codes in hv.c.
--- drivers/staging/hv/hv.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/hv/hv.c +2 -2
@@ -277,11 +277,11 @@ u16 hv_post_message(union hv_connection_id connection_id,unsigned long addr;if (payload_size >HV_MESSAGE_PAYLOAD_BYTE_COUNT ) -return -1 ; +return -EMSGSIZE ; addr = (unsigned long )kmalloc (sizeof (struct aligned_input ),GFP_ATOMIC );if (!addr) -return -1 ; +return -ENOMEM ; aligned_msg = (struct hv_input_post_message *) (ALIGN (addr,HV_HYPERCALL_PARAM_ALIGN ));
Signature · 1 line
1.7.4.1
PATCH 46/49 Staging: hv: vmbus: Cleanup error codes in connection.c
In reply to K. Y. SrinivasanCleanup error codes in connection.c.
--- drivers/staging/hv/connection.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/hv/connection.c +5 -5
@@ -51,13 +51,13 @@ int vmbus_connect(void)/* Make sure we are not connecting or connected */ if (vmbus_connection.conn_state !=DISCONNECTED ) -return -1 ; +return -EISCONN ;/* Initialize the vmbus connection */ vmbus_connection.conn_state =CONNECTING ; vmbus_connection.work_queue =create_workqueue ("hv_vmbus_con" );if (!vmbus_connection.work_queue) { - ret =-1 ; + ret = -ENOMEM ; goto cleanup; }
@@ -74,7 +74,7 @@ int vmbus_connect(void) vmbus_connection.int_page = (void *)__get_free_pages (GFP_KERNEL |__GFP_ZERO,0 );if (vmbus_connection.int_page ==NULL ) { - ret =-1 ; + ret = -ENOMEM ; goto cleanup; }
@@ -90,7 +90,7 @@ int vmbus_connect(void) vmbus_connection.monitor_pages = (void *)__get_free_pages ((GFP_KERNEL |__GFP_ZERO),1 );if (vmbus_connection.monitor_pages ==NULL ) { - ret =-1 ; + ret = -ENOMEM ; goto cleanup; }
@@ -157,7 +157,7 @@ int vmbus_connect(void)pr_err ("Unable to connect, " "Version %d not supported by Hyper-V\n" ,VMBUS_REVISION_NUMBER ); - ret =-1 ; + ret = -ECONNREFUSED ; goto cleanup; }
Signature · 1 line
1.7.4.1
PATCH 47/49 Staging: hv: vmbus: Cleanup some error values in channel.c
In reply to K. Y. SrinivasanCleanup some error values in channel.c.
--- drivers/staging/hv/channel.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/hv/channel.c +1 -1
@@ -811,7 +811,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer,pr_err ("Buffer too small - got %d needs %d\n" , bufferlen, userlen); -return -1 ; +return -ETOOSMALL ; } *requestid = desc.trans_id;
Signature · 1 line
1.7.4.1
PATCH 48/49 Staging: hv: vmbus: Change Cleanup to cleanup in channel.c
In reply to K. Y. SrinivasanChange the jump label Cleanup to cleanup.
--- drivers/staging/hv/channel.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/hv/channel.c +5 -5
@@ -209,7 +209,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, sizeof(struct vmbus_channel_open_channel));if (ret !=0 ) - goto Cleanup; + goto cleanup; t =wait_for_completion_timeout (&openInfo->waitevent,HZ );if (t ==0 ) {
@@ -221,7 +221,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,if (openInfo->response.open_result.status) err = openInfo->response.open_result.status; -Cleanup: +cleanup:spin_lock_irqsave (&vmbus_connection.channelmsg_lock, flags);list_del (&openInfo->msglistentry);spin_unlock_irqrestore (&vmbus_connection.channelmsg_lock, flags);
@@ -472,7 +472,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, ret =vmbus_post_msg (gpadlmsg, msginfo->msgsize -sizeof (*msginfo));if (ret !=0 ) - goto Cleanup; + goto cleanup;if (msgcount >1 ) {list_for_each (curr, &msginfo->submsglist) {
@@ -491,7 +491,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, submsginfo->msgsize - sizeof(*submsginfo));if (ret !=0 ) - goto Cleanup; + goto cleanup; } }
@@ -502,7 +502,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,/* At this point, we received the gpadl created msg */ *gpadl_handle = gpadlmsg->gpadl; -Cleanup: +cleanup:spin_lock_irqsave (&vmbus_connection.channelmsg_lock, flags);list_del (&msginfo->msglistentry);spin_unlock_irqrestore (&vmbus_connection.channelmsg_lock, flags);
Signature · 1 line
1.7.4.1
PATCH 49/49 Staging: hv: vmbus: Increase the timeout value in vmbus_request_offers()
In reply to K. Y. SrinivasanIncrease the timeout value in vmbus_request_offers().
--- drivers/staging/hv/channel_mgmt.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/hv/channel_mgmt.c +1 -1
@@ -767,7 +767,7 @@ int vmbus_request_offers(void) goto cleanup; } - t =wait_for_completion_timeout (&msginfo->waitevent,HZ ); + t =wait_for_completion_timeout (&msginfo->waitevent,5 *HZ );if (t ==0 ) { ret = -ETIMEDOUT ; goto cleanup;
Signature · 1 line
1.7.4.1
Re: [PATCH 49/49] Staging: hv: vmbus: Increase the timeout value in vmbus_request_offers()
Quoted 1 line · K. Y. Srinivasan
Increase the timeout value in
vmbus_request_offers().
Why? What does this solve/fix/prevent?
thanks,
greg k-h
RE: [PATCH 49/49] Staging: hv: vmbus: Increase the timeout value in vmbus_request_offers()
Quoted 12 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, June 07, 2011 4:45 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 49/49] Staging: hv: vmbus: Increase the timeout value invmbus_request_offers()
Quoted 4 lines
Quoted 1 line · K. Y. Srinivasan
Increase the timeout value in
vmbus_request_offers().Why? What does this solve/fix/prevent?
On some very loaded systems, when we tested the 1 second timeout that we had prior to this patch was insufficient. So I bumped it to 5 seconds.
Regards,
K. Y
Re: [PATCH 49/49] Staging: hv: vmbus: Increase the timeout value in vmbus_request_offers()
Quoted 12 lines · KY Srinivasan
Quoted 12 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, June 07, 2011 4:45 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 49/49] Staging: hv: vmbus: Increase the timeout value invmbus_request_offers()
Quoted 7 lines
Quoted 4 lines · K. Y. Srinivasan
Quoted 1 line
Increase the timeout value in
vmbus_request_offers().Why? What does this solve/fix/prevent?
On some very loaded systems, when we tested the 1 second timeout that we had prior to this patch was insufficient. So I bumped it to 5 seconds.
Ok, then this should be something that goes into 3.0 and older kernels, right?
If so, please say so, with this type of description, when you submit it.
Remember, don't say only what you did in the changelog comment, but why you did it if it's not obvious (and it wasn't here.)
Care to resend this one with this information?
thanks,
greg k-h
RE: [PATCH 49/49] Staging: hv: vmbus: Increase the timeout value in vmbus_request_offers()
Quoted 36 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, June 07, 2011 5:28 PM
To: KY Srinivasan
Cc: Greg KH; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 49/49] Staging: hv: vmbus: Increase the timeout value invmbus_request_offers()Quoted 12 lines · KY Srinivasan
Quoted 12 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, June 07, 2011 4:45 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 49/49] Staging: hv: vmbus: Increase the timeout value invmbus_request_offers()Quoted 7 lines
Quoted 4 lines · K. Y. Srinivasan
Quoted 1 line
Increase the timeout value in
vmbus_request_offers().Why? What does this solve/fix/prevent?
On some very loaded systems, when we tested the 1 second timeout that we had prior to this patch was insufficient. So I bumped it to 5 seconds.
Ok, then this should be something that goes into 3.0 and older kernels, right?
Quoted 6 lines
If so, please say so, with this type of description, when you submit it.
Remember, don't say only what you did in the changelog comment, but why you did it if it's not obvious (and it wasn't here.)
Care to resend this one with this information?
Will do.
Thanks,
K. Y
Quoted 9 lines · K. Y. Srinivasan
Further cleanup of the hv drivers:
1) Continue to cleanup our drivers to conform to the Linux Driver Model.
2) Fix some long standing bugs with regards to unloading and reloading the drivers - block, net and stor.
3) VMBUS is an ACPI enumerated device; make VMBUS an ACPI bus driver.
Ok, if that's the way the bus really is, it's good to get rid of the pci code.
Quoted 8 lines
4) Get rid of channel polling code; instead the channel receive paths will be purely interrupt drive.
5) Cleanup error return values in the vmbus driver and general cleanup.
6) Fix memory barrier calls in the ring buffer code.
7) Increase the timeout values for some critical guest to host calls.
I applied all of these but the last one.
For the last patch, please provide more information about it. Should it also go to older kernel releases to resolve issues found there?
thanks,
greg k-h