RE: [PATCH 07/07] Replaced printk with pr_info in hv_timesource
-Original Message- From: Greg KH [mailto:g...@kroah.com] Sent: Monday, April 04, 2011 10:01 PM To: Hank Janssen Cc: Haiyang Zhang; gre...@suse.de; linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; virtualizat...@lists.osdl.org; KY Srinivasan Subject: Re: [PATCH 07/07] Replaced printk with pr_info in hv_timesource #include linux/version.h #include linux/clocksource.h @@ -91,7 +92,7 @@ static int __init init_hv_clocksource(void) if (!dmi_check_system(hv_timesource_dmi_table)) return -ENODEV; - printk(KERN_INFO Registering HyperV clock source\n); + pr_info(Registering HyperV clock source\n); Why is this line even needed at all? Please remove it in future patches. Of course, since there have been so many changes I will wait a day or two To get stuff settled in staging and I will send the patch to remove it. Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 1/5] staging: hv: change camel case funct names to lower case funct in hv_mouse
Change all camelcase function names to lower case in hv_mouse Signed-off-by: Abhishek Kane v-abk...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: K. Y. Srinivasan k...@microsoft.com --- drivers/staging/hv/hv_mouse.c | 92 ++--- 1 files changed, 49 insertions(+), 43 deletions(-) diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c index 50147f8..084ba3b 100644 --- a/drivers/staging/hv/hv_mouse.c +++ b/drivers/staging/hv/hv_mouse.c @@ -200,7 +200,7 @@ static void deviceinfo_callback(struct hv_device *dev, struct hv_input_dev_info static void inputreport_callback(struct hv_device *dev, void *packet, u32 len); static void reportdesc_callback(struct hv_device *dev, void *packet, u32 len); -static struct mousevsc_dev *AllocInputDevice(struct hv_device *Device) +static struct mousevsc_dev *alloc_input_device(struct hv_device *Device) { struct mousevsc_dev *inputDevice; @@ -211,7 +211,7 @@ static struct mousevsc_dev *AllocInputDevice(struct hv_device *Device) /* * Set to 2 to allow both inbound and outbound traffics -* (ie GetInputDevice() and MustGetInputDevice()) to proceed. +* (ie get_input_device() and must_get_input_device()) to proceed. */ atomic_cmpxchg(inputDevice-RefCount, 0, 2); @@ -221,7 +221,7 @@ static struct mousevsc_dev *AllocInputDevice(struct hv_device *Device) return inputDevice; } -static void FreeInputDevice(struct mousevsc_dev *Device) +static void free_input_device(struct mousevsc_dev *Device) { WARN_ON(atomic_read(Device-RefCount) == 0); kfree(Device); @@ -230,7 +230,7 @@ static void FreeInputDevice(struct mousevsc_dev *Device) /* * Get the inputdevice object if exists and its refcount 1 */ -static struct mousevsc_dev *GetInputDevice(struct hv_device *Device) +static struct mousevsc_dev *get_input_device(struct hv_device *Device) { struct mousevsc_dev *inputDevice; @@ -256,7 +256,7 @@ static struct mousevsc_dev *GetInputDevice(struct hv_device *Device) /* * Get the inputdevice object iff exists and its refcount 0 */ -static struct mousevsc_dev *MustGetInputDevice(struct hv_device *Device) +static struct mousevsc_dev *must_get_input_device(struct hv_device *Device) { struct mousevsc_dev *inputDevice; @@ -270,7 +270,7 @@ static struct mousevsc_dev *MustGetInputDevice(struct hv_device *Device) return inputDevice; } -static void PutInputDevice(struct hv_device *Device) +static void put_input_device(struct hv_device *Device) { struct mousevsc_dev *inputDevice; @@ -280,9 +280,9 @@ static void PutInputDevice(struct hv_device *Device) } /* - * Drop ref count to 1 to effectively disable GetInputDevice() + * Drop ref count to 1 to effectively disable get_input_device() */ -static struct mousevsc_dev *ReleaseInputDevice(struct hv_device *Device) +static struct mousevsc_dev *release_input_device(struct hv_device *Device) { struct mousevsc_dev *inputDevice; @@ -298,7 +298,7 @@ static struct mousevsc_dev *ReleaseInputDevice(struct hv_device *Device) /* * Drop ref count to 0. No one can use InputDevice object. */ -static struct mousevsc_dev *FinalReleaseInputDevice(struct hv_device *Device) +static struct mousevsc_dev *final_release_input_device(struct hv_device *Device) { struct mousevsc_dev *inputDevice; @@ -312,12 +312,13 @@ static struct mousevsc_dev *FinalReleaseInputDevice(struct hv_device *Device) return inputDevice; } -static void MousevscOnSendCompletion(struct hv_device *Device, struct vmpacket_descriptor *Packet) +static void mousevsc_on_send_completion(struct hv_device *Device, + struct vmpacket_descriptor *Packet) { struct mousevsc_dev *inputDevice; void *request; - inputDevice = MustGetInputDevice(Device); + inputDevice = must_get_input_device(Device); if (!inputDevice) { pr_err(unable to get input device...device being destroyed?); return; @@ -330,10 +331,11 @@ static void MousevscOnSendCompletion(struct hv_device *Device, struct vmpacket_d /* Shouldn't we be doing something here? */ } - PutInputDevice(Device); + put_input_device(Device); } -static void MousevscOnReceiveDeviceInfo(struct mousevsc_dev *InputDevice, struct synthhid_device_info *DeviceInfo) +static void mousevsc_on_receive_device_info(struct mousevsc_dev *InputDevice, + struct synthhid_device_info *DeviceInfo) { int ret = 0; struct hid_descriptor *desc; @@ -413,7 +415,8 @@ Cleanup: wake_up(InputDevice-DeviceInfoWaitEvent); } -static void MousevscOnReceiveInputReport(struct mousevsc_dev *InputDevice, struct synthhid_input_report *InputReport) +static void
[PATCH 3/5] staging: hv: Convert camel case member of struct mousevsc_drv_obj to lower case
Change camelcase members of mousevsc_drv_obj to lower case in hv_mouse. Signed-off-by: Abhishek Kane v-abk...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: K. Y. Srinivasan k...@microsoft.com --- drivers/staging/hv/hv_mouse.c | 26 +- 1 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c index 3b0390d..ce88868 100644 --- a/drivers/staging/hv/hv_mouse.c +++ b/drivers/staging/hv/hv_mouse.c @@ -46,7 +46,7 @@ struct hv_input_dev_info { /* Represents the input vsc driver */ /* FIXME - can be removed entirely */ struct mousevsc_drv_obj { - struct hv_driver Base; + struct hv_driver base; }; @@ -836,7 +836,7 @@ static int mousevsc_probe(struct device *device) dev_set_drvdata(device, input_dev_ctx); /* Call to the vsc driver to add the device */ - ret = mousevsc_drv_obj-Base.dev_add(device_obj, NULL); + ret = mousevsc_drv_obj-base.dev_add(device_obj, NULL); if (ret != 0) { DPRINT_ERR(INPUTVSC_DRV, unable to add input vsc device); @@ -868,14 +868,14 @@ static int mousevsc_remove(struct device *device) input_dev_ctx-connected = 0; } - if (!mousevsc_drv_obj-Base.dev_rm) + if (!mousevsc_drv_obj-base.dev_rm) return -1; /* * Call to the vsc driver to let it know that the device * is being removed */ - ret = mousevsc_drv_obj-Base.dev_rm(device_obj); + ret = mousevsc_drv_obj-base.dev_rm(device_obj); if (ret != 0) { DPRINT_ERR(INPUTVSC_DRV, @@ -951,7 +951,7 @@ static int mousevsc_drv_exit_cb(struct device *dev, void *data) static void mousevsc_drv_exit(void) { struct mousevsc_drv_obj *mousevsc_drv_obj = g_mousevsc_drv; - struct hv_driver *drv = g_mousevsc_drv.Base; + struct hv_driver *drv = g_mousevsc_drv.base; int ret; struct device *current_dev = NULL; @@ -973,8 +973,8 @@ static void mousevsc_drv_exit(void) device_unregister(current_dev); } - if (mousevsc_drv_obj-Base.cleanup) - mousevsc_drv_obj-Base.cleanup(mousevsc_drv_obj-Base); + if (mousevsc_drv_obj-base.cleanup) + mousevsc_drv_obj-base.cleanup(mousevsc_drv_obj-base); vmbus_child_driver_unregister(drv-driver); @@ -992,9 +992,9 @@ static int mouse_vsc_initialize(struct hv_driver *driver) sizeof(struct hv_guid)); /* Setup the dispatch table */ - inputDriver-Base.dev_add = mousevsc_on_device_add; - inputDriver-Base.dev_rm = mousevsc_on_device_remove; - inputDriver-Base.cleanup = mousevsc_on_cleanup; + inputDriver-base.dev_add = mousevsc_on_device_add; + inputDriver-base.dev_rm = mousevsc_on_device_remove; + inputDriver-base.cleanup = mousevsc_on_cleanup; return ret; } @@ -1003,14 +1003,14 @@ static int mouse_vsc_initialize(struct hv_driver *driver) static int __init mousevsc_init(void) { struct mousevsc_drv_obj *input_drv_obj = g_mousevsc_drv; - struct hv_driver *drv = g_mousevsc_drv.Base; + struct hv_driver *drv = g_mousevsc_drv.base; DPRINT_INFO(INPUTVSC_DRV, Hyper-V Mouse driver initializing.); /* Callback to client driver to complete the initialization */ - mouse_vsc_initialize(input_drv_obj-Base); + mouse_vsc_initialize(input_drv_obj-base); - drv-driver.name = input_drv_obj-Base.name; + drv-driver.name = input_drv_obj-base.name; drv-priv = input_drv_obj; drv-driver.probe = mousevsc_probe; -- 1.7.1 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 2/5] staging: hv: Convert camel case func params to lower case in hv_mouse
Change all camelcase function params to lower case in hv_mouse Signed-off-by: Abhishek Kane v-abk...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: K. Y. Srinivasan k...@microsoft.com --- drivers/staging/hv/hv_mouse.c | 172 + 1 files changed, 87 insertions(+), 85 deletions(-) diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c index 084ba3b..3b0390d 100644 --- a/drivers/staging/hv/hv_mouse.c +++ b/drivers/staging/hv/hv_mouse.c @@ -200,7 +200,7 @@ static void deviceinfo_callback(struct hv_device *dev, struct hv_input_dev_info static void inputreport_callback(struct hv_device *dev, void *packet, u32 len); static void reportdesc_callback(struct hv_device *dev, void *packet, u32 len); -static struct mousevsc_dev *alloc_input_device(struct hv_device *Device) +static struct mousevsc_dev *alloc_input_device(struct hv_device *device) { struct mousevsc_dev *inputDevice; @@ -215,26 +215,26 @@ static struct mousevsc_dev *alloc_input_device(struct hv_device *Device) */ atomic_cmpxchg(inputDevice-RefCount, 0, 2); - inputDevice-Device = Device; - Device-ext = inputDevice; + inputDevice-Device = device; + device-ext = inputDevice; return inputDevice; } -static void free_input_device(struct mousevsc_dev *Device) +static void free_input_device(struct mousevsc_dev *device) { - WARN_ON(atomic_read(Device-RefCount) == 0); - kfree(Device); + WARN_ON(atomic_read(device-RefCount) == 0); + kfree(device); } /* * Get the inputdevice object if exists and its refcount 1 */ -static struct mousevsc_dev *get_input_device(struct hv_device *Device) +static struct mousevsc_dev *get_input_device(struct hv_device *device) { struct mousevsc_dev *inputDevice; - inputDevice = (struct mousevsc_dev *)Device-ext; + inputDevice = (struct mousevsc_dev *)device-ext; /* * FIXME @@ -256,11 +256,11 @@ static struct mousevsc_dev *get_input_device(struct hv_device *Device) /* * Get the inputdevice object iff exists and its refcount 0 */ -static struct mousevsc_dev *must_get_input_device(struct hv_device *Device) +static struct mousevsc_dev *must_get_input_device(struct hv_device *device) { struct mousevsc_dev *inputDevice; - inputDevice = (struct mousevsc_dev *)Device-ext; + inputDevice = (struct mousevsc_dev *)device-ext; if (inputDevice atomic_read(inputDevice-RefCount)) atomic_inc(inputDevice-RefCount); @@ -270,11 +270,11 @@ static struct mousevsc_dev *must_get_input_device(struct hv_device *Device) return inputDevice; } -static void put_input_device(struct hv_device *Device) +static void put_input_device(struct hv_device *device) { struct mousevsc_dev *inputDevice; - inputDevice = (struct mousevsc_dev *)Device-ext; + inputDevice = (struct mousevsc_dev *)device-ext; atomic_dec(inputDevice-RefCount); } @@ -282,11 +282,11 @@ static void put_input_device(struct hv_device *Device) /* * Drop ref count to 1 to effectively disable get_input_device() */ -static struct mousevsc_dev *release_input_device(struct hv_device *Device) +static struct mousevsc_dev *release_input_device(struct hv_device *device) { struct mousevsc_dev *inputDevice; - inputDevice = (struct mousevsc_dev *)Device-ext; + inputDevice = (struct mousevsc_dev *)device-ext; /* Busy wait until the ref drop to 2, then set it to 1 */ while (atomic_cmpxchg(inputDevice-RefCount, 2, 1) != 2) @@ -296,82 +296,83 @@ static struct mousevsc_dev *release_input_device(struct hv_device *Device) } /* - * Drop ref count to 0. No one can use InputDevice object. + * Drop ref count to 0. No one can use input_device object. */ -static struct mousevsc_dev *final_release_input_device(struct hv_device *Device) +static struct mousevsc_dev *final_release_input_device(struct hv_device *device) { struct mousevsc_dev *inputDevice; - inputDevice = (struct mousevsc_dev *)Device-ext; + inputDevice = (struct mousevsc_dev *)device-ext; /* Busy wait until the ref drop to 1, then set it to 0 */ while (atomic_cmpxchg(inputDevice-RefCount, 1, 0) != 1) udelay(100); - Device-ext = NULL; + device-ext = NULL; return inputDevice; } -static void mousevsc_on_send_completion(struct hv_device *Device, - struct vmpacket_descriptor *Packet) +static void mousevsc_on_send_completion(struct hv_device *device, + struct vmpacket_descriptor *packet) { struct mousevsc_dev *inputDevice; void *request; - inputDevice = must_get_input_device(Device); + inputDevice = must_get_input_device(device); if (!inputDevice
[PATCH 4/5] staging: hv: Convert camel case members of struct mousevsc_dev to lower case
Change camelcase members of struct mousevsc_dev to lower case in hv_mouse Signed-off-by: Abhishek Kane v-abk...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: K. Y. Srinivasan k...@microsoft.com --- drivers/staging/hv/hv_mouse.c | 127 + 1 files changed, 65 insertions(+), 62 deletions(-) diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c index ce88868..1edcdf7 100644 --- a/drivers/staging/hv/hv_mouse.c +++ b/drivers/staging/hv/hv_mouse.c @@ -167,23 +167,23 @@ struct mousevsc_prt_msg { * Represents an mousevsc device */ struct mousevsc_dev { - struct hv_device*Device; + struct hv_device*device; /* 0 indicates the device is being destroyed */ - atomic_tRefCount; - int NumOutstandingRequests; - unsigned char bInitializeComplete; - struct mousevsc_prt_msg ProtocolReq; - struct mousevsc_prt_msg ProtocolResp; + atomic_tref_count; + int num_outstanding_req; + unsigned char init_complete; + struct mousevsc_prt_msg protocol_req; + struct mousevsc_prt_msg protocol_resp; /* Synchronize the request/response if needed */ - wait_queue_head_t ProtocolWaitEvent; - wait_queue_head_t DeviceInfoWaitEvent; + wait_queue_head_t protocol_wait_event; + wait_queue_head_t dev_info_wait_event; int protocol_wait_condition; int device_wait_condition; - int DeviceInfoStatus; + int dev_info_status; - struct hid_descriptor *HidDesc; - unsigned char *ReportDesc; - u32 ReportDescSize; + struct hid_descriptor *hid_desc; + unsigned char *report_desc; + u32 report_desc_size; struct hv_input_dev_info hid_dev_info; }; @@ -213,9 +213,9 @@ static struct mousevsc_dev *alloc_input_device(struct hv_device *device) * Set to 2 to allow both inbound and outbound traffics * (ie get_input_device() and must_get_input_device()) to proceed. */ - atomic_cmpxchg(inputDevice-RefCount, 0, 2); + atomic_cmpxchg(inputDevice-ref_count, 0, 2); - inputDevice-Device = device; + inputDevice-device = device; device-ext = inputDevice; return inputDevice; @@ -223,7 +223,7 @@ static struct mousevsc_dev *alloc_input_device(struct hv_device *device) static void free_input_device(struct mousevsc_dev *device) { - WARN_ON(atomic_read(device-RefCount) == 0); + WARN_ON(atomic_read(device-ref_count) == 0); kfree(device); } @@ -242,11 +242,11 @@ static struct mousevsc_dev *get_input_device(struct hv_device *device) * what the intention is... * * printk(KERN_ERR - REFCOUNT = %d, - *inputDevice-RefCount); + *inputDevice-ref_count); */ - if (inputDevice atomic_read(inputDevice-RefCount) 1) - atomic_inc(inputDevice-RefCount); + if (inputDevice atomic_read(inputDevice-ref_count) 1) + atomic_inc(inputDevice-ref_count); else inputDevice = NULL; @@ -262,8 +262,8 @@ static struct mousevsc_dev *must_get_input_device(struct hv_device *device) inputDevice = (struct mousevsc_dev *)device-ext; - if (inputDevice atomic_read(inputDevice-RefCount)) - atomic_inc(inputDevice-RefCount); + if (inputDevice atomic_read(inputDevice-ref_count)) + atomic_inc(inputDevice-ref_count); else inputDevice = NULL; @@ -276,7 +276,7 @@ static void put_input_device(struct hv_device *device) inputDevice = (struct mousevsc_dev *)device-ext; - atomic_dec(inputDevice-RefCount); + atomic_dec(inputDevice-ref_count); } /* @@ -289,7 +289,7 @@ static struct mousevsc_dev *release_input_device(struct hv_device *device) inputDevice = (struct mousevsc_dev *)device-ext; /* Busy wait until the ref drop to 2, then set it to 1 */ - while (atomic_cmpxchg(inputDevice-RefCount, 2, 1) != 2) + while (atomic_cmpxchg(inputDevice-ref_count, 2, 1) != 2) udelay(100); return inputDevice; @@ -305,7 +305,7 @@ static struct mousevsc_dev *final_release_input_device(struct hv_device *device) inputDevice = (struct mousevsc_dev *)device-ext; /* Busy wait until the ref drop to 1, then set it to 0 */ - while (atomic_cmpxchg(inputDevice-RefCount, 1, 0) != 1) + while (atomic_cmpxchg(inputDevice-ref_count, 1, 0) != 1) udelay(100); device-ext = NULL; @@ -326,7 +326,7 @@ static void
[PATCH 5/5] staging: hv: Convert camel case in in all functions to lower case in hv_mouse
Convert all camelcase variables inside of all remaining functions to lower case in hv_mouse. Signed-off-by: Abhishek Kane v-abk...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: K. Y. Srinivasan k...@microsoft.com --- drivers/staging/hv/hv_mouse.c | 225 + 1 files changed, 113 insertions(+), 112 deletions(-) diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c index 1edcdf7..23b69c1 100644 --- a/drivers/staging/hv/hv_mouse.c +++ b/drivers/staging/hv/hv_mouse.c @@ -202,23 +202,23 @@ static void reportdesc_callback(struct hv_device *dev, void *packet, u32 len); static struct mousevsc_dev *alloc_input_device(struct hv_device *device) { - struct mousevsc_dev *inputDevice; + struct mousevsc_dev *input_dev; - inputDevice = kzalloc(sizeof(struct mousevsc_dev), GFP_KERNEL); + input_dev = kzalloc(sizeof(struct mousevsc_dev), GFP_KERNEL); - if (!inputDevice) + if (!input_dev) return NULL; /* * Set to 2 to allow both inbound and outbound traffics * (ie get_input_device() and must_get_input_device()) to proceed. */ - atomic_cmpxchg(inputDevice-ref_count, 0, 2); + atomic_cmpxchg(input_dev-ref_count, 0, 2); - inputDevice-device = device; - device-ext = inputDevice; + input_dev-device = device; + device-ext = input_dev; - return inputDevice; + return input_dev; } static void free_input_device(struct mousevsc_dev *device) @@ -232,9 +232,9 @@ static void free_input_device(struct mousevsc_dev *device) */ static struct mousevsc_dev *get_input_device(struct hv_device *device) { - struct mousevsc_dev *inputDevice; + struct mousevsc_dev *input_dev; - inputDevice = (struct mousevsc_dev *)device-ext; + input_dev = (struct mousevsc_dev *)device-ext; /* * FIXME @@ -242,15 +242,15 @@ static struct mousevsc_dev *get_input_device(struct hv_device *device) * what the intention is... * * printk(KERN_ERR - REFCOUNT = %d, - *inputDevice-ref_count); + *input_dev-ref_count); */ - if (inputDevice atomic_read(inputDevice-ref_count) 1) - atomic_inc(inputDevice-ref_count); + if (input_dev atomic_read(input_dev-ref_count) 1) + atomic_inc(input_dev-ref_count); else - inputDevice = NULL; + input_dev = NULL; - return inputDevice; + return input_dev; } /* @@ -258,25 +258,25 @@ static struct mousevsc_dev *get_input_device(struct hv_device *device) */ static struct mousevsc_dev *must_get_input_device(struct hv_device *device) { - struct mousevsc_dev *inputDevice; + struct mousevsc_dev *input_dev; - inputDevice = (struct mousevsc_dev *)device-ext; + input_dev = (struct mousevsc_dev *)device-ext; - if (inputDevice atomic_read(inputDevice-ref_count)) - atomic_inc(inputDevice-ref_count); + if (input_dev atomic_read(input_dev-ref_count)) + atomic_inc(input_dev-ref_count); else - inputDevice = NULL; + input_dev = NULL; - return inputDevice; + return input_dev; } static void put_input_device(struct hv_device *device) { - struct mousevsc_dev *inputDevice; + struct mousevsc_dev *input_dev; - inputDevice = (struct mousevsc_dev *)device-ext; + input_dev = (struct mousevsc_dev *)device-ext; - atomic_dec(inputDevice-ref_count); + atomic_dec(input_dev-ref_count); } /* @@ -284,15 +284,15 @@ static void put_input_device(struct hv_device *device) */ static struct mousevsc_dev *release_input_device(struct hv_device *device) { - struct mousevsc_dev *inputDevice; + struct mousevsc_dev *input_dev; - inputDevice = (struct mousevsc_dev *)device-ext; + input_dev = (struct mousevsc_dev *)device-ext; /* Busy wait until the ref drop to 2, then set it to 1 */ - while (atomic_cmpxchg(inputDevice-ref_count, 2, 1) != 2) + while (atomic_cmpxchg(input_dev-ref_count, 2, 1) != 2) udelay(100); - return inputDevice; + return input_dev; } /* @@ -300,33 +300,33 @@ static struct mousevsc_dev *release_input_device(struct hv_device *device) */ static struct mousevsc_dev *final_release_input_device(struct hv_device *device) { - struct mousevsc_dev *inputDevice; + struct mousevsc_dev *input_dev; - inputDevice = (struct mousevsc_dev *)device-ext; + input_dev = (struct mousevsc_dev *)device-ext; /* Busy wait until the ref drop to 1, then set it to 0 */ - while (atomic_cmpxchg(inputDevice-ref_count, 1, 0) != 1) + while (atomic_cmpxchg(input_dev-ref_count, 1, 0) != 1
[PATCH 03/07] Remove all unneeded DPRINT from hv_utils
Remove all un-needed DPRINT calls from hv_utils. This patch deals with hv_utils only. Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: K. Y. Srinivasan k...@microsoft.com --- drivers/staging/hv/hv_kvp.c |3 --- drivers/staging/hv/hv_util.c | 12 2 files changed, 0 insertions(+), 15 deletions(-) diff --git a/drivers/staging/hv/hv_kvp.c b/drivers/staging/hv/hv_kvp.c index faf692e..7775820 100644 --- a/drivers/staging/hv/hv_kvp.c +++ b/drivers/staging/hv/hv_kvp.c @@ -259,9 +259,6 @@ void hv_kvp_onchannelcallback(void *context) vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE, recvlen, requestid); if (recvlen 0) { - DPRINT_DBG(VMBUS, KVP packet: len=%d, requestid=%lld, - recvlen, requestid); - icmsghdrp = (struct icmsg_hdr *)recv_buffer[ sizeof(struct vmbuspipe_hdr)]; diff --git a/drivers/staging/hv/hv_util.c b/drivers/staging/hv/hv_util.c index 4792f2c..3e74f79 100644 --- a/drivers/staging/hv/hv_util.c +++ b/drivers/staging/hv/hv_util.c @@ -59,9 +59,6 @@ static void shutdown_onchannelcallback(void *context) PAGE_SIZE, recvlen, requestid); if (recvlen 0) { - DPRINT_DBG(VMBUS, shutdown packet: len=%d, requestid=%lld, - recvlen, requestid); - icmsghdrp = (struct icmsg_hdr *)shut_txf_buf[ sizeof(struct vmbuspipe_hdr)]; @@ -159,9 +156,6 @@ static void timesync_onchannelcallback(void *context) PAGE_SIZE, recvlen, requestid); if (recvlen 0) { - DPRINT_DBG(VMBUS, timesync packet: recvlen=%d, requestid=%lld, - recvlen, requestid); - icmsghdrp = (struct icmsg_hdr *)time_txf_buf[ sizeof(struct vmbuspipe_hdr)]; @@ -200,9 +194,6 @@ static void heartbeat_onchannelcallback(void *context) PAGE_SIZE, recvlen, requestid); if (recvlen 0) { - DPRINT_DBG(VMBUS, heartbeat packet: len=%d, requestid=%lld, - recvlen, requestid); - icmsghdrp = (struct icmsg_hdr *)hbeat_txf_buf[ sizeof(struct vmbuspipe_hdr)]; @@ -214,9 +205,6 @@ static void heartbeat_onchannelcallback(void *context) sizeof(struct vmbuspipe_hdr) + sizeof(struct icmsg_hdr)]; - DPRINT_DBG(VMBUS, heartbeat seq = %lld, - heartbeat_msg-seq_num); - heartbeat_msg-seq_num += 1; } -- 1.6.0.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 02/07] Remove all unneeded DPRINT from hv_netvsc
Remove all un-needed DPRINT calls from hv_netvsc. This patch deals with hv_netvsc only. Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: K. Y. Srinivasan k...@microsoft.com --- drivers/staging/hv/netvsc.c | 102 ++--- drivers/staging/hv/netvsc_drv.c | 10 drivers/staging/hv/rndis_filter.c | 13 - 3 files changed, 4 insertions(+), 121 deletions(-) diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c index 20b1597..be572b4 100644 --- a/drivers/staging/hv/netvsc.c +++ b/drivers/staging/hv/netvsc.c @@ -178,13 +178,6 @@ int netvsc_initialize(struct hv_driver *drv) { struct netvsc_driver *driver = (struct netvsc_driver *)drv; - DPRINT_DBG(NETVSC, sizeof(struct hv_netvsc_packet)=%zd, - sizeof(struct nvsp_message)=%zd, - sizeof(struct vmtransfer_page_packet_header)=%zd, - sizeof(struct hv_netvsc_packet), - sizeof(struct nvsp_message), - sizeof(struct vmtransfer_page_packet_header)); - drv-name = driver_name; memcpy(drv-dev_type, netvsc_device_type, sizeof(struct hv_guid)); @@ -223,8 +216,6 @@ static int netvsc_init_recv_buf(struct hv_device *device) goto cleanup; } - DPRINT_INFO(NETVSC, Establishing receive buffer's GPADL...); - /* * Establish the gpadl handle for this buffer on this * channel. Note: This call uses the vmbus connection rather @@ -241,8 +232,6 @@ static int netvsc_init_recv_buf(struct hv_device *device) /* Notify the NetVsp of the gpadl handle */ - DPRINT_INFO(NETVSC, Sending NvspMessage1TypeSendReceiveBuffer...); - init_packet = net_device-channel_init_pkt; memset(init_packet, 0, sizeof(struct nvsp_message)); @@ -301,14 +290,6 @@ static int netvsc_init_recv_buf(struct hv_device *device) net_device-recv_section_cnt * sizeof(struct nvsp_1_receive_buffer_section)); - DPRINT_INFO(NETVSC, Receive sections info (count %d, offset %d, - endoffset %d, suballoc size %d, num suballocs %d), - net_device-recv_section_cnt, - net_device-recv_section[0].offset, - net_device-recv_section[0].end_offset, - net_device-recv_section[0].sub_alloc_size, - net_device-recv_section[0].num_sub_allocs); - /* * For 1st release, there should only be 1 section that represents the * entire receive buffer @@ -356,8 +337,6 @@ static int netvsc_init_send_buf(struct hv_device *device) goto cleanup; } - DPRINT_INFO(NETVSC, Establishing send buffer's GPADL...); - /* * Establish the gpadl handle for this buffer on this * channel. Note: This call uses the vmbus connection rather @@ -372,8 +351,6 @@ static int netvsc_init_send_buf(struct hv_device *device) } /* Notify the NetVsp of the gpadl handle */ - DPRINT_INFO(NETVSC, Sending NvspMessage1TypeSendSendBuffer...); - init_packet = net_device-channel_init_pkt; memset(init_packet, 0, sizeof(struct nvsp_message)); @@ -438,9 +415,6 @@ static int netvsc_destroy_recv_buf(struct netvsc_device *net_device) * to send a revoke msg here */ if (net_device-recv_section_cnt) { - DPRINT_INFO(NETVSC, - Sending NvspMessage1TypeRevokeReceiveBuffer...); - /* Send the revoke receive buffer */ revoke_packet = net_device-revoke_packet; memset(revoke_packet, 0, sizeof(struct nvsp_message)); @@ -468,8 +442,6 @@ static int netvsc_destroy_recv_buf(struct netvsc_device *net_device) /* Teardown the gpadl on the vsp end */ if (net_device-recv_buf_gpadl_handle) { - DPRINT_INFO(NETVSC, Tearing down receive buffer's GPADL...); - ret = vmbus_teardown_gpadl(net_device-dev-channel, net_device-recv_buf_gpadl_handle); @@ -483,8 +455,6 @@ static int netvsc_destroy_recv_buf(struct netvsc_device *net_device) } if (net_device-recv_buf) { - DPRINT_INFO(NETVSC, Freeing up receive buffer...); - /* Free up the receive buffer */ free_pages((unsigned long)net_device-recv_buf, get_order(net_device-recv_buf_size)); @@ -512,9 +482,6 @@ static int netvsc_destroy_send_buf(struct netvsc_device *net_device) * to send a revoke msg here */ if (net_device-send_section_size) { - DPRINT_INFO(NETVSC, - Sending NvspMessage1TypeRevokeSendBuffer...); - /* Send the revoke send buffer */ revoke_packet = net_device-revoke_packet
[PATCH 01/07] Remove all unneeded DPRINT from hv_vmbus
Remove all un-needed DPRINT calls from hv_vmbus. Several are remaining that will be cleaned up in my next set of patches. They deal with printing out the ringbuffer debugging which is going to be implemented slightly differently. This patch deals with hv_vmbus only. Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: K. Y. Srinivasan k...@microsoft.com --- drivers/staging/hv/channel.c | 70 - drivers/staging/hv/channel_mgmt.c | 51 ++- drivers/staging/hv/connection.c |9 - drivers/staging/hv/hv.c | 54 drivers/staging/hv/ring_buffer.c | 20 -- drivers/staging/hv/vmbus_drv.c| 69 +--- 6 files changed, 21 insertions(+), 252 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 775a52a..c90dbaf 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -213,9 +213,6 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, /* Establish the gpadl for the ring buffer */ - DPRINT_DBG(VMBUS, Establishing ring buffer's gpadl for channel %p..., - newchannel); - newchannel-ringbuffer_gpadlhandle = 0; ret = vmbus_establish_gpadl(newchannel, @@ -229,16 +226,6 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, goto errorout; } - DPRINT_DBG(VMBUS, channel %p relid %d gpadl 0x%x send ring %p - size %d recv ring %p size %d, downstreamoffset %d, - newchannel, newchannel-offermsg.child_relid, - newchannel-ringbuffer_gpadlhandle, - newchannel-outbound.ring_buffer, - newchannel-outbound.ring_size, - newchannel-inbound.ring_buffer, - newchannel-inbound.ring_size, - send_ringbuffer_size); - /* Create and init the channel open message */ openInfo = kmalloc(sizeof(*openInfo) + sizeof(struct vmbus_channel_open_channel), @@ -272,14 +259,11 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, vmbus_connection.chn_msg_list); spin_unlock_irqrestore(vmbus_connection.channelmsg_lock, flags); - DPRINT_DBG(VMBUS, Sending channel open msg...); - ret = vmbus_post_msg(openMsg, sizeof(struct vmbus_channel_open_channel)); - if (ret != 0) { - DPRINT_ERR(VMBUS, unable to open channel - %d, ret); + + if (ret != 0) goto Cleanup; - } openInfo-wait_condition = 0; wait_event_timeout(openInfo-waitevent, @@ -291,11 +275,8 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, } - if (openInfo-response.open_result.status == 0) - DPRINT_INFO(VMBUS, channel %p open success!!, newchannel); - else - DPRINT_INFO(VMBUS, channel %p open failed - %d!!, - newchannel, openInfo-response.open_result.status); + if (openInfo-response.open_result.status) + err = openInfo-response.open_result.status; Cleanup: spin_lock_irqsave(vmbus_connection.channelmsg_lock, flags); @@ -303,7 +284,7 @@ Cleanup: spin_unlock_irqrestore(vmbus_connection.channelmsg_lock, flags); kfree(openInfo); - return 0; + return err; errorout: ringbuffer_cleanup(newchannel-outbound); @@ -326,6 +307,7 @@ static void dump_gpadl_body(struct vmbus_channel_gpadl_body *gpadl, u32 len) pfncount = (len - sizeof(struct vmbus_channel_gpadl_body)) / sizeof(u64); + DPRINT_DBG(VMBUS, gpadl body - len %d pfn count %d, len, pfncount); for (i = 0; i pfncount; i++) @@ -530,19 +512,12 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, vmbus_connection.chn_msg_list); spin_unlock_irqrestore(vmbus_connection.channelmsg_lock, flags); - DPRINT_DBG(VMBUS, buffer %p, size %d msg cnt %d, - kbuffer, size, msgcount); - - DPRINT_DBG(VMBUS, Sending GPADL Header - len %zd, - msginfo-msgsize - sizeof(*msginfo)); msginfo-wait_condition = 0; ret = vmbus_post_msg(gpadlmsg, msginfo-msgsize - sizeof(*msginfo)); - if (ret != 0) { - DPRINT_ERR(VMBUS, Unable to open channel - %d, ret); + if (ret != 0) goto Cleanup; - } if (msgcount 1) { list_for_each(curr, msginfo-submsglist) { @@ -556,10 +531,6 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, CHANNELMSG_GPADL_BODY
[PATCH 06/07] Replaced DPRINT and printk with native functions in hv_utils
Replaced all DPRINT and printk calls with pr_ calls Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: K. Y. Srinivasan k...@microsoft.com --- drivers/staging/hv/hv_kvp.c |6 +++--- drivers/staging/hv/hv_util.c | 17 + 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/staging/hv/hv_kvp.c b/drivers/staging/hv/hv_kvp.c index 7775820..c71a148 100644 --- a/drivers/staging/hv/hv_kvp.c +++ b/drivers/staging/hv/hv_kvp.c @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ - +#define pr_fmt(fmt) KBUILD_MODNAME : fmt #include linux/net.h #include linux/nls.h @@ -114,7 +114,7 @@ kvp_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) message = (struct hv_ku_msg *)msg-data; if (msg-seq == KVP_REGISTER) { - printk(KERN_INFO KVP: user-mode registering done.\n); + pr_info(KVP: user-mode registering done.\n); kvp_register(); } @@ -174,7 +174,7 @@ kvp_respond_to_host(char *key, char *value, int error) /* * This is a spurious call! */ - printk(KERN_WARNING KVP: Transaction not active\n); + pr_warn(KVP: Transaction not active\n); return; } /* diff --git a/drivers/staging/hv/hv_util.c b/drivers/staging/hv/hv_util.c index 3e74f79..3af0a11 100644 --- a/drivers/staging/hv/hv_util.c +++ b/drivers/staging/hv/hv_util.c @@ -18,6 +18,8 @@ * Haiyang Zhang haiya...@microsoft.com * Hank Janssen hjans...@microsoft.com */ +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + #include linux/kernel.h #include linux/init.h #include linux/module.h @@ -76,15 +78,15 @@ static void shutdown_onchannelcallback(void *context) icmsghdrp-status = HV_S_OK; execute_shutdown = true; - DPRINT_INFO(VMBUS, Shutdown request received - -gracefull shutdown initiated); + pr_info(Shutdown request received - +gracefull shutdown initiated\n); break; default: icmsghdrp-status = HV_E_FAIL; execute_shutdown = false; - DPRINT_INFO(VMBUS, Shutdown request received - -Invalid request); + pr_info(Shutdown request received - +Invalid request\n); break; }; } @@ -242,7 +244,7 @@ MODULE_DEVICE_TABLE(dmi, hv_utils_dmi_table); static int __init init_hyperv_utils(void) { - printk(KERN_INFO Registering HyperV Utility Driver\n); + pr_info(Registering HyperV Utility Driver\n); if (hv_kvp_init()) return -ENODEV; @@ -256,8 +258,7 @@ static int __init init_hyperv_utils(void) hbeat_txf_buf = kmalloc(PAGE_SIZE, GFP_KERNEL); if (!shut_txf_buf || !time_txf_buf || !hbeat_txf_buf) { - printk(KERN_INFO - Unable to allocate memory for receive buffer\n); + pr_info(Unable to allocate memory for receive buffer\n); kfree(shut_txf_buf); kfree(time_txf_buf); kfree(hbeat_txf_buf); @@ -286,7 +287,7 @@ static int __init init_hyperv_utils(void) static void exit_hyperv_utils(void) { - printk(KERN_INFO De-Registered HyperV Utility Driver\n); + pr_info(De-Registered HyperV Utility Driver\n); hv_cb_utils[HV_SHUTDOWN_MSG].channel-onchannel_callback = chn_cb_negotiate; -- 1.6.0.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 05/07] replace DPRINT with native primitives in hv_netvsc
Replace all remaining DPRINT calls with their native dev_ and netvsc_ calls. And also change some of the verbiage to be more useful. rndis_filter has a few remaining DPRINT calls in it that will be removed in a future patch because the debug will be implemented differently. Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: K. Y. Srinivasan k...@microsoft.com --- drivers/staging/hv/netvsc.c | 115 +++-- drivers/staging/hv/netvsc_drv.c | 36 ++-- drivers/staging/hv/rndis_filter.c | 51 + 3 files changed, 103 insertions(+), 99 deletions(-) diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c index be572b4..ddf7546 100644 --- a/drivers/staging/hv/netvsc.c +++ b/drivers/staging/hv/netvsc.c @@ -18,6 +18,8 @@ * Haiyang Zhang haiya...@microsoft.com * Hank Janssen hjans...@microsoft.com */ +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + #include linux/kernel.h #include linux/sched.h #include linux/wait.h @@ -200,7 +202,7 @@ static int netvsc_init_recv_buf(struct hv_device *device) net_device = get_outbound_net_device(device); if (!net_device) { - DPRINT_ERR(NETVSC, unable to get net device... + dev_err(device-device, unable to get net device... device being destroyed?); return -1; } @@ -209,9 +211,8 @@ static int netvsc_init_recv_buf(struct hv_device *device) (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, get_order(net_device-recv_buf_size)); if (!net_device-recv_buf) { - DPRINT_ERR(NETVSC, - unable to allocate receive buffer of size %d, - net_device-recv_buf_size); + dev_err(device-device, unable to allocate receive + buffer of size %d, net_device-recv_buf_size); ret = -1; goto cleanup; } @@ -225,8 +226,8 @@ static int netvsc_init_recv_buf(struct hv_device *device) net_device-recv_buf_size, net_device-recv_buf_gpadl_handle); if (ret != 0) { - DPRINT_ERR(NETVSC, - unable to establish receive buffer's gpadl); + dev_err(device-device, + unable to establish receive buffer's gpadl); goto cleanup; } @@ -250,8 +251,8 @@ static int netvsc_init_recv_buf(struct hv_device *device) VM_PKT_DATA_INBAND, VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); if (ret != 0) { - DPRINT_ERR(NETVSC, - unable to send receive buffer's gpadl to netvsp); + dev_err(device-device, + unable to send receive buffer's gpadl to netvsp); goto cleanup; } @@ -264,7 +265,7 @@ static int netvsc_init_recv_buf(struct hv_device *device) /* Check the response */ if (init_packet-msg.v1_msg. send_recv_buf_complete.status != NVSP_STAT_SUCCESS) { - DPRINT_ERR(NETVSC, Unable to complete receive buffer + dev_err(device-device, Unable to complete receive buffer initialzation with NetVsp - status %d, init_packet-msg.v1_msg. send_recv_buf_complete.status); @@ -318,7 +319,7 @@ static int netvsc_init_send_buf(struct hv_device *device) net_device = get_outbound_net_device(device); if (!net_device) { - DPRINT_ERR(NETVSC, unable to get net device... + dev_err(device-device, unable to get net device... device being destroyed?); return -1; } @@ -331,8 +332,8 @@ static int netvsc_init_send_buf(struct hv_device *device) (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, get_order(net_device-send_buf_size)); if (!net_device-send_buf) { - DPRINT_ERR(NETVSC, unable to allocate send buffer of size %d, - net_device-send_buf_size); + dev_err(device-device, unable to allocate send + buffer of size %d, net_device-send_buf_size); ret = -1; goto cleanup; } @@ -346,7 +347,7 @@ static int netvsc_init_send_buf(struct hv_device *device) net_device-send_buf_size, net_device-send_buf_gpadl_handle); if (ret != 0) { - DPRINT_ERR(NETVSC, unable to establish send buffer's gpadl); + dev_err(device-device, unable to establish send buffer's gpadl); goto cleanup
[PATCH 07/07] Replaced printk with pr_info in hv_timesource
Replaced printk in hv_timesource with pr_ calls Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: K. Y. Srinivasan k...@microsoft.com --- drivers/staging/hv/hv_timesource.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/staging/hv/hv_timesource.c b/drivers/staging/hv/hv_timesource.c index a7ee533..0efb049 100644 --- a/drivers/staging/hv/hv_timesource.c +++ b/drivers/staging/hv/hv_timesource.c @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * */ +#define pr_fmt(fmt) KBUILD_MODNAME : fmt #include linux/version.h #include linux/clocksource.h @@ -91,7 +92,7 @@ static int __init init_hv_clocksource(void) if (!dmi_check_system(hv_timesource_dmi_table)) return -ENODEV; - printk(KERN_INFO Registering HyperV clock source\n); + pr_info(Registering HyperV clock source\n); return clocksource_register(hyperv_cs); } -- 1.6.0.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 00/07] Remove and replace all un-needed DPRINT and printk
This patch set removes all un-needed DPRINT and printk calls and replaces the remaining ones with the correct pr_, dev_ and netdev_ calls from hv_vmbus, hv_netvsc, hv_timesource and hv_utils. Several DPRINTS are remaining that will be cleaned up in my next set of patches. They deal with printing out certain debugging that will be implemented slightly differently. The remaining hv_storvsc and hv_blkvsc will get the same treatment in a different set of patches. Regards, Hank Janssen hjans...@microsoft.com ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
Re: [PATCH 12/21] Staging: hv: Cleanup irq management
On Mar 10, 2011, at 14:46, Thomas Gleixner t...@linutronix.de wrote: } -vector = VMBUS_IRQ_VECTOR; -DPRINT_INFO(VMBUS_DRV, irq 0x%x vector 0x%x, vmbus_irq, vector); +vector = IRQ0_VECTOR + pdev-irq; +DPRINT_INFO(VMBUS_DRV, irq 0x%x vector 0x%x, pdev-irq, +IRQ0_VECTOR + pdev-irq); Why evaluating vector first and then not using it for that debug print thingy? Btw, are you going to replace that DPRINT_* stuff as well ? Thanks, Yes, that is in my next set of patches. Hank ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: [PATCH 1/6] Staging: hv: vmbus_drv.c Replaced DPRINT with native pr_XXX
-Original Message- From: Joe Perches [mailto:j...@perches.com] Sent: Tuesday, February 22, 2011 8:51 PM On Tue, 2011-02-22 at 15:32 -0800, Hank Janssen wrote: This group of patches removes all DPRINT from hv_vmbus.ko. It is divided in several patches due to size. [] - DPRINT_ERR(VMBUS_DRV, - ERROR - Unable to register vmbus root device); + pr_err(%s: %s ERROR Unable to register vmbus root device, + VMBUS_MOD, __func__); All of the pr_level calls should probably have a terminating \n I will correct them and resubmit. Also, ff all the pr_level's are using VMBUS_MOD, then perhaps it would look better to add #define pr_fmt(fmt) %s: fmt, VMBUS_MOD or #define pr_fmt(fmt) %s:%s fmt, VMBUS_MOD, __func__ (if you must) I wrestled with that when I did the conversion, The reason I did not Do that is when I check other drivers very few do it that way, most do It the way I do it or actually hard code the module name to be printed. And since the original objection was that DPRINT seems to implement it's own logging I did not want to re-implement the pr_XXX calls with this layer of indirection which almost looks like I am going down the path of DPRINT again. So what is the general consensus. The current way I implemented it seems to be how other drivers use it to. Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: [PATCH 1/6] Staging: hv: vmbus_drv.c Replaced DPRINT with native pr_XXX
-Original Message- From: Joe Perches [mailto:j...@perches.com] Sent: Wednesday, February 23, 2011 9:10 AM To: Hank Janssen On Wed, 2011-02-23 at 16:58 +, Hank Janssen wrote: #define pr_fmt(fmt) %s: fmt, VMBUS_MOD or #define pr_fmt(fmt) %s:%s fmt, VMBUS_MOD, __func__ (if you must) I wrestled with that when I did the conversion, The reason I did not Do that is when I check other drivers very few do it that way, most do It the way I do it or actually hard code the module name to be printed. My preference would have been to use the KBUILD_MODNAME that almost every other driver/module uses. So what is the general consensus. The current way I implemented it seems to be how other drivers use it to. Your code, your choices. Joe, Hey I am easy! I am just not cheap! :) Based on your feedback and Dan Carpenter's feedback I will implement It the way you suggested it. I should have the patch out later today. Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: [PATCH 1/6] Staging: hv: vmbus_drv.c Replaced DPRINT with native pr_XXX
-Original Message- From: Greg KH [mailto:g...@kroah.com] Sent: Wednesday, February 23, 2011 11:12 AM To: Hank Janssen Why say this in the 1/6 patch? It should be in the 0/6 introduction. All DPRINT calls have been removed, and where needed have been replaced with pr_XX native calls. Many debug DPRINT calls have been removed outright. I think a lot of these pr_XX calls can be switched to dev_XX calls instead, right? Not in this case, this patch set is for vmbus only. The next patch set will use netdev_* and dev* for netvsc, scsi and IDE. How about you break this up into a different series of patches to make it more readable: - remove unneeded DPRINT calls - convert remaining DPRINT calls to pr_XX or dev_XX as needed That would make it easier to review, as it is, it's quite difficult. Will do. Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: [PATCH 2/6] Staging: hv: hv.c Removed all DPRINT and debug - using pr_err now
-Original Message- From: Greg KH [mailto:g...@kroah.com] Sent: Wednesday, February 23, 2011 1:57 PM They where compile and run tested. And syslog was not a mess. What did I mess up here? The amount of printouts now are a fraction of what they where before. You forgot to put '\n' at the end of all of your pr_XXX lines, so they will be merged with the next one, messing up your syslog. Joe also pointed this problem out. Take a look at your syslog to see what I am talking about... I am trying to get some of these patches corrected and out today, but it might be tomorrow. So far I have lost power for a minutes or so twice this afternoon. It seems that the threat of snow is enough to lose power where I am in the PNW. Sigh.. Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 6/6] Staging: hv: connection.c Removed DPRINT replaced with pr_XX
This group of patches removes all DPRINT from hv_vmbus.ko. It is divided in several patches due to size. All DPRINT calls have been removed, and where needed have been replaced with pr_XX native calls. Many debug DPRINT calls have been removed outright. The amount of clutter this driver prints has been significantly reduced. Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: K. Y. Srinivasan k...@microsoft.com --- drivers/staging/hv/connection.c | 27 --- 1 files changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c index f7df479..2e9c0b7 100644 --- a/drivers/staging/hv/connection.c +++ b/drivers/staging/hv/connection.c @@ -121,11 +121,6 @@ int vmbus_connect(void) spin_unlock_irqrestore(vmbus_connection.channelmsg_lock, flags); - DPRINT_DBG(VMBUS, Vmbus connection - interrupt pfn %llx, - monitor1 pfn %llx,, monitor2 pfn %llx, - msg-interrupt_page, msg-monitor_page1, msg-monitor_page2); - - DPRINT_DBG(VMBUS, Sending channel initiate msg...); ret = vmbus_post_msg(msg, sizeof(struct vmbus_channel_initiate_contact)); if (ret != 0) { @@ -156,13 +151,12 @@ int vmbus_connect(void) /* Check if successful */ if (msginfo-response.version_response.version_supported) { - DPRINT_INFO(VMBUS, Vmbus connected!!); + pr_info(%s: Connected to Hyper-V., VMBUS_MOD); vmbus_connection.conn_state = CONNECTED; - } else { - DPRINT_ERR(VMBUS, Vmbus connection failed!!... - current version (%d) not supported, - VMBUS_REVISION_NUMBER); + pr_err(%s: %s Unable to connect, + Version %d not supported by Hyper-V , + VMBUS_MOD, __func__, VMBUS_REVISION_NUMBER); ret = -1; goto Cleanup; } @@ -225,7 +219,7 @@ int vmbus_disconnect(void) vmbus_connection.conn_state = DISCONNECTED; - DPRINT_INFO(VMBUS, Vmbus disconnected!!); + pr_info(%s: Vmbus disconnected., VMBUS_MOD); Cleanup: kfree(msg); @@ -278,7 +272,8 @@ static void process_chn_event(void *context) *(void*)channel); */ } else { - DPRINT_ERR(VMBUS, channel not found for relid - %d., relid); + pr_err(%s: %s channel not found for relid - %d., + VMBUS_MOD, __func__, relid); } } @@ -302,11 +297,13 @@ void vmbus_on_event(void) (unsigned long *) recv_int_page[dword])) { relid = (dword 5) + bit; - DPRINT_DBG(VMBUS, event detected for relid - %d, relid); if (relid == 0) { - /* special case - vmbus channel protocol msg */ - DPRINT_DBG(VMBUS, invalid relid - %d, relid); + /* +* special case - +* vmbus channel +* protocol msg +*/ continue; } else { /* QueueWorkItem(VmbusProcessEvent, (void*)relid); */ -- 1.6.0.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 5/6] Staging: hv: ring_buffer.c Removed DPRINT replaced with pr_XX
This group of patches removes all DPRINT from hv_vmbus.ko. It is divided in several patches due to size. All DPRINT calls have been removed, and where needed have been replaced with pr_XX native calls. Many debug DPRINT calls have been removed outright. The amount of clutter this driver prints has been significantly reduced. Several DPRINT calls remain in this file, they will be removed in a subsequent patch. They are designed to print out a common debug stream that will be implemented differently. Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: K. Y. Srinivasan k...@microsoft.com --- drivers/staging/hv/ring_buffer.c | 25 ++--- 1 files changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c index 66688fb..95dd75c 100644 --- a/drivers/staging/hv/ring_buffer.c +++ b/drivers/staging/hv/ring_buffer.c @@ -372,19 +372,16 @@ int ringbuffer_write(struct hv_ring_buffer_info *outring_info, bytes_avail_toread, bytes_avail_towrite); - DPRINT_DBG(VMBUS, Writing %u bytes..., totalbytes_towrite); - /* Dumpring_info(Outring_info, BEFORE ); */ /* If there is only room for the packet, assume it is full. */ /* Otherwise, the next time around, we think the ring buffer */ /* is empty since the read index == write index */ if (bytes_avail_towrite = totalbytes_towrite) { - DPRINT_DBG(VMBUS, - No more space left on outbound ring buffer + pr_debug(%s: %s No more space left on outbound ring buffer (needed %u, avail %u), - totalbytes_towrite, - bytes_avail_towrite); +VMBUS_MOD, __func__, totalbytes_towrite, +bytes_avail_towrite); spin_unlock_irqrestore(outring_info-ring_lock, flags); return -1; @@ -499,17 +496,13 @@ int ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer, bytes_avail_toread, bytes_avail_towrite); - DPRINT_DBG(VMBUS, Reading %u bytes..., buflen); - /* Dumpring_info(Inring_info, BEFORE ); */ /* Make sure there is something to read */ if (bytes_avail_toread buflen) { - DPRINT_DBG(VMBUS, - got callback but not enough to read - avail to read %d read size %d!!, - bytes_avail_toread, - buflen); + pr_debug(%s: %s got callback but not enough to read + avail to read %d read size %d, +VMBUS_MOD, __func__, bytes_avail_toread, buflen); spin_unlock_irqrestore(inring_info-ring_lock, flags); @@ -568,7 +561,8 @@ copyto_ringbuffer( /* wrap-around detected! */ if (srclen ring_buffer_size - start_write_offset) { - DPRINT_DBG(VMBUS, wrap-around detected!); + pr_debug(%s: %s destination wrap-around detected!, +VMBUS_MOD, __func__); frag_len = ring_buffer_size - start_write_offset; memcpy(ring_buffer + start_write_offset, src, frag_len); @@ -607,7 +601,8 @@ copyfrom_ringbuffer( /* wrap-around detected at the src */ if (destlen ring_buffer_size - start_read_offset) { - DPRINT_DBG(VMBUS, src wrap-around detected!); + pr_debug(%s: %s source wrap-around detected!, +VMBUS_MOD, __func__); frag_len = ring_buffer_size - start_read_offset; -- 1.6.0.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 3/6] Staging: hv: channel.c Removed debug DPRINTS use pr_err for errors
This group of patches removes all DPRINT from hv_vmbus.ko. It is divided in several patches due to size. All DPRINT calls have been removed, and where needed have been replaced with pr_XX native calls. Many debug DPRINT calls have been removed outright. The amount of clutter this driver prints has been significantly reduced. Several DPRINT calls remain in this file, they will be removed in a subsequent patch. They are designed to print out a common debug stream that will be implemented differently. Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: K. Y. Srinivasan k...@microsoft.com --- drivers/staging/hv/channel.c | 71 ++--- 1 files changed, 11 insertions(+), 60 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 775a52a..654e80c 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -213,9 +213,6 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, /* Establish the gpadl for the ring buffer */ - DPRINT_DBG(VMBUS, Establishing ring buffer's gpadl for channel %p..., - newchannel); - newchannel-ringbuffer_gpadlhandle = 0; ret = vmbus_establish_gpadl(newchannel, @@ -229,16 +226,6 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, goto errorout; } - DPRINT_DBG(VMBUS, channel %p relid %d gpadl 0x%x send ring %p - size %d recv ring %p size %d, downstreamoffset %d, - newchannel, newchannel-offermsg.child_relid, - newchannel-ringbuffer_gpadlhandle, - newchannel-outbound.ring_buffer, - newchannel-outbound.ring_size, - newchannel-inbound.ring_buffer, - newchannel-inbound.ring_size, - send_ringbuffer_size); - /* Create and init the channel open message */ openInfo = kmalloc(sizeof(*openInfo) + sizeof(struct vmbus_channel_open_channel), @@ -272,12 +259,11 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, vmbus_connection.chn_msg_list); spin_unlock_irqrestore(vmbus_connection.channelmsg_lock, flags); - DPRINT_DBG(VMBUS, Sending channel open msg...); - ret = vmbus_post_msg(openMsg, sizeof(struct vmbus_channel_open_channel)); if (ret != 0) { - DPRINT_ERR(VMBUS, unable to open channel - %d, ret); + pr_err(%s: %s Unable to open channel - %d, + VMBUS_MOD, __func__, ret); goto Cleanup; } @@ -291,10 +277,9 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, } - if (openInfo-response.open_result.status == 0) - DPRINT_INFO(VMBUS, channel %p open success!!, newchannel); - else - DPRINT_INFO(VMBUS, channel %p open failed - %d!!, + if (openInfo-response.open_result.status) + pr_err(%s: %s Channel %p open failed - %d!!, + VMBUS_MOD, __func__, newchannel, openInfo-response.open_result.status); Cleanup: @@ -530,17 +515,13 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, vmbus_connection.chn_msg_list); spin_unlock_irqrestore(vmbus_connection.channelmsg_lock, flags); - DPRINT_DBG(VMBUS, buffer %p, size %d msg cnt %d, - kbuffer, size, msgcount); - - DPRINT_DBG(VMBUS, Sending GPADL Header - len %zd, - msginfo-msgsize - sizeof(*msginfo)); msginfo-wait_condition = 0; ret = vmbus_post_msg(gpadlmsg, msginfo-msgsize - sizeof(*msginfo)); if (ret != 0) { - DPRINT_ERR(VMBUS, Unable to open channel - %d, ret); + pr_err(%s: %s Unable to open channel - %d, + VMBUS_MOD, __func__, ret); goto Cleanup; } @@ -556,10 +537,6 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, CHANNELMSG_GPADL_BODY; gpadl_body-gpadl = next_gpadl_handle; - DPRINT_DBG(VMBUS, Sending GPADL Body - len %zd, - submsginfo-msgsize - - sizeof(*submsginfo)); - dump_gpadl_body(gpadl_body, submsginfo-msgsize - sizeof(*submsginfo)); ret = vmbus_post_msg(gpadl_body, @@ -577,12 +554,6 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, /* At this point, we received the gpadl created msg */ - DPRINT_DBG(VMBUS, Received GPADL created
[PATCH 2/6] Staging: hv: hv.c Removed all DPRINT and debug - using pr_err now
This group of patches removes all DPRINT from hv_vmbus.ko. It is divided in several patches due to size. All DPRINT calls have been removed, and where needed have been replaced with pr_XX native calls. Many debug DPRINT calls have been removed outright. The amount of clutter this driver prints has been significantly reduced. Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: K. Y. Srinivasan k...@microsoft.com --- drivers/staging/hv/hv.c | 88 +++--- 1 files changed, 21 insertions(+), 67 deletions(-) diff --git a/drivers/staging/hv/hv.c b/drivers/staging/hv/hv.c index 2d492ad..e3ce26d 100644 --- a/drivers/staging/hv/hv.c +++ b/drivers/staging/hv/hv.c @@ -80,20 +80,6 @@ static int query_hypervisor_info(void) op = HVCPUID_VENDOR_MAXFUNCTION; cpuid(op, eax, ebx, ecx, edx); - DPRINT_INFO(VMBUS, Vendor ID: %c%c%c%c%c%c%c%c%c%c%c%c, - (ebx 0xFF), - ((ebx 8) 0xFF), - ((ebx 16) 0xFF), - ((ebx 24) 0xFF), - (ecx 0xFF), - ((ecx 8) 0xFF), - ((ecx 16) 0xFF), - ((ecx 24) 0xFF), - (edx 0xFF), - ((edx 8) 0xFF), - ((edx 16) 0xFF), - ((edx 24) 0xFF)); - max_leaf = eax; eax = 0; ebx = 0; @@ -102,12 +88,6 @@ static int query_hypervisor_info(void) op = HVCPUID_INTERFACE; cpuid(op, eax, ebx, ecx, edx); - DPRINT_INFO(VMBUS, Interface ID: %c%c%c%c, - (eax 0xFF), - ((eax 8) 0xFF), - ((eax 16) 0xFF), - ((eax 24) 0xFF)); - if (max_leaf = HVCPUID_VERSION) { eax = 0; ebx = 0; @@ -115,14 +95,17 @@ static int query_hypervisor_info(void) edx = 0; op = HVCPUID_VERSION; cpuid(op, eax, ebx, ecx, edx); - DPRINT_INFO(VMBUS, OS Build:%d-%d.%d-%d-%d.%d,\ - eax, - ebx 16, - ebx 0x, - ecx, - edx 24, - edx 0xFF); + + pr_info(%s: Hyper-V Host OS Build:%d-%d.%d-%d-%d.%d, + VMBUS_MOD, + eax, + ebx 16, + ebx 0x, + ecx, + edx 24, + edx 0xFF); } + return max_leaf; } @@ -137,20 +120,12 @@ static u64 do_hypercall(u64 control, void *input, void *output) u64 output_address = (output) ? virt_to_phys(output) : 0; volatile void *hypercall_page = hv_context.hypercall_page; - DPRINT_DBG(VMBUS, Hypercall control %llx input phys %llx virt %p - output phys %llx virt %p hypercall %p, - control, input_address, input, - output_address, output, hypercall_page); - __asm__ __volatile__(mov %0, %%r8 : : r (output_address) : r8); __asm__ __volatile__(call *%3 : =a (hv_status) : c (control), d (input_address), m (hypercall_page)); - DPRINT_DBG(VMBUS, Hypercall return %llx, hv_status); - return hv_status; - #else u32 control_hi = control 32; @@ -165,18 +140,12 @@ static u64 do_hypercall(u64 control, void *input, void *output) u32 output_address_lo = output_address 0x; volatile void *hypercall_page = hv_context.hypercall_page; - DPRINT_DBG(VMBUS, Hypercall control %llx input %p output %p, - control, input, output); - __asm__ __volatile__ (call *%8 : =d(hv_status_hi), =a(hv_status_lo) : d (control_hi), a (control_lo), b (input_address_hi), c (input_address_lo), D(output_address_hi), S(output_address_lo), m (hypercall_page)); - DPRINT_DBG(VMBUS, Hypercall return %llx, - hv_status_lo | ((u64)hv_status_hi 32)); - return hv_status_lo | ((u64)hv_status_hi 32); #endif /* !x86_64 */ } @@ -198,13 +167,10 @@ int hv_init(void) sizeof(void *) * MAX_NUM_CPUS); if (!query_hypervisor_presence()) { - DPRINT_ERR(VMBUS, No Windows hypervisor detected!!); + pr_err(%s: %s No Hyper-V detected, VMBUS_MOD, __func__); goto Cleanup; } - DPRINT_INFO(VMBUS, - Windows hypervisor detected! Retrieving more info...); - max_leaf = query_hypervisor_info(); /* HvQueryHypervisorFeatures(maxLeaf); */ @@ -214,8 +180,8 @@ int hv_init(void
[PATCH 1/6] Staging: hv: vmbus_drv.c Replaced DPRINT with native pr_XXX
This group of patches removes all DPRINT from hv_vmbus.ko. It is divided in several patches due to size. All DPRINT calls have been removed, and where needed have been replaced with pr_XX native calls. Many debug DPRINT calls have been removed outright. The amount of clutter this driver prints has been significantly reduced. Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: K. Y. Srinivasan k...@microsoft.com --- drivers/staging/hv/logging.h |1 + drivers/staging/hv/vmbus_drv.c | 145 +++- 2 files changed, 39 insertions(+), 107 deletions(-) diff --git a/drivers/staging/hv/logging.h b/drivers/staging/hv/logging.h index 1799951..517d721 100644 --- a/drivers/staging/hv/logging.h +++ b/drivers/staging/hv/logging.h @@ -31,6 +31,7 @@ /* #include linux/init.h */ /* #include linux/module.h */ +#define VMBUS_MOD hv_vmbus #define VMBUS 0x0001 #define STORVSC0x0002 diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c index 459c707..a560a80 100644 --- a/drivers/staging/hv/vmbus_drv.c +++ b/drivers/staging/hv/vmbus_drv.c @@ -279,22 +279,16 @@ static int vmbus_on_isr(struct hv_driver *drv) msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; /* Check if there are actual msgs to be process */ - if (msg-header.message_type != HVMSG_NONE) { - DPRINT_DBG(VMBUS, received msg type %d size %d, - msg-header.message_type, - msg-header.payload_size); + 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; /* Since we are a child, we only need to check bit 0 */ - if (test_and_clear_bit(0, (unsigned long *) event-flags32[0])) { - DPRINT_DBG(VMBUS, received event %d, event-flags32[0]); + if (test_and_clear_bit(0, (unsigned long *) event-flags32[0])) ret |= 0x2; - } return ret; } @@ -468,17 +462,6 @@ static int vmbus_bus_init(void) int ret; unsigned int vector; - DPRINT_INFO(VMBUS, +++ HV Driver version = %s +++, - HV_DRV_VERSION); - DPRINT_INFO(VMBUS, +++ Vmbus supported version = %d +++, - VMBUS_REVISION_NUMBER); - DPRINT_INFO(VMBUS, +++ Vmbus using SINT %d +++, - VMBUS_MESSAGE_SINT); - DPRINT_DBG(VMBUS, sizeof(vmbus_channel_packet_page_buffer)=%zd, - sizeof(VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER)=%zd, - sizeof(struct vmbus_channel_packet_page_buffer), - sizeof(struct vmbus_channel_packet_multipage_buffer)); - driver-name = driver_name; memcpy(driver-dev_type, device_type, sizeof(struct hv_guid)); @@ -490,15 +473,8 @@ static int vmbus_bus_init(void) /* Hypervisor initialization...setup hypercall page..etc */ ret = hv_init(); if (ret != 0) { - DPRINT_ERR(VMBUS, Unable to initialize the hypervisor - 0x%x, - ret); - goto cleanup; - } - - /* Sanity checks */ - if (!driver-dev_add) { - DPRINT_ERR(VMBUS_DRV, OnDeviceAdd() routine not set); - ret = -1; + pr_err(%s: %s - Unable to initialize hypervisor - 0x%x, + VMBUS_MOD, __func__, ret); goto cleanup; } @@ -522,8 +498,8 @@ static int vmbus_bus_init(void) driver-name, NULL); if (ret != 0) { - DPRINT_ERR(VMBUS_DRV, ERROR - Unable to request IRQ %d, - vmbus_irq); + pr_err(%s: %s ERROR - Unable to request IRQ %d, + VMBUS_MOD, __func__, vmbus_irq); bus_unregister(vmbus_drv_ctx-bus); @@ -532,15 +508,15 @@ static int vmbus_bus_init(void) } vector = VMBUS_IRQ_VECTOR; - DPRINT_INFO(VMBUS_DRV, irq 0x%x vector 0x%x, vmbus_irq, vector); + pr_info(%s: irq 0x%x vector 0x%x, VMBUS_MOD, vmbus_irq, vector); /* Call to bus driver to add the root device */ memset(dev_ctx, 0, sizeof(struct vm_device)); ret = driver-dev_add(dev_ctx-device_obj, vector); if (ret != 0) { - DPRINT_ERR(VMBUS_DRV, - ERROR - Unable to add vmbus root device); + pr_err(%s: %s ERROR - Unable to add hv_vmbus root device, + VMBUS_MOD, __func__); free_irq(vmbus_irq, NULL); @@ -567,8 +543,8 @@ static int vmbus_bus_init(void) /* Setup
[PATCH 4/6] Staging: hv: channel_mgmt.c Removed DPRINT and implemented pr_XX
This group of patches removes all DPRINT from hv_vmbus.ko. It is divided in several patches due to size. All DPRINT calls have been removed, and where needed have been replaced with pr_XX native calls. Many debug DPRINT calls have been removed outright. The amount of clutter this driver prints has been significantly reduced. Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: K. Y. Srinivasan k...@microsoft.com --- drivers/staging/hv/channel_mgmt.c | 73 +++-- 1 files changed, 14 insertions(+), 59 deletions(-) diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c index 0781c0e..752de54 100644 --- a/drivers/staging/hv/channel_mgmt.c +++ b/drivers/staging/hv/channel_mgmt.c @@ -290,9 +290,7 @@ static void release_channel(struct work_struct *work) struct vmbus_channel, work); - DPRINT_DBG(VMBUS, releasing channel (%p), channel); destroy_workqueue(channel-controlwq); - DPRINT_DBG(VMBUS, channel released (%p), channel); kfree(channel); } @@ -384,8 +382,6 @@ static void vmbus_process_offer(struct work_struct *work) spin_unlock_irqrestore(vmbus_connection.channel_lock, flags); if (!fnew) { - DPRINT_DBG(VMBUS, Ignoring duplicate offer for relid (%d), - newchannel-offermsg.child_relid); free_channel(newchannel); return; } @@ -400,9 +396,6 @@ static void vmbus_process_offer(struct work_struct *work) newchannel-offermsg.offer.if_instance, newchannel); - DPRINT_DBG(VMBUS, child device object allocated - %p, - newchannel-device_obj); - /* * Add the new device to the bus. This will kick off device-driver * binding which eventually invokes the device driver's AddDevice() @@ -410,9 +403,8 @@ static void vmbus_process_offer(struct work_struct *work) */ ret = vmbus_child_dev_add(newchannel-device_obj); if (ret != 0) { - DPRINT_ERR(VMBUS, - unable to add child device object (relid %d), - newchannel-offermsg.child_relid); + pr_err(%s: %s Unable to add child device object (relid %d), + VMBUS_MOD, __func__, newchannel-offermsg.child_relid); spin_lock_irqsave(vmbus_connection.channel_lock, flags); list_del(newchannel-listentry); @@ -437,8 +429,8 @@ static void vmbus_process_offer(struct work_struct *work) hv_cb_utils[cnt].callback, newchannel) == 0) { hv_cb_utils[cnt].channel = newchannel; - DPRINT_INFO(VMBUS, %s, - hv_cb_utils[cnt].log_msg); + pr_info(%s: %s, + VMBUS_MOD, hv_cb_utils[cnt].log_msg); count_hv_channel(); } } @@ -471,48 +463,20 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr) } if (!fsupported) { - DPRINT_DBG(VMBUS, Ignoring channel offer notification for - child relid %d, offer-child_relid); return; } guidtype = offer-offer.if_type; guidinstance = offer-offer.if_instance; - DPRINT_INFO(VMBUS, Channel offer notification - - child relid %d monitor id %d allocated %d, - type {%02x%02x%02x%02x-%02x%02x-%02x%02x- - %02x%02x%02x%02x%02x%02x%02x%02x} - instance {%02x%02x%02x%02x-%02x%02x-%02x%02x- - %02x%02x%02x%02x%02x%02x%02x%02x}, - offer-child_relid, offer-monitorid, - offer-monitor_allocated, - guidtype-data[3], guidtype-data[2], - guidtype-data[1], guidtype-data[0], - guidtype-data[5], guidtype-data[4], - guidtype-data[7], guidtype-data[6], - guidtype-data[8], guidtype-data[9], - guidtype-data[10], guidtype-data[11], - guidtype-data[12], guidtype-data[13], - guidtype-data[14], guidtype-data[15], - guidinstance-data[3], guidinstance-data[2], - guidinstance-data[1], guidinstance-data[0], - guidinstance-data[5], guidinstance-data[4], - guidinstance-data[7], guidinstance-data[6], - guidinstance-data[8], guidinstance-data[9], - guidinstance-data[10], guidinstance-data[11
[PATCH] Staging: hv: Fixed FIXME comments by using list_for_each_entry
Fixed FIXME requests in channel_mgmt.c by using list_for_each_entry. Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: K.Y. Srinivasan k...@microsoft.com --- drivers/staging/hv/channel_mgmt.c | 24 1 files changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c index 325e0bc..0781c0e 100644 --- a/drivers/staging/hv/channel_mgmt.c +++ b/drivers/staging/hv/channel_mgmt.c @@ -567,7 +567,6 @@ static void vmbus_onoffers_delivered( static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr) { struct vmbus_channel_open_result *result; - struct list_head *curr; struct vmbus_channel_msginfo *msginfo; struct vmbus_channel_message_header *requestheader; struct vmbus_channel_open_channel *openmsg; @@ -581,9 +580,8 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr) */ spin_lock_irqsave(vmbus_connection.channelmsg_lock, flags); - list_for_each(curr, vmbus_connection.chn_msg_list) { -/* FIXME: this should probably use list_entry() instead */ - msginfo = (struct vmbus_channel_msginfo *)curr; + list_for_each_entry(msginfo, vmbus_connection.chn_msg_list, + msglistentry) { requestheader = (struct vmbus_channel_message_header *)msginfo-msg; @@ -614,7 +612,6 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr) static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr) { struct vmbus_channel_gpadl_created *gpadlcreated; - struct list_head *curr; struct vmbus_channel_msginfo *msginfo; struct vmbus_channel_message_header *requestheader; struct vmbus_channel_gpadl_header *gpadlheader; @@ -630,9 +627,8 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr) */ spin_lock_irqsave(vmbus_connection.channelmsg_lock, flags); - list_for_each(curr, vmbus_connection.chn_msg_list) { -/* FIXME: this should probably use list_entry() instead */ - msginfo = (struct vmbus_channel_msginfo *)curr; + list_for_each_entry(msginfo, vmbus_connection.chn_msg_list, + msglistentry) { requestheader = (struct vmbus_channel_message_header *)msginfo-msg; @@ -666,7 +662,6 @@ static void vmbus_ongpadl_torndown( struct vmbus_channel_message_header *hdr) { struct vmbus_channel_gpadl_torndown *gpadl_torndown; - struct list_head *curr; struct vmbus_channel_msginfo *msginfo; struct vmbus_channel_message_header *requestheader; struct vmbus_channel_gpadl_teardown *gpadl_teardown; @@ -679,9 +674,8 @@ static void vmbus_ongpadl_torndown( */ spin_lock_irqsave(vmbus_connection.channelmsg_lock, flags); - list_for_each(curr, vmbus_connection.chn_msg_list) { -/* FIXME: this should probably use list_entry() instead */ - msginfo = (struct vmbus_channel_msginfo *)curr; + list_for_each_entry(msginfo, vmbus_connection.chn_msg_list, + msglistentry) { requestheader = (struct vmbus_channel_message_header *)msginfo-msg; @@ -712,7 +706,6 @@ static void vmbus_ongpadl_torndown( static void vmbus_onversion_response( struct vmbus_channel_message_header *hdr) { - struct list_head *curr; struct vmbus_channel_msginfo *msginfo; struct vmbus_channel_message_header *requestheader; struct vmbus_channel_initiate_contact *initiate; @@ -722,9 +715,8 @@ static void vmbus_onversion_response( version_response = (struct vmbus_channel_version_response *)hdr; spin_lock_irqsave(vmbus_connection.channelmsg_lock, flags); - list_for_each(curr, vmbus_connection.chn_msg_list) { -/* FIXME: this should probably use list_entry() instead */ - msginfo = (struct vmbus_channel_msginfo *)curr; + list_for_each_entry(msginfo, vmbus_connection.chn_msg_list, + msglistentry) { requestheader = (struct vmbus_channel_message_header *)msginfo-msg; -- 1.6.0.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: [PATCH ]:Staging: hv: Allocate the vmbus irq dynamically
-Original Message- From: KY Srinivasan Sent: Tuesday, February 15, 2011 8:54 AM -Original Message- From: Greg KH [mailto:gre...@suse.de] Sent: Tuesday, February 15, 2011 11:00 AM To: KY Srinivasan Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; virtualizat...@lists.osdl.org; Haiyang Zhang; Hank Janssen Subject: Re: [PATCH ]:Staging: hv: Allocate the vmbus irq dynamically And why are you still printing this out for the whole world to see? Greg, this patch addressed a specific comment with regards dynamically allocate the irq. Hank is working on a patch to address the various DPRINTS in the code. Before the end of the week I will submit two patches for this; Remove DPRINT and change it to printk Remove excessive printouts on startup of vmbus Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: [PATCH ]:Staging: hv: Allocate the vmbus irq dynamically
-Original Message- From: Greg KH [mailto:gre...@suse.de] Sent: Tuesday, February 15, 2011 9:23 AM Before the end of the week I will submit two patches for this; Remove DPRINT and change it to printk No, use dev_dbg() and friends instead of raw printk() calls. Will do, you caught me just as I was starting the conversion :) Remove excessive printouts on startup of vmbus That would be nice to see. There should be almost nothing outputed by these drivers on normal operation. Agreed. Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: [PATCH ]:Staging: hv: Allocate the vmbus irq dynamically
-Original Message- From: Greg KH [mailto:gre...@suse.de] Sent: Tuesday, February 15, 2011 9:23 AM Before the end of the week I will submit two patches for this; Remove DPRINT and change it to printk No, use dev_dbg() and friends instead of raw printk() calls. Will do, you caught me just as I was starting the conversion :) While cleaning this up there are a few places in vmbus and channel behavior where it is not in a device context. Are printk's okay in that context? The three drivers network/SCSI and Block of course will use dev_XX family. Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH] Staging: hv: Use list_entry for msg_info and remove associated comment
Change code to use list_entry api. And removed comment suggesting that change. Signed-off-by: Abhishek Kane v-abk...@microsoft.com Signed-off-by: K.Y. Srinivasan k...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com --- drivers/staging/hv/channel_mgmt.c | 17 + 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c index a9c9d49..6c497e9 100644 --- a/drivers/staging/hv/channel_mgmt.c +++ b/drivers/staging/hv/channel_mgmt.c @@ -580,8 +580,9 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr) spin_lock_irqsave(vmbus_connection.channelmsg_lock, flags); list_for_each(curr, vmbus_connection.chn_msg_list) { -/* FIXME: this should probably use list_entry() instead */ - msginfo = (struct vmbus_channel_msginfo *)curr; + msginfo = list_entry(curr, struct vmbus_channel_msginfo, + msglistentry); + requestheader = (struct vmbus_channel_message_header *)msginfo-msg; @@ -628,8 +629,8 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr) spin_lock_irqsave(vmbus_connection.channelmsg_lock, flags); list_for_each(curr, vmbus_connection.chn_msg_list) { -/* FIXME: this should probably use list_entry() instead */ - msginfo = (struct vmbus_channel_msginfo *)curr; + msginfo = list_entry(curr, struct vmbus_channel_msginfo, + msglistentry); requestheader = (struct vmbus_channel_message_header *)msginfo-msg; @@ -676,8 +677,8 @@ static void vmbus_ongpadl_torndown( spin_lock_irqsave(vmbus_connection.channelmsg_lock, flags); list_for_each(curr, vmbus_connection.chn_msg_list) { -/* FIXME: this should probably use list_entry() instead */ - msginfo = (struct vmbus_channel_msginfo *)curr; + msginfo = list_entry(curr, struct vmbus_channel_msginfo, + msglistentry); requestheader = (struct vmbus_channel_message_header *)msginfo-msg; @@ -718,8 +719,8 @@ static void vmbus_onversion_response( spin_lock_irqsave(vmbus_connection.channelmsg_lock, flags); list_for_each(curr, vmbus_connection.chn_msg_list) { -/* FIXME: this should probably use list_entry() instead */ - msginfo = (struct vmbus_channel_msginfo *)curr; + msginfo = list_entry(curr, struct vmbus_channel_msginfo, + msglistentry); requestheader = (struct vmbus_channel_message_header *)msginfo-msg; -- 1.6.0.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: [PATCH 1/3]: Staging: hv: Use native page allocation/free functions
-Original Message- And then KY Srinivasan spoke on Friday, February 11, 2011 12:56 PM From: Greg KH [mailto:gre...@suse.de] Sent: Friday, February 11, 2011 1:30 PM - virtaddr = osd_virtual_alloc_exec(PAGE_SIZE); +#ifdef __x86_64__ + virtaddr = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL_EXEC); #else + virtaddr = __vmalloc(PAGE_SIZE, GFP_KERNEL, + __pgprot(__PAGE_KERNEL (~_PAGE_NX))); #endif I'm not saying this patch is wrong at all, but I still don't understand why this is different depending on the architecture of the machine. Why is this necessary, it should be ok to do the same type of allocation no matter what the processor is, right? You are right Greg; I don't think there is a need to specify different page protection bits based on the architecture - PAGE_KERNEL_EXEC should be enough. However, this is the code that is currently in the tree - refer to osd.c. If it is ok with you, I could submit an additional patch to clean this up. I seem to recall that we did it for very old versions of Linux (pre 2.6.18) But I cannot for the life of me remember why. Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: [PATCH 1/3]: Staging: hv: Use native page allocation/free functions
-Original Message- From: Greg KH [mailto:gre...@suse.de] On Friday, February 11, 2011 1:24 PM On Fri, Feb 11, 2011 at 08:55:56PM +, KY Srinivasan wrote: I'm not saying this patch is wrong at all, but I still don't understand why this is different depending on the architecture of the machine. Why is this necessary, it should be ok to do the same type of allocation no matter what the processor is, right? You are right Greg; I don't think there is a need to specify different page protection bits based on the architecture - PAGE_KERNEL_EXEC should be enough. I thought so, but for some reason Hank said there this was needed. Hank, is it still true? I recall we did it for older versions of Linux but I do not recall why. Something from way before 2.6.18, the reason of which I seem to have Purged due to age :) However, this is the code that is currently in the tree - refer to osd.c. Oh, I remember, it's not a critique of this patch, it just reminded me of this question I always had for this code. If it is ok with you, I could submit an additional patch to clean this up. If Hank says it is ok, and you all test it to verify nothing breaks, please send it on. If you could accept the patch as is and I will work with Ky to see if nothing breaks If we change this part to what you are suggesting? If nothing breaks we will submit A followup patch to remove those lines. Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 1/1] staging: hv: Removed unneeded call to netif_stop_queue() in hv_netvsc
From: Hank Janssen hjans...@microsoft.com Removed the call to netif_stop_queue() in netvsc_probe() as the queue is not initialized at that point and further call to it after queue initialization is really not necessary. This change was prompted after an upstream change went into 2.6.37 (netif_tx_stop_queue) that now checks if netif_stop_queue is called before register with netdev is done. This will eliminate the warning message to the log when hv_netvsc driver starts up. Signed-off-by: Abhishek Kane v-abk...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com --- drivers/staging/hv/netvsc_drv.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c index 0147b40..54706a1 100644 --- a/drivers/staging/hv/netvsc_drv.c +++ b/drivers/staging/hv/netvsc_drv.c @@ -358,7 +358,6 @@ static int netvsc_probe(struct device *device) /* Set initial state */ netif_carrier_off(net); - netif_stop_queue(net); net_device_ctx = netdev_priv(net); net_device_ctx-device_ctx = device_ctx; -- 1.6.0.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 1/1] hv: Use only one receive buffer and kmalloc on initialize
Correct issue with not checking kmalloc return value. This fix now only uses one receive buffer for all hv_utils channels, and will do only one kmalloc on init and will return with a -ENOMEM if kmalloc fails on initialize. Thanks to Evgeniy Polyakov z...@ioremap.net for pointing this out. And thanks to Jesper Juhl j...@chaosbits.net and Ky Srinivasan ksriniva...@novell.com for suggesting a better implementation of my original patch. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com Cc:Evgeniy Polyakov z...@ioremap.net Cc:Jesper Juhl j...@chaosbits.net Cc:Ky Srinivasan ksriniva...@novell.com --- drivers/staging/hv/hv_utils.c | 68 +++- 1 files changed, 32 insertions(+), 36 deletions(-) diff --git a/drivers/staging/hv/hv_utils.c b/drivers/staging/hv/hv_utils.c index 53e1e29..4ed4ab8 100644 --- a/drivers/staging/hv/hv_utils.c +++ b/drivers/staging/hv/hv_utils.c @@ -38,12 +38,15 @@ #include vmbus_api.h #include utils.h +/* + * Buffer used to receive packets from Hyper-V + */ +static u8 *chan_buf; static void shutdown_onchannelcallback(void *context) { struct vmbus_channel *channel = context; - u8 *buf; - u32 buflen, recvlen; + u32 recvlen; u64 requestid; u8 execute_shutdown = false; @@ -52,22 +55,19 @@ static void shutdown_onchannelcallback(void *context) struct icmsg_hdr *icmsghdrp; struct icmsg_negotiate *negop = NULL; - buflen = PAGE_SIZE; - buf = kmalloc(buflen, GFP_ATOMIC); - - vmbus_recvpacket(channel, buf, buflen, recvlen, requestid); + vmbus_recvpacket(channel, chan_buf, PAGE_SIZE, recvlen, requestid); if (recvlen 0) { DPRINT_DBG(VMBUS, shutdown packet: len=%d, requestid=%lld, recvlen, requestid); - icmsghdrp = (struct icmsg_hdr *)buf[ + icmsghdrp = (struct icmsg_hdr *)chan_buf[ sizeof(struct vmbuspipe_hdr)]; if (icmsghdrp-icmsgtype == ICMSGTYPE_NEGOTIATE) { - prep_negotiate_resp(icmsghdrp, negop, buf); + prep_negotiate_resp(icmsghdrp, negop, chan_buf); } else { - shutdown_msg = (struct shutdown_msg_data *)buf[ + shutdown_msg = (struct shutdown_msg_data *)chan_buf[ sizeof(struct vmbuspipe_hdr) + sizeof(struct icmsg_hdr)]; @@ -93,13 +93,11 @@ static void shutdown_onchannelcallback(void *context) icmsghdrp-icflags = ICMSGHDRFLAG_TRANSACTION | ICMSGHDRFLAG_RESPONSE; - vmbus_sendpacket(channel, buf, + vmbus_sendpacket(channel, chan_buf, recvlen, requestid, VmbusPacketTypeDataInBand, 0); } - kfree(buf); - if (execute_shutdown == true) orderly_poweroff(false); } @@ -150,28 +148,24 @@ static inline void adj_guesttime(u64 hosttime, u8 flags) static void timesync_onchannelcallback(void *context) { struct vmbus_channel *channel = context; - u8 *buf; - u32 buflen, recvlen; + u32 recvlen; u64 requestid; struct icmsg_hdr *icmsghdrp; struct ictimesync_data *timedatap; - buflen = PAGE_SIZE; - buf = kmalloc(buflen, GFP_ATOMIC); - - vmbus_recvpacket(channel, buf, buflen, recvlen, requestid); + vmbus_recvpacket(channel, chan_buf, PAGE_SIZE, recvlen, requestid); if (recvlen 0) { DPRINT_DBG(VMBUS, timesync packet: recvlen=%d, requestid=%lld, recvlen, requestid); - icmsghdrp = (struct icmsg_hdr *)buf[ + icmsghdrp = (struct icmsg_hdr *)chan_buf[ sizeof(struct vmbuspipe_hdr)]; if (icmsghdrp-icmsgtype == ICMSGTYPE_NEGOTIATE) { - prep_negotiate_resp(icmsghdrp, NULL, buf); + prep_negotiate_resp(icmsghdrp, NULL, chan_buf); } else { - timedatap = (struct ictimesync_data *)buf[ + timedatap = (struct ictimesync_data *)chan_buf[ sizeof(struct vmbuspipe_hdr) + sizeof(struct icmsg_hdr)]; adj_guesttime(timedatap-parenttime, timedatap-flags); @@ -180,12 +174,10 @@ static void timesync_onchannelcallback(void *context) icmsghdrp-icflags = ICMSGHDRFLAG_TRANSACTION | ICMSGHDRFLAG_RESPONSE; - vmbus_sendpacket(channel, buf, + vmbus_sendpacket(channel, chan_buf, recvlen, requestid, VmbusPacketTypeDataInBand, 0); } - - kfree(buf
RE: [PATCH 1/1] hv: Use only one receive buffer and kmalloc on initialize
-Original Message- From: Greg KH [mailto:g...@kroah.com] Sent: Monday, December 13, 2010 11:41 AM The current versions of Hyper-V support interrupt handling on CPU0 only. I can make multiple buffers per channel, but because of Hyper-V implementation It does not really make a difference. Then put a big fat note in there saying this, and that it will have to change if the hyperv channel ever changes. Hm, how will you handle things if the hyperv core changes and an old kernel is running this code where things were assumed about the reentrancy happening here? I will re-roll this patch to have a buffer per channel. It is a more elegant design Even though Hyper-V behavior is not changing in Win8 for this. Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 1/1] hv: Use only one receive buffer per channel and kmalloc on initialize
Correct issue with not checking kmalloc return value. This fix now only uses one receive buffer for all hv_utils channels, and will do only one kmalloc on init and will return with a -ENOMEM if kmalloc fails on initialize. Thanks to Evgeniy Polyakov z...@ioremap.net for pointing this out. And thanks to Jesper Juhl j...@chaosbits.net and Ky Srinivasan ksriniva...@novell.com for suggesting a better implementation of my original patch. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com Cc: Evgeniy Polyakov z...@ioremap.net Cc: Jesper Juhl j...@chaosbits.net Cc: Ky Srinivasan ksriniva...@novell.com --- drivers/staging/hv/hv_utils.c | 84 +--- 1 files changed, 44 insertions(+), 40 deletions(-) diff --git a/drivers/staging/hv/hv_utils.c b/drivers/staging/hv/hv_utils.c index 53e1e29..e0ecc23 100644 --- a/drivers/staging/hv/hv_utils.c +++ b/drivers/staging/hv/hv_utils.c @@ -38,12 +38,14 @@ #include vmbus_api.h #include utils.h +static u8 *shut_txf_buf; +static u8 *time_txf_buf; +static u8 *hbeat_txf_buf; static void shutdown_onchannelcallback(void *context) { struct vmbus_channel *channel = context; - u8 *buf; - u32 buflen, recvlen; + u32 recvlen; u64 requestid; u8 execute_shutdown = false; @@ -52,24 +54,23 @@ static void shutdown_onchannelcallback(void *context) struct icmsg_hdr *icmsghdrp; struct icmsg_negotiate *negop = NULL; - buflen = PAGE_SIZE; - buf = kmalloc(buflen, GFP_ATOMIC); - - vmbus_recvpacket(channel, buf, buflen, recvlen, requestid); + vmbus_recvpacket(channel, shut_txf_buf, +PAGE_SIZE, recvlen, requestid); if (recvlen 0) { DPRINT_DBG(VMBUS, shutdown packet: len=%d, requestid=%lld, recvlen, requestid); - icmsghdrp = (struct icmsg_hdr *)buf[ + icmsghdrp = (struct icmsg_hdr *)shut_txf_buf[ sizeof(struct vmbuspipe_hdr)]; if (icmsghdrp-icmsgtype == ICMSGTYPE_NEGOTIATE) { - prep_negotiate_resp(icmsghdrp, negop, buf); + prep_negotiate_resp(icmsghdrp, negop, shut_txf_buf); } else { - shutdown_msg = (struct shutdown_msg_data *)buf[ - sizeof(struct vmbuspipe_hdr) + - sizeof(struct icmsg_hdr)]; + shutdown_msg = + (struct shutdown_msg_data *)shut_txf_buf[ + sizeof(struct vmbuspipe_hdr) + + sizeof(struct icmsg_hdr)]; switch (shutdown_msg-flags) { case 0: @@ -93,13 +94,11 @@ static void shutdown_onchannelcallback(void *context) icmsghdrp-icflags = ICMSGHDRFLAG_TRANSACTION | ICMSGHDRFLAG_RESPONSE; - vmbus_sendpacket(channel, buf, + vmbus_sendpacket(channel, shut_txf_buf, recvlen, requestid, VmbusPacketTypeDataInBand, 0); } - kfree(buf); - if (execute_shutdown == true) orderly_poweroff(false); } @@ -150,28 +149,25 @@ static inline void adj_guesttime(u64 hosttime, u8 flags) static void timesync_onchannelcallback(void *context) { struct vmbus_channel *channel = context; - u8 *buf; - u32 buflen, recvlen; + u32 recvlen; u64 requestid; struct icmsg_hdr *icmsghdrp; struct ictimesync_data *timedatap; - buflen = PAGE_SIZE; - buf = kmalloc(buflen, GFP_ATOMIC); - - vmbus_recvpacket(channel, buf, buflen, recvlen, requestid); + vmbus_recvpacket(channel, time_txf_buf, +PAGE_SIZE, recvlen, requestid); if (recvlen 0) { DPRINT_DBG(VMBUS, timesync packet: recvlen=%d, requestid=%lld, recvlen, requestid); - icmsghdrp = (struct icmsg_hdr *)buf[ + icmsghdrp = (struct icmsg_hdr *)time_txf_buf[ sizeof(struct vmbuspipe_hdr)]; if (icmsghdrp-icmsgtype == ICMSGTYPE_NEGOTIATE) { - prep_negotiate_resp(icmsghdrp, NULL, buf); + prep_negotiate_resp(icmsghdrp, NULL, time_txf_buf); } else { - timedatap = (struct ictimesync_data *)buf[ + timedatap = (struct ictimesync_data *)time_txf_buf[ sizeof(struct vmbuspipe_hdr) + sizeof(struct icmsg_hdr)]; adj_guesttime(timedatap-parenttime, timedatap-flags); @@ -180,12 +176,10 @@ static void timesync_onchannelcallback(void *context
RE: [PATCH 1/1] hv: Use only one receive buffer per channel and kmalloc on initialize
-Original Message- From: Jesper Juhl [mailto:j...@chaosbits.net] Sent: Monday, December 13, 2010 12:48 PM You are leaking memory in the failure path. If for example one or two allocations succeed but one or two fail, then you'll leak the two successful allocations. I believe this should be if (!shut_txf_buf || !time_txf_buf || !hbeat_txf_buf) { printk(KERN_INFO Unable to allocate memory for receive buffer\n); kfree(hbeat_txf_buf); kfree(time_txf_buf); kfree(shut_txf_buf); return -ENOMEM; ... Oops, you are correct. Resubmitting the patch in a few minutes. Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 1/1] hv: Use only one txf buffer per channel and kmalloc on initialize
Correct issue with not checking kmalloc return value. This fix now only uses one receive buffer for all hv_utils channels, and will do only one kmalloc on init and will return with a -ENOMEM if kmalloc fails on initialize. And properly clean up memory on failure. Thanks to Evgeniy Polyakov z...@ioremap.net for pointing this out. And thanks to Jesper Juhl j...@chaosbits.net and Ky Srinivasan ksriniva...@novell.com for suggesting a better implementation of my original patch. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com Cc: Evgeniy Polyakov z...@ioremap.net Cc: Jesper Juhl j...@chaosbits.net Cc: Ky Srinivasan ksriniva...@novell.com --- drivers/staging/hv/hv_utils.c | 84 +--- 1 files changed, 44 insertions(+), 40 deletions(-) diff --git a/drivers/staging/hv/hv_utils.c b/drivers/staging/hv/hv_utils.c index 53e1e29..e0ecc23 100644 --- a/drivers/staging/hv/hv_utils.c +++ b/drivers/staging/hv/hv_utils.c @@ -38,12 +38,14 @@ #include vmbus_api.h #include utils.h +static u8 *shut_txf_buf; +static u8 *time_txf_buf; +static u8 *hbeat_txf_buf; static void shutdown_onchannelcallback(void *context) { struct vmbus_channel *channel = context; - u8 *buf; - u32 buflen, recvlen; + u32 recvlen; u64 requestid; u8 execute_shutdown = false; @@ -52,24 +54,23 @@ static void shutdown_onchannelcallback(void *context) struct icmsg_hdr *icmsghdrp; struct icmsg_negotiate *negop = NULL; - buflen = PAGE_SIZE; - buf = kmalloc(buflen, GFP_ATOMIC); - - vmbus_recvpacket(channel, buf, buflen, recvlen, requestid); + vmbus_recvpacket(channel, shut_txf_buf, +PAGE_SIZE, recvlen, requestid); if (recvlen 0) { DPRINT_DBG(VMBUS, shutdown packet: len=%d, requestid=%lld, recvlen, requestid); - icmsghdrp = (struct icmsg_hdr *)buf[ + icmsghdrp = (struct icmsg_hdr *)shut_txf_buf[ sizeof(struct vmbuspipe_hdr)]; if (icmsghdrp-icmsgtype == ICMSGTYPE_NEGOTIATE) { - prep_negotiate_resp(icmsghdrp, negop, buf); + prep_negotiate_resp(icmsghdrp, negop, shut_txf_buf); } else { - shutdown_msg = (struct shutdown_msg_data *)buf[ - sizeof(struct vmbuspipe_hdr) + - sizeof(struct icmsg_hdr)]; + shutdown_msg = + (struct shutdown_msg_data *)shut_txf_buf[ + sizeof(struct vmbuspipe_hdr) + + sizeof(struct icmsg_hdr)]; switch (shutdown_msg-flags) { case 0: @@ -93,13 +94,11 @@ static void shutdown_onchannelcallback(void *context) icmsghdrp-icflags = ICMSGHDRFLAG_TRANSACTION | ICMSGHDRFLAG_RESPONSE; - vmbus_sendpacket(channel, buf, + vmbus_sendpacket(channel, shut_txf_buf, recvlen, requestid, VmbusPacketTypeDataInBand, 0); } - kfree(buf); - if (execute_shutdown == true) orderly_poweroff(false); } @@ -150,28 +149,25 @@ static inline void adj_guesttime(u64 hosttime, u8 flags) static void timesync_onchannelcallback(void *context) { struct vmbus_channel *channel = context; - u8 *buf; - u32 buflen, recvlen; + u32 recvlen; u64 requestid; struct icmsg_hdr *icmsghdrp; struct ictimesync_data *timedatap; - buflen = PAGE_SIZE; - buf = kmalloc(buflen, GFP_ATOMIC); - - vmbus_recvpacket(channel, buf, buflen, recvlen, requestid); + vmbus_recvpacket(channel, time_txf_buf, +PAGE_SIZE, recvlen, requestid); if (recvlen 0) { DPRINT_DBG(VMBUS, timesync packet: recvlen=%d, requestid=%lld, recvlen, requestid); - icmsghdrp = (struct icmsg_hdr *)buf[ + icmsghdrp = (struct icmsg_hdr *)time_txf_buf[ sizeof(struct vmbuspipe_hdr)]; if (icmsghdrp-icmsgtype == ICMSGTYPE_NEGOTIATE) { - prep_negotiate_resp(icmsghdrp, NULL, buf); + prep_negotiate_resp(icmsghdrp, NULL, time_txf_buf); } else { - timedatap = (struct ictimesync_data *)buf[ + timedatap = (struct ictimesync_data *)time_txf_buf[ sizeof(struct vmbuspipe_hdr) + sizeof(struct icmsg_hdr)]; adj_guesttime(timedatap-parenttime, timedatap-flags); @@ -180,12 +176,10 @@ static void
RE: [PATCH 1/1] hv: Use only one receive buffer per channel and kmalloc on initialize
-Original Message- From: Jesper Juhl [mailto:j...@chaosbits.net] Sent: Monday, December 13, 2010 1:06 PM On Mon, 13 Dec 2010, Hank Janssen wrote: ... Oops, you are correct. Resubmitting the patch in a few minutes. Ohh and another little detail; shouldn't this log message be a KERN_WARNING level message? And perhaps the log text should include HyperV or something so it's clear where it comes from..? I will make that part of another set of patches. I need to remove the DPRINT Completely from the code and replace them all with the correct kprint statements. Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: [PATCH 1/1] hv: Use only one txf buffer per channel and kmalloc on initialize
From: Jesper Juhl [mailto:j...@chaosbits.net] Sent: Monday, December 13, 2010 1:22 PM I can't spot any problems with these changes now, so feel free to add Reviewed-by: Jesper Juhl j...@chaosbits.net if you like. Thank you for your help Jesper. Greg, do you want me to resubmit with the Reviewed by line? Or do you Add it once you queue it up for linux-next? Thanks, Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: [PATCH 1/1] hv: Use only one receive buffer per channel and kmalloc on initialize
-Original Message- From: Jesper Juhl [mailto:j...@chaosbits.net] Sent: Monday, December 13, 2010 3:51 PM To: Ky Srinivasan + shut_txf_buf = kmalloc(PAGE_SIZE, GFP_ATOMIC); + time_txf_buf = kmalloc(PAGE_SIZE, GFP_ATOMIC); + hbeat_txf_buf = kmalloc(PAGE_SIZE, GFP_ATOMIC); Why are these allocations GFP_ATOMIC. Clearly this is in module loading context and you can afford to sleep. GFP_KERNEL should be fine. I actually also noticed this when I did my first review of the patch, but I didn't point it out since I thought that there must be a good reason. But now that you point it out and I look at the code once more I can't actually think of a good reason,, so I agree with you completely that these should just be GFP_KERNEL. I was looking at some of the back code to make sure it is okay, and I see No reason not make this change either. I will change it and resubmit. Thanks, Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 1/1] hv: Use only one txf buffer per channel and kmalloc/GFP_KERNEL on initialize
Correct issue with not checking kmalloc return value. This fix now only uses one receive buffer for all hv_utils channels, and will do only one kmalloc on init and will return with a -ENOMEM if kmalloc fails on initialize. And properly clean up memory on failure. Thanks to Evgeniy Polyakov z...@ioremap.net for pointing this out. And thanks to Jesper Juhl j...@chaosbits.net and Ky Srinivasan ksriniva...@novell.com for suggesting a better implementation of my original patch. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com Reviewed-by: Jesper Juhl j...@chaosbits.net Cc: Evgeniy Polyakov z...@ioremap.net Cc: Jesper Juhl j...@chaosbits.net Cc: Ky Srinivasan ksriniva...@novell.com --- drivers/staging/hv/hv_utils.c | 84 +--- 1 files changed, 44 insertions(+), 40 deletions(-) diff --git a/drivers/staging/hv/hv_utils.c b/drivers/staging/hv/hv_utils.c index 53e1e29..e0ecc23 100644 --- a/drivers/staging/hv/hv_utils.c +++ b/drivers/staging/hv/hv_utils.c @@ -38,12 +38,14 @@ #include vmbus_api.h #include utils.h +static u8 *shut_txf_buf; +static u8 *time_txf_buf; +static u8 *hbeat_txf_buf; static void shutdown_onchannelcallback(void *context) { struct vmbus_channel *channel = context; - u8 *buf; - u32 buflen, recvlen; + u32 recvlen; u64 requestid; u8 execute_shutdown = false; @@ -52,24 +54,23 @@ static void shutdown_onchannelcallback(void *context) struct icmsg_hdr *icmsghdrp; struct icmsg_negotiate *negop = NULL; - buflen = PAGE_SIZE; - buf = kmalloc(buflen, GFP_ATOMIC); - - vmbus_recvpacket(channel, buf, buflen, recvlen, requestid); + vmbus_recvpacket(channel, shut_txf_buf, +PAGE_SIZE, recvlen, requestid); if (recvlen 0) { DPRINT_DBG(VMBUS, shutdown packet: len=%d, requestid=%lld, recvlen, requestid); - icmsghdrp = (struct icmsg_hdr *)buf[ + icmsghdrp = (struct icmsg_hdr *)shut_txf_buf[ sizeof(struct vmbuspipe_hdr)]; if (icmsghdrp-icmsgtype == ICMSGTYPE_NEGOTIATE) { - prep_negotiate_resp(icmsghdrp, negop, buf); + prep_negotiate_resp(icmsghdrp, negop, shut_txf_buf); } else { - shutdown_msg = (struct shutdown_msg_data *)buf[ - sizeof(struct vmbuspipe_hdr) + - sizeof(struct icmsg_hdr)]; + shutdown_msg = + (struct shutdown_msg_data *)shut_txf_buf[ + sizeof(struct vmbuspipe_hdr) + + sizeof(struct icmsg_hdr)]; switch (shutdown_msg-flags) { case 0: @@ -93,13 +94,11 @@ static void shutdown_onchannelcallback(void *context) icmsghdrp-icflags = ICMSGHDRFLAG_TRANSACTION | ICMSGHDRFLAG_RESPONSE; - vmbus_sendpacket(channel, buf, + vmbus_sendpacket(channel, shut_txf_buf, recvlen, requestid, VmbusPacketTypeDataInBand, 0); } - kfree(buf); - if (execute_shutdown == true) orderly_poweroff(false); } @@ -150,28 +149,25 @@ static inline void adj_guesttime(u64 hosttime, u8 flags) static void timesync_onchannelcallback(void *context) { struct vmbus_channel *channel = context; - u8 *buf; - u32 buflen, recvlen; + u32 recvlen; u64 requestid; struct icmsg_hdr *icmsghdrp; struct ictimesync_data *timedatap; - buflen = PAGE_SIZE; - buf = kmalloc(buflen, GFP_ATOMIC); - - vmbus_recvpacket(channel, buf, buflen, recvlen, requestid); + vmbus_recvpacket(channel, time_txf_buf, +PAGE_SIZE, recvlen, requestid); if (recvlen 0) { DPRINT_DBG(VMBUS, timesync packet: recvlen=%d, requestid=%lld, recvlen, requestid); - icmsghdrp = (struct icmsg_hdr *)buf[ + icmsghdrp = (struct icmsg_hdr *)time_txf_buf[ sizeof(struct vmbuspipe_hdr)]; if (icmsghdrp-icmsgtype == ICMSGTYPE_NEGOTIATE) { - prep_negotiate_resp(icmsghdrp, NULL, buf); + prep_negotiate_resp(icmsghdrp, NULL, time_txf_buf); } else { - timedatap = (struct ictimesync_data *)buf[ + timedatap = (struct ictimesync_data *)time_txf_buf[ sizeof(struct vmbuspipe_hdr) + sizeof(struct icmsg_hdr)]; adj_guesttime(timedatap-parenttime, timedatap-flags); @@ -180,12
[PATCH 1/1] Properly check return values of kmalloc and vmbus_recvpacket
Correct ugly oversight, we need to check the return values of kmalloc and vmbus_recvpacket and return if they fail. I also tightened up the call to kmalloc. Thanks to Evgeniy Polyakov z...@ioremap.net for pointing this out. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com --- drivers/staging/hv/hv_utils.c | 48 1 files changed, 33 insertions(+), 15 deletions(-) diff --git a/drivers/staging/hv/hv_utils.c b/drivers/staging/hv/hv_utils.c index 53e1e29..ac68575 100644 --- a/drivers/staging/hv/hv_utils.c +++ b/drivers/staging/hv/hv_utils.c @@ -43,21 +43,27 @@ static void shutdown_onchannelcallback(void *context) { struct vmbus_channel *channel = context; u8 *buf; - u32 buflen, recvlen; + u32 recvlen; u64 requestid; u8 execute_shutdown = false; + int ret = 0; struct shutdown_msg_data *shutdown_msg; struct icmsg_hdr *icmsghdrp; struct icmsg_negotiate *negop = NULL; - buflen = PAGE_SIZE; - buf = kmalloc(buflen, GFP_ATOMIC); + buf = kmalloc(PAGE_SIZE, GFP_ATOMIC); - vmbus_recvpacket(channel, buf, buflen, recvlen, requestid); + if (!buf) { + printk(KERN_INFO + Unable to allocate memory for shutdown_onchannelcallback); + return; + } + + ret = vmbus_recvpacket(channel, buf, PAGE_SIZE, recvlen, requestid); - if (recvlen 0) { + if (ret == 0 recvlen 0) { DPRINT_DBG(VMBUS, shutdown packet: len=%d, requestid=%lld, recvlen, requestid); @@ -151,17 +157,23 @@ static void timesync_onchannelcallback(void *context) { struct vmbus_channel *channel = context; u8 *buf; - u32 buflen, recvlen; + u32 recvlen; u64 requestid; struct icmsg_hdr *icmsghdrp; struct ictimesync_data *timedatap; + int ret = 0; - buflen = PAGE_SIZE; - buf = kmalloc(buflen, GFP_ATOMIC); + buf = kmalloc(PAGE_SIZE, GFP_ATOMIC); - vmbus_recvpacket(channel, buf, buflen, recvlen, requestid); + if (!buf) { + printk(KERN_INFO + Unable to allocate memory for timesync_onchannelcallback); + return; + } - if (recvlen 0) { + ret = vmbus_recvpacket(channel, buf, PAGE_SIZE, recvlen, requestid); + + if (ret == 0 recvlen 0) { DPRINT_DBG(VMBUS, timesync packet: recvlen=%d, requestid=%lld, recvlen, requestid); @@ -197,17 +209,23 @@ static void heartbeat_onchannelcallback(void *context) { struct vmbus_channel *channel = context; u8 *buf; - u32 buflen, recvlen; + u32 recvlen; u64 requestid; struct icmsg_hdr *icmsghdrp; struct heartbeat_msg_data *heartbeat_msg; + int ret = 0; + + buf = kmalloc(PAGE_SIZE, GFP_ATOMIC); - buflen = PAGE_SIZE; - buf = kmalloc(buflen, GFP_ATOMIC); + if (!buf) { + printk(KERN_INFO + Unable to allocate memory for heartbeat_onchannelcallback); + return; + } - vmbus_recvpacket(channel, buf, buflen, recvlen, requestid); + ret = vmbus_recvpacket(channel, buf, PAGE_SIZE, recvlen, requestid); - if (recvlen 0) { + if (ret == 0 recvlen 0) { DPRINT_DBG(VMBUS, heartbeat packet: len=%d, requestid=%lld, recvlen, requestid); -- 1.6.0.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: [PATCH 2/3]: An implementation of HyperV KVP functionality
From: Ky Srinivasan [mailto:ksriniva...@novell.com] Sent: Tuesday, December 07, 2010 3:19 PM On 12/7/2010 at 5:29 PM, in message 20101207222933.ga10...@ioremap.net, Evgeniy Polyakov z...@ioremap.net wrote: On Tue, Dec 07, 2010 at 03:25:56PM -0700, Ky Srinivasan (ksriniva...@novell.com) wrote: +static void shutdown_onchannelcallback(void *context) +{ + struct vmbus_channel *channel = context; + u8 *buf; + u32 buflen, recvlen; + u64 requestid; + u8 execute_shutdown = false; + + struct shutdown_msg_data *shutdown_msg; + + struct icmsg_hdr *icmsghdrp; + struct icmsg_negotiate *negop = NULL; + + buflen = PAGE_SIZE; + buf = kmalloc(buflen, GFP_ATOMIC); + + vmbus_recvpacket(channel, buf, buflen, recvlen, requestid); This did not change since previous review and this is wrong. It is the right way to crash kernel. I did not read further since this is a show-stopper imo. Hank, do you want to respond to this comment. I will submit a patch for hv_utils.c to check the return value from kmalloc and vmbus_recvpacket and return if either one of them fail. The function is a void because they are treated here as fire and Forget. But it comment about what would happen if kmalloc or Vmbus_recvpacket fails is correct. We could cause a crash. So I will correct that part. Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 4/8] staging: hv: Convert camel case struct fields in storvsc.c to lowercase
From: Hank Janssen hjans...@microsoft.com Convert camel cased struct fields in storvsc.c to lowercase Signed-off-by: Abhishek Kane v-abk...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com --- drivers/staging/hv/storvsc.c | 133 +- 1 files changed, 67 insertions(+), 66 deletions(-) diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c index 7704131..3b6e63a 100644 --- a/drivers/staging/hv/storvsc.c +++ b/drivers/staging/hv/storvsc.c @@ -34,43 +34,43 @@ struct storvsc_request_extension { /* LIST_ENTRY ListEntry; */ - struct hv_storvsc_request *Request; - struct hv_device *Device; + struct hv_storvsc_request *request; + struct hv_device *device; /* Synchronize the request/response if needed */ - struct osd_waitevent *WaitEvent; + struct osd_waitevent *wait_event; - struct vstor_packet VStorPacket; + struct vstor_packet vstor_packet; }; /* A storvsc device is a device object that contains a vmbus channel */ struct storvsc_device { - struct hv_device *Device; + struct hv_device *device; /* 0 indicates the device is being destroyed */ - atomic_t RefCount; + atomic_t ref_count; - atomic_t NumOutstandingRequests; + atomic_t num_outstanding_requests; /* * Each unique Port/Path/Target represents 1 channel ie scsi * controller. In reality, the pathid, targetid is always 0 * and the port is set by us */ - unsigned int PortNumber; - unsigned char PathId; - unsigned char TargetId; + unsigned int port_number; + unsigned char path_id; + unsigned char target_id; /* LIST_ENTRY OutstandingRequestList; */ /* HANDLE OutstandingRequestLock; */ /* Used for vsc/vsp channel reset process */ - struct storvsc_request_extension InitRequest; - struct storvsc_request_extension ResetRequest; + struct storvsc_request_extension init_request; + struct storvsc_request_extension reset_request; }; -static const char *gDriverName = storvsc; +static const char *g_driver_name = storvsc; /* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */ static const struct hv_guid gStorVscDeviceType = { @@ -90,10 +90,10 @@ static inline struct storvsc_device *AllocStorDevice(struct hv_device *Device) return NULL; /* Set to 2 to allow both inbound and outbound traffics */ - /* (ie GetStorDevice() and MustGetStorDevice()) to proceed. */ - atomic_cmpxchg(storDevice-RefCount, 0, 2); + /* (ie get_stor_device() and must_get_stor_device()) to proceed. */ + atomic_cmpxchg(storDevice-ref_count, 0, 2); - storDevice-Device = Device; + storDevice-device = Device; Device-Extension = storDevice; return storDevice; @@ -101,7 +101,7 @@ static inline struct storvsc_device *AllocStorDevice(struct hv_device *Device) static inline void FreeStorDevice(struct storvsc_device *Device) { - /* ASSERT(atomic_read(Device-RefCount) == 0); */ + /* ASSERT(atomic_read(Device-ref_count) == 0); */ kfree(Device); } @@ -111,8 +111,8 @@ static inline struct storvsc_device *GetStorDevice(struct hv_device *Device) struct storvsc_device *storDevice; storDevice = (struct storvsc_device *)Device-Extension; - if (storDevice atomic_read(storDevice-RefCount) 1) - atomic_inc(storDevice-RefCount); + if (storDevice atomic_read(storDevice-ref_count) 1) + atomic_inc(storDevice-ref_count); else storDevice = NULL; @@ -125,8 +125,8 @@ static inline struct storvsc_device *MustGetStorDevice(struct hv_device *Device) struct storvsc_device *storDevice; storDevice = (struct storvsc_device *)Device-Extension; - if (storDevice atomic_read(storDevice-RefCount)) - atomic_inc(storDevice-RefCount); + if (storDevice atomic_read(storDevice-ref_count)) + atomic_inc(storDevice-ref_count); else storDevice = NULL; @@ -140,8 +140,8 @@ static inline void PutStorDevice(struct hv_device *Device) storDevice = (struct storvsc_device *)Device-Extension; /* ASSERT(storDevice); */ - atomic_dec(storDevice-RefCount); - /* ASSERT(atomic_read(storDevice-RefCount)); */ + atomic_dec(storDevice-ref_count); + /* ASSERT(atomic_read(storDevice-ref_count)); */ } /* Drop ref count to 1 to effectively disable GetStorDevice() */ @@ -153,7 +153,7 @@ static inline struct storvsc_device *ReleaseStorDevice(struct hv_device *Device) /* ASSERT(storDevice); */ /* Busy wait until the ref drop to 2, then set it to 1 */ - while (atomic_cmpxchg(storDevice-RefCount, 2, 1) != 2) + while (atomic_cmpxchg(storDevice
[PATCH 3/8] staging: hv: Convert camel case functions in storvsc_api.h to lowercase
From: Hank Janssen hjans...@microsoft.com Convert camel case functions in storvsc_api.h to lowercase Signed-off-by: Abhishek Kane v-abk...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com --- drivers/staging/hv/blkvsc.c |2 +- drivers/staging/hv/blkvsc_drv.c |2 +- drivers/staging/hv/storvsc.c |6 +++--- drivers/staging/hv/storvsc_api.h |6 +++--- drivers/staging/hv/storvsc_drv.c |4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/hv/blkvsc.c b/drivers/staging/hv/blkvsc.c index 9ac04c3..e62c922 100644 --- a/drivers/staging/hv/blkvsc.c +++ b/drivers/staging/hv/blkvsc.c @@ -62,7 +62,7 @@ static int BlkVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo) return ret; } -int BlkVscInitialize(struct hv_driver *Driver) +int blk_vsc_initialize(struct hv_driver *Driver) { struct storvsc_driver_object *storDriver; int ret = 0; diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c index d65d69e..b3d05fc 100644 --- a/drivers/staging/hv/blkvsc_drv.c +++ b/drivers/staging/hv/blkvsc_drv.c @@ -1487,7 +1487,7 @@ static int __init blkvsc_init(void) DPRINT_INFO(BLKVSC_DRV, Blkvsc initializing); - ret = blkvsc_drv_init(BlkVscInitialize); + ret = blkvsc_drv_init(blk_vsc_initialize); return ret; } diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c index c4346c6..7704131 100644 --- a/drivers/staging/hv/storvsc.c +++ b/drivers/staging/hv/storvsc.c @@ -605,7 +605,7 @@ static int StorVscOnDeviceRemove(struct hv_device *Device) return 0; } -int StorVscOnHostReset(struct hv_device *Device) +int stor_vsc_on_host_reset(struct hv_device *Device) { struct storvsc_device *storDevice; struct storvsc_request_extension *request; @@ -762,9 +762,9 @@ static void StorVscOnCleanup(struct hv_driver *Driver) } /* - * StorVscInitialize - Main entry point + * stor_vsc_initialize - Main entry point */ -int StorVscInitialize(struct hv_driver *Driver) +int stor_vsc_initialize(struct hv_driver *Driver) { struct storvsc_driver_object *storDriver; diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h index 46f031e..fbf5755 100644 --- a/drivers/staging/hv/storvsc_api.h +++ b/drivers/staging/hv/storvsc_api.h @@ -103,8 +103,8 @@ struct storvsc_device_info { }; /* Interface */ -int StorVscInitialize(struct hv_driver *driver); -int StorVscOnHostReset(struct hv_device *device); -int BlkVscInitialize(struct hv_driver *driver); +int stor_vsc_initialize(struct hv_driver *driver); +int stor_vsc_on_host_reset(struct hv_device *device); +int blk_vsc_initialize(struct hv_driver *driver); #endif /* _STORVSC_API_H_ */ diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c index 03695ce..0d96878 100644 --- a/drivers/staging/hv/storvsc_drv.c +++ b/drivers/staging/hv/storvsc_drv.c @@ -846,7 +846,7 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd) scmnd-device, device_ctx-device_obj); /* Invokes the vsc to reset the host/bus */ - ret = StorVscOnHostReset(device_ctx-device_obj); + ret = stor_vsc_on_host_reset(device_ctx-device_obj); if (ret != 0) return ret; @@ -941,7 +941,7 @@ static int __init storvsc_init(void) int ret; DPRINT_INFO(STORVSC_DRV, Storvsc initializing); - ret = storvsc_drv_init(StorVscInitialize); + ret = storvsc_drv_init(stor_vsc_initialize); return ret; } -- 1.6.0.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 7/8] staging: hv: Convert camel case function names in blkvsc.c to lowercase
From: Hank Janssen hjans...@microsoft.com Convert camel case function names in blkvsc.c to lowercase Signed-off-by: Abhishek Kane v-abk...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com --- drivers/staging/hv/blkvsc.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/hv/blkvsc.c b/drivers/staging/hv/blkvsc.c index 208492c..4f4a65c 100644 --- a/drivers/staging/hv/blkvsc.c +++ b/drivers/staging/hv/blkvsc.c @@ -35,7 +35,7 @@ static const struct hv_guid gBlkVscDeviceType = { } }; -static int BlkVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo) +static int blk_vsc_on_device_add(struct hv_device *Device, void *AdditionalInfo) { struct storvsc_device_info *deviceInfo; int ret = 0; @@ -93,7 +93,7 @@ int blk_vsc_initialize(struct hv_driver *Driver) storDriver-max_outstanding_req_per_channel); /* Setup the dispatch table */ - storDriver-base.OnDeviceAdd = BlkVscOnDeviceAdd; + storDriver-base.OnDeviceAdd = blk_vsc_on_device_add; storDriver-base.OnDeviceRemove = stor_vsc_on_device_remove; storDriver-base.OnCleanup = stor_vsc_on_cleanup; storDriver-on_io_request = stor_vsc_on_io_request; -- 1.6.0.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 8/8] staging: hv: Convert camel case local variables in blkvsc.c to lowercase
From: Hank Janssen hjans...@microsoft.com Convert camel case local variables in blkvsc.c to lowercase Signed-off-by: Abhishek Kane v-abk...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com --- drivers/staging/hv/blkvsc.c | 52 +- 1 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/staging/hv/blkvsc.c b/drivers/staging/hv/blkvsc.c index 4f4a65c..bc16d91 100644 --- a/drivers/staging/hv/blkvsc.c +++ b/drivers/staging/hv/blkvsc.c @@ -25,24 +25,24 @@ #include osd.h #include storvsc.c -static const char *gBlkDriverName = blkvsc; +static const char *g_blk_driver_name = blkvsc; /* {32412632-86cb-44a2-9b5c-50d1417354f5} */ -static const struct hv_guid gBlkVscDeviceType = { +static const struct hv_guid g_blk_device_type = { .data = { 0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5 } }; -static int blk_vsc_on_device_add(struct hv_device *Device, void *AdditionalInfo) +static int blk_vsc_on_device_add(struct hv_device *device, void *additional_info) { - struct storvsc_device_info *deviceInfo; + struct storvsc_device_info *device_info; int ret = 0; - deviceInfo = (struct storvsc_device_info *)AdditionalInfo; + device_info = (struct storvsc_device_info *)additional_info; - ret = stor_vsc_on_device_add(Device, AdditionalInfo); + ret = stor_vsc_on_device_add(device, additional_info); if (ret != 0) return ret; @@ -51,31 +51,31 @@ static int blk_vsc_on_device_add(struct hv_device *Device, void *AdditionalInfo) * id. For IDE devices, the device instance id is formatted as * bus id * - device id - 8899 - . */ - deviceInfo-path_id = Device-deviceInstance.data[3] 24 | -Device-deviceInstance.data[2] 16 | -Device-deviceInstance.data[1] 8 | -Device-deviceInstance.data[0]; + device_info-path_id = device-deviceInstance.data[3] 24 | +device-deviceInstance.data[2] 16 | +device-deviceInstance.data[1] 8 | +device-deviceInstance.data[0]; - deviceInfo-target_id = Device-deviceInstance.data[5] 8 | - Device-deviceInstance.data[4]; + device_info-target_id = device-deviceInstance.data[5] 8 | + device-deviceInstance.data[4]; return ret; } -int blk_vsc_initialize(struct hv_driver *Driver) +int blk_vsc_initialize(struct hv_driver *driver) { - struct storvsc_driver_object *storDriver; + struct storvsc_driver_object *stor_driver; int ret = 0; - storDriver = (struct storvsc_driver_object *)Driver; + stor_driver = (struct storvsc_driver_object *)driver; /* Make sure we are at least 2 pages since 1 page is used for control */ - /* ASSERT(storDriver-RingBufferSize = (PAGE_SIZE 1)); */ + /* ASSERT(stor_driver-RingBufferSize = (PAGE_SIZE 1)); */ - Driver-name = gBlkDriverName; - memcpy(Driver-deviceType, gBlkVscDeviceType, sizeof(struct hv_guid)); + driver-name = g_blk_driver_name; + memcpy(driver-deviceType, g_blk_device_type, sizeof(struct hv_guid)); - storDriver-request_ext_size = sizeof(struct storvsc_request_extension); + stor_driver-request_ext_size = sizeof(struct storvsc_request_extension); /* * Divide the ring buffer data size (which is 1 page less than the ring @@ -83,20 +83,20 @@ int blk_vsc_initialize(struct hv_driver *Driver) * by the max request size (which is * vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64) */ - storDriver-max_outstanding_req_per_channel = - ((storDriver-ring_buffer_size - PAGE_SIZE) / + stor_driver-max_outstanding_req_per_channel = + ((stor_driver-ring_buffer_size - PAGE_SIZE) / ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + sizeof(struct vstor_packet) + sizeof(u64), sizeof(u64))); DPRINT_INFO(BLKVSC, max io outstd %u, - storDriver-max_outstanding_req_per_channel); + stor_driver-max_outstanding_req_per_channel); /* Setup the dispatch table */ - storDriver-base.OnDeviceAdd = blk_vsc_on_device_add; - storDriver-base.OnDeviceRemove = stor_vsc_on_device_remove; - storDriver-base.OnCleanup = stor_vsc_on_cleanup; - storDriver-on_io_request = stor_vsc_on_io_request; + stor_driver-base.OnDeviceAdd = blk_vsc_on_device_add; + stor_driver-base.OnDeviceRemove = stor_vsc_on_device_remove; + stor_driver-base.OnCleanup = stor_vsc_on_cleanup
[PATCH 1/8] staging: hv: Convert camel case struct fields in vstorage.h to lowercase
From: Hank Janssen hjans...@microsoft.com Convert camel case struct fields in vstorage.h to lowercase Signed-off-by: Abhishek Kane v-abk...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com --- drivers/staging/hv/storvsc.c | 133 + drivers/staging/hv/vstorage.h | 106 2 files changed, 120 insertions(+), 119 deletions(-) diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c index 525c8ee..96b4ed9 100644 --- a/drivers/staging/hv/storvsc.c +++ b/drivers/staging/hv/storvsc.c @@ -204,8 +204,8 @@ static int StorVscChannelInit(struct hv_device *Device) goto nomem; } - vstorPacket-Operation = VStorOperationBeginInitialization; - vstorPacket-Flags = REQUEST_COMPLETION_FLAG; + vstorPacket-operation = VSTOR_OPERATION_BEGIN_INITIALIZATION; + vstorPacket-flags = REQUEST_COMPLETION_FLAG; /*SpinlockAcquire(gDriverExt.packetListLock); INSERT_TAIL_LIST(gDriverExt.packetList, packet-listEntry.entry); @@ -226,11 +226,11 @@ static int StorVscChannelInit(struct hv_device *Device) osd_waitevent_wait(request-WaitEvent); - if (vstorPacket-Operation != VStorOperationCompleteIo || - vstorPacket-Status != 0) { + if (vstorPacket-operation != VSTOR_OPERATION_COMPLETE_IO || + vstorPacket-status != 0) { DPRINT_ERR(STORVSC, BEGIN_INITIALIZATION_OPERATION failed (op %d status 0x%x), - vstorPacket-Operation, vstorPacket-Status); + vstorPacket-operation, vstorPacket-status); goto Cleanup; } @@ -238,11 +238,11 @@ static int StorVscChannelInit(struct hv_device *Device) /* reuse the packet for version range supported */ memset(vstorPacket, 0, sizeof(struct vstor_packet)); - vstorPacket-Operation = VStorOperationQueryProtocolVersion; - vstorPacket-Flags = REQUEST_COMPLETION_FLAG; + vstorPacket-operation = VSTOR_OPERATION_QUERY_PROTOCOL_VERSION; + vstorPacket-flags = REQUEST_COMPLETION_FLAG; - vstorPacket-Version.MajorMinor = VMSTOR_PROTOCOL_VERSION_CURRENT; - FILL_VMSTOR_REVISION(vstorPacket-Version.Revision); + vstorPacket-version.major_minor = VMSTOR_PROTOCOL_VERSION_CURRENT; + FILL_VMSTOR_REVISION(vstorPacket-version.revision); ret = vmbus_sendpacket(Device-channel, vstorPacket, sizeof(struct vstor_packet), @@ -258,11 +258,11 @@ static int StorVscChannelInit(struct hv_device *Device) osd_waitevent_wait(request-WaitEvent); /* TODO: Check returned version */ - if (vstorPacket-Operation != VStorOperationCompleteIo || - vstorPacket-Status != 0) { + if (vstorPacket-operation != VSTOR_OPERATION_COMPLETE_IO || + vstorPacket-status != 0) { DPRINT_ERR(STORVSC, QUERY_PROTOCOL_VERSION_OPERATION failed (op %d status 0x%x), - vstorPacket-Operation, vstorPacket-Status); + vstorPacket-operation, vstorPacket-status); goto Cleanup; } @@ -270,9 +270,9 @@ static int StorVscChannelInit(struct hv_device *Device) DPRINT_INFO(STORVSC, QUERY_PROPERTIES_OPERATION...); memset(vstorPacket, 0, sizeof(struct vstor_packet)); - vstorPacket-Operation = VStorOperationQueryProperties; - vstorPacket-Flags = REQUEST_COMPLETION_FLAG; - vstorPacket-StorageChannelProperties.PortNumber = + vstorPacket-operation = VSTOR_OPERATION_QUERY_PROPERTIES; + vstorPacket-flags = REQUEST_COMPLETION_FLAG; + vstorPacket-storage_channel_properties.port_number = storDevice-PortNumber; ret = vmbus_sendpacket(Device-channel, vstorPacket, @@ -290,26 +290,27 @@ static int StorVscChannelInit(struct hv_device *Device) osd_waitevent_wait(request-WaitEvent); /* TODO: Check returned version */ - if (vstorPacket-Operation != VStorOperationCompleteIo || - vstorPacket-Status != 0) { + if (vstorPacket-operation != VSTOR_OPERATION_COMPLETE_IO || + vstorPacket-status != 0) { DPRINT_ERR(STORVSC, QUERY_PROPERTIES_OPERATION failed (op %d status 0x%x), - vstorPacket-Operation, vstorPacket-Status); + vstorPacket-operation, vstorPacket-status); goto Cleanup; } - storDevice-PathId = vstorPacket-StorageChannelProperties.PathId; - storDevice-TargetId = vstorPacket-StorageChannelProperties.TargetId; + storDevice-PathId = vstorPacket-storage_channel_properties.path_id; + storDevice-TargetId + = vstorPacket-storage_channel_properties.target_id
[PATCH 6/8] staging: hv: Convert camel case local variables in storvsc.c to lowercase
From: Hank Janssen hjans...@microsoft.com Convert camel case local variables in storvsc.c to lowercase Signed-off-by: Abhishek Kane v-abk...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com --- drivers/staging/hv/storvsc.c | 496 +- 1 files changed, 249 insertions(+), 247 deletions(-) diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c index 6643038..9295113 100644 --- a/drivers/staging/hv/storvsc.c +++ b/drivers/staging/hv/storvsc.c @@ -50,7 +50,7 @@ struct storvsc_device { /* 0 indicates the device is being destroyed */ atomic_t ref_count; - atomic_t num_outstanding_requests; + atomic_t num_outstanding_req; /* * Each unique Port/Path/Target represents 1 channel ie scsi @@ -81,119 +81,119 @@ static const struct hv_guid gStorVscDeviceType = { }; -static inline struct storvsc_device *alloc_stor_device(struct hv_device *Device) +static inline struct storvsc_device *alloc_stor_device(struct hv_device *device) { - struct storvsc_device *storDevice; + struct storvsc_device *stor_device; - storDevice = kzalloc(sizeof(struct storvsc_device), GFP_KERNEL); - if (!storDevice) + stor_device = kzalloc(sizeof(struct storvsc_device), GFP_KERNEL); + if (!stor_device) return NULL; /* Set to 2 to allow both inbound and outbound traffics */ /* (ie get_stor_device() and must_get_stor_device()) to proceed. */ - atomic_cmpxchg(storDevice-ref_count, 0, 2); + atomic_cmpxchg(stor_device-ref_count, 0, 2); - storDevice-device = Device; - Device-Extension = storDevice; + stor_device-device = device; + device-Extension = stor_device; - return storDevice; + return stor_device; } -static inline void free_stor_device(struct storvsc_device *Device) +static inline void free_stor_device(struct storvsc_device *device) { - /* ASSERT(atomic_read(Device-ref_count) == 0); */ - kfree(Device); + /* ASSERT(atomic_read(device-ref_count) == 0); */ + kfree(device); } /* Get the stordevice object iff exists and its refcount 1 */ -static inline struct storvsc_device *get_stor_device(struct hv_device *Device) +static inline struct storvsc_device *get_stor_device(struct hv_device *device) { - struct storvsc_device *storDevice; + struct storvsc_device *stor_device; - storDevice = (struct storvsc_device *)Device-Extension; - if (storDevice atomic_read(storDevice-ref_count) 1) - atomic_inc(storDevice-ref_count); + stor_device = (struct storvsc_device *)device-Extension; + if (stor_device atomic_read(stor_device-ref_count) 1) + atomic_inc(stor_device-ref_count); else - storDevice = NULL; + stor_device = NULL; - return storDevice; + return stor_device; } /* Get the stordevice object iff exists and its refcount 0 */ static inline struct storvsc_device *must_get_stor_device( - struct hv_device *Device) + struct hv_device *device) { - struct storvsc_device *storDevice; + struct storvsc_device *stor_device; - storDevice = (struct storvsc_device *)Device-Extension; - if (storDevice atomic_read(storDevice-ref_count)) - atomic_inc(storDevice-ref_count); + stor_device = (struct storvsc_device *)device-Extension; + if (stor_device atomic_read(stor_device-ref_count)) + atomic_inc(stor_device-ref_count); else - storDevice = NULL; + stor_device = NULL; - return storDevice; + return stor_device; } -static inline void put_stor_device(struct hv_device *Device) +static inline void put_stor_device(struct hv_device *device) { - struct storvsc_device *storDevice; + struct storvsc_device *stor_device; - storDevice = (struct storvsc_device *)Device-Extension; - /* ASSERT(storDevice); */ + stor_device = (struct storvsc_device *)device-Extension; + /* ASSERT(stor_device); */ - atomic_dec(storDevice-ref_count); - /* ASSERT(atomic_read(storDevice-ref_count)); */ + atomic_dec(stor_device-ref_count); + /* ASSERT(atomic_read(stor_device-ref_count)); */ } /* Drop ref count to 1 to effectively disable get_stor_device() */ static inline struct storvsc_device *release_stor_device( - struct hv_device *Device) + struct hv_device *device) { - struct storvsc_device *storDevice; + struct storvsc_device *stor_device; - storDevice = (struct storvsc_device *)Device-Extension; - /* ASSERT(storDevice); */ + stor_device = (struct storvsc_device *)device-Extension
[PATCH 5/8] staging: hv: Convert camel case function names in storvsc.c to lowercase
From: Hank Janssen hjans...@microsoft.com Convert camel case function names in storvsc.c to lowercase Signed-off-by: Abhishek Kane v-abk...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com --- drivers/staging/hv/blkvsc.c |8 ++-- drivers/staging/hv/storvsc.c | 91 + 2 files changed, 51 insertions(+), 48 deletions(-) diff --git a/drivers/staging/hv/blkvsc.c b/drivers/staging/hv/blkvsc.c index e62c922..208492c 100644 --- a/drivers/staging/hv/blkvsc.c +++ b/drivers/staging/hv/blkvsc.c @@ -42,7 +42,7 @@ static int BlkVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo) deviceInfo = (struct storvsc_device_info *)AdditionalInfo; - ret = StorVscOnDeviceAdd(Device, AdditionalInfo); + ret = stor_vsc_on_device_add(Device, AdditionalInfo); if (ret != 0) return ret; @@ -94,9 +94,9 @@ int blk_vsc_initialize(struct hv_driver *Driver) /* Setup the dispatch table */ storDriver-base.OnDeviceAdd = BlkVscOnDeviceAdd; - storDriver-base.OnDeviceRemove = StorVscOnDeviceRemove; - storDriver-base.OnCleanup = StorVscOnCleanup; - storDriver-on_io_request = StorVscOnIORequest; + storDriver-base.OnDeviceRemove = stor_vsc_on_device_remove; + storDriver-base.OnCleanup = stor_vsc_on_cleanup; + storDriver-on_io_request = stor_vsc_on_io_request; return ret; } diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c index 3b6e63a..6643038 100644 --- a/drivers/staging/hv/storvsc.c +++ b/drivers/staging/hv/storvsc.c @@ -81,7 +81,7 @@ static const struct hv_guid gStorVscDeviceType = { }; -static inline struct storvsc_device *AllocStorDevice(struct hv_device *Device) +static inline struct storvsc_device *alloc_stor_device(struct hv_device *Device) { struct storvsc_device *storDevice; @@ -99,14 +99,14 @@ static inline struct storvsc_device *AllocStorDevice(struct hv_device *Device) return storDevice; } -static inline void FreeStorDevice(struct storvsc_device *Device) +static inline void free_stor_device(struct storvsc_device *Device) { /* ASSERT(atomic_read(Device-ref_count) == 0); */ kfree(Device); } /* Get the stordevice object iff exists and its refcount 1 */ -static inline struct storvsc_device *GetStorDevice(struct hv_device *Device) +static inline struct storvsc_device *get_stor_device(struct hv_device *Device) { struct storvsc_device *storDevice; @@ -120,7 +120,8 @@ static inline struct storvsc_device *GetStorDevice(struct hv_device *Device) } /* Get the stordevice object iff exists and its refcount 0 */ -static inline struct storvsc_device *MustGetStorDevice(struct hv_device *Device) +static inline struct storvsc_device *must_get_stor_device( + struct hv_device *Device) { struct storvsc_device *storDevice; @@ -133,7 +134,7 @@ static inline struct storvsc_device *MustGetStorDevice(struct hv_device *Device) return storDevice; } -static inline void PutStorDevice(struct hv_device *Device) +static inline void put_stor_device(struct hv_device *Device) { struct storvsc_device *storDevice; @@ -144,8 +145,9 @@ static inline void PutStorDevice(struct hv_device *Device) /* ASSERT(atomic_read(storDevice-ref_count)); */ } -/* Drop ref count to 1 to effectively disable GetStorDevice() */ -static inline struct storvsc_device *ReleaseStorDevice(struct hv_device *Device) +/* Drop ref count to 1 to effectively disable get_stor_device() */ +static inline struct storvsc_device *release_stor_device( + struct hv_device *Device) { struct storvsc_device *storDevice; @@ -160,7 +162,7 @@ static inline struct storvsc_device *ReleaseStorDevice(struct hv_device *Device) } /* Drop ref count to 0. No one can use StorDevice object. */ -static inline struct storvsc_device *FinalReleaseStorDevice( +static inline struct storvsc_device *final_release_stor_device( struct hv_device *Device) { struct storvsc_device *storDevice; @@ -176,14 +178,14 @@ static inline struct storvsc_device *FinalReleaseStorDevice( return storDevice; } -static int StorVscChannelInit(struct hv_device *Device) +static int stor_vsc_channel_init(struct hv_device *Device) { struct storvsc_device *storDevice; struct storvsc_request_extension *request; struct vstor_packet *vstorPacket; int ret; - storDevice = GetStorDevice(Device); + storDevice = get_stor_device(Device); if (!storDevice) { DPRINT_ERR(STORVSC, unable to get stor device... device being destroyed?); @@ -340,18 +342,18 @@ Cleanup: kfree(request-wait_event); request-wait_event = NULL; nomem: - PutStorDevice(Device
[PATCH 2/8] staging: hv: Convert camel case struct fields in storvsc_api.h to lowercase
From: Hank Janssen hjans...@microsoft.com Convert camel case struct fields in vstorage.h to lowercase Signed-off-by: Abhishek Kane v-abk...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com --- drivers/staging/hv/blkvsc.c | 20 +++--- drivers/staging/hv/blkvsc_drv.c | 115 -- drivers/staging/hv/storvsc.c | 67 +++--- drivers/staging/hv/storvsc_api.h | 50 drivers/staging/hv/storvsc_drv.c | 91 +++--- 5 files changed, 175 insertions(+), 168 deletions(-) diff --git a/drivers/staging/hv/blkvsc.c b/drivers/staging/hv/blkvsc.c index d5b0abd..9ac04c3 100644 --- a/drivers/staging/hv/blkvsc.c +++ b/drivers/staging/hv/blkvsc.c @@ -51,12 +51,12 @@ static int BlkVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo) * id. For IDE devices, the device instance id is formatted as * bus id * - device id - 8899 - . */ - deviceInfo-PathId = Device-deviceInstance.data[3] 24 | + deviceInfo-path_id = Device-deviceInstance.data[3] 24 | Device-deviceInstance.data[2] 16 | Device-deviceInstance.data[1] 8 | Device-deviceInstance.data[0]; - deviceInfo-TargetId = Device-deviceInstance.data[5] 8 | + deviceInfo-target_id = Device-deviceInstance.data[5] 8 | Device-deviceInstance.data[4]; return ret; @@ -75,7 +75,7 @@ int BlkVscInitialize(struct hv_driver *Driver) Driver-name = gBlkDriverName; memcpy(Driver-deviceType, gBlkVscDeviceType, sizeof(struct hv_guid)); - storDriver-RequestExtSize = sizeof(struct storvsc_request_extension); + storDriver-request_ext_size = sizeof(struct storvsc_request_extension); /* * Divide the ring buffer data size (which is 1 page less than the ring @@ -83,20 +83,20 @@ int BlkVscInitialize(struct hv_driver *Driver) * by the max request size (which is * vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64) */ - storDriver-MaxOutstandingRequestsPerChannel = - ((storDriver-RingBufferSize - PAGE_SIZE) / + storDriver-max_outstanding_req_per_channel = + ((storDriver-ring_buffer_size - PAGE_SIZE) / ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + sizeof(struct vstor_packet) + sizeof(u64), sizeof(u64))); DPRINT_INFO(BLKVSC, max io outstd %u, - storDriver-MaxOutstandingRequestsPerChannel); + storDriver-max_outstanding_req_per_channel); /* Setup the dispatch table */ - storDriver-Base.OnDeviceAdd = BlkVscOnDeviceAdd; - storDriver-Base.OnDeviceRemove = StorVscOnDeviceRemove; - storDriver-Base.OnCleanup = StorVscOnCleanup; - storDriver-OnIORequest = StorVscOnIORequest; + storDriver-base.OnDeviceAdd = BlkVscOnDeviceAdd; + storDriver-base.OnDeviceRemove = StorVscOnDeviceRemove; + storDriver-base.OnCleanup = StorVscOnCleanup; + storDriver-on_io_request = StorVscOnIORequest; return ret; } diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c index 3f81ca5..d65d69e 100644 --- a/drivers/staging/hv/blkvsc_drv.c +++ b/drivers/staging/hv/blkvsc_drv.c @@ -177,13 +177,13 @@ static int blkvsc_drv_init(int (*drv_init)(struct hv_driver *drv)) struct driver_context *drv_ctx = g_blkvsc_drv.drv_ctx; int ret; - storvsc_drv_obj-RingBufferSize = blkvsc_ringbuffer_size; + storvsc_drv_obj-ring_buffer_size = blkvsc_ringbuffer_size; /* Callback to client driver to complete the initialization */ - drv_init(storvsc_drv_obj-Base); + drv_init(storvsc_drv_obj-base); - drv_ctx-driver.name = storvsc_drv_obj-Base.name; - memcpy(drv_ctx-class_id, storvsc_drv_obj-Base.deviceType, + drv_ctx-driver.name = storvsc_drv_obj-base.name; + memcpy(drv_ctx-class_id, storvsc_drv_obj-base.deviceType, sizeof(struct hv_guid)); drv_ctx-probe = blkvsc_probe; @@ -230,8 +230,8 @@ static void blkvsc_drv_exit(void) device_unregister(current_dev); } - if (storvsc_drv_obj-Base.OnCleanup) - storvsc_drv_obj-Base.OnCleanup(storvsc_drv_obj-Base); + if (storvsc_drv_obj-base.OnCleanup) + storvsc_drv_obj-base.OnCleanup(storvsc_drv_obj-base); vmbus_child_driver_unregister(drv_ctx); @@ -262,7 +262,7 @@ static int blkvsc_probe(struct device *device) DPRINT_DBG(BLKVSC_DRV, blkvsc_probe - enter); - if (!storvsc_drv_obj-Base.OnDeviceAdd) { + if (!storvsc_drv_obj-base.OnDeviceAdd) { DPRINT_ERR(BLKVSC_DRV, OnDeviceAdd() not set); ret = -1
[PATCH 1/1] staging: hv: Doubled ringbuffer size for Hyper-v network driver
From: Hank Janssen hjans...@microsoft.com Double the default network ringsize buffer for Hyper-V network driver. In very heavily loaded systems the there is a chance you run out of ringbuffer space and error out. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com --- drivers/staging/hv/netvsc_drv.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c index 56e1157..45e082a 100644 --- a/drivers/staging/hv/netvsc_drv.c +++ b/drivers/staging/hv/netvsc_drv.c @@ -59,7 +59,7 @@ struct netvsc_driver_context { /* Need this many pages to handle worst case fragmented packet */ #define PACKET_PAGES_HIWATER (MAX_SKB_FRAGS + 2) -static int ring_size = roundup_pow_of_two(2*MAX_SKB_FRAGS+1); +static int ring_size = 128; module_param(ring_size, int, S_IRUGO); MODULE_PARM_DESC(ring_size, Ring buffer size (# of pages)); -- 1.6.0.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 1/1] staging: hv: Rename camel cased functions in channel.c to lowercase
From: Haiyang Zhang haiya...@microsoft.com Rename camel cased functions in channel.c to lowercase Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com --- drivers/staging/hv/channel.c | 102 drivers/staging/hv/channel.h | 94 +++--- drivers/staging/hv/channel_interface.c | 20 +++--- drivers/staging/hv/channel_mgmt.c |8 +- drivers/staging/hv/connection.c|4 +- drivers/staging/hv/hv_utils.c | 12 ++-- 6 files changed, 120 insertions(+), 120 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 1037488..39b8fd3 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -27,13 +27,13 @@ #include vmbus_private.h /* Internal routines */ -static int VmbusChannelCreateGpadlHeader( +static int create_gpadl_header( void *kbuffer, /* must be phys and virt contiguous */ u32 size, /* page-size multiple */ struct vmbus_channel_msginfo **msginfo, u32 *messagecount); -static void DumpVmbusChannel(struct vmbus_channel *channel); -static void VmbusChannelSetEvent(struct vmbus_channel *channel); +static void dump_vmbus_channel(struct vmbus_channel *channel); +static void vmbus_setevent(struct vmbus_channel *channel); #if 0 @@ -67,10 +67,10 @@ static void DumpMonitorPage(struct hv_monitor_page *MonitorPage) #endif /* - * VmbusChannelSetEvent - Trigger an event notification on the specified + * vmbus_setevent- Trigger an event notification on the specified * channel. */ -static void VmbusChannelSetEvent(struct vmbus_channel *channel) +static void vmbus_setevent(struct vmbus_channel *channel) { struct hv_monitor_page *monitorpage; @@ -115,9 +115,9 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel) #endif /* - * VmbusChannelGetDebugInfo -Retrieve various channel debug info + * vmbus_get_debug_info -Retrieve various channel debug info */ -void VmbusChannelGetDebugInfo(struct vmbus_channel *channel, +void vmbus_get_debug_info(struct vmbus_channel *channel, struct vmbus_channel_debug_info *debuginfo) { struct hv_monitor_page *monitorpage; @@ -160,9 +160,9 @@ void VmbusChannelGetDebugInfo(struct vmbus_channel *channel, } /* - * VmbusChannelOpen - Open the specified channel. + * vmbus_open - Open the specified channel. */ -int VmbusChannelOpen(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, +int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, u32 recv_ringbuffer_size, void *userdata, u32 userdatalen, void (*onchannelcallback)(void *context), void *context) { @@ -212,7 +212,7 @@ int VmbusChannelOpen(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, newchannel-RingBufferGpadlHandle = 0; - ret = VmbusChannelEstablishGpadl(newchannel, + ret = vmbus_establish_gpadl(newchannel, newchannel-Outbound.RingBuffer, send_ringbuffer_size + recv_ringbuffer_size, @@ -307,10 +307,10 @@ errorout: } /* - * DumpGpadlBody - Dump the gpadl body message to the console for + * dump_gpadl_body - Dump the gpadl body message to the console for * debugging purposes. */ -static void DumpGpadlBody(struct vmbus_channel_gpadl_body *gpadl, u32 len) +static void dump_gpadl_body(struct vmbus_channel_gpadl_body *gpadl, u32 len) { int i; int pfncount; @@ -325,10 +325,10 @@ static void DumpGpadlBody(struct vmbus_channel_gpadl_body *gpadl, u32 len) } /* - * DumpGpadlHeader - Dump the gpadl header message to the console for + * dump_gpadl_header - Dump the gpadl header message to the console for * debugging purposes. */ -static void DumpGpadlHeader(struct vmbus_channel_gpadl_header *gpadl) +static void dump_gpadl_header(struct vmbus_channel_gpadl_header *gpadl) { int i, j; int pagecount; @@ -351,9 +351,9 @@ static void DumpGpadlHeader(struct vmbus_channel_gpadl_header *gpadl) } /* - * VmbusChannelCreateGpadlHeader - Creates a gpadl for the specified buffer + * create_gpadl_header - Creates a gpadl for the specified buffer */ -static int VmbusChannelCreateGpadlHeader(void *kbuffer, u32 size, +static int create_gpadl_header(void *kbuffer, u32 size, struct vmbus_channel_msginfo **msginfo, u32 *messagecount) { @@ -479,14 +479,14 @@ nomem: } /* - * VmbusChannelEstablishGpadl - Estabish a GPADL for the specified buffer + * vmbus_establish_gpadl - Estabish a GPADL for the specified buffer * * @channel: a channel * @kbuffer: from kmalloc * @size: page-size multiple * @gpadl_handle: some funky thing */ -int VmbusChannelEstablishGpadl
[PATCH 1/1] staging: hv: Remove camel case variables in channel.c
From: Haiyang Zhang haiya...@microsoft.com Rename camel case variables in channel.c and changed them to lowercase. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com --- drivers/staging/hv/channel.c | 767 +- 1 files changed, 387 insertions(+), 380 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 37b7b4c..1037488 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -28,10 +28,10 @@ /* Internal routines */ static int VmbusChannelCreateGpadlHeader( - void *Kbuffer, /* must be phys and virt contiguous */ - u32 Size, /* page-size multiple */ - struct vmbus_channel_msginfo **msgInfo, - u32 *MessageCount); + void *kbuffer, /* must be phys and virt contiguous */ + u32 size, /* page-size multiple */ + struct vmbus_channel_msginfo **msginfo, + u32 *messagecount); static void DumpVmbusChannel(struct vmbus_channel *channel); static void VmbusChannelSetEvent(struct vmbus_channel *channel); @@ -70,25 +70,25 @@ static void DumpMonitorPage(struct hv_monitor_page *MonitorPage) * VmbusChannelSetEvent - Trigger an event notification on the specified * channel. */ -static void VmbusChannelSetEvent(struct vmbus_channel *Channel) +static void VmbusChannelSetEvent(struct vmbus_channel *channel) { - struct hv_monitor_page *monitorPage; + struct hv_monitor_page *monitorpage; - if (Channel-OfferMsg.MonitorAllocated) { + if (channel-OfferMsg.MonitorAllocated) { /* Each u32 represents 32 channels */ - set_bit(Channel-OfferMsg.ChildRelId 31, + set_bit(channel-OfferMsg.ChildRelId 31, (unsigned long *) gVmbusConnection.SendInterruptPage + - (Channel-OfferMsg.ChildRelId 5)); + (channel-OfferMsg.ChildRelId 5)); - monitorPage = gVmbusConnection.MonitorPages; - monitorPage++; /* Get the child to parent monitor page */ + monitorpage = gVmbusConnection.MonitorPages; + monitorpage++; /* Get the child to parent monitor page */ - set_bit(Channel-MonitorBit, - (unsigned long *)monitorPage-TriggerGroup - [Channel-MonitorGroup].Pending); + set_bit(channel-MonitorBit, + (unsigned long *)monitorpage-TriggerGroup + [channel-MonitorGroup].Pending); } else { - VmbusSetEvent(Channel-OfferMsg.ChildRelId); + VmbusSetEvent(channel-OfferMsg.ChildRelId); } } @@ -117,54 +117,54 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel) /* * VmbusChannelGetDebugInfo -Retrieve various channel debug info */ -void VmbusChannelGetDebugInfo(struct vmbus_channel *Channel, - struct vmbus_channel_debug_info *DebugInfo) +void VmbusChannelGetDebugInfo(struct vmbus_channel *channel, + struct vmbus_channel_debug_info *debuginfo) { - struct hv_monitor_page *monitorPage; - u8 monitorGroup = (u8)Channel-OfferMsg.MonitorId / 32; - u8 monitorOffset = (u8)Channel-OfferMsg.MonitorId % 32; + struct hv_monitor_page *monitorpage; + u8 monitor_group = (u8)channel-OfferMsg.MonitorId / 32; + u8 monitor_offset = (u8)channel-OfferMsg.MonitorId % 32; /* u32 monitorBit = 1 monitorOffset; */ - DebugInfo-RelId = Channel-OfferMsg.ChildRelId; - DebugInfo-State = Channel-State; - memcpy(DebugInfo-InterfaceType, - Channel-OfferMsg.Offer.InterfaceType, sizeof(struct hv_guid)); - memcpy(DebugInfo-InterfaceInstance, - Channel-OfferMsg.Offer.InterfaceInstance, + debuginfo-RelId = channel-OfferMsg.ChildRelId; + debuginfo-State = channel-State; + memcpy(debuginfo-InterfaceType, + channel-OfferMsg.Offer.InterfaceType, sizeof(struct hv_guid)); + memcpy(debuginfo-InterfaceInstance, + channel-OfferMsg.Offer.InterfaceInstance, sizeof(struct hv_guid)); - monitorPage = (struct hv_monitor_page *)gVmbusConnection.MonitorPages; + monitorpage = (struct hv_monitor_page *)gVmbusConnection.MonitorPages; - DebugInfo-MonitorId = Channel-OfferMsg.MonitorId; + debuginfo-MonitorId = channel-OfferMsg.MonitorId; - DebugInfo-ServerMonitorPending = - monitorPage-TriggerGroup[monitorGroup].Pending; - DebugInfo-ServerMonitorLatency = - monitorPage-Latency[monitorGroup][monitorOffset]; - DebugInfo-ServerMonitorConnectionId = - monitorPage-Parameter[monitorGroup] - [monitorOffset].ConnectionId.u.Id
[PATCH 2/5] staging: hv: Fixed lockup problem with bounce_buffer scatter list - Cleaned up
Fixed lockup problem with bounce_buffer scatter list which caused crashes in heavy loads. And minor code indentation cleanup in effected area. Removed whitespace and noted minor indentation changes in description as pointed out by Joe Perches. (Thanks for reviewing Joe) Signed-off-by:Hank Janssen hjans...@microsoft.com Signed-off-by:Haiyang Zhang haiya...@microsoft.com --- drivers/staging/hv/storvsc_drv.c |9 ++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c index 3b9ccb0..169d701 100644 --- a/drivers/staging/hv/storvsc_drv.c +++ b/drivers/staging/hv/storvsc_drv.c @@ -615,6 +615,7 @@ static int storvsc_queuecommand(struct scsi_cmnd *scmnd, unsigned int request_size = 0; int i; struct scatterlist *sgl; + unsigned int sg_count = 0; DPRINT_DBG(STORVSC_DRV, scmnd %p dir %d, use_sg %d buf %p len %d queue depth %d tagged %d, scmnd, scmnd-sc_data_direction, @@ -697,6 +698,7 @@ static int storvsc_queuecommand(struct scsi_cmnd *scmnd, request-DataBuffer.Length = scsi_bufflen(scmnd); if (scsi_sg_count(scmnd)) { sgl = (struct scatterlist *)scsi_sglist(scmnd); + sg_count = scsi_sg_count(scmnd); /* check if we need to bounce the sgl */ if (do_bounce_buffer(sgl, scsi_sg_count(scmnd)) != -1) { @@ -731,15 +733,16 @@ static int storvsc_queuecommand(struct scsi_cmnd *scmnd, scsi_sg_count(scmnd)); sgl = cmd_request-bounce_sgl; + sg_count = cmd_request-bounce_sgl_count; } request-DataBuffer.Offset = sgl[0].offset; - for (i = 0; i scsi_sg_count(scmnd); i++) { + for (i = 0; i sg_count; i++) { DPRINT_DBG(STORVSC_DRV, sgl[%d] len %d offset %d\n, i, sgl[i].length, sgl[i].offset); - request-DataBuffer.PfnArray[i] = - page_to_pfn(sg_page((sgl[i]))); + request-DataBuffer.PfnArray[i] = + page_to_pfn(sg_page((sgl[i]))); } } else if (scsi_sglist(scmnd)) { /* ASSERT(scsi_bufflen(scmnd) = PAGE_SIZE); */ -- 1.6.0.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: [PATCH 5/5] staging: hv: Gracefully handle SCSI resets
From: Greg KH [mailto:g...@kroah.com] Sent: Monday, August 30, 2010 4:52 PM This patch is corrupted as well, something odd is going on in your email system :( care to resend it? Of course, I will resend these from my own account in a few minutes after I check them At least it will bypass lookout at that point :) Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 2/5] staging: hv: Fixed lockup problem with bounce_buffer scatter list - RESEND
(Send from a linux machine, not routed through exchange) Fixed lockup problem with bounce_buffer scatter list which caused crashes in heavy loads. Signed-off-by:Hank Janssen hjans...@microsoft.com Signed-off-by:Haiyang Zhang haiya...@microsoft.com --- drivers/staging/hv/storvsc_drv.c |9 ++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c index 3b9ccb0..169d701 100644 --- a/drivers/staging/hv/storvsc_drv.c +++ b/drivers/staging/hv/storvsc_drv.c @@ -615,6 +615,7 @@ static int storvsc_queuecommand(struct scsi_cmnd *scmnd, unsigned int request_size = 0; int i; struct scatterlist *sgl; + unsigned int sg_count = 0; DPRINT_DBG(STORVSC_DRV, scmnd %p dir %d, use_sg %d buf %p len %d queue depth %d tagged %d, scmnd, scmnd-sc_data_direction, @@ -697,6 +698,7 @@ static int storvsc_queuecommand(struct scsi_cmnd *scmnd, request-DataBuffer.Length = scsi_bufflen(scmnd); if (scsi_sg_count(scmnd)) { sgl = (struct scatterlist *)scsi_sglist(scmnd); + sg_count = scsi_sg_count(scmnd); /* check if we need to bounce the sgl */ if (do_bounce_buffer(sgl, scsi_sg_count(scmnd)) != -1) { @@ -731,15 +733,16 @@ static int storvsc_queuecommand(struct scsi_cmnd *scmnd, scsi_sg_count(scmnd)); sgl = cmd_request-bounce_sgl; + sg_count = cmd_request-bounce_sgl_count; } request-DataBuffer.Offset = sgl[0].offset; - for (i = 0; i scsi_sg_count(scmnd); i++) { + for (i = 0; i sg_count; i++) { DPRINT_DBG(STORVSC_DRV, sgl[%d] len %d offset %d\n, i, sgl[i].length, sgl[i].offset); - request-DataBuffer.PfnArray[i] = - page_to_pfn(sg_page((sgl[i]))); + request-DataBuffer.PfnArray[i] = + page_to_pfn(sg_page((sgl[i]))); } } else if (scsi_sglist(scmnd)) { /* ASSERT(scsi_bufflen(scmnd) = PAGE_SIZE); */ -- 1.6.0.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 5/5] staging: hv: Gracefully handle SCSI resets - RESEND
(Send from a linux machine, not routed through exchange) If we get a SCSI host bus reset we now gracefully handle it, and we take the device offline. This before sometimes caused hangs. Signed-off-by:Hank Janssen hjans...@microsoft.com Signed-off-by:Haiyang Zhang haiya...@microsoft.com --- drivers/staging/hv/storvsc.c | 36 +++- 1 files changed, 35 insertions(+), 1 deletions(-) diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c index 6bd2ff1..5f222cf 100644 --- a/drivers/staging/hv/storvsc.c +++ b/drivers/staging/hv/storvsc.c @@ -48,7 +48,9 @@ struct storvsc_device { /* 0 indicates the device is being destroyed */ atomic_t RefCount; - + + int reset; + spinlock_t lock; atomic_t NumOutstandingRequests; /* @@ -93,6 +95,9 @@ static inline struct storvsc_device *AllocStorDevice(struct hv_device *Device) atomic_cmpxchg(storDevice-RefCount, 0, 2); storDevice-Device = Device; + storDevice-reset = 0; + spin_lock_init(storDevice-lock); + Device-Extension = storDevice; return storDevice; @@ -101,6 +106,7 @@ static inline struct storvsc_device *AllocStorDevice(struct hv_device *Device) static inline void FreeStorDevice(struct storvsc_device *Device) { /* ASSERT(atomic_read(Device-RefCount) == 0); */ + /*kfree(Device-lock);*/ kfree(Device); } @@ -108,13 +114,24 @@ static inline void FreeStorDevice(struct storvsc_device *Device) static inline struct storvsc_device *GetStorDevice(struct hv_device *Device) { struct storvsc_device *storDevice; + unsigned long flags; storDevice = (struct storvsc_device *)Device-Extension; + + spin_lock_irqsave(storDevice-lock, flags); + + if (storDevice-reset == 1) { + spin_unlock_irqrestore(storDevice-lock, flags); + return NULL; + } + if (storDevice atomic_read(storDevice-RefCount) 1) atomic_inc(storDevice-RefCount); else storDevice = NULL; + spin_unlock_irqrestore(storDevice-lock, flags); + return storDevice; } @@ -122,13 +139,19 @@ static inline struct storvsc_device *GetStorDevice(struct hv_device *Device) static inline struct storvsc_device *MustGetStorDevice(struct hv_device *Device) { struct storvsc_device *storDevice; + unsigned long flags; storDevice = (struct storvsc_device *)Device-Extension; + + spin_lock_irqsave(storDevice-lock, flags); + if (storDevice atomic_read(storDevice-RefCount)) atomic_inc(storDevice-RefCount); else storDevice = NULL; + spin_unlock_irqrestore(storDevice-lock, flags); + return storDevice; } @@ -614,6 +637,7 @@ int StorVscOnHostReset(struct hv_device *Device) struct storvsc_device *storDevice; struct storvsc_request_extension *request; struct vstor_packet *vstorPacket; + unsigned long flags; int ret; DPRINT_INFO(STORVSC, resetting host adapter...); @@ -625,6 +649,16 @@ int StorVscOnHostReset(struct hv_device *Device) return -1; } + spin_lock_irqsave(storDevice-lock, flags); + storDevice-reset = 1; + spin_unlock_irqrestore(storDevice-lock, flags); + + /* +* Wait for traffic in transit to complete +*/ + while (atomic_read(storDevice-NumOutstandingRequests)) + udelay(1000); + request = storDevice-ResetRequest; vstorPacket = request-VStorPacket; -- 1.6.0.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
Re: [PATCH 2/5] staging: hv: Fixed lockup problem with bounce_buffer scatter list - RESEND
On 09/01/2010 09:38 AM, Joe Perches wrote: On Tue, 2010-08-31 at 11:13 -0700, Hank Janssen wrote: diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c [] -request-DataBuffer.PfnArray[i] = -page_to_pfn(sg_page((sgl[i]))); +request-DataBuffer.PfnArray[i] = +page_to_pfn(sg_page((sgl[i]))); I did a bit of a doubletake reading this last change. This isn't actually a part of your fix and it introduces a whitespace error. I will resubmit this patch and clean up the whitespace error. When change the code I normally also change the indentation to the correct format for that area of the code. That is how the whitespace snuck in there. Thanks, Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: hv block drivers
On Monday 30 August 2010 Arnd Bergmann wrote: On Monday 30 August 2010, Jeremy Fitzhardinge wrote: Have you investigated making virtio a scsi device? I doubt that there is much value in changing it now, and it's not something I'd be interested in working on. For the HyperV drivers, it probably makes sense because half of it is trying to look like SCSI anyway, while the other half is trying to look like ATA. For the ATA driver, the obvious choice would be to make it a libata backend, though my impression from a brief look at the driver was that it's better to copy some of the libata code and integrate it into the hv SCSI driver. Arnd, Thanks for following up! I was cleaning up some other part of the drivers (not related to IDE/SCSI) And on my todo list is to clean up the IDE/SCSI drivers. I will go through the libata code and see If there is anything in there that I can use to make these drivers somewhat saner. I am not sure if I can combine them into one yet, Hyper-V treats both drivers differently. And there Are some rumored changes to Hyper-V that would make these changes maybe even a bit more difficult. I will use this mailing list to bounce ideas off of. I still need to clean up your other suggestion as well, the static declarations :) For a more general question, When/if we make it out of staging, where should these drivers live? drivers/hyper-v or drivers/scsi and drivers/ide. Is there a standard that is being followed? Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 1/6] staging: hv: Fixed bounce kmap problem by using correct index
From: Hank Janssen hjans...@microsoft.com Fixed bounce offset kmap problem by using correct index Signed-off-by:Hank Janssen hjans...@microsoft.com Signed-off-by:Haiyang Zhang haiya...@microsoft.com --- drivers/staging/hv/storvsc_drv.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c index 075b61b..3b9ccb0 100644 --- a/drivers/staging/hv/storvsc_drv.c +++ b/drivers/staging/hv/storvsc_drv.c @@ -495,7 +495,7 @@ static unsigned int copy_to_bounce_buffer(struct scatterlist *orig_sgl, /* ASSERT(orig_sgl[i].offset + orig_sgl[i].length = PAGE_SIZE); */ - if (j == 0) + if (bounce_addr == 0) bounce_addr = (unsigned long)kmap_atomic(sg_page((bounce_sgl[j])), KM_IRQ0); while (srclen) { @@ -556,7 +556,7 @@ static unsigned int copy_from_bounce_buffer(struct scatterlist *orig_sgl, destlen = orig_sgl[i].length; /* ASSERT(orig_sgl[i].offset + orig_sgl[i].length = PAGE_SIZE); */ - if (j == 0) + if (bounce_addr == 0) bounce_addr = (unsigned long)kmap_atomic(sg_page((bounce_sgl[j])), KM_IRQ0); while (destlen) { -- 1.6.0.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 6/6] staging: hv: Gracefully handle SCSI resets
From: Hank Janssen hjans...@microsoft.com If we get a SCSI host bus reset we now gracefully handle it, and we take the device offline. This before sometimes caused hangs. Signed-off-by:Hank Janssen hjans...@microsoft.com Signed-off-by:Haiyang Zhang haiya...@microsoft.com --- drivers/staging/hv/storvsc.c | 36 +++- 1 files changed, 35 insertions(+), 1 deletions(-) diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c index 6bd2ff1..5f222cf 100644 --- a/drivers/staging/hv/storvsc.c +++ b/drivers/staging/hv/storvsc.c @@ -48,7 +48,9 @@ struct storvsc_device { /* 0 indicates the device is being destroyed */ atomic_t RefCount; - + + int reset; + spinlock_t lock; atomic_t NumOutstandingRequests; /* @@ -93,6 +95,9 @@ static inline struct storvsc_device *AllocStorDevice(struct hv_device *Device) atomic_cmpxchg(storDevice-RefCount, 0, 2); storDevice-Device = Device; + storDevice-reset = 0; + spin_lock_init(storDevice-lock); + Device-Extension = storDevice; return storDevice; @@ -101,6 +106,7 @@ static inline struct storvsc_device *AllocStorDevice(struct hv_device *Device) static inline void FreeStorDevice(struct storvsc_device *Device) { /* ASSERT(atomic_read(Device-RefCount) == 0); */ + /*kfree(Device-lock);*/ kfree(Device); } @@ -108,13 +114,24 @@ static inline void FreeStorDevice(struct storvsc_device *Device) static inline struct storvsc_device *GetStorDevice(struct hv_device *Device) { struct storvsc_device *storDevice; + unsigned long flags; storDevice = (struct storvsc_device *)Device-Extension; + + spin_lock_irqsave(storDevice-lock, flags); + + if (storDevice-reset == 1) { + spin_unlock_irqrestore(storDevice-lock, flags); + return NULL; + } + if (storDevice atomic_read(storDevice-RefCount) 1) atomic_inc(storDevice-RefCount); else storDevice = NULL; + spin_unlock_irqrestore(storDevice-lock, flags); + return storDevice; } @@ -122,13 +139,19 @@ static inline struct storvsc_device *GetStorDevice(struct hv_device *Device) static inline struct storvsc_device *MustGetStorDevice(struct hv_device *Device) { struct storvsc_device *storDevice; + unsigned long flags; storDevice = (struct storvsc_device *)Device-Extension; + + spin_lock_irqsave(storDevice-lock, flags); + if (storDevice atomic_read(storDevice-RefCount)) atomic_inc(storDevice-RefCount); else storDevice = NULL; + spin_unlock_irqrestore(storDevice-lock, flags); + return storDevice; } @@ -614,6 +637,7 @@ int StorVscOnHostReset(struct hv_device *Device) struct storvsc_device *storDevice; struct storvsc_request_extension *request; struct vstor_packet *vstorPacket; + unsigned long flags; int ret; DPRINT_INFO(STORVSC, resetting host adapter...); @@ -625,6 +649,16 @@ int StorVscOnHostReset(struct hv_device *Device) return -1; } + spin_lock_irqsave(storDevice-lock, flags); + storDevice-reset = 1; + spin_unlock_irqrestore(storDevice-lock, flags); + + /* +* Wait for traffic in transit to complete +*/ + while (atomic_read(storDevice-NumOutstandingRequests)) + udelay(1000); + request = storDevice-ResetRequest; vstorPacket = request-VStorPacket; -- 1.6.0.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 2/6] staging: hv: Fixed lockup problem with bounce_buffer scatter list
From: Hank Janssen hjans...@microsoft.com Fixed lockup problem with bounce_buffer scatter list which caused crashes in heavy loads. Signed-off-by:Hank Janssen hjans...@microsoft.com Signed-off-by:Haiyang Zhang haiya...@microsoft.com --- drivers/staging/hv/storvsc_drv.c |9 ++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c index 3b9ccb0..169d701 100644 --- a/drivers/staging/hv/storvsc_drv.c +++ b/drivers/staging/hv/storvsc_drv.c @@ -615,6 +615,7 @@ static int storvsc_queuecommand(struct scsi_cmnd *scmnd, unsigned int request_size = 0; int i; struct scatterlist *sgl; + unsigned int sg_count = 0; DPRINT_DBG(STORVSC_DRV, scmnd %p dir %d, use_sg %d buf %p len %d queue depth %d tagged %d, scmnd, scmnd-sc_data_direction, @@ -697,6 +698,7 @@ static int storvsc_queuecommand(struct scsi_cmnd *scmnd, request-DataBuffer.Length = scsi_bufflen(scmnd); if (scsi_sg_count(scmnd)) { sgl = (struct scatterlist *)scsi_sglist(scmnd); + sg_count = scsi_sg_count(scmnd); /* check if we need to bounce the sgl */ if (do_bounce_buffer(sgl, scsi_sg_count(scmnd)) != -1) { @@ -731,15 +733,16 @@ static int storvsc_queuecommand(struct scsi_cmnd *scmnd, scsi_sg_count(scmnd)); sgl = cmd_request-bounce_sgl; + sg_count = cmd_request-bounce_sgl_count; } request-DataBuffer.Offset = sgl[0].offset; - for (i = 0; i scsi_sg_count(scmnd); i++) { + for (i = 0; i sg_count; i++) { DPRINT_DBG(STORVSC_DRV, sgl[%d] len %d offset %d\n, i, sgl[i].length, sgl[i].offset); - request-DataBuffer.PfnArray[i] = - page_to_pfn(sg_page((sgl[i]))); + request-DataBuffer.PfnArray[i] = + page_to_pfn(sg_page((sgl[i]))); } } else if (scsi_sglist(scmnd)) { /* ASSERT(scsi_bufflen(scmnd) = PAGE_SIZE); */ -- 1.6.0.2 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: [PATCH 5/6] staging: hv: Increased storvsc ringbuffer and max_io_requests
And than Greg KH spoke these words: On Tue, Aug 03, 2010 at 05:31:55PM +, Hank Janssen wrote: From: Hank Janssen hjans...@microsoft.com Increased storvsc ringbuffer and max_io_requests. This now more closely mimics the numbers on Hyper-V. What do you mean by this? The max provided by the hypervisor? Max_IO is set to double from what it was before, Hyper-V allows it and We have had appliance builder requests to see if it was a problem to increase The number. Ringbuffer size for storvsc is now increased because I have seen A few buffer problems on extremely busy systems. They where Set pretty low before. And since max_io_requests is increased I Really needed to increase the buffer as well. And will allow more IO requests to take place for the SCSI driver. Which means what, better throughput? Or just more outstanding requests and the same speed overall? It means better throughput of high load systems, else you get buffer Contention. Thanks, Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: [PATCH 3/6] staging: hv: Fixed the value of the 64bit-hole inside ring buffer
On Tue, Aug 03, 2010 at 05:31:57PM +, Hank Janssen wrote: From: Haiyang Zhang haiya...@microsoft.com Fixed the value of the 64bit-hole inside ring buffer, this caused a problem on Hyper-V when running checked Windows builds. What was the problem, and why would this fix it? Was it a bug in this code, by virtue that the code was incorrect in the client and the checked builds properly warned of this, or something else? Checked builds of Windows are used internally and given to external system builders at times. They are builds that for example that all elements in a structure follow the definition of that Structure. The bug this fixed was for a field that we did not fill in at all (Because we do Not use it on the Linux side), and the checked build of windows gives errors on it internally to the Windows logs. This fixes that error. Thanks, Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: [PATCH 6/6] staging: hv: Gracefully handle SCSI resets
And then Greg spoke; On Tue, Aug 03, 2010 at 05:31:56PM +, Hank Janssen wrote: From: Hank Janssen hjans...@microsoft.com If we get a SCSI host bus reset we now gracefully handle it, and we take the device offline. This before sometimes caused hangs. Is this a problem for all older versions as well? If so, should it be backported to the -stable kernel releases? Yes, this should be backported to all stable kernel releases that have the Hyper-V drivers In them. This fixes a VM freeze. All patches I submitted in the batch of 6 (Except for the TODO patch) fix bugs. This one Fixes the worst one. Thanks, Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 1/1] staging: hv: Added heartbeat functionality to hv_utils
From: Hank Janssen hjans...@microsoft.com Subject: [PATCH 1/1] staging: hv: Added heartbeat functionality to hv_utils Add heartbeat functionality to hv_utils/Hyper-V Signed-off-by: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Hank Janssen hjans...@microsoft.com --- drivers/staging/hv/channel_mgmt.c | 23 - drivers/staging/hv/hv_utils.c | 64 + drivers/staging/hv/utils.h|5 +++ drivers/staging/hv/version_info.h |3 +- 4 files changed, 92 insertions(+), 3 deletions(-) diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c index 6877e8e..3f53b4d 100644 --- a/drivers/staging/hv/channel_mgmt.c +++ b/drivers/staging/hv/channel_mgmt.c @@ -33,8 +33,8 @@ struct vmbus_channel_message_table_entry { void (*messageHandler)(struct vmbus_channel_message_header *msg); }; -#define MAX_MSG_TYPES2 -#define MAX_NUM_DEVICE_CLASSES_SUPPORTED 6 +#define MAX_MSG_TYPES3 +#define MAX_NUM_DEVICE_CLASSES_SUPPORTED 7 static const struct hv_guid gSupportedDeviceClasses[MAX_NUM_DEVICE_CLASSES_SUPPORTED] = { @@ -89,6 +89,14 @@ static const struct hv_guid 0xad, 0xce, 0xe8, 0x0a, 0xb0, 0x17, 0x5c, 0xaf } }, + /* {57164f39-9115-4e78-ab55-382f3bd5422d} */ + /* Heartbeat */ + { + .data = { + 0x39, 0x4f, 0x16, 0x57, 0x15, 0x91, 0x78, 0x4e, + 0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d + } + }, }; @@ -211,6 +219,17 @@ struct hyperv_service_callback hv_cb_utils[MAX_MSG_TYPES] = { .callback = chn_cb_negotiate, .log_msg = Timesync channel functionality initialized }, + /* {57164f39-9115-4e78-ab55-382f3bd5422d} */ + /* Heartbeat */ + { + .msg_type = HV_HEARTBEAT_MSG, + .data = { + 0x39, 0x4f, 0x16, 0x57, 0x15, 0x91, 0x78, 0x4e, + 0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d + }, + .callback = chn_cb_negotiate, + .log_msg = Heartbeat channel functionality initialized + }, }; EXPORT_SYMBOL(hv_cb_utils); diff --git a/drivers/staging/hv/hv_utils.c b/drivers/staging/hv/hv_utils.c index db45d97..8a49aaf 100644 --- a/drivers/staging/hv/hv_utils.c +++ b/drivers/staging/hv/hv_utils.c @@ -194,6 +194,62 @@ static void timesync_onchannelcallback(void *context) DPRINT_EXIT(VMBUS); } +/* + * Heartbeat functionality. + * Every two seconds, Hyper-V send us a heartbeat request message. + * we respond to this message, and Hyper-V knows we are alive. + */ +static void heartbeat_onchannelcallback(void *context) +{ + struct vmbus_channel *channel = context; + u8 *buf; + u32 buflen, recvlen; + u64 requestid; + struct icmsg_hdr *icmsghdrp; + struct heartbeat_msg_data *heartbeat_msg; + + DPRINT_ENTER(VMBUS); + + buflen = PAGE_SIZE; + buf = kmalloc(buflen, GFP_ATOMIC); + + VmbusChannelRecvPacket(channel, buf, buflen, recvlen, requestid); + + if (recvlen 0) { + DPRINT_DBG(VMBUS, heartbeat packet: len=%d, requestid=%lld, + recvlen, requestid); + + icmsghdrp = (struct icmsg_hdr *)buf[ + sizeof(struct vmbuspipe_hdr)]; + + icmsghdrp = (struct icmsg_hdr *)buf[ + sizeof(struct vmbuspipe_hdr)]; + + if (icmsghdrp-icmsgtype == ICMSGTYPE_NEGOTIATE) { + prep_negotiate_resp(icmsghdrp, NULL, buf); + } else { + heartbeat_msg = (struct heartbeat_msg_data *)buf[ + sizeof(struct vmbuspipe_hdr) + + sizeof(struct icmsg_hdr)]; + + DPRINT_DBG(VMBUS, heartbeat seq = %lld, + heartbeat_msg-seq_num); + + heartbeat_msg-seq_num += 1; + } + + icmsghdrp-icflags = ICMSGHDRFLAG_TRANSACTION + | ICMSGHDRFLAG_RESPONSE; + + VmbusChannelSendPacket(channel, buf, + recvlen, requestid, + VmbusPacketTypeDataInBand, 0); + } + + kfree(buf); + + DPRINT_EXIT(VMBUS); +} static int __init init_hyperv_utils(void) { @@ -207,6 +263,10 @@ static int __init init_hyperv_utils(void) timesync_onchannelcallback; hv_cb_utils[HV_TIMESYNC_MSG].callback = timesync_onchannelcallback; + hv_cb_utils[HV_HEARTBEAT_MSG].channel-OnChannelCallback = + heartbeat_onchannelcallback; + hv_cb_utils[HV_HEARTBEAT_MSG].callback = heartbeat_onchannelcallback; + return 0; } @@ -221,6 +281,10 @@ static void exit_hyperv_utils(void
RE: Patch to auto-load MSFT PV NIC driver
Sent: Saturday, May 08, 2010 7:27 AM - Hank Janssen On Sat, May 08, 2010 at 01:52:01PM +, Hank Janssen wrote: I am not sure if this is the right approach. hv_netvsc takes a dependency on hv_vmbus. hv_vmbus does have the same DMI detection logic in it. But unless hv_vmbus has loaded up competely, hv_netvsc will fail on loadup. And I do not think we can guarantee that hv_vmbus has loaded yet. Yes you can, the dependancies in the module will take care of it. Try it, if you try to load the hv_netvsc module before hv_vmbus, modprobe will load hv_vmbus first. In my testing I have seen issues with timing. It takes a little while for VMBus to start getting the initialization taken care of with Hyper-V. And I have seen netvsc error with unresolved symbols because vmbus had not completed the initialization yet. Thanks, Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: Patch to auto-load MSFT PV NIC driver
From: Ky Srinivasan [ksriniva...@novell.com] - Friday, May 07, 2010 4:52 PM I am attaching a patch to auto-load hv_netvsc. I am not sure if this is the right approach. hv_netvsc takes a dependency on hv_vmbus. hv_vmbus does have the same DMI detection logic in it. But unless hv_vmbus has loaded up competely, hv_netvsc will fail on loadup. And I do not think we can guarantee that hv_vmbus has loaded yet. It would be better to have netvsc check to make sure hv_vmbus is loaded. Thanks, Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 1/1] hv: Added new hv_utils driver with shutdown as first functionality - NO OUTLOOK
Resending this patch from my personal Linux server. Exchange server and outlook at Microsoft seems to badly munge my patch. :( From: Hank Janssen hjans...@sailtheuniverse.com Subject: [PATCH 1/1] hv: Added new hv_utils driver with shutdown as first functionality Addition of new driver for Hyper-V called hv_utils. This driver is intended to support things like KVP, Timesync, Heartbeat etc. This first release has support for Gracefull shutdown. e.g. Select shutdown from the Hyper-V main admin screen and the Linux VM will do a gracefull shutdown. Signed-off-by: Hank Janssen microsoft.com Signed-off-by: Hank Janssen sailtheuniverse.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com --- drivers/staging/hv/Channel.c | 34 ++- drivers/staging/hv/ChannelMgmt.c | 148 +++- drivers/staging/hv/Kconfig |6 ++ drivers/staging/hv/Makefile|2 + drivers/staging/hv/VmbusPacketFormat.h |1 + drivers/staging/hv/ext_utils.c | 27 ++ drivers/staging/hv/hyperv_utils.c | 134 + drivers/staging/hv/utils.h | 94 8 files changed, 438 insertions(+), 8 deletions(-) create mode 100644 drivers/staging/hv/ext_utils.c create mode 100644 drivers/staging/hv/hyperv_utils.c create mode 100644 drivers/staging/hv/utils.h diff --git a/drivers/staging/hv/Channel.c b/drivers/staging/hv/Channel.c index 328d3a0..de2ccb1 100644 --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -21,6 +21,7 @@ #include linux/kernel.h #include linux/mm.h #include linux/slab.h +#include linux/module.h #include osd.h #include logging.h #include VmbusPrivate.h @@ -666,8 +667,19 @@ void VmbusChannelClose(struct vmbus_channel *Channel) DPRINT_EXIT(VMBUS); } -/* - * VmbusChannelSendPacket - Send the specified buffer on the given channel +/** + * VmbusChannelSendPacket() - Send the specified buffer on the given channel + * @Channel: Pointer to vmbus_channel structure. + * @Buffer: Pointer to the buffer you want to receive the data into. + * @BufferLen: Maximum size of what the the buffer will hold + * @RequestId: Identifier of the request + * @vmbus_packet_type: Type of packet that is being send e.g. negotiate, time + * packet etc. + * + * Sends data in @Buffer directly to hyper-v via the vmbus + * This will send the data unparsed to hyper-v. + * + * Mainly used by Hyper-V drivers. */ int VmbusChannelSendPacket(struct vmbus_channel *Channel, const void *Buffer, u32 BufferLen, u64 RequestId, @@ -711,6 +723,7 @@ int VmbusChannelSendPacket(struct vmbus_channel *Channel, const void *Buffer, return ret; } +EXPORT_SYMBOL(VmbusChannelSendPacket); /* * VmbusChannelSendPacketPageBuffer - Send a range of single-page buffer @@ -848,10 +861,20 @@ int VmbusChannelSendPacketMultiPageBuffer(struct vmbus_channel *Channel, return ret; } -/* - * VmbusChannelRecvPacket - Retrieve the user packet on the specified channel + +/** + * VmbusChannelRecvPacket() - Retrieve the user packet on the specified channel + * @Channel: Pointer to vmbus_channel structure. + * @Buffer: Pointer to the buffer you want to receive the data into. + * @BufferLen: Maximum size of what the the buffer will hold + * @BufferActualLen: The actual size of the data after it was received + * @RequestId: Identifier of the request + * + * Receives directly from the hyper-v vmbus and puts the data it received + * into Buffer. This will receive the data unparsed from hyper-v. + * + * Mainly used by Hyper-V drivers. */ -/* TODO: Do we ever receive a gpa direct packet other than the ones we send ? */ int VmbusChannelRecvPacket(struct vmbus_channel *Channel, void *Buffer, u32 BufferLen, u32 *BufferActualLen, u64 *RequestId) { @@ -913,6 +936,7 @@ int VmbusChannelRecvPacket(struct vmbus_channel *Channel, void *Buffer, return 0; } +EXPORT_SYMBOL(VmbusChannelRecvPacket); /* * VmbusChannelRecvPacketRaw - Retrieve the raw packet on the specified channel diff --git a/drivers/staging/hv/ChannelMgmt.c b/drivers/staging/hv/ChannelMgmt.c index 43f28f2..9c3069f 100644 --- a/drivers/staging/hv/ChannelMgmt.c +++ b/drivers/staging/hv/ChannelMgmt.c @@ -22,18 +22,22 @@ #include linux/mm.h #include linux/slab.h #include linux/list.h +#include linux/module.h #include osd.h #include logging.h #include VmbusPrivate.h +#include utils.h struct vmbus_channel_message_table_entry { enum vmbus_channel_message_type messageType; void (*messageHandler)(struct vmbus_channel_message_header *msg); }; -#define MAX_NUM_DEVICE_CLASSES_SUPPORTED 4 +#define MAX_MSG_TYPES1 +#define MAX_NUM_DEVICE_CLASSES_SUPPORTED 5 + static const struct hv_guid - gSupportedDeviceClasses[MAX_NUM_DEVICE_CLASSES_SUPPORTED] = { + gSupportedDeviceClasses[MAX_NUM_DEVICE_CLASSES_SUPPORTED
RE: [PATCH 1/1] hv: Added new hv_utils driver to hyper-v - CORRECTED
From: Greg KH [mailto:g...@kroah.com] - Thursday, April 29, 2010 12:15 PM Cc: Greg Kroah-Hartman gre...@suse.de Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com This patch fails to apply :( Can you redo it against the linux-next tree of tomorrow and resend it? Odd, but I will do that right now and resend it. Thanks, Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 1/1] hv: Added new hv_utils driver to hyper-v - RE-CREATED
Greg, As requested, here is the patch, it was created against a fresh clone of kernel.org:/pub/scm/linux/kernel/git/gregkh/staging-next-2.6.git of this morning using the origin/staging-next branch. It was created with the help of the git format-patch command. But when I do a diff from this patch and the one I send earlier this Week, I do not see anything different in my patch. Let me know if there is still an issue with this. Thanks, Hank. - From: Hank Janssen hjans...@microsoft.com Subject: [PATCH 1/1] hv: Added new hv_utils driver with shutdown as first functionality Addition of new driver for Hyper-V called hv_utils. This driver is intended to support things like KVP, Timesync, Heartbeat etc. This first release has support for graceful shutdown. e.g. Select shutdown from the Hyper-V main admin screen and the Linux VM will do a graceful shutdown. Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com --- drivers/staging/hv/Channel.c | 34 ++- drivers/staging/hv/ChannelMgmt.c | 148 +++- drivers/staging/hv/Kconfig |6 ++ drivers/staging/hv/Makefile|2 + drivers/staging/hv/VmbusPacketFormat.h |1 + drivers/staging/hv/ext_utils.c | 27 ++ drivers/staging/hv/hyperv_utils.c | 134 + drivers/staging/hv/utils.h | 94 8 files changed, 438 insertions(+), 8 deletions(-) create mode 100644 drivers/staging/hv/ext_utils.c create mode 100644 drivers/staging/hv/hyperv_utils.c create mode 100644 drivers/staging/hv/utils.h diff --git a/drivers/staging/hv/Channel.c b/drivers/staging/hv/Channel.c index 328d3a0..de2ccb1 100644 --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -21,6 +21,7 @@ #include linux/kernel.h #include linux/mm.h #include linux/slab.h +#include linux/module.h #include osd.h #include logging.h #include VmbusPrivate.h @@ -666,8 +667,19 @@ void VmbusChannelClose(struct vmbus_channel *Channel) DPRINT_EXIT(VMBUS); } -/* - * VmbusChannelSendPacket - Send the specified buffer on the given channel +/** + * VmbusChannelSendPacket() - Send the specified buffer on the given channel + * @Channel: Pointer to vmbus_channel structure. + * @Buffer: Pointer to the buffer you want to receive the data into. + * @BufferLen: Maximum size of what the the buffer will hold + * @RequestId: Identifier of the request + * @vmbus_packet_type: Type of packet that is being send e.g. negotiate, time + * packet etc. + * + * Sends data in @Buffer directly to hyper-v via the vmbus + * This will send the data unparsed to hyper-v. + * + * Mainly used by Hyper-V drivers. */ int VmbusChannelSendPacket(struct vmbus_channel *Channel, const void *Buffer, u32 BufferLen, u64 RequestId, @@ -711,6 +723,7 @@ int VmbusChannelSendPacket(struct vmbus_channel *Channel, const void *Buffer, return ret; } +EXPORT_SYMBOL(VmbusChannelSendPacket); /* * VmbusChannelSendPacketPageBuffer - Send a range of single-page buffer @@ -848,10 +861,20 @@ int VmbusChannelSendPacketMultiPageBuffer(struct vmbus_channel *Channel, return ret; } -/* - * VmbusChannelRecvPacket - Retrieve the user packet on the specified channel + +/** + * VmbusChannelRecvPacket() - Retrieve the user packet on the specified channel + * @Channel: Pointer to vmbus_channel structure. + * @Buffer: Pointer to the buffer you want to receive the data into. + * @BufferLen: Maximum size of what the the buffer will hold + * @BufferActualLen: The actual size of the data after it was received + * @RequestId: Identifier of the request + * + * Receives directly from the hyper-v vmbus and puts the data it received + * into Buffer. This will receive the data unparsed from hyper-v. + * + * Mainly used by Hyper-V drivers. */ -/* TODO: Do we ever receive a gpa direct packet other than the ones we send ? */ int VmbusChannelRecvPacket(struct vmbus_channel *Channel, void *Buffer, u32 BufferLen, u32 *BufferActualLen, u64 *RequestId) { @@ -913,6 +936,7 @@ int VmbusChannelRecvPacket(struct vmbus_channel *Channel, void *Buffer, return 0; } +EXPORT_SYMBOL(VmbusChannelRecvPacket); /* * VmbusChannelRecvPacketRaw - Retrieve the raw packet on the specified channel diff --git a/drivers/staging/hv/ChannelMgmt.c b/drivers/staging/hv/ChannelMgmt.c index 43f28f2..9c3069f 100644 --- a/drivers/staging/hv/ChannelMgmt.c +++ b/drivers/staging/hv/ChannelMgmt.c @@ -22,18 +22,22 @@ #include linux/mm.h #include linux/slab.h #include linux/list.h +#include linux/module.h #include osd.h #include logging.h #include VmbusPrivate.h +#include utils.h struct vmbus_channel_message_table_entry { enum vmbus_channel_message_type messageType; void (*messageHandler)(struct vmbus_channel_message_header *msg); }; -#define
[PATCH 1/1] Stage: hv: Remove Ringbuffer from TODO line
From: Hank Janssen hjans...@microsoft.com Remove Ringbuffer work line item from TODO file. The ring buffer in the Hyper-V Linux drivers is used to communicate with the parent partition running Windows Server 2008 Hyper-V. The ring buffer functionality on the Hyper-V Linux drivers is written to be functionally compatible with the ring buffer functionality on the Hyper-V Server. Consequently, it is not possible to make any changes that might break the compatibility with server side ring buffer implementation. Cc: Greg Kroah-Hartman gre...@suse.de Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com --- drivers/staging/hv/TODO |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/staging/hv/TODO b/drivers/staging/hv/TODO index dbfbde9..efe8ce9 100644 --- a/drivers/staging/hv/TODO +++ b/drivers/staging/hv/TODO @@ -1,7 +1,6 @@ TODO: - fix remaining checkpatch warnings and errors - use of /** when it is not a kerneldoc header - - remove RingBuffer.c to us in-kernel ringbuffer functions instead. - audit the vmbus to verify it is working properly with the driver model - convert vmbus driver interface function pointer tables ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
[PATCH 1/1] Stage: hv: Corrected all header comments to follow kernel-doc format
From: Hank Janssen hjans...@microsoft.com Removed kerneldoc /** from functions that should not have them. Added proper kerneldoc headers to functions that should have them. Cc: Greg Kroah-Hartman gre...@suse.de Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com --- drivers/staging/hv/Channel.c | 49 ++--- drivers/staging/hv/ChannelMgmt.c | 33 + drivers/staging/hv/Connection.c | 14 drivers/staging/hv/Hv.c | 18 +- drivers/staging/hv/NetVsc.c |8 ++-- drivers/staging/hv/StorVsc.c | 10 +++--- drivers/staging/hv/TODO |1 - drivers/staging/hv/Vmbus.c | 26 +++--- drivers/staging/hv/VmbusApi.h| 19 ++ drivers/staging/hv/blkvsc_drv.c |6 ++-- drivers/staging/hv/netvsc_drv.c |4 +- drivers/staging/hv/osd.c | 70 +++ drivers/staging/hv/storvsc_drv.c | 14 drivers/staging/hv/vmbus_drv.c | 74 + 14 files changed, 233 insertions(+), 113 deletions(-) diff --git a/drivers/staging/hv/Channel.c b/drivers/staging/hv/Channel.c index d46eb14..1fc2710 100644 --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -64,8 +64,9 @@ static void DumpMonitorPage(struct hv_monitor_page *MonitorPage) } #endif -/** - * VmbusChannelSetEvent - Trigger an event notification on the specified channel. +/* + * VmbusChannelSetEvent - Trigger an event notification on the +specified + * channel. */ static void VmbusChannelSetEvent(struct vmbus_channel *Channel) { @@ -119,7 +120,7 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel) } #endif -/** +/* * VmbusChannelGetDebugInfo -Retrieve various channel debug info */ void VmbusChannelGetDebugInfo(struct vmbus_channel *Channel, @@ -164,7 +165,7 @@ void VmbusChannelGetDebugInfo(struct vmbus_channel *Channel, RingBufferGetDebugInfo(Channel-Outbound, DebugInfo-Outbound); } -/** +/* * VmbusChannelOpen - Open the specified channel. */ int VmbusChannelOpen(struct vmbus_channel *NewChannel, u32 SendRingBufferSize, @@ -282,8 +283,9 @@ Cleanup: return 0; } -/** - * DumpGpadlBody - Dump the gpadl body message to the console for debugging purposes. +/* + * DumpGpadlBody - Dump the gpadl body message to the console for + * debugging purposes. */ static void DumpGpadlBody(struct vmbus_channel_gpadl_body *Gpadl, u32 Len) { @@ -299,8 +301,9 @@ static void DumpGpadlBody(struct vmbus_channel_gpadl_body *Gpadl, u32 Len) i, Gpadl-Pfn[i]); } -/** - * DumpGpadlHeader - Dump the gpadl header message to the console for debugging purposes. +/* + * DumpGpadlHeader - Dump the gpadl header message to the console for + * debugging purposes. */ static void DumpGpadlHeader(struct vmbus_channel_gpadl_header *Gpadl) { @@ -324,7 +327,7 @@ static void DumpGpadlHeader(struct vmbus_channel_gpadl_header *Gpadl) } } -/** +/* * VmbusChannelCreateGpadlHeader - Creates a gpadl for the specified buffer */ static int VmbusChannelCreateGpadlHeader(void *Kbuffer, u32 Size, @@ -440,7 +443,7 @@ static int VmbusChannelCreateGpadlHeader(void *Kbuffer, u32 Size, return 0; } -/** +/* * VmbusChannelEstablishGpadl - Estabish a GPADL for the specified buffer * * @Channel: a channel @@ -544,7 +547,7 @@ Cleanup: return ret; } -/** +/* * VmbusChannelTeardownGpadl -Teardown the specified GPADL handle */ int VmbusChannelTeardownGpadl(struct vmbus_channel *Channel, u32 GpadlHandle) @@ -597,7 +600,7 @@ int VmbusChannelTeardownGpadl(struct vmbus_channel *Channel, u32 GpadlHandle) return ret; } -/** +/* * VmbusChannelClose - Close the specified channel */ void VmbusChannelClose(struct vmbus_channel *Channel) @@ -662,7 +665,7 @@ void VmbusChannelClose(struct vmbus_channel *Channel) DPRINT_EXIT(VMBUS); } -/** +/* * VmbusChannelSendPacket - Send the specified buffer on the given channel */ int VmbusChannelSendPacket(struct vmbus_channel *Channel, const void *Buffer, @@ -708,8 +711,9 @@ int VmbusChannelSendPacket(struct vmbus_channel *Channel, const void *Buffer, return ret; } -/** - * VmbusChannelSendPacketPageBuffer - Send a range of single-page buffer packets using a GPADL Direct packet type. +/* + * VmbusChannelSendPacketPageBuffer - Send a range of single-page +buffer + * packets using a GPADL Direct packet type. */ int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *Channel, struct hv_page_buffer PageBuffers[], @@ -773,8 +777,9 @@ int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *Channel, return ret; } -/** - * VmbusChannelSendPacketMultiPageBuffer - Send a multi-page buffer packet using a GPADL Direct packet type. +/* + * VmbusChannelSendPacketMultiPageBuffer - Send a multi-page buffer
[PATCH 1/1] Stage: hv: Corrected all header comments to follow kernel-doc format-CORRECTED
From: Hank Janssen hjans...@microsoft.com Removed kerneldoc /** from functions that should not have them. Added proper kerneldoc headers to functions that should have them. This includes fixes as pointed out by Randy Dunlap and Joe Perches. Cc: Greg Kroah-Hartman gre...@suse.de Cc: Joe Perches j...@perches.com Cc: Randy Dunlap rdun...@xenotime.net Signed-off-by: Hank Janssen hjans...@microsoft.com Signed-off-by: Haiyang Zhang haiya...@microsoft.com --- drivers/staging/hv/Channel.c | 49 ++--- drivers/staging/hv/ChannelMgmt.c | 33 + drivers/staging/hv/Connection.c | 14 drivers/staging/hv/Hv.c | 18 +- drivers/staging/hv/NetVsc.c |8 ++-- drivers/staging/hv/StorVsc.c | 10 +++--- drivers/staging/hv/TODO |1 - drivers/staging/hv/Vmbus.c | 26 +++--- drivers/staging/hv/VmbusApi.h| 18 + drivers/staging/hv/blkvsc_drv.c |6 ++-- drivers/staging/hv/netvsc_drv.c |7 ++-- drivers/staging/hv/osd.c | 70 +++ drivers/staging/hv/storvsc_drv.c | 14 drivers/staging/hv/vmbus_drv.c | 74 + 14 files changed, 234 insertions(+), 114 deletions(-) diff --git a/drivers/staging/hv/Channel.c b/drivers/staging/hv/Channel.c index d46eb14..1fc2710 100644 --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -64,8 +64,9 @@ static void DumpMonitorPage(struct hv_monitor_page *MonitorPage) } #endif -/** - * VmbusChannelSetEvent - Trigger an event notification on the specified channel. +/* + * VmbusChannelSetEvent - Trigger an event notification on the specified + * channel. */ static void VmbusChannelSetEvent(struct vmbus_channel *Channel) { @@ -119,7 +120,7 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel) } #endif -/** +/* * VmbusChannelGetDebugInfo -Retrieve various channel debug info */ void VmbusChannelGetDebugInfo(struct vmbus_channel *Channel, @@ -164,7 +165,7 @@ void VmbusChannelGetDebugInfo(struct vmbus_channel *Channel, RingBufferGetDebugInfo(Channel-Outbound, DebugInfo-Outbound); } -/** +/* * VmbusChannelOpen - Open the specified channel. */ int VmbusChannelOpen(struct vmbus_channel *NewChannel, u32 SendRingBufferSize, @@ -282,8 +283,9 @@ Cleanup: return 0; } -/** - * DumpGpadlBody - Dump the gpadl body message to the console for debugging purposes. +/* + * DumpGpadlBody - Dump the gpadl body message to the console for + * debugging purposes. */ static void DumpGpadlBody(struct vmbus_channel_gpadl_body *Gpadl, u32 Len) { @@ -299,8 +301,9 @@ static void DumpGpadlBody(struct vmbus_channel_gpadl_body *Gpadl, u32 Len) i, Gpadl-Pfn[i]); } -/** - * DumpGpadlHeader - Dump the gpadl header message to the console for debugging purposes. +/* + * DumpGpadlHeader - Dump the gpadl header message to the console for + * debugging purposes. */ static void DumpGpadlHeader(struct vmbus_channel_gpadl_header *Gpadl) { @@ -324,7 +327,7 @@ static void DumpGpadlHeader(struct vmbus_channel_gpadl_header *Gpadl) } } -/** +/* * VmbusChannelCreateGpadlHeader - Creates a gpadl for the specified buffer */ static int VmbusChannelCreateGpadlHeader(void *Kbuffer, u32 Size, @@ -440,7 +443,7 @@ static int VmbusChannelCreateGpadlHeader(void *Kbuffer, u32 Size, return 0; } -/** +/* * VmbusChannelEstablishGpadl - Estabish a GPADL for the specified buffer * * @Channel: a channel @@ -544,7 +547,7 @@ Cleanup: return ret; } -/** +/* * VmbusChannelTeardownGpadl -Teardown the specified GPADL handle */ int VmbusChannelTeardownGpadl(struct vmbus_channel *Channel, u32 GpadlHandle) @@ -597,7 +600,7 @@ int VmbusChannelTeardownGpadl(struct vmbus_channel *Channel, u32 GpadlHandle) return ret; } -/** +/* * VmbusChannelClose - Close the specified channel */ void VmbusChannelClose(struct vmbus_channel *Channel) @@ -662,7 +665,7 @@ void VmbusChannelClose(struct vmbus_channel *Channel) DPRINT_EXIT(VMBUS); } -/** +/* * VmbusChannelSendPacket - Send the specified buffer on the given channel */ int VmbusChannelSendPacket(struct vmbus_channel *Channel, const void *Buffer, @@ -708,8 +711,9 @@ int VmbusChannelSendPacket(struct vmbus_channel *Channel, const void *Buffer, return ret; } -/** - * VmbusChannelSendPacketPageBuffer - Send a range of single-page buffer packets using a GPADL Direct packet type. +/* + * VmbusChannelSendPacketPageBuffer - Send a range of single-page buffer + * packets using a GPADL Direct packet type. */ int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *Channel, struct hv_page_buffer PageBuffers[], @@ -773,8 +777,9 @@ int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *Channel, return ret; } -/** - * VmbusChannelSendPacketMultiPageBuffer - Send
Ringbuffer usage in Linux Hyper-V drivers
All, I have been looking at one of the TODO items in the Linux Hyper-V drivers. Specifically the one that says; - remove RingBuffer.c to use in-kernel ringbuffer functions instead. I spend some time figuring out the ring buffer capability inside of the Linux Kernel to see if we could change the Hyper-V ring buffer out for the in-kernel ring buffer capability. The ring buffer in the Hyper-V Linux drivers is used to communicate with the parent partition running Server 2008 Hyper-V. The ring buffer functionality on the Hyper-V Linux drivers is written to be functionally compatible with the ring buffer functionality on the Hyper-V Server. Consequently, it is not possible to make any changes that might break the compatibility with server side ring buffer implementation. There is a pretty good chance that ring buffer on Hyper-V will change to support additional functionality. I did further investigations to check on other virtualization technologies. And this same things seems to be true for XEN, they also implemented their own ring buffer implementation on the guest side because of their host side implementation. So my question is to the community at large, am I missing something that would enable me to use an existing ring buffer functionality somehow in the kernel? If not, I want to remove the line from the TODO file that is requesting to use the in-kernel ring buffer functionality. Finally, while checking this out, I looked at a bunch of non virtualization device drivers currently in the kernel. And all the ones I looked at have implemented their own ring buffer. Is there a reason why this might be the case? As usual, any help is appreciated. Thanks, Hank Janssen. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
Learning question regarding virtio and partvirt_ops
Greetings all, I guess this is my official first port on the virtualization mailing list. So any errors in posting and the correctness of asking questions in the present And future are mine alone :) I am one of the Microsoft developers responsible for Hyper-V support for Linux. I had the pleasure of meeting Anthony Liguori and Chris Wright last week at the Linux Plumbers Conference in Portland. The discussion was around virtio and possibly using some virtio for the Hyper-V work. Since I am still much a novice with virtio, I wanted to ask the general wisdom on the list. There is also paravirt_ops, and I am trying to understand the relationship of paravirt_ops And the kernel, virtio and the kernel and possible relation between paravirt_ops and virtio. Is there a place somebody can point me towards that gives me a better understanding of These two systems, how they compliment/do not compliment, are the same or are not the same. And what is the general direction of the people on the list regarding these systems. Why you would use one over the other, or if they can be combined in some way. I know this might be a loaded question, but there you have it :) Anthony and Chris can only be blamed for telling me that this is a good list to have These discussions on. Everything else is my fault :) Thanks, Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization
RE: [patch 00/54] [Announce] Microsoft Hyper-V drivers for Linux
What is the long term strategy to keep the sources in sync? Is there one? Do you expect to get updates for these sources? Balbir Balbir, I think you are asking me if we plan to continue contributing? It is my plan to use the kernel as my primary development area, and I will Continue to provide Greg with updates. First step is to clean up the code To make sure if fulfills all Kernel coding standards and requirements. Then I will start contributing new functionality. Thanks, Hank. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/virtualization