public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/13] hv: clean up dev_attr usage
@ 2013-09-13 18:32 Greg Kroah-Hartman
  2013-09-13 18:32 ` [PATCH 01/13] hv: use dev_groups for device attributes Greg Kroah-Hartman
                   ` (14 more replies)
  0 siblings, 15 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2013-09-13 18:32 UTC (permalink / raw)
  To: kys, haiyangz; +Cc: devel, linux-kernel

Hi,

Here's a set of 13 patches to get rid of the dev_attrs use in the hv bus
code, as it will be going away soon.  It's _way_ bigger than all other
conversions I've had to do so far in the kernel, as you were using a
"multiplexor" function for all of these files.

So, I've broken it up into individual show/store sysfs functions, and
cleaned up a bunch of debug structures that aren't needed and shouldn't
be exported to the rest of the kernel.

I've also fixed up some void * usage in the hv core, in patch 07, to
make things simpler and not so "magic" when dealing with these pages.
If you could review that one closely to ensure I didn't mess anything
up, I would appreciate it.

Also, are all of these files really needed for sysfs?  They seem to be
all debugging stuff, shouldn't they go into debugfs if you really
need/use them anymore?

KY, could you test these out?  I don't have access to a hv system at the
moment.  I'll wait for your ack before applying them to any of my trees.

thanks,

greg k-h


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

* [PATCH 01/13] hv: use dev_groups for device attributes
  2013-09-13 18:32 [PATCH 00/13] hv: clean up dev_attr usage Greg Kroah-Hartman
@ 2013-09-13 18:32 ` Greg Kroah-Hartman
  2013-09-13 18:32 ` [PATCH 02/13] hv: move "state" bus attribute to dev_groups Greg Kroah-Hartman
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2013-09-13 18:32 UTC (permalink / raw)
  To: kys, haiyangz; +Cc: devel, linux-kernel, Greg Kroah-Hartman

This patch is the first in a series that moves the hv bus code to use the
dev_groups field instead of dev_attrs, as dev_attrs is going away in future
kernel releases.

It moves the id sysfs file to the dev_groups structure, and creates the needed
show/store functions, instead of relying on one "universal" function for this.
By doing this, it removes the need for this to be in a temporary structure.

Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hv/channel.c   |  1 -
 drivers/hv/vmbus_drv.c | 23 ++++++++++++++++++-----
 include/linux/hyperv.h |  1 -
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 6de6c98c..b58a1785 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -69,7 +69,6 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
 	u8 monitor_group = (u8)channel->offermsg.monitorid / 32;
 	u8 monitor_offset = (u8)channel->offermsg.monitorid % 32;
 
-	debuginfo->relid = channel->offermsg.child_relid;
 	debuginfo->state = channel->state;
 	memcpy(&debuginfo->interfacetype,
 	       &channel->offermsg.offer.if_type, sizeof(uuid_le));
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index f9fe46f5..5c21b228 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -47,7 +47,6 @@ static struct completion probe_event;
 static int irq;
 
 struct hv_device_info {
-	u32 chn_id;
 	u32 chn_state;
 	uuid_le chn_type;
 	uuid_le chn_instance;
@@ -83,7 +82,6 @@ static void get_channel_info(struct hv_device *device,
 
 	vmbus_get_debug_info(device->channel, &debug_info);
 
-	info->chn_id = debug_info.relid;
 	info->chn_state = debug_info.state;
 	memcpy(&info->chn_type, &debug_info.interfacetype,
 	       sizeof(uuid_le));
@@ -156,8 +154,6 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
 		ret = sprintf(buf, "vmbus:%s\n", alias_name);
 	} else if (!strcmp(dev_attr->attr.name, "state")) {
 		ret = sprintf(buf, "%d\n", device_info->chn_state);
-	} else if (!strcmp(dev_attr->attr.name, "id")) {
-		ret = sprintf(buf, "%d\n", device_info->chn_id);
 	} else if (!strcmp(dev_attr->attr.name, "out_intr_mask")) {
 		ret = sprintf(buf, "%d\n", device_info->outbound.int_mask);
 	} else if (!strcmp(dev_attr->attr.name, "out_read_index")) {
@@ -204,9 +200,25 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
 	return ret;
 }
 
+static ssize_t id_show(struct device *dev, struct device_attribute *dev_attr,
+		       char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	return sprintf(buf, "%d\n", hv_dev->channel->offermsg.child_relid);
+}
+static DEVICE_ATTR_RO(id);
+
+static struct attribute *vmbus_attrs[] = {
+	&dev_attr_id.attr,
+	NULL,
+};
+ATTRIBUTE_GROUPS(vmbus);
+
 /* Set up per device attributes in /sys/bus/vmbus/devices/<bus device> */
 static struct device_attribute vmbus_device_attrs[] = {
-	__ATTR(id, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(state, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(class_id, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(device_id, S_IRUGO, vmbus_show_device_attr, NULL),
@@ -384,6 +396,7 @@ static struct bus_type  hv_bus = {
 	.probe =		vmbus_probe,
 	.uevent =		vmbus_uevent,
 	.dev_attrs =	vmbus_device_attrs,
+	.dev_groups =		vmbus_groups,
 };
 
 static const char *driver_name = "hyperv";
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index a3b8b2e2..45e9b65e 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -900,7 +900,6 @@ enum vmbus_channel_state {
 };
 
 struct vmbus_channel_debug_info {
-	u32 relid;
 	enum vmbus_channel_state state;
 	uuid_le interfacetype;
 	uuid_le interface_instance;
-- 
1.8.4.3.gca3854a


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

* [PATCH 02/13] hv: move "state" bus attribute to dev_groups
  2013-09-13 18:32 [PATCH 00/13] hv: clean up dev_attr usage Greg Kroah-Hartman
  2013-09-13 18:32 ` [PATCH 01/13] hv: use dev_groups for device attributes Greg Kroah-Hartman
@ 2013-09-13 18:32 ` Greg Kroah-Hartman
  2013-09-13 18:32 ` [PATCH 03/13] hv: move "monitor_id" " Greg Kroah-Hartman
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2013-09-13 18:32 UTC (permalink / raw)
  To: kys, haiyangz; +Cc: devel, linux-kernel, Greg Kroah-Hartman

This moves the "state" bus attribute to the dev_groups structure,
removing the need for it to be in a temporary structure.

Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hv/channel.c   |  1 -
 drivers/hv/vmbus_drv.c | 17 ++++++++++++-----
 include/linux/hyperv.h |  1 -
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index b58a1785..64f19f22 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -69,7 +69,6 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
 	u8 monitor_group = (u8)channel->offermsg.monitorid / 32;
 	u8 monitor_offset = (u8)channel->offermsg.monitorid % 32;
 
-	debuginfo->state = channel->state;
 	memcpy(&debuginfo->interfacetype,
 	       &channel->offermsg.offer.if_type, sizeof(uuid_le));
 	memcpy(&debuginfo->interface_instance,
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 5c21b228..1e5bc9c4 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -47,7 +47,6 @@ static struct completion probe_event;
 static int irq;
 
 struct hv_device_info {
-	u32 chn_state;
 	uuid_le chn_type;
 	uuid_le chn_instance;
 
@@ -82,7 +81,6 @@ static void get_channel_info(struct hv_device *device,
 
 	vmbus_get_debug_info(device->channel, &debug_info);
 
-	info->chn_state = debug_info.state;
 	memcpy(&info->chn_type, &debug_info.interfacetype,
 	       sizeof(uuid_le));
 	memcpy(&info->chn_instance, &debug_info.interface_instance,
@@ -152,8 +150,6 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
 	} else if (!strcmp(dev_attr->attr.name, "modalias")) {
 		print_alias_name(hv_dev, alias_name);
 		ret = sprintf(buf, "vmbus:%s\n", alias_name);
-	} else if (!strcmp(dev_attr->attr.name, "state")) {
-		ret = sprintf(buf, "%d\n", device_info->chn_state);
 	} else if (!strcmp(dev_attr->attr.name, "out_intr_mask")) {
 		ret = sprintf(buf, "%d\n", device_info->outbound.int_mask);
 	} else if (!strcmp(dev_attr->attr.name, "out_read_index")) {
@@ -211,15 +207,26 @@ static ssize_t id_show(struct device *dev, struct device_attribute *dev_attr,
 }
 static DEVICE_ATTR_RO(id);
 
+static ssize_t state_show(struct device *dev, struct device_attribute *dev_attr,
+			  char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	return sprintf(buf, "%d\n", hv_dev->channel->state);
+}
+static DEVICE_ATTR_RO(state);
+
 static struct attribute *vmbus_attrs[] = {
 	&dev_attr_id.attr,
+	&dev_attr_state.attr,
 	NULL,
 };
 ATTRIBUTE_GROUPS(vmbus);
 
 /* Set up per device attributes in /sys/bus/vmbus/devices/<bus device> */
 static struct device_attribute vmbus_device_attrs[] = {
-	__ATTR(state, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(class_id, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(device_id, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(monitor_id, S_IRUGO, vmbus_show_device_attr, NULL),
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 45e9b65e..b350a8cf 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -900,7 +900,6 @@ enum vmbus_channel_state {
 };
 
 struct vmbus_channel_debug_info {
-	enum vmbus_channel_state state;
 	uuid_le interfacetype;
 	uuid_le interface_instance;
 	u32 monitorid;
-- 
1.8.4.3.gca3854a


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

* [PATCH 03/13] hv: move "monitor_id" bus attribute to dev_groups
  2013-09-13 18:32 [PATCH 00/13] hv: clean up dev_attr usage Greg Kroah-Hartman
  2013-09-13 18:32 ` [PATCH 01/13] hv: use dev_groups for device attributes Greg Kroah-Hartman
  2013-09-13 18:32 ` [PATCH 02/13] hv: move "state" bus attribute to dev_groups Greg Kroah-Hartman
@ 2013-09-13 18:32 ` Greg Kroah-Hartman
  2013-09-13 18:32 ` [PATCH 04/13] hv: move "modalias" " Greg Kroah-Hartman
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2013-09-13 18:32 UTC (permalink / raw)
  To: kys, haiyangz; +Cc: devel, linux-kernel, Greg Kroah-Hartman

This moves the "state" bus attribute to the dev_groups structure,
removing the need for it to be in a temporary structure.

Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hv/channel.c   |  2 --
 drivers/hv/vmbus_drv.c | 18 ++++++++++++------
 include/linux/hyperv.h |  1 -
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 64f19f22..f26a5d25 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -77,8 +77,6 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
 
 	monitorpage = (struct hv_monitor_page *)vmbus_connection.monitor_pages;
 
-	debuginfo->monitorid = channel->offermsg.monitorid;
-
 	debuginfo->servermonitor_pending =
 			monitorpage->trigger_group[monitor_group].pending;
 	debuginfo->servermonitor_latency =
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 1e5bc9c4..2114ecb8 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -50,7 +50,6 @@ struct hv_device_info {
 	uuid_le chn_type;
 	uuid_le chn_instance;
 
-	u32 monitor_id;
 	u32 server_monitor_pending;
 	u32 server_monitor_latency;
 	u32 server_monitor_conn_id;
@@ -86,8 +85,6 @@ static void get_channel_info(struct hv_device *device,
 	memcpy(&info->chn_instance, &debug_info.interface_instance,
 	       sizeof(uuid_le));
 
-	info->monitor_id = debug_info.monitorid;
-
 	info->server_monitor_pending = debug_info.servermonitor_pending;
 	info->server_monitor_latency = debug_info.servermonitor_latency;
 	info->server_monitor_conn_id = debug_info.servermonitor_connectionid;
@@ -174,8 +171,6 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
 	} else if (!strcmp(dev_attr->attr.name, "in_write_bytes_avail")) {
 		ret = sprintf(buf, "%d\n",
 			       device_info->inbound.bytes_avail_towrite);
-	} else if (!strcmp(dev_attr->attr.name, "monitor_id")) {
-		ret = sprintf(buf, "%d\n", device_info->monitor_id);
 	} else if (!strcmp(dev_attr->attr.name, "server_monitor_pending")) {
 		ret = sprintf(buf, "%d\n", device_info->server_monitor_pending);
 	} else if (!strcmp(dev_attr->attr.name, "server_monitor_latency")) {
@@ -218,9 +213,21 @@ static ssize_t state_show(struct device *dev, struct device_attribute *dev_attr,
 }
 static DEVICE_ATTR_RO(state);
 
+static ssize_t monitor_id_show(struct device *dev,
+			       struct device_attribute *dev_attr, char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	return sprintf(buf, "%d\n", hv_dev->channel->offermsg.monitorid);
+}
+static DEVICE_ATTR_RO(monitor_id);
+
 static struct attribute *vmbus_attrs[] = {
 	&dev_attr_id.attr,
 	&dev_attr_state.attr,
+	&dev_attr_monitor_id.attr,
 	NULL,
 };
 ATTRIBUTE_GROUPS(vmbus);
@@ -229,7 +236,6 @@ ATTRIBUTE_GROUPS(vmbus);
 static struct device_attribute vmbus_device_attrs[] = {
 	__ATTR(class_id, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(device_id, S_IRUGO, vmbus_show_device_attr, NULL),
-	__ATTR(monitor_id, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(modalias, S_IRUGO, vmbus_show_device_attr, NULL),
 
 	__ATTR(server_monitor_pending, S_IRUGO, vmbus_show_device_attr, NULL),
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index b350a8cf..888a8e53 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -902,7 +902,6 @@ enum vmbus_channel_state {
 struct vmbus_channel_debug_info {
 	uuid_le interfacetype;
 	uuid_le interface_instance;
-	u32 monitorid;
 	u32 servermonitor_pending;
 	u32 servermonitor_latency;
 	u32 servermonitor_connectionid;
-- 
1.8.4.3.gca3854a


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

* [PATCH 04/13] hv: move "modalias" bus attribute to dev_groups
  2013-09-13 18:32 [PATCH 00/13] hv: clean up dev_attr usage Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2013-09-13 18:32 ` [PATCH 03/13] hv: move "monitor_id" " Greg Kroah-Hartman
@ 2013-09-13 18:32 ` Greg Kroah-Hartman
  2013-09-13 18:32 ` [PATCH 05/13] hv: move "class_id" " Greg Kroah-Hartman
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2013-09-13 18:32 UTC (permalink / raw)
  To: kys, haiyangz; +Cc: devel, linux-kernel, Greg Kroah-Hartman

This moves the "state" bus attribute to the dev_groups structure.

Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hv/vmbus_drv.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 2114ecb8..e3f43700 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -131,7 +131,6 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
 {
 	struct hv_device *hv_dev = device_to_hv_device(dev);
 	struct hv_device_info *device_info;
-	char alias_name[VMBUS_ALIAS_LEN + 1];
 	int ret = 0;
 
 	device_info = kzalloc(sizeof(struct hv_device_info), GFP_KERNEL);
@@ -144,9 +143,6 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
 		ret = sprintf(buf, "{%pUl}\n", device_info->chn_type.b);
 	} else if (!strcmp(dev_attr->attr.name, "device_id")) {
 		ret = sprintf(buf, "{%pUl}\n", device_info->chn_instance.b);
-	} else if (!strcmp(dev_attr->attr.name, "modalias")) {
-		print_alias_name(hv_dev, alias_name);
-		ret = sprintf(buf, "vmbus:%s\n", alias_name);
 	} else if (!strcmp(dev_attr->attr.name, "out_intr_mask")) {
 		ret = sprintf(buf, "%d\n", device_info->outbound.int_mask);
 	} else if (!strcmp(dev_attr->attr.name, "out_read_index")) {
@@ -224,10 +220,22 @@ static ssize_t monitor_id_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(monitor_id);
 
+static ssize_t modalias_show(struct device *dev,
+			     struct device_attribute *dev_attr, char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+	char alias_name[VMBUS_ALIAS_LEN + 1];
+
+	print_alias_name(hv_dev, alias_name);
+	return sprintf(buf, "vmbus:%s\n", alias_name);
+}
+static DEVICE_ATTR_RO(modalias);
+
 static struct attribute *vmbus_attrs[] = {
 	&dev_attr_id.attr,
 	&dev_attr_state.attr,
 	&dev_attr_monitor_id.attr,
+	&dev_attr_modalias.attr,
 	NULL,
 };
 ATTRIBUTE_GROUPS(vmbus);
@@ -236,7 +244,6 @@ ATTRIBUTE_GROUPS(vmbus);
 static struct device_attribute vmbus_device_attrs[] = {
 	__ATTR(class_id, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(device_id, S_IRUGO, vmbus_show_device_attr, NULL),
-	__ATTR(modalias, S_IRUGO, vmbus_show_device_attr, NULL),
 
 	__ATTR(server_monitor_pending, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(server_monitor_latency, S_IRUGO, vmbus_show_device_attr, NULL),
-- 
1.8.4.3.gca3854a


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

* [PATCH 05/13] hv: move "class_id" bus attribute to dev_groups
  2013-09-13 18:32 [PATCH 00/13] hv: clean up dev_attr usage Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2013-09-13 18:32 ` [PATCH 04/13] hv: move "modalias" " Greg Kroah-Hartman
@ 2013-09-13 18:32 ` Greg Kroah-Hartman
  2013-09-13 18:32 ` [PATCH 06/13] hv: move "device_id" " Greg Kroah-Hartman
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2013-09-13 18:32 UTC (permalink / raw)
  To: kys, haiyangz; +Cc: devel, linux-kernel, Greg Kroah-Hartman

This moves the "class_id" bus attribute to the dev_groups structure,
removing the need for it to be in a temporary structure.

Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hv/channel.c   |  2 --
 drivers/hv/vmbus_drv.c | 22 +++++++++++++++-------
 include/linux/hyperv.h |  1 -
 3 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index f26a5d25..df9499c1 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -69,8 +69,6 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
 	u8 monitor_group = (u8)channel->offermsg.monitorid / 32;
 	u8 monitor_offset = (u8)channel->offermsg.monitorid % 32;
 
-	memcpy(&debuginfo->interfacetype,
-	       &channel->offermsg.offer.if_type, sizeof(uuid_le));
 	memcpy(&debuginfo->interface_instance,
 	       &channel->offermsg.offer.if_instance,
 	       sizeof(uuid_le));
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index e3f43700..48258ae3 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -47,7 +47,6 @@ static struct completion probe_event;
 static int irq;
 
 struct hv_device_info {
-	uuid_le chn_type;
 	uuid_le chn_instance;
 
 	u32 server_monitor_pending;
@@ -80,8 +79,6 @@ static void get_channel_info(struct hv_device *device,
 
 	vmbus_get_debug_info(device->channel, &debug_info);
 
-	memcpy(&info->chn_type, &debug_info.interfacetype,
-	       sizeof(uuid_le));
 	memcpy(&info->chn_instance, &debug_info.interface_instance,
 	       sizeof(uuid_le));
 
@@ -139,9 +136,7 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
 
 	get_channel_info(hv_dev, device_info);
 
-	if (!strcmp(dev_attr->attr.name, "class_id")) {
-		ret = sprintf(buf, "{%pUl}\n", device_info->chn_type.b);
-	} else if (!strcmp(dev_attr->attr.name, "device_id")) {
+	if (!strcmp(dev_attr->attr.name, "device_id")) {
 		ret = sprintf(buf, "{%pUl}\n", device_info->chn_instance.b);
 	} else if (!strcmp(dev_attr->attr.name, "out_intr_mask")) {
 		ret = sprintf(buf, "%d\n", device_info->outbound.int_mask);
@@ -220,6 +215,18 @@ static ssize_t monitor_id_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(monitor_id);
 
+static ssize_t class_id_show(struct device *dev,
+			       struct device_attribute *dev_attr, char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	return sprintf(buf, "{%pUl}\n",
+		       hv_dev->channel->offermsg.offer.if_type.b);
+}
+static DEVICE_ATTR_RO(class_id);
+
 static ssize_t modalias_show(struct device *dev,
 			     struct device_attribute *dev_attr, char *buf)
 {
@@ -231,10 +238,12 @@ static ssize_t modalias_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(modalias);
 
+
 static struct attribute *vmbus_attrs[] = {
 	&dev_attr_id.attr,
 	&dev_attr_state.attr,
 	&dev_attr_monitor_id.attr,
+	&dev_attr_class_id.attr,
 	&dev_attr_modalias.attr,
 	NULL,
 };
@@ -242,7 +251,6 @@ ATTRIBUTE_GROUPS(vmbus);
 
 /* Set up per device attributes in /sys/bus/vmbus/devices/<bus device> */
 static struct device_attribute vmbus_device_attrs[] = {
-	__ATTR(class_id, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(device_id, S_IRUGO, vmbus_show_device_attr, NULL),
 
 	__ATTR(server_monitor_pending, S_IRUGO, vmbus_show_device_attr, NULL),
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 888a8e53..8ccf6f68 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -900,7 +900,6 @@ enum vmbus_channel_state {
 };
 
 struct vmbus_channel_debug_info {
-	uuid_le interfacetype;
 	uuid_le interface_instance;
 	u32 servermonitor_pending;
 	u32 servermonitor_latency;
-- 
1.8.4.3.gca3854a


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

* [PATCH 06/13] hv: move "device_id" bus attribute to dev_groups
  2013-09-13 18:32 [PATCH 00/13] hv: clean up dev_attr usage Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2013-09-13 18:32 ` [PATCH 05/13] hv: move "class_id" " Greg Kroah-Hartman
@ 2013-09-13 18:32 ` Greg Kroah-Hartman
  2013-09-13 18:32 ` [PATCH 07/13] hv: make "monitor_pages" a "real" pointer array Greg Kroah-Hartman
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2013-09-13 18:32 UTC (permalink / raw)
  To: kys, haiyangz; +Cc: devel, linux-kernel, Greg Kroah-Hartman

This moves the "device_id" bus attribute to the dev_groups structure,
removing the need for it to be in a temporary structure.

Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hv/channel.c   |  4 ----
 drivers/hv/vmbus_drv.c | 24 ++++++++++++++----------
 include/linux/hyperv.h |  1 -
 3 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index df9499c1..dde30b48 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -69,10 +69,6 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
 	u8 monitor_group = (u8)channel->offermsg.monitorid / 32;
 	u8 monitor_offset = (u8)channel->offermsg.monitorid % 32;
 
-	memcpy(&debuginfo->interface_instance,
-	       &channel->offermsg.offer.if_instance,
-	       sizeof(uuid_le));
-
 	monitorpage = (struct hv_monitor_page *)vmbus_connection.monitor_pages;
 
 	debuginfo->servermonitor_pending =
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 48258ae3..944dc4b0 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -47,8 +47,6 @@ static struct completion probe_event;
 static int irq;
 
 struct hv_device_info {
-	uuid_le chn_instance;
-
 	u32 server_monitor_pending;
 	u32 server_monitor_latency;
 	u32 server_monitor_conn_id;
@@ -79,9 +77,6 @@ static void get_channel_info(struct hv_device *device,
 
 	vmbus_get_debug_info(device->channel, &debug_info);
 
-	memcpy(&info->chn_instance, &debug_info.interface_instance,
-	       sizeof(uuid_le));
-
 	info->server_monitor_pending = debug_info.servermonitor_pending;
 	info->server_monitor_latency = debug_info.servermonitor_latency;
 	info->server_monitor_conn_id = debug_info.servermonitor_connectionid;
@@ -136,9 +131,7 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
 
 	get_channel_info(hv_dev, device_info);
 
-	if (!strcmp(dev_attr->attr.name, "device_id")) {
-		ret = sprintf(buf, "{%pUl}\n", device_info->chn_instance.b);
-	} else if (!strcmp(dev_attr->attr.name, "out_intr_mask")) {
+	if (!strcmp(dev_attr->attr.name, "out_intr_mask")) {
 		ret = sprintf(buf, "%d\n", device_info->outbound.int_mask);
 	} else if (!strcmp(dev_attr->attr.name, "out_read_index")) {
 		ret = sprintf(buf, "%d\n", device_info->outbound.read_idx);
@@ -227,6 +220,18 @@ static ssize_t class_id_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(class_id);
 
+static ssize_t device_id_show(struct device *dev,
+			      struct device_attribute *dev_attr, char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	return sprintf(buf, "{%pUl}\n",
+		       hv_dev->channel->offermsg.offer.if_instance.b);
+}
+static DEVICE_ATTR_RO(device_id);
+
 static ssize_t modalias_show(struct device *dev,
 			     struct device_attribute *dev_attr, char *buf)
 {
@@ -244,6 +249,7 @@ static struct attribute *vmbus_attrs[] = {
 	&dev_attr_state.attr,
 	&dev_attr_monitor_id.attr,
 	&dev_attr_class_id.attr,
+	&dev_attr_device_id.attr,
 	&dev_attr_modalias.attr,
 	NULL,
 };
@@ -251,8 +257,6 @@ ATTRIBUTE_GROUPS(vmbus);
 
 /* Set up per device attributes in /sys/bus/vmbus/devices/<bus device> */
 static struct device_attribute vmbus_device_attrs[] = {
-	__ATTR(device_id, S_IRUGO, vmbus_show_device_attr, NULL),
-
 	__ATTR(server_monitor_pending, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(server_monitor_latency, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(server_monitor_conn_id, S_IRUGO, vmbus_show_device_attr, NULL),
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 8ccf6f68..687c01b8 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -900,7 +900,6 @@ enum vmbus_channel_state {
 };
 
 struct vmbus_channel_debug_info {
-	uuid_le interface_instance;
 	u32 servermonitor_pending;
 	u32 servermonitor_latency;
 	u32 servermonitor_connectionid;
-- 
1.8.4.3.gca3854a


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

* [PATCH 07/13] hv: make "monitor_pages" a "real" pointer array
  2013-09-13 18:32 [PATCH 00/13] hv: clean up dev_attr usage Greg Kroah-Hartman
                   ` (5 preceding siblings ...)
  2013-09-13 18:32 ` [PATCH 06/13] hv: move "device_id" " Greg Kroah-Hartman
@ 2013-09-13 18:32 ` Greg Kroah-Hartman
  2013-09-13 18:32 ` [PATCH 08/13] hv: move "client/server_monitor_pending" bus attributes to dev_groups Greg Kroah-Hartman
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2013-09-13 18:32 UTC (permalink / raw)
  To: kys, haiyangz; +Cc: devel, linux-kernel, Greg Kroah-Hartman

monitor_pages was a void pointer, containing an unknown number of arrays that
we just "knew" were a child and parent array of a specific size.  Instead of
that implicit knowledge, let's make them a real pointer, allowing us to have
type safety, and a semblance of sane addressing schemes.

Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hv/channel.c      | 10 ++++------
 drivers/hv/connection.c   | 21 ++++++++++-----------
 drivers/hv/hyperv_vmbus.h |  2 +-
 3 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index dde30b48..04bf0656 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -47,8 +47,8 @@ static void vmbus_setevent(struct vmbus_channel *channel)
 			(unsigned long *) vmbus_connection.send_int_page +
 			(channel->offermsg.child_relid >> 5));
 
-		monitorpage = vmbus_connection.monitor_pages;
-		monitorpage++; /* Get the child to parent monitor page */
+		/* Get the child to parent monitor page */
+		monitorpage = vmbus_connection.monitor_pages[1];
 
 		sync_set_bit(channel->monitor_bit,
 			(unsigned long *)&monitorpage->trigger_group
@@ -69,8 +69,7 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
 	u8 monitor_group = (u8)channel->offermsg.monitorid / 32;
 	u8 monitor_offset = (u8)channel->offermsg.monitorid % 32;
 
-	monitorpage = (struct hv_monitor_page *)vmbus_connection.monitor_pages;
-
+	monitorpage = vmbus_connection.monitor_pages[0];
 	debuginfo->servermonitor_pending =
 			monitorpage->trigger_group[monitor_group].pending;
 	debuginfo->servermonitor_latency =
@@ -79,8 +78,7 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
 			monitorpage->parameter[monitor_group]
 					[monitor_offset].connectionid.u.id;
 
-	monitorpage++;
-
+	monitorpage = vmbus_connection.monitor_pages[1];
 	debuginfo->clientmonitor_pending =
 			monitorpage->trigger_group[monitor_group].pending;
 	debuginfo->clientmonitor_latency =
diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index 8f4743ab..4faea979 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -76,10 +76,8 @@ static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo,
 	msg->header.msgtype = CHANNELMSG_INITIATE_CONTACT;
 	msg->vmbus_version_requested = version;
 	msg->interrupt_page = virt_to_phys(vmbus_connection.int_page);
-	msg->monitor_page1 = virt_to_phys(vmbus_connection.monitor_pages);
-	msg->monitor_page2 = virt_to_phys(
-			(void *)((unsigned long)vmbus_connection.monitor_pages +
-				 PAGE_SIZE));
+	msg->monitor_page1 = virt_to_phys(vmbus_connection.monitor_pages[0]);
+	msg->monitor_page2 = virt_to_phys(vmbus_connection.monitor_pages[1]);
 
 	/*
 	 * Add to list before we send the request since we may
@@ -169,9 +167,10 @@ int vmbus_connect(void)
 	 * Setup the monitor notification facility. The 1st page for
 	 * parent->child and the 2nd page for child->parent
 	 */
-	vmbus_connection.monitor_pages =
-	(void *)__get_free_pages((GFP_KERNEL|__GFP_ZERO), 1);
-	if (vmbus_connection.monitor_pages == NULL) {
+	vmbus_connection.monitor_pages[0] = (void *)__get_free_pages((GFP_KERNEL|__GFP_ZERO), 0);
+	vmbus_connection.monitor_pages[1] = (void *)__get_free_pages((GFP_KERNEL|__GFP_ZERO), 0);
+	if ((vmbus_connection.monitor_pages[0] == NULL) ||
+	    (vmbus_connection.monitor_pages[1] == NULL)) {
 		ret = -ENOMEM;
 		goto cleanup;
 	}
@@ -229,10 +228,10 @@ cleanup:
 		vmbus_connection.int_page = NULL;
 	}
 
-	if (vmbus_connection.monitor_pages) {
-		free_pages((unsigned long)vmbus_connection.monitor_pages, 1);
-		vmbus_connection.monitor_pages = NULL;
-	}
+	free_pages((unsigned long)vmbus_connection.monitor_pages[0], 1);
+	free_pages((unsigned long)vmbus_connection.monitor_pages[1], 1);
+	vmbus_connection.monitor_pages[0] = NULL;
+	vmbus_connection.monitor_pages[1] = NULL;
 
 	kfree(msginfo);
 
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index d84918fe..d58c22ff 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -612,7 +612,7 @@ struct vmbus_connection {
 	 * 2 pages - 1st page for parent->child notification and 2nd
 	 * is child->parent notification
 	 */
-	void *monitor_pages;
+	struct hv_monitor_page *monitor_pages[2];
 	struct list_head chn_msg_list;
 	spinlock_t channelmsg_lock;
 
-- 
1.8.4.3.gca3854a


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

* [PATCH 08/13] hv: move "client/server_monitor_pending" bus attributes to dev_groups
  2013-09-13 18:32 [PATCH 00/13] hv: clean up dev_attr usage Greg Kroah-Hartman
                   ` (6 preceding siblings ...)
  2013-09-13 18:32 ` [PATCH 07/13] hv: make "monitor_pages" a "real" pointer array Greg Kroah-Hartman
@ 2013-09-13 18:32 ` Greg Kroah-Hartman
  2013-09-13 18:32 ` [PATCH 09/13] hv: move "client/server_monitor_latency" " Greg Kroah-Hartman
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2013-09-13 18:32 UTC (permalink / raw)
  To: kys, haiyangz; +Cc: devel, linux-kernel, Greg Kroah-Hartman

This moves the "client_monitor_pending" and "server_monitor_pending" bus
attributes to the dev_groups structure, removing the need for it to be
in a temporary structure.

Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hv/channel.c   |  4 ----
 drivers/hv/vmbus_drv.c | 56 +++++++++++++++++++++++++++++++++++++++++---------
 include/linux/hyperv.h |  2 --
 3 files changed, 46 insertions(+), 16 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 04bf0656..d600360e 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -70,8 +70,6 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
 	u8 monitor_offset = (u8)channel->offermsg.monitorid % 32;
 
 	monitorpage = vmbus_connection.monitor_pages[0];
-	debuginfo->servermonitor_pending =
-			monitorpage->trigger_group[monitor_group].pending;
 	debuginfo->servermonitor_latency =
 			monitorpage->latency[monitor_group][monitor_offset];
 	debuginfo->servermonitor_connectionid =
@@ -79,8 +77,6 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
 					[monitor_offset].connectionid.u.id;
 
 	monitorpage = vmbus_connection.monitor_pages[1];
-	debuginfo->clientmonitor_pending =
-			monitorpage->trigger_group[monitor_group].pending;
 	debuginfo->clientmonitor_latency =
 			monitorpage->latency[monitor_group][monitor_offset];
 	debuginfo->clientmonitor_connectionid =
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 944dc4b0..5a44957b 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -47,10 +47,8 @@ static struct completion probe_event;
 static int irq;
 
 struct hv_device_info {
-	u32 server_monitor_pending;
 	u32 server_monitor_latency;
 	u32 server_monitor_conn_id;
-	u32 client_monitor_pending;
 	u32 client_monitor_latency;
 	u32 client_monitor_conn_id;
 
@@ -77,11 +75,9 @@ static void get_channel_info(struct hv_device *device,
 
 	vmbus_get_debug_info(device->channel, &debug_info);
 
-	info->server_monitor_pending = debug_info.servermonitor_pending;
 	info->server_monitor_latency = debug_info.servermonitor_latency;
 	info->server_monitor_conn_id = debug_info.servermonitor_connectionid;
 
-	info->client_monitor_pending = debug_info.clientmonitor_pending;
 	info->client_monitor_latency = debug_info.clientmonitor_latency;
 	info->client_monitor_conn_id = debug_info.clientmonitor_connectionid;
 
@@ -155,15 +151,11 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
 	} else if (!strcmp(dev_attr->attr.name, "in_write_bytes_avail")) {
 		ret = sprintf(buf, "%d\n",
 			       device_info->inbound.bytes_avail_towrite);
-	} else if (!strcmp(dev_attr->attr.name, "server_monitor_pending")) {
-		ret = sprintf(buf, "%d\n", device_info->server_monitor_pending);
 	} else if (!strcmp(dev_attr->attr.name, "server_monitor_latency")) {
 		ret = sprintf(buf, "%d\n", device_info->server_monitor_latency);
 	} else if (!strcmp(dev_attr->attr.name, "server_monitor_conn_id")) {
 		ret = sprintf(buf, "%d\n",
 			       device_info->server_monitor_conn_id);
-	} else if (!strcmp(dev_attr->attr.name, "client_monitor_pending")) {
-		ret = sprintf(buf, "%d\n", device_info->client_monitor_pending);
 	} else if (!strcmp(dev_attr->attr.name, "client_monitor_latency")) {
 		ret = sprintf(buf, "%d\n", device_info->client_monitor_latency);
 	} else if (!strcmp(dev_attr->attr.name, "client_monitor_conn_id")) {
@@ -175,6 +167,23 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
 	return ret;
 }
 
+static u8 channel_monitor_group(struct vmbus_channel *channel)
+{
+	return (u8)channel->offermsg.monitorid / 32;
+}
+
+static u8 channel_monitor_offset(struct vmbus_channel *channel)
+{
+	return (u8)channel->offermsg.monitorid % 32;
+}
+
+static u32 channel_pending(struct vmbus_channel *channel,
+			   struct hv_monitor_page *monitor_page)
+{
+	u8 monitor_group = channel_monitor_group(channel);
+	return monitor_page->trigger_group[monitor_group].pending;
+}
+
 static ssize_t id_show(struct device *dev, struct device_attribute *dev_attr,
 		       char *buf)
 {
@@ -243,6 +252,33 @@ static ssize_t modalias_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(modalias);
 
+static ssize_t server_monitor_pending_show(struct device *dev,
+					   struct device_attribute *dev_attr,
+					   char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	return sprintf(buf, "%d\n",
+		       channel_pending(hv_dev->channel,
+				       vmbus_connection.monitor_pages[1]));
+}
+static DEVICE_ATTR_RO(server_monitor_pending);
+
+static ssize_t client_monitor_pending_show(struct device *dev,
+					   struct device_attribute *dev_attr,
+					   char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	return sprintf(buf, "%d\n",
+		       channel_pending(hv_dev->channel,
+				       vmbus_connection.monitor_pages[1]));
+}
+static DEVICE_ATTR_RO(client_monitor_pending);
 
 static struct attribute *vmbus_attrs[] = {
 	&dev_attr_id.attr,
@@ -251,17 +287,17 @@ static struct attribute *vmbus_attrs[] = {
 	&dev_attr_class_id.attr,
 	&dev_attr_device_id.attr,
 	&dev_attr_modalias.attr,
+	&dev_attr_server_monitor_pending.attr,
+	&dev_attr_client_monitor_pending.attr,
 	NULL,
 };
 ATTRIBUTE_GROUPS(vmbus);
 
 /* Set up per device attributes in /sys/bus/vmbus/devices/<bus device> */
 static struct device_attribute vmbus_device_attrs[] = {
-	__ATTR(server_monitor_pending, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(server_monitor_latency, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(server_monitor_conn_id, S_IRUGO, vmbus_show_device_attr, NULL),
 
-	__ATTR(client_monitor_pending, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(client_monitor_latency, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(client_monitor_conn_id, S_IRUGO, vmbus_show_device_attr, NULL),
 
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 687c01b8..f0a7d27f 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -900,10 +900,8 @@ enum vmbus_channel_state {
 };
 
 struct vmbus_channel_debug_info {
-	u32 servermonitor_pending;
 	u32 servermonitor_latency;
 	u32 servermonitor_connectionid;
-	u32 clientmonitor_pending;
 	u32 clientmonitor_latency;
 	u32 clientmonitor_connectionid;
 
-- 
1.8.4.3.gca3854a


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

* [PATCH 09/13] hv: move "client/server_monitor_latency" bus attributes to dev_groups
  2013-09-13 18:32 [PATCH 00/13] hv: clean up dev_attr usage Greg Kroah-Hartman
                   ` (7 preceding siblings ...)
  2013-09-13 18:32 ` [PATCH 08/13] hv: move "client/server_monitor_pending" bus attributes to dev_groups Greg Kroah-Hartman
@ 2013-09-13 18:32 ` Greg Kroah-Hartman
  2013-09-13 18:32 ` [PATCH 10/13] hv: move "client/server_monitor_conn_id" " Greg Kroah-Hartman
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2013-09-13 18:32 UTC (permalink / raw)
  To: kys, haiyangz; +Cc: devel, linux-kernel, Greg Kroah-Hartman

This moves the "client_monitor_latency" and "server_monitor_latency" bus
attributes to the dev_groups structure, removing the need for it to be
in a temporary structure.

Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hv/channel.c   |  4 ----
 drivers/hv/vmbus_drv.c | 48 ++++++++++++++++++++++++++++++++++++++----------
 include/linux/hyperv.h |  2 --
 3 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index d600360e..ff61464f 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -70,15 +70,11 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
 	u8 monitor_offset = (u8)channel->offermsg.monitorid % 32;
 
 	monitorpage = vmbus_connection.monitor_pages[0];
-	debuginfo->servermonitor_latency =
-			monitorpage->latency[monitor_group][monitor_offset];
 	debuginfo->servermonitor_connectionid =
 			monitorpage->parameter[monitor_group]
 					[monitor_offset].connectionid.u.id;
 
 	monitorpage = vmbus_connection.monitor_pages[1];
-	debuginfo->clientmonitor_latency =
-			monitorpage->latency[monitor_group][monitor_offset];
 	debuginfo->clientmonitor_connectionid =
 			monitorpage->parameter[monitor_group]
 					[monitor_offset].connectionid.u.id;
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 5a44957b..461b9898 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -47,9 +47,7 @@ static struct completion probe_event;
 static int irq;
 
 struct hv_device_info {
-	u32 server_monitor_latency;
 	u32 server_monitor_conn_id;
-	u32 client_monitor_latency;
 	u32 client_monitor_conn_id;
 
 	struct hv_dev_port_info inbound;
@@ -75,10 +73,8 @@ static void get_channel_info(struct hv_device *device,
 
 	vmbus_get_debug_info(device->channel, &debug_info);
 
-	info->server_monitor_latency = debug_info.servermonitor_latency;
 	info->server_monitor_conn_id = debug_info.servermonitor_connectionid;
 
-	info->client_monitor_latency = debug_info.clientmonitor_latency;
 	info->client_monitor_conn_id = debug_info.clientmonitor_connectionid;
 
 	info->inbound.int_mask = debug_info.inbound.current_interrupt_mask;
@@ -151,13 +147,9 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
 	} else if (!strcmp(dev_attr->attr.name, "in_write_bytes_avail")) {
 		ret = sprintf(buf, "%d\n",
 			       device_info->inbound.bytes_avail_towrite);
-	} else if (!strcmp(dev_attr->attr.name, "server_monitor_latency")) {
-		ret = sprintf(buf, "%d\n", device_info->server_monitor_latency);
 	} else if (!strcmp(dev_attr->attr.name, "server_monitor_conn_id")) {
 		ret = sprintf(buf, "%d\n",
 			       device_info->server_monitor_conn_id);
-	} else if (!strcmp(dev_attr->attr.name, "client_monitor_latency")) {
-		ret = sprintf(buf, "%d\n", device_info->client_monitor_latency);
 	} else if (!strcmp(dev_attr->attr.name, "client_monitor_conn_id")) {
 		ret = sprintf(buf, "%d\n",
 			       device_info->client_monitor_conn_id);
@@ -184,6 +176,14 @@ static u32 channel_pending(struct vmbus_channel *channel,
 	return monitor_page->trigger_group[monitor_group].pending;
 }
 
+static u32 channel_latency(struct vmbus_channel *channel,
+			   struct hv_monitor_page *monitor_page)
+{
+	u8 monitor_group = channel_monitor_group(channel);
+	u8 monitor_offset = channel_monitor_offset(channel);
+	return monitor_page->latency[monitor_group][monitor_offset];
+}
+
 static ssize_t id_show(struct device *dev, struct device_attribute *dev_attr,
 		       char *buf)
 {
@@ -280,6 +280,34 @@ static ssize_t client_monitor_pending_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(client_monitor_pending);
 
+static ssize_t server_monitor_latency_show(struct device *dev,
+					   struct device_attribute *dev_attr,
+					   char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	return sprintf(buf, "%d\n",
+		       channel_latency(hv_dev->channel,
+				       vmbus_connection.monitor_pages[0]));
+}
+static DEVICE_ATTR_RO(server_monitor_latency);
+
+static ssize_t client_monitor_latency_show(struct device *dev,
+					   struct device_attribute *dev_attr,
+					   char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	return sprintf(buf, "%d\n",
+		       channel_latency(hv_dev->channel,
+				       vmbus_connection.monitor_pages[1]));
+}
+static DEVICE_ATTR_RO(client_monitor_latency);
+
 static struct attribute *vmbus_attrs[] = {
 	&dev_attr_id.attr,
 	&dev_attr_state.attr,
@@ -289,16 +317,16 @@ static struct attribute *vmbus_attrs[] = {
 	&dev_attr_modalias.attr,
 	&dev_attr_server_monitor_pending.attr,
 	&dev_attr_client_monitor_pending.attr,
+	&dev_attr_server_monitor_latency.attr,
+	&dev_attr_client_monitor_latency.attr,
 	NULL,
 };
 ATTRIBUTE_GROUPS(vmbus);
 
 /* Set up per device attributes in /sys/bus/vmbus/devices/<bus device> */
 static struct device_attribute vmbus_device_attrs[] = {
-	__ATTR(server_monitor_latency, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(server_monitor_conn_id, S_IRUGO, vmbus_show_device_attr, NULL),
 
-	__ATTR(client_monitor_latency, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(client_monitor_conn_id, S_IRUGO, vmbus_show_device_attr, NULL),
 
 	__ATTR(out_intr_mask, S_IRUGO, vmbus_show_device_attr, NULL),
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index f0a7d27f..ec1e5033 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -900,9 +900,7 @@ enum vmbus_channel_state {
 };
 
 struct vmbus_channel_debug_info {
-	u32 servermonitor_latency;
 	u32 servermonitor_connectionid;
-	u32 clientmonitor_latency;
 	u32 clientmonitor_connectionid;
 
 	struct hv_ring_buffer_debug_info inbound;
-- 
1.8.4.3.gca3854a


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

* [PATCH 10/13] hv: move "client/server_monitor_conn_id" bus attributes to dev_groups
  2013-09-13 18:32 [PATCH 00/13] hv: clean up dev_attr usage Greg Kroah-Hartman
                   ` (8 preceding siblings ...)
  2013-09-13 18:32 ` [PATCH 09/13] hv: move "client/server_monitor_latency" " Greg Kroah-Hartman
@ 2013-09-13 18:32 ` Greg Kroah-Hartman
  2013-09-13 18:32 ` [PATCH 11/13] hv: delete vmbus_get_debug_info() Greg Kroah-Hartman
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2013-09-13 18:32 UTC (permalink / raw)
  To: kys, haiyangz; +Cc: devel, linux-kernel, Greg Kroah-Hartman

This moves the "client_monitor_conn_id" and "server_monitor_conn_id" bus
attributes to the dev_groups structure, removing the need for it to be
in a temporary structure.

Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hv/channel.c   | 14 -------------
 drivers/hv/vmbus_drv.c | 55 ++++++++++++++++++++++++++++++++++----------------
 include/linux/hyperv.h |  3 ---
 3 files changed, 38 insertions(+), 34 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index ff61464f..75c26da3 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -65,20 +65,6 @@ static void vmbus_setevent(struct vmbus_channel *channel)
 void vmbus_get_debug_info(struct vmbus_channel *channel,
 			      struct vmbus_channel_debug_info *debuginfo)
 {
-	struct hv_monitor_page *monitorpage;
-	u8 monitor_group = (u8)channel->offermsg.monitorid / 32;
-	u8 monitor_offset = (u8)channel->offermsg.monitorid % 32;
-
-	monitorpage = vmbus_connection.monitor_pages[0];
-	debuginfo->servermonitor_connectionid =
-			monitorpage->parameter[monitor_group]
-					[monitor_offset].connectionid.u.id;
-
-	monitorpage = vmbus_connection.monitor_pages[1];
-	debuginfo->clientmonitor_connectionid =
-			monitorpage->parameter[monitor_group]
-					[monitor_offset].connectionid.u.id;
-
 	hv_ringbuffer_get_debuginfo(&channel->inbound, &debuginfo->inbound);
 	hv_ringbuffer_get_debuginfo(&channel->outbound, &debuginfo->outbound);
 }
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 461b9898..73cb456e 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -47,9 +47,6 @@ static struct completion probe_event;
 static int irq;
 
 struct hv_device_info {
-	u32 server_monitor_conn_id;
-	u32 client_monitor_conn_id;
-
 	struct hv_dev_port_info inbound;
 	struct hv_dev_port_info outbound;
 };
@@ -73,10 +70,6 @@ static void get_channel_info(struct hv_device *device,
 
 	vmbus_get_debug_info(device->channel, &debug_info);
 
-	info->server_monitor_conn_id = debug_info.servermonitor_connectionid;
-
-	info->client_monitor_conn_id = debug_info.clientmonitor_connectionid;
-
 	info->inbound.int_mask = debug_info.inbound.current_interrupt_mask;
 	info->inbound.read_idx = debug_info.inbound.current_read_index;
 	info->inbound.write_idx = debug_info.inbound.current_write_index;
@@ -147,12 +140,6 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
 	} else if (!strcmp(dev_attr->attr.name, "in_write_bytes_avail")) {
 		ret = sprintf(buf, "%d\n",
 			       device_info->inbound.bytes_avail_towrite);
-	} else if (!strcmp(dev_attr->attr.name, "server_monitor_conn_id")) {
-		ret = sprintf(buf, "%d\n",
-			       device_info->server_monitor_conn_id);
-	} else if (!strcmp(dev_attr->attr.name, "client_monitor_conn_id")) {
-		ret = sprintf(buf, "%d\n",
-			       device_info->client_monitor_conn_id);
 	}
 
 	kfree(device_info);
@@ -184,6 +171,14 @@ static u32 channel_latency(struct vmbus_channel *channel,
 	return monitor_page->latency[monitor_group][monitor_offset];
 }
 
+static u32 channel_conn_id(struct vmbus_channel *channel,
+			   struct hv_monitor_page *monitor_page)
+{
+	u8 monitor_group = channel_monitor_group(channel);
+	u8 monitor_offset = channel_monitor_offset(channel);
+	return monitor_page->parameter[monitor_group][monitor_offset].connectionid.u.id;
+}
+
 static ssize_t id_show(struct device *dev, struct device_attribute *dev_attr,
 		       char *buf)
 {
@@ -308,6 +303,34 @@ static ssize_t client_monitor_latency_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(client_monitor_latency);
 
+static ssize_t server_monitor_conn_id_show(struct device *dev,
+					   struct device_attribute *dev_attr,
+					   char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	return sprintf(buf, "%d\n",
+		       channel_conn_id(hv_dev->channel,
+				       vmbus_connection.monitor_pages[0]));
+}
+static DEVICE_ATTR_RO(server_monitor_conn_id);
+
+static ssize_t client_monitor_conn_id_show(struct device *dev,
+					   struct device_attribute *dev_attr,
+					   char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	return sprintf(buf, "%d\n",
+		       channel_conn_id(hv_dev->channel,
+				       vmbus_connection.monitor_pages[1]));
+}
+static DEVICE_ATTR_RO(client_monitor_conn_id);
+
 static struct attribute *vmbus_attrs[] = {
 	&dev_attr_id.attr,
 	&dev_attr_state.attr,
@@ -319,16 +342,14 @@ static struct attribute *vmbus_attrs[] = {
 	&dev_attr_client_monitor_pending.attr,
 	&dev_attr_server_monitor_latency.attr,
 	&dev_attr_client_monitor_latency.attr,
+	&dev_attr_server_monitor_conn_id.attr,
+	&dev_attr_client_monitor_conn_id.attr,
 	NULL,
 };
 ATTRIBUTE_GROUPS(vmbus);
 
 /* Set up per device attributes in /sys/bus/vmbus/devices/<bus device> */
 static struct device_attribute vmbus_device_attrs[] = {
-	__ATTR(server_monitor_conn_id, S_IRUGO, vmbus_show_device_attr, NULL),
-
-	__ATTR(client_monitor_conn_id, S_IRUGO, vmbus_show_device_attr, NULL),
-
 	__ATTR(out_intr_mask, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(out_read_index, S_IRUGO, vmbus_show_device_attr, NULL),
 	__ATTR(out_write_index, S_IRUGO, vmbus_show_device_attr, NULL),
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index ec1e5033..332e80ce 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -900,9 +900,6 @@ enum vmbus_channel_state {
 };
 
 struct vmbus_channel_debug_info {
-	u32 servermonitor_connectionid;
-	u32 clientmonitor_connectionid;
-
 	struct hv_ring_buffer_debug_info inbound;
 	struct hv_ring_buffer_debug_info outbound;
 };
-- 
1.8.4.3.gca3854a


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

* [PATCH 11/13] hv: delete vmbus_get_debug_info()
  2013-09-13 18:32 [PATCH 00/13] hv: clean up dev_attr usage Greg Kroah-Hartman
                   ` (9 preceding siblings ...)
  2013-09-13 18:32 ` [PATCH 10/13] hv: move "client/server_monitor_conn_id" " Greg Kroah-Hartman
@ 2013-09-13 18:32 ` Greg Kroah-Hartman
  2013-09-13 18:33 ` [PATCH 12/13] hv: delete struct hv_dev_port_info Greg Kroah-Hartman
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2013-09-13 18:32 UTC (permalink / raw)
  To: kys, haiyangz; +Cc: devel, linux-kernel, Greg Kroah-Hartman

It's only used once, only contains 2 function calls, so just make those
calls directly, deleting the function, and the now unneeded structure
entirely.

Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hv/channel.c   | 10 ----------
 drivers/hv/vmbus_drv.c | 35 ++++++++++++++++-------------------
 include/linux/hyperv.h |  8 --------
 3 files changed, 16 insertions(+), 37 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 75c26da3..94d54591 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -60,16 +60,6 @@ static void vmbus_setevent(struct vmbus_channel *channel)
 }
 
 /*
- * vmbus_get_debug_info -Retrieve various channel debug info
- */
-void vmbus_get_debug_info(struct vmbus_channel *channel,
-			      struct vmbus_channel_debug_info *debuginfo)
-{
-	hv_ringbuffer_get_debuginfo(&channel->inbound, &debuginfo->inbound);
-	hv_ringbuffer_get_debuginfo(&channel->outbound, &debuginfo->outbound);
-}
-
-/*
  * vmbus_open - Open the specified channel.
  */
 int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 73cb456e..62d9311b 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -63,29 +63,26 @@ static int vmbus_exists(void)
 static void get_channel_info(struct hv_device *device,
 			     struct hv_device_info *info)
 {
-	struct vmbus_channel_debug_info debug_info;
+	struct hv_ring_buffer_debug_info inbound;
+	struct hv_ring_buffer_debug_info outbound;
 
 	if (!device->channel)
 		return;
 
-	vmbus_get_debug_info(device->channel, &debug_info);
-
-	info->inbound.int_mask = debug_info.inbound.current_interrupt_mask;
-	info->inbound.read_idx = debug_info.inbound.current_read_index;
-	info->inbound.write_idx = debug_info.inbound.current_write_index;
-	info->inbound.bytes_avail_toread =
-		debug_info.inbound.bytes_avail_toread;
-	info->inbound.bytes_avail_towrite =
-		debug_info.inbound.bytes_avail_towrite;
-
-	info->outbound.int_mask =
-		debug_info.outbound.current_interrupt_mask;
-	info->outbound.read_idx = debug_info.outbound.current_read_index;
-	info->outbound.write_idx = debug_info.outbound.current_write_index;
-	info->outbound.bytes_avail_toread =
-		debug_info.outbound.bytes_avail_toread;
-	info->outbound.bytes_avail_towrite =
-		debug_info.outbound.bytes_avail_towrite;
+	hv_ringbuffer_get_debuginfo(&device->channel->inbound, &inbound);
+	hv_ringbuffer_get_debuginfo(&device->channel->outbound, &outbound);
+
+	info->inbound.int_mask = inbound.current_interrupt_mask;
+	info->inbound.read_idx = inbound.current_read_index;
+	info->inbound.write_idx = inbound.current_write_index;
+	info->inbound.bytes_avail_toread = inbound.bytes_avail_toread;
+	info->inbound.bytes_avail_towrite = inbound.bytes_avail_towrite;
+
+	info->outbound.int_mask = outbound.current_interrupt_mask;
+	info->outbound.read_idx = outbound.current_read_index;
+	info->outbound.write_idx = outbound.current_write_index;
+	info->outbound.bytes_avail_toread = outbound.bytes_avail_toread;
+	info->outbound.bytes_avail_towrite = outbound.bytes_avail_towrite;
 }
 
 #define VMBUS_ALIAS_LEN ((sizeof((struct hv_vmbus_device_id *)0)->guid) * 2)
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 332e80ce..c0e8faf4 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -899,11 +899,6 @@ enum vmbus_channel_state {
 	CHANNEL_OPENED_STATE,
 };
 
-struct vmbus_channel_debug_info {
-	struct hv_ring_buffer_debug_info inbound;
-	struct hv_ring_buffer_debug_info outbound;
-};
-
 /*
  * Represents each channel msg on the vmbus connection This is a
  * variable-size data structure depending on the msg type itself
@@ -1169,9 +1164,6 @@ extern int vmbus_recvpacket_raw(struct vmbus_channel *channel,
 				     u64 *requestid);
 
 
-extern void vmbus_get_debug_info(struct vmbus_channel *channel,
-				     struct vmbus_channel_debug_info *debug);
-
 extern void vmbus_ontimer(unsigned long data);
 
 struct hv_dev_port_info {
-- 
1.8.4.3.gca3854a


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

* [PATCH 12/13] hv: delete struct hv_dev_port_info
  2013-09-13 18:32 [PATCH 00/13] hv: clean up dev_attr usage Greg Kroah-Hartman
                   ` (10 preceding siblings ...)
  2013-09-13 18:32 ` [PATCH 11/13] hv: delete vmbus_get_debug_info() Greg Kroah-Hartman
@ 2013-09-13 18:33 ` Greg Kroah-Hartman
  2013-09-13 18:33 ` [PATCH 13/13] hv: move ringbuffer bus attributes to dev_groups Greg Kroah-Hartman
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2013-09-13 18:33 UTC (permalink / raw)
  To: kys, haiyangz; +Cc: devel, linux-kernel, Greg Kroah-Hartman

It's no longer needed, and the struct hv_ring_buffer_debug_info
structure shouldn't be "global" so move it to the local .h file instead.


Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hv/hyperv_vmbus.h |  7 +++++++
 drivers/hv/vmbus_drv.c    | 35 ++++++++++-------------------------
 include/linux/hyperv.h    | 17 -----------------
 3 files changed, 17 insertions(+), 42 deletions(-)

diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index d58c22ff..e0551761 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -514,6 +514,13 @@ struct hv_context {
 
 extern struct hv_context hv_context;
 
+struct hv_ring_buffer_debug_info {
+	u32 current_interrupt_mask;
+	u32 current_read_index;
+	u32 current_write_index;
+	u32 bytes_avail_toread;
+	u32 bytes_avail_towrite;
+};
 
 /* Hv Interface */
 
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 62d9311b..cf3220e8 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -47,8 +47,8 @@ static struct completion probe_event;
 static int irq;
 
 struct hv_device_info {
-	struct hv_dev_port_info inbound;
-	struct hv_dev_port_info outbound;
+	struct hv_ring_buffer_debug_info inbound;
+	struct hv_ring_buffer_debug_info outbound;
 };
 
 static int vmbus_exists(void)
@@ -63,26 +63,11 @@ static int vmbus_exists(void)
 static void get_channel_info(struct hv_device *device,
 			     struct hv_device_info *info)
 {
-	struct hv_ring_buffer_debug_info inbound;
-	struct hv_ring_buffer_debug_info outbound;
-
 	if (!device->channel)
 		return;
 
-	hv_ringbuffer_get_debuginfo(&device->channel->inbound, &inbound);
-	hv_ringbuffer_get_debuginfo(&device->channel->outbound, &outbound);
-
-	info->inbound.int_mask = inbound.current_interrupt_mask;
-	info->inbound.read_idx = inbound.current_read_index;
-	info->inbound.write_idx = inbound.current_write_index;
-	info->inbound.bytes_avail_toread = inbound.bytes_avail_toread;
-	info->inbound.bytes_avail_towrite = inbound.bytes_avail_towrite;
-
-	info->outbound.int_mask = outbound.current_interrupt_mask;
-	info->outbound.read_idx = outbound.current_read_index;
-	info->outbound.write_idx = outbound.current_write_index;
-	info->outbound.bytes_avail_toread = outbound.bytes_avail_toread;
-	info->outbound.bytes_avail_towrite = outbound.bytes_avail_towrite;
+	hv_ringbuffer_get_debuginfo(&device->channel->inbound, &info->inbound);
+	hv_ringbuffer_get_debuginfo(&device->channel->outbound, &info->outbound);
 }
 
 #define VMBUS_ALIAS_LEN ((sizeof((struct hv_vmbus_device_id *)0)->guid) * 2)
@@ -114,11 +99,11 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
 	get_channel_info(hv_dev, device_info);
 
 	if (!strcmp(dev_attr->attr.name, "out_intr_mask")) {
-		ret = sprintf(buf, "%d\n", device_info->outbound.int_mask);
+		ret = sprintf(buf, "%d\n", device_info->outbound.current_interrupt_mask);
 	} else if (!strcmp(dev_attr->attr.name, "out_read_index")) {
-		ret = sprintf(buf, "%d\n", device_info->outbound.read_idx);
+		ret = sprintf(buf, "%d\n", device_info->outbound.current_read_index);
 	} else if (!strcmp(dev_attr->attr.name, "out_write_index")) {
-		ret = sprintf(buf, "%d\n", device_info->outbound.write_idx);
+		ret = sprintf(buf, "%d\n", device_info->outbound.current_write_index);
 	} else if (!strcmp(dev_attr->attr.name, "out_read_bytes_avail")) {
 		ret = sprintf(buf, "%d\n",
 			       device_info->outbound.bytes_avail_toread);
@@ -126,11 +111,11 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
 		ret = sprintf(buf, "%d\n",
 			       device_info->outbound.bytes_avail_towrite);
 	} else if (!strcmp(dev_attr->attr.name, "in_intr_mask")) {
-		ret = sprintf(buf, "%d\n", device_info->inbound.int_mask);
+		ret = sprintf(buf, "%d\n", device_info->inbound.current_interrupt_mask);
 	} else if (!strcmp(dev_attr->attr.name, "in_read_index")) {
-		ret = sprintf(buf, "%d\n", device_info->inbound.read_idx);
+		ret = sprintf(buf, "%d\n", device_info->inbound.current_read_index);
 	} else if (!strcmp(dev_attr->attr.name, "in_write_index")) {
-		ret = sprintf(buf, "%d\n", device_info->inbound.write_idx);
+		ret = sprintf(buf, "%d\n", device_info->inbound.current_write_index);
 	} else if (!strcmp(dev_attr->attr.name, "in_read_bytes_avail")) {
 		ret = sprintf(buf, "%d\n",
 			       device_info->inbound.bytes_avail_toread);
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index c0e8faf4..c68ecfe2 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -429,15 +429,6 @@ struct hv_ring_buffer_info {
 	u32 ring_data_startoffset;
 };
 
-struct hv_ring_buffer_debug_info {
-	u32 current_interrupt_mask;
-	u32 current_read_index;
-	u32 current_write_index;
-	u32 bytes_avail_toread;
-	u32 bytes_avail_towrite;
-};
-
-
 /*
  *
  * hv_get_ringbuffer_availbytes()
@@ -1166,14 +1157,6 @@ extern int vmbus_recvpacket_raw(struct vmbus_channel *channel,
 
 extern void vmbus_ontimer(unsigned long data);
 
-struct hv_dev_port_info {
-	u32 int_mask;
-	u32 read_idx;
-	u32 write_idx;
-	u32 bytes_avail_toread;
-	u32 bytes_avail_towrite;
-};
-
 /* Base driver object */
 struct hv_driver {
 	const char *name;
-- 
1.8.4.3.gca3854a


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

* [PATCH 13/13] hv: move ringbuffer bus attributes to dev_groups
  2013-09-13 18:32 [PATCH 00/13] hv: clean up dev_attr usage Greg Kroah-Hartman
                   ` (11 preceding siblings ...)
  2013-09-13 18:33 ` [PATCH 12/13] hv: delete struct hv_dev_port_info Greg Kroah-Hartman
@ 2013-09-13 18:33 ` Greg Kroah-Hartman
  2013-09-13 19:13 ` [PATCH 00/13] hv: clean up dev_attr usage KY Srinivasan
  2013-09-17 18:42 ` KY Srinivasan
  14 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2013-09-13 18:33 UTC (permalink / raw)
  To: kys, haiyangz; +Cc: devel, linux-kernel, Greg Kroah-Hartman

This moves the ringbuffer bus attributes to the dev_groups structure,
deletes the now unneeded struct hv_device_info, and removes some now
unused functions, and variables as everything is now moved to the
dev_groups structure, dev_attrs is no longer needed.

Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hv/vmbus_drv.c | 230 +++++++++++++++++++++++++++++++------------------
 1 file changed, 146 insertions(+), 84 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index cf3220e8..48aad4fa 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -46,11 +46,6 @@ static struct tasklet_struct msg_dpc;
 static struct completion probe_event;
 static int irq;
 
-struct hv_device_info {
-	struct hv_ring_buffer_debug_info inbound;
-	struct hv_ring_buffer_debug_info outbound;
-};
-
 static int vmbus_exists(void)
 {
 	if (hv_acpi_dev == NULL)
@@ -59,17 +54,6 @@ static int vmbus_exists(void)
 	return 0;
 }
 
-
-static void get_channel_info(struct hv_device *device,
-			     struct hv_device_info *info)
-{
-	if (!device->channel)
-		return;
-
-	hv_ringbuffer_get_debuginfo(&device->channel->inbound, &info->inbound);
-	hv_ringbuffer_get_debuginfo(&device->channel->outbound, &info->outbound);
-}
-
 #define VMBUS_ALIAS_LEN ((sizeof((struct hv_vmbus_device_id *)0)->guid) * 2)
 static void print_alias_name(struct hv_device *hv_dev, char *alias_name)
 {
@@ -78,56 +62,6 @@ static void print_alias_name(struct hv_device *hv_dev, char *alias_name)
 		sprintf(&alias_name[i], "%02x", hv_dev->dev_type.b[i/2]);
 }
 
-/*
- * vmbus_show_device_attr - Show the device attribute in sysfs.
- *
- * This is invoked when user does a
- * "cat /sys/bus/vmbus/devices/<busdevice>/<attr name>"
- */
-static ssize_t vmbus_show_device_attr(struct device *dev,
-				      struct device_attribute *dev_attr,
-				      char *buf)
-{
-	struct hv_device *hv_dev = device_to_hv_device(dev);
-	struct hv_device_info *device_info;
-	int ret = 0;
-
-	device_info = kzalloc(sizeof(struct hv_device_info), GFP_KERNEL);
-	if (!device_info)
-		return ret;
-
-	get_channel_info(hv_dev, device_info);
-
-	if (!strcmp(dev_attr->attr.name, "out_intr_mask")) {
-		ret = sprintf(buf, "%d\n", device_info->outbound.current_interrupt_mask);
-	} else if (!strcmp(dev_attr->attr.name, "out_read_index")) {
-		ret = sprintf(buf, "%d\n", device_info->outbound.current_read_index);
-	} else if (!strcmp(dev_attr->attr.name, "out_write_index")) {
-		ret = sprintf(buf, "%d\n", device_info->outbound.current_write_index);
-	} else if (!strcmp(dev_attr->attr.name, "out_read_bytes_avail")) {
-		ret = sprintf(buf, "%d\n",
-			       device_info->outbound.bytes_avail_toread);
-	} else if (!strcmp(dev_attr->attr.name, "out_write_bytes_avail")) {
-		ret = sprintf(buf, "%d\n",
-			       device_info->outbound.bytes_avail_towrite);
-	} else if (!strcmp(dev_attr->attr.name, "in_intr_mask")) {
-		ret = sprintf(buf, "%d\n", device_info->inbound.current_interrupt_mask);
-	} else if (!strcmp(dev_attr->attr.name, "in_read_index")) {
-		ret = sprintf(buf, "%d\n", device_info->inbound.current_read_index);
-	} else if (!strcmp(dev_attr->attr.name, "in_write_index")) {
-		ret = sprintf(buf, "%d\n", device_info->inbound.current_write_index);
-	} else if (!strcmp(dev_attr->attr.name, "in_read_bytes_avail")) {
-		ret = sprintf(buf, "%d\n",
-			       device_info->inbound.bytes_avail_toread);
-	} else if (!strcmp(dev_attr->attr.name, "in_write_bytes_avail")) {
-		ret = sprintf(buf, "%d\n",
-			       device_info->inbound.bytes_avail_towrite);
-	}
-
-	kfree(device_info);
-	return ret;
-}
-
 static u8 channel_monitor_group(struct vmbus_channel *channel)
 {
 	return (u8)channel->offermsg.monitorid / 32;
@@ -313,6 +247,142 @@ static ssize_t client_monitor_conn_id_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(client_monitor_conn_id);
 
+static ssize_t out_intr_mask_show(struct device *dev,
+				  struct device_attribute *dev_attr, char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+	struct hv_ring_buffer_debug_info outbound;
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound);
+	return sprintf(buf, "%d\n", outbound.current_interrupt_mask);
+}
+static DEVICE_ATTR_RO(out_intr_mask);
+
+static ssize_t out_read_index_show(struct device *dev,
+				   struct device_attribute *dev_attr, char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+	struct hv_ring_buffer_debug_info outbound;
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound);
+	return sprintf(buf, "%d\n", outbound.current_read_index);
+}
+static DEVICE_ATTR_RO(out_read_index);
+
+static ssize_t out_write_index_show(struct device *dev,
+				    struct device_attribute *dev_attr,
+				    char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+	struct hv_ring_buffer_debug_info outbound;
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound);
+	return sprintf(buf, "%d\n", outbound.current_write_index);
+}
+static DEVICE_ATTR_RO(out_write_index);
+
+static ssize_t out_read_bytes_avail_show(struct device *dev,
+					 struct device_attribute *dev_attr,
+					 char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+	struct hv_ring_buffer_debug_info outbound;
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound);
+	return sprintf(buf, "%d\n", outbound.bytes_avail_toread);
+}
+static DEVICE_ATTR_RO(out_read_bytes_avail);
+
+static ssize_t out_write_bytes_avail_show(struct device *dev,
+					  struct device_attribute *dev_attr,
+					  char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+	struct hv_ring_buffer_debug_info outbound;
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound);
+	return sprintf(buf, "%d\n", outbound.bytes_avail_towrite);
+}
+static DEVICE_ATTR_RO(out_write_bytes_avail);
+
+static ssize_t in_intr_mask_show(struct device *dev,
+				 struct device_attribute *dev_attr, char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+	struct hv_ring_buffer_debug_info inbound;
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound);
+	return sprintf(buf, "%d\n", inbound.current_interrupt_mask);
+}
+static DEVICE_ATTR_RO(in_intr_mask);
+
+static ssize_t in_read_index_show(struct device *dev,
+				  struct device_attribute *dev_attr, char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+	struct hv_ring_buffer_debug_info inbound;
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound);
+	return sprintf(buf, "%d\n", inbound.current_read_index);
+}
+static DEVICE_ATTR_RO(in_read_index);
+
+static ssize_t in_write_index_show(struct device *dev,
+				   struct device_attribute *dev_attr, char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+	struct hv_ring_buffer_debug_info inbound;
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound);
+	return sprintf(buf, "%d\n", inbound.current_write_index);
+}
+static DEVICE_ATTR_RO(in_write_index);
+
+static ssize_t in_read_bytes_avail_show(struct device *dev,
+					struct device_attribute *dev_attr,
+					char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+	struct hv_ring_buffer_debug_info inbound;
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound);
+	return sprintf(buf, "%d\n", inbound.bytes_avail_toread);
+}
+static DEVICE_ATTR_RO(in_read_bytes_avail);
+
+static ssize_t in_write_bytes_avail_show(struct device *dev,
+					 struct device_attribute *dev_attr,
+					 char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+	struct hv_ring_buffer_debug_info inbound;
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+	hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound);
+	return sprintf(buf, "%d\n", inbound.bytes_avail_towrite);
+}
+static DEVICE_ATTR_RO(in_write_bytes_avail);
+
+/* Set up per device attributes in /sys/bus/vmbus/devices/<bus device> */
 static struct attribute *vmbus_attrs[] = {
 	&dev_attr_id.attr,
 	&dev_attr_state.attr,
@@ -326,27 +396,20 @@ static struct attribute *vmbus_attrs[] = {
 	&dev_attr_client_monitor_latency.attr,
 	&dev_attr_server_monitor_conn_id.attr,
 	&dev_attr_client_monitor_conn_id.attr,
+	&dev_attr_out_intr_mask.attr,
+	&dev_attr_out_read_index.attr,
+	&dev_attr_out_write_index.attr,
+	&dev_attr_out_read_bytes_avail.attr,
+	&dev_attr_out_write_bytes_avail.attr,
+	&dev_attr_in_intr_mask.attr,
+	&dev_attr_in_read_index.attr,
+	&dev_attr_in_write_index.attr,
+	&dev_attr_in_read_bytes_avail.attr,
+	&dev_attr_in_write_bytes_avail.attr,
 	NULL,
 };
 ATTRIBUTE_GROUPS(vmbus);
 
-/* Set up per device attributes in /sys/bus/vmbus/devices/<bus device> */
-static struct device_attribute vmbus_device_attrs[] = {
-	__ATTR(out_intr_mask, S_IRUGO, vmbus_show_device_attr, NULL),
-	__ATTR(out_read_index, S_IRUGO, vmbus_show_device_attr, NULL),
-	__ATTR(out_write_index, S_IRUGO, vmbus_show_device_attr, NULL),
-	__ATTR(out_read_bytes_avail, S_IRUGO, vmbus_show_device_attr, NULL),
-	__ATTR(out_write_bytes_avail, S_IRUGO, vmbus_show_device_attr, NULL),
-
-	__ATTR(in_intr_mask, S_IRUGO, vmbus_show_device_attr, NULL),
-	__ATTR(in_read_index, S_IRUGO, vmbus_show_device_attr, NULL),
-	__ATTR(in_write_index, S_IRUGO, vmbus_show_device_attr, NULL),
-	__ATTR(in_read_bytes_avail, S_IRUGO, vmbus_show_device_attr, NULL),
-	__ATTR(in_write_bytes_avail, S_IRUGO, vmbus_show_device_attr, NULL),
-	__ATTR_NULL
-};
-
-
 /*
  * vmbus_uevent - add uevent for our device
  *
@@ -494,7 +557,6 @@ static struct bus_type  hv_bus = {
 	.remove =		vmbus_remove,
 	.probe =		vmbus_probe,
 	.uevent =		vmbus_uevent,
-	.dev_attrs =	vmbus_device_attrs,
 	.dev_groups =		vmbus_groups,
 };
 
-- 
1.8.4.3.gca3854a


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

* RE: [PATCH 00/13] hv: clean up dev_attr usage
  2013-09-13 18:32 [PATCH 00/13] hv: clean up dev_attr usage Greg Kroah-Hartman
                   ` (12 preceding siblings ...)
  2013-09-13 18:33 ` [PATCH 13/13] hv: move ringbuffer bus attributes to dev_groups Greg Kroah-Hartman
@ 2013-09-13 19:13 ` KY Srinivasan
  2013-09-17 18:42 ` KY Srinivasan
  14 siblings, 0 replies; 18+ messages in thread
From: KY Srinivasan @ 2013-09-13 19:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Haiyang Zhang
  Cc: devel@linuxdriverproject.org, linux-kernel@vger.kernel.org



> -----Original Message-----
> From: Greg Kroah-Hartman [mailto:gregkh@linuxfoundation.org]
> Sent: Friday, September 13, 2013 11:33 AM
> To: KY Srinivasan; Haiyang Zhang
> Cc: devel@linuxdriverproject.org; linux-kernel@vger.kernel.org
> Subject: [PATCH 00/13] hv: clean up dev_attr usage
> 
> Hi,
> 
> Here's a set of 13 patches to get rid of the dev_attrs use in the hv bus
> code, as it will be going away soon.  It's _way_ bigger than all other
> conversions I've had to do so far in the kernel, as you were using a
> "multiplexor" function for all of these files.
> 
> So, I've broken it up into individual show/store sysfs functions, and
> cleaned up a bunch of debug structures that aren't needed and shouldn't
> be exported to the rest of the kernel.
> 
> I've also fixed up some void * usage in the hv core, in patch 07, to
> make things simpler and not so "magic" when dealing with these pages.
> If you could review that one closely to ensure I didn't mess anything
> up, I would appreciate it.
> 
> Also, are all of these files really needed for sysfs?  They seem to be
> all debugging stuff, shouldn't they go into debugfs if you really
> need/use them anymore?
> 
> KY, could you test these out?  I don't have access to a hv system at the
> moment.  I'll wait for your ack before applying them to any of my trees.
> 
> thanks,

Will do. Thank you.

K. Y
> 
> greg k-h


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

* RE: [PATCH 00/13] hv: clean up dev_attr usage
  2013-09-13 18:32 [PATCH 00/13] hv: clean up dev_attr usage Greg Kroah-Hartman
                   ` (13 preceding siblings ...)
  2013-09-13 19:13 ` [PATCH 00/13] hv: clean up dev_attr usage KY Srinivasan
@ 2013-09-17 18:42 ` KY Srinivasan
  2013-09-26 15:59   ` Greg Kroah-Hartman
  14 siblings, 1 reply; 18+ messages in thread
From: KY Srinivasan @ 2013-09-17 18:42 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Haiyang Zhang
  Cc: devel@linuxdriverproject.org, linux-kernel@vger.kernel.org



> -----Original Message-----
> From: Greg Kroah-Hartman [mailto:gregkh@linuxfoundation.org]
> Sent: Friday, September 13, 2013 11:33 AM
> To: KY Srinivasan; Haiyang Zhang
> Cc: devel@linuxdriverproject.org; linux-kernel@vger.kernel.org
> Subject: [PATCH 00/13] hv: clean up dev_attr usage
> 
> Hi,
> 
> Here's a set of 13 patches to get rid of the dev_attrs use in the hv bus
> code, as it will be going away soon.  It's _way_ bigger than all other
> conversions I've had to do so far in the kernel, as you were using a
> "multiplexor" function for all of these files.
> 
> So, I've broken it up into individual show/store sysfs functions, and
> cleaned up a bunch of debug structures that aren't needed and shouldn't
> be exported to the rest of the kernel.
> 
> I've also fixed up some void * usage in the hv core, in patch 07, to
> make things simpler and not so "magic" when dealing with these pages.
> If you could review that one closely to ensure I didn't mess anything
> up, I would appreciate it.
> 
> Also, are all of these files really needed for sysfs?  They seem to be
> all debugging stuff, shouldn't they go into debugfs if you really
> need/use them anymore?
> 
> KY, could you test these out?  I don't have access to a hv system at the
> moment.  I'll wait for your ack before applying them to any of my trees.

The patches look good and I tested them. The guest comes up and is functional.
I did notice though that the pending state appears to be a signed entity now which was not the
the case  before - I see a negative sign when I cat the client/server pending state.

Regards,

K. Y 
> 
> thanks,
> 
> greg k-h


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

* Re: [PATCH 00/13] hv: clean up dev_attr usage
  2013-09-17 18:42 ` KY Srinivasan
@ 2013-09-26 15:59   ` Greg Kroah-Hartman
  2013-09-26 22:36     ` KY Srinivasan
  0 siblings, 1 reply; 18+ messages in thread
From: Greg Kroah-Hartman @ 2013-09-26 15:59 UTC (permalink / raw)
  To: KY Srinivasan
  Cc: Haiyang Zhang, devel@linuxdriverproject.org,
	linux-kernel@vger.kernel.org

On Tue, Sep 17, 2013 at 06:42:30PM +0000, KY Srinivasan wrote:
> 
> 
> > -----Original Message-----
> > From: Greg Kroah-Hartman [mailto:gregkh@linuxfoundation.org]
> > Sent: Friday, September 13, 2013 11:33 AM
> > To: KY Srinivasan; Haiyang Zhang
> > Cc: devel@linuxdriverproject.org; linux-kernel@vger.kernel.org
> > Subject: [PATCH 00/13] hv: clean up dev_attr usage
> > 
> > Hi,
> > 
> > Here's a set of 13 patches to get rid of the dev_attrs use in the hv bus
> > code, as it will be going away soon.  It's _way_ bigger than all other
> > conversions I've had to do so far in the kernel, as you were using a
> > "multiplexor" function for all of these files.
> > 
> > So, I've broken it up into individual show/store sysfs functions, and
> > cleaned up a bunch of debug structures that aren't needed and shouldn't
> > be exported to the rest of the kernel.
> > 
> > I've also fixed up some void * usage in the hv core, in patch 07, to
> > make things simpler and not so "magic" when dealing with these pages.
> > If you could review that one closely to ensure I didn't mess anything
> > up, I would appreciate it.
> > 
> > Also, are all of these files really needed for sysfs?  They seem to be
> > all debugging stuff, shouldn't they go into debugfs if you really
> > need/use them anymore?
> > 
> > KY, could you test these out?  I don't have access to a hv system at the
> > moment.  I'll wait for your ack before applying them to any of my trees.
> 
> The patches look good and I tested them. The guest comes up and is functional.
> I did notice though that the pending state appears to be a signed entity now which was not the
> the case  before - I see a negative sign when I cat the client/server pending state.

Which exact file is that?  I didn't change the % modifiers for any of
the data types, or at least I sure shouldn't have, if so, that's a bug
on my side.

Thanks for testing, I'll queue these up, and if you can tell me which
sysfs file is different, I'll verify the code conversion again, but I
just reviewed it and can't seem to find anything.

thanks,

greg k-h

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

* RE: [PATCH 00/13] hv: clean up dev_attr usage
  2013-09-26 15:59   ` Greg Kroah-Hartman
@ 2013-09-26 22:36     ` KY Srinivasan
  0 siblings, 0 replies; 18+ messages in thread
From: KY Srinivasan @ 2013-09-26 22:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Haiyang Zhang, devel@linuxdriverproject.org,
	linux-kernel@vger.kernel.org

Greg,

I am currently travelling; when I get back I will take a look.

K. Y

> -----Original Message-----
> From: Greg Kroah-Hartman [mailto:gregkh@linuxfoundation.org]
> Sent: Thursday, September 26, 2013 9:00 AM
> To: KY Srinivasan
> Cc: Haiyang Zhang; devel@linuxdriverproject.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 00/13] hv: clean up dev_attr usage
> 
> On Tue, Sep 17, 2013 at 06:42:30PM +0000, KY Srinivasan wrote:
> >
> >
> > > -----Original Message-----
> > > From: Greg Kroah-Hartman [mailto:gregkh@linuxfoundation.org]
> > > Sent: Friday, September 13, 2013 11:33 AM
> > > To: KY Srinivasan; Haiyang Zhang
> > > Cc: devel@linuxdriverproject.org; linux-kernel@vger.kernel.org
> > > Subject: [PATCH 00/13] hv: clean up dev_attr usage
> > >
> > > Hi,
> > >
> > > Here's a set of 13 patches to get rid of the dev_attrs use in the hv bus
> > > code, as it will be going away soon.  It's _way_ bigger than all other
> > > conversions I've had to do so far in the kernel, as you were using a
> > > "multiplexor" function for all of these files.
> > >
> > > So, I've broken it up into individual show/store sysfs functions, and
> > > cleaned up a bunch of debug structures that aren't needed and shouldn't
> > > be exported to the rest of the kernel.
> > >
> > > I've also fixed up some void * usage in the hv core, in patch 07, to
> > > make things simpler and not so "magic" when dealing with these pages.
> > > If you could review that one closely to ensure I didn't mess anything
> > > up, I would appreciate it.
> > >
> > > Also, are all of these files really needed for sysfs?  They seem to be
> > > all debugging stuff, shouldn't they go into debugfs if you really
> > > need/use them anymore?
> > >
> > > KY, could you test these out?  I don't have access to a hv system at the
> > > moment.  I'll wait for your ack before applying them to any of my trees.
> >
> > The patches look good and I tested them. The guest comes up and is functional.
> > I did notice though that the pending state appears to be a signed entity now
> which was not the
> > the case  before - I see a negative sign when I cat the client/server pending
> state.
> 
> Which exact file is that?  I didn't change the % modifiers for any of
> the data types, or at least I sure shouldn't have, if so, that's a bug
> on my side.
> 
> Thanks for testing, I'll queue these up, and if you can tell me which
> sysfs file is different, I'll verify the code conversion again, but I
> just reviewed it and can't seem to find anything.
> 
> thanks,
> 
> greg k-h

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

end of thread, other threads:[~2013-09-26 22:53 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-13 18:32 [PATCH 00/13] hv: clean up dev_attr usage Greg Kroah-Hartman
2013-09-13 18:32 ` [PATCH 01/13] hv: use dev_groups for device attributes Greg Kroah-Hartman
2013-09-13 18:32 ` [PATCH 02/13] hv: move "state" bus attribute to dev_groups Greg Kroah-Hartman
2013-09-13 18:32 ` [PATCH 03/13] hv: move "monitor_id" " Greg Kroah-Hartman
2013-09-13 18:32 ` [PATCH 04/13] hv: move "modalias" " Greg Kroah-Hartman
2013-09-13 18:32 ` [PATCH 05/13] hv: move "class_id" " Greg Kroah-Hartman
2013-09-13 18:32 ` [PATCH 06/13] hv: move "device_id" " Greg Kroah-Hartman
2013-09-13 18:32 ` [PATCH 07/13] hv: make "monitor_pages" a "real" pointer array Greg Kroah-Hartman
2013-09-13 18:32 ` [PATCH 08/13] hv: move "client/server_monitor_pending" bus attributes to dev_groups Greg Kroah-Hartman
2013-09-13 18:32 ` [PATCH 09/13] hv: move "client/server_monitor_latency" " Greg Kroah-Hartman
2013-09-13 18:32 ` [PATCH 10/13] hv: move "client/server_monitor_conn_id" " Greg Kroah-Hartman
2013-09-13 18:32 ` [PATCH 11/13] hv: delete vmbus_get_debug_info() Greg Kroah-Hartman
2013-09-13 18:33 ` [PATCH 12/13] hv: delete struct hv_dev_port_info Greg Kroah-Hartman
2013-09-13 18:33 ` [PATCH 13/13] hv: move ringbuffer bus attributes to dev_groups Greg Kroah-Hartman
2013-09-13 19:13 ` [PATCH 00/13] hv: clean up dev_attr usage KY Srinivasan
2013-09-17 18:42 ` KY Srinivasan
2013-09-26 15:59   ` Greg Kroah-Hartman
2013-09-26 22:36     ` KY Srinivasan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox