Hank Janssen
2011-Feb-22  23:32 UTC
[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 <hjanssen at microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz at microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys at 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 STORVSC				0x0002
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 the bus as root device */
 	ret = device_register(&dev_ctx->device);
 	if (ret) {
-		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__);
 
 		free_irq(vmbus_irq, NULL);
 		bus_unregister(&vmbus_drv_ctx->bus);
@@ -631,9 +607,6 @@ int vmbus_child_driver_register(struct driver_context
*driver_ctx)
 {
 	int ret;
 
-	DPRINT_INFO(VMBUS_DRV, "child driver (%p) registering - name %s",
-		    driver_ctx, driver_ctx->driver.name);
-
 	/* The child driver on this vmbus */
 	driver_ctx->driver.bus = &vmbus_drv.bus;
 
@@ -641,6 +614,13 @@ int vmbus_child_driver_register(struct driver_context
*driver_ctx)
 
 	vmbus_request_offers();
 
+	if (ret)
+		pr_err("%s: %s Unable to register Hyper-V driver %s",
+		       VMBUS_MOD, __func__, driver_ctx->driver.name);
+	else
+		pr_info("%s: Hyper-V driver registering %s", VMBUS_MOD,
+			driver_ctx->driver.name);
+
 	return ret;
 }
 EXPORT_SYMBOL(vmbus_child_driver_register);
@@ -658,11 +638,11 @@ EXPORT_SYMBOL(vmbus_child_driver_register);
  */
 void vmbus_child_driver_unregister(struct driver_context *driver_ctx)
 {
-	DPRINT_INFO(VMBUS_DRV, "child driver (%p) unregistering - name %s",
-		    driver_ctx, driver_ctx->driver.name);
-
 	driver_unregister(&driver_ctx->driver);
 
+	pr_info("%s: child driver unregistering - %s", VMBUS_MOD,
+		driver_ctx->driver.name);
+
 	driver_ctx->driver.bus = NULL;
 }
 EXPORT_SYMBOL(vmbus_child_driver_unregister);
@@ -681,30 +661,11 @@ struct hv_device *vmbus_child_device_create(struct hv_guid
*type,
 	/* Allocate the new child device */
 	child_device_ctx = kzalloc(sizeof(struct vm_device), GFP_KERNEL);
 	if (!child_device_ctx) {
-		DPRINT_ERR(VMBUS_DRV,
-			"unable to allocate device_context for child device");
+		pr_err("%s: %s Unable to allocate device_context child device",
+		       VMBUS_MOD, __func__);
 		return NULL;
 	}
 
-	DPRINT_DBG(VMBUS_DRV, "child device (%p) allocated - "
-		"type {%02x%02x%02x%02x-%02x%02x-%02x%02x-"
-		"%02x%02x%02x%02x%02x%02x%02x%02x},"
-		"id {%02x%02x%02x%02x-%02x%02x-%02x%02x-"
-		"%02x%02x%02x%02x%02x%02x%02x%02x}",
-		&child_device_ctx->device,
-		type->data[3], type->data[2], type->data[1], type->data[0],
-		type->data[5], type->data[4], type->data[7], type->data[6],
-		type->data[8], type->data[9], type->data[10], type->data[11],
-		type->data[12], type->data[13], type->data[14], type->data[15],
-		instance->data[3], instance->data[2],
-		instance->data[1], instance->data[0],
-		instance->data[5], instance->data[4],
-		instance->data[7], instance->data[6],
-		instance->data[8], instance->data[9],
-		instance->data[10], instance->data[11],
-		instance->data[12], instance->data[13],
-		instance->data[14], instance->data[15]);
-
 	child_device_obj = &child_device_ctx->device_obj;
 	child_device_obj->channel = channel;
 	memcpy(&child_device_obj->dev_type, type, sizeof(struct hv_guid));
@@ -730,9 +691,6 @@ int vmbus_child_device_register(struct hv_device
*root_device_obj,
 				to_vm_device(child_device_obj);
 	static atomic_t device_num = ATOMIC_INIT(0);
 
-	DPRINT_DBG(VMBUS_DRV, "child device (%p) registering",
-		   child_device_ctx);
-
 	/* Set the device name. Otherwise, device_register() will fail. */
 	dev_set_name(&child_device_ctx->device, "vmbus_0_%d",
 		     atomic_inc_return(&device_num));
@@ -752,11 +710,11 @@ int vmbus_child_device_register(struct hv_device
*root_device_obj,
 	ret = child_device_ctx->probe_error;
 
 	if (ret)
-		DPRINT_ERR(VMBUS_DRV, "unable to register child device (%p)",
-			   &child_device_ctx->device);
+		pr_err("%s: %s Unable to register child device",
+		       VMBUS_MOD, __func__);
 	else
-		DPRINT_INFO(VMBUS_DRV, "child device (%p) registered",
-			    &child_device_ctx->device);
+		pr_info("%s: Child device (%s) registered", VMBUS_MOD,
+			dev_name(&child_device_ctx->device));
 
 	return ret;
 }
@@ -769,17 +727,14 @@ void vmbus_child_device_unregister(struct hv_device
*device_obj)
 {
 	struct vm_device *device_ctx = to_vm_device(device_obj);
 
-	DPRINT_INFO(VMBUS_DRV, "unregistering child device (%p)",
-		    &device_ctx->device);
-
 	/*
 	 * Kick off the process of unregistering the device.
 	 * This will call vmbus_remove() and eventually vmbus_device_release()
 	 */
 	device_unregister(&device_ctx->device);
 
-	DPRINT_INFO(VMBUS_DRV, "child device (%p) unregistered",
-		    &device_ctx->device);
+	pr_info("%s: child device %s unregistered", VMBUS_MOD,
+		    dev_name(&device_ctx->device));
 }
 
 /*
@@ -794,21 +749,6 @@ static int vmbus_uevent(struct device *device, struct
kobj_uevent_env *env)
 	struct vm_device *device_ctx = device_to_vm_device(device);
 	int ret;
 
-	DPRINT_INFO(VMBUS_DRV, "generating uevent -
VMBUS_DEVICE_CLASS_GUID={"
-		    "%02x%02x%02x%02x-%02x%02x-%02x%02x-"
-		    "%02x%02x%02x%02x%02x%02x%02x%02x}",
-		    device_ctx->class_id.data[3], device_ctx->class_id.data[2],
-		    device_ctx->class_id.data[1], device_ctx->class_id.data[0],
-		    device_ctx->class_id.data[5], device_ctx->class_id.data[4],
-		    device_ctx->class_id.data[7], device_ctx->class_id.data[6],
-		    device_ctx->class_id.data[8], device_ctx->class_id.data[9],
-		    device_ctx->class_id.data[10],
-		    device_ctx->class_id.data[11],
-		    device_ctx->class_id.data[12],
-		    device_ctx->class_id.data[13],
-		    device_ctx->class_id.data[14],
-		    device_ctx->class_id.data[15]);
-
 	ret = add_uevent_var(env, "VMBUS_DEVICE_CLASS_GUID={"
 			     "%02x%02x%02x%02x-%02x%02x-%02x%02x-"
 			     "%02x%02x%02x%02x%02x%02x%02x%02x}",
@@ -877,10 +817,6 @@ static int vmbus_match(struct device *device, struct
device_driver *driver)
 			(struct vmbus_driver_context *)driver_ctx;
 
 		device_ctx->device_obj.drv = &vmbus_drv_ctx->drv_obj;
-		DPRINT_INFO(VMBUS_DRV,
-			    "device object (%p) set to driver object (%p)",
-			    &device_ctx->device_obj,
-			    device_ctx->device_obj.drv);
 
 		match = 1;
 	}
@@ -922,18 +858,17 @@ static int vmbus_probe(struct device *child_device)
 	if (driver_ctx->probe) {
 		ret = device_ctx->probe_error = driver_ctx->probe(child_device);
 		if (ret != 0) {
-			DPRINT_ERR(VMBUS_DRV, "probe() failed for device %s "
-				   "(%p) on driver %s (%d)...",
-				   dev_name(child_device), child_device,
-				   child_device->driver->name, ret);
+			pr_err("%s: %s failed for device %s (%d)",
+			       VMBUS_MOD, __func__,
+			       dev_name(child_device), ret);
 
 			INIT_WORK(&device_ctx->probe_failed_work_item,
 				  vmbus_probe_failed_cb);
 			schedule_work(&device_ctx->probe_failed_work_item);
 		}
 	} else {
-		DPRINT_ERR(VMBUS_DRV, "probe() method not set for driver - %s",
-			   child_device->driver->name);
+		pr_err("%s: %s not set for driver - %s",
+		       VMBUS_MOD, __func__, dev_name(child_device));
 		ret = -1;
 	}
 	return ret;
@@ -966,9 +901,8 @@ static int vmbus_remove(struct device *child_device)
 		if (driver_ctx->remove) {
 			ret = driver_ctx->remove(child_device);
 		} else {
-			DPRINT_ERR(VMBUS_DRV,
-				   "remove() method not set for driver - %s",
-				   child_device->driver->name);
+			pr_err("%s: %s not set for driver - %s",
+			       VMBUS_MOD, __func__, dev_name(child_device));
 			ret = -1;
 		}
 	}
@@ -1086,10 +1020,8 @@ MODULE_DEVICE_TABLE(dmi, microsoft_hv_dmi_table);
 
 static int __init vmbus_init(void)
 {
-	DPRINT_INFO(VMBUS_DRV,
-		"Vmbus initializing.... current log level 0x%x (%x,%x)",
-		vmbus_loglevel, HIWORD(vmbus_loglevel), LOWORD(vmbus_loglevel));
-	/* Todo: it is used for loglevel, to be ported to new kernel. */
+	pr_info("%s: initializing Version %s. Supported Hyper-V Rev %d.",
+		VMBUS_MOD, HV_DRV_VERSION, VMBUS_REVISION_NUMBER);
 
 	if (!dmi_check_system(microsoft_hv_dmi_table))
 		return -ENODEV;
@@ -1100,7 +1032,6 @@ static int __init vmbus_init(void)
 static void __exit vmbus_exit(void)
 {
 	vmbus_bus_exit();
-	/* Todo: it is used for loglevel, to be ported to new kernel. */
 }
 
 /*
-- 
1.6.0.2
Hank Janssen
2011-Feb-22  23:32 UTC
[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 <hjanssen at microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz at microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys at 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 & 0xFFFF,
-			    ecx,
-			    edx >> 24,
-			    edx & 0xFFFFFF);
+
+		pr_info("%s: Hyper-V Host OS Build:%d-%d.%d-%d-%d.%d",
+			VMBUS_MOD,
+			eax,
+			ebx >> 16,
+			ebx & 0xFFFF,
+			ecx,
+			edx >> 24,
+			edx & 0xFFFFFF);
 	}
+
 	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 & 0xFFFFFFFF;
 	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)
 	rdmsrl(HV_X64_MSR_GUEST_OS_ID, hv_context.guestid);
 
 	if (hv_context.guestid != 0) {
-		DPRINT_ERR(VMBUS, "Unknown guest id (0x%llx)!!",
-				hv_context.guestid);
+		pr_err("%s: %s Unknown guest id (0x%llx)",
+		       VMBUS_MOD, __func__, hv_context.guestid);
 		goto Cleanup;
 	}
 
@@ -233,8 +199,8 @@ int hv_init(void)
 	virtaddr = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL_EXEC);
 
 	if (!virtaddr) {
-		DPRINT_ERR(VMBUS,
-			   "unable to allocate hypercall page!!");
+		pr_err("%s: %s unable to allocate hypercall page",
+		       VMBUS_MOD, __func__);
 		goto Cleanup;
 	}
 
@@ -248,16 +214,13 @@ int hv_init(void)
 	rdmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
 
 	if (!hypercall_msr.enable) {
-		DPRINT_ERR(VMBUS, "unable to set hypercall page!!");
+		pr_err("%s: %s Unable to set hypercall page",
+			VMBUS_MOD, __func__);
 		goto Cleanup;
 	}
 
 	hv_context.hypercall_page = virtaddr;
 
-	DPRINT_INFO(VMBUS, "Hypercall page VA=%p, PA=0x%0llx",
-		    hv_context.hypercall_page,
-		    (u64)hypercall_msr.guest_physical_address << PAGE_SHIFT);
-
 	/* Setup the global signal event param for the signal event hypercall */
 	hv_context.signal_event_buffer  			kmalloc(sizeof(struct
hv_input_signal_event_buffer),
@@ -394,14 +357,12 @@ void hv_synic_init(void *irqarg)
 	/* Check the version */
 	rdmsrl(HV_X64_MSR_SVERSION, version);
 
-	DPRINT_INFO(VMBUS, "SynIC version: %llx", version);
-
 	hv_context.synic_message_page[cpu]  		(void *)get_zeroed_page(GFP_ATOMIC);
 
 	if (hv_context.synic_message_page[cpu] == NULL) {
-		DPRINT_ERR(VMBUS,
-			   "unable to allocate SYNIC message page!!");
+		pr_err("%s: %s Unable to allocate SYNIC message page",
+		       VMBUS_MOD, __func__);
 		goto Cleanup;
 	}
 
@@ -409,8 +370,8 @@ void hv_synic_init(void *irqarg)
 		(void *)get_zeroed_page(GFP_ATOMIC);
 
 	if (hv_context.synic_event_page[cpu] == NULL) {
-		DPRINT_ERR(VMBUS,
-			   "unable to allocate SYNIC event page!!");
+		pr_err("%s: %s Unable to allocate SYNIC event page",
+		       VMBUS_MOD, __func__);
 		goto Cleanup;
 	}
 
@@ -420,8 +381,6 @@ void hv_synic_init(void *irqarg)
 	simp.base_simp_gpa = virt_to_phys(hv_context.synic_message_page[cpu])
 		>> PAGE_SHIFT;
 
-	DPRINT_DBG(VMBUS, "HV_X64_MSR_SIMP msr set to: %llx",
simp.as_uint64);
-
 	wrmsrl(HV_X64_MSR_SIMP, simp.as_uint64);
 
 	/* Setup the Synic's event page */
@@ -430,8 +389,6 @@ void hv_synic_init(void *irqarg)
 	siefp.base_siefp_gpa = virt_to_phys(hv_context.synic_event_page[cpu])
 		>> PAGE_SHIFT;
 
-	DPRINT_DBG(VMBUS, "HV_X64_MSR_SIEFP msr set to: %llx",
siefp.as_uint64);
-
 	wrmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64);
 
 	/* Setup the interception SINT. */
@@ -446,9 +403,6 @@ void hv_synic_init(void *irqarg)
 	shared_sint.masked = false;
 	shared_sint.auto_eoi = true;
 
-	DPRINT_DBG(VMBUS, "HV_X64_MSR_SINT1 msr set to: %llx",
-		   shared_sint.as_uint64);
-
 	wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
 
 	/* Enable the global synic bit */
-- 
1.6.0.2
Hank Janssen
2011-Feb-22  23:32 UTC
[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 <hjanssen at microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz at microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys at 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
Joe Perches
2011-Feb-23  04:51 UTC
[PATCH 1/6] Staging: hv: vmbus_drv.c Replaced DPRINT with native pr_XXX
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" 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) and then use: pr_err("ERROR Unable to register vmbus root device\n");
Greg KH
2011-Feb-23  19:11 UTC
[PATCH 1/6] Staging: hv: vmbus_drv.c Replaced DPRINT with native pr_XXX
On Tue, Feb 22, 2011 at 03:32:40PM -0800, Hank Janssen wrote:> This group of patches removes all DPRINT from hv_vmbus.ko. > It is divided in several patches due to size.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? 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. thanks, greg k-h
Maybe Matching Threads
- [PATCH 1/6] Staging: hv: vmbus_drv.c Replaced DPRINT with native pr_XXX
- [PATCH ] Staging: hv: Hyper-V driver cleanup
- [PATCH ] Staging: hv: Hyper-V driver cleanup
- [PATCH 3/6] Staging: hv: Cleanup hyperv_device variable names
- [PATCH 3/6] Staging: hv: Cleanup hyperv_device variable names