Skip to contentSkip to conversation

xen/balloon: export balloon hotplug page stats to sysfs

PATCH In review Wei Liu 3 participants 6 messages Mar 20, 2014 – Mar 21, 2014 Xen hypervisor interface

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 xen/balloon: export balloon hotplug page stats to sysfs

Cc Konrad Wilk <[email protected]>
Cc David Vrabel <[email protected]>
Cc Boris Ostrovsky <[email protected]>
---
 drivers/xen/xen-balloon.c |    9 +++++++++
 1 file changed, 9 insertions(+)
drivers/xen/xen-balloon.c +9 -0
index e555845..2d4c5a8 100644
@@ -129,6 +129,11 @@ module_exit(balloon_exit);
 BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(balloon_stats.current_pages));
 BALLOON_SHOW(low_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_low));
 BALLOON_SHOW(high_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_high));
+#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
+BALLOON_SHOW(hotplug_kb, "%lu\n", PAGES2KB(balloon_stats.hotplug_pages));
+BALLOON_SHOW(balloon_hotplug_kb, "%lu\n",
+	     PAGES2KB(balloon_stats.balloon_hotplug));
+#endif
 
 static DEVICE_ULONG_ATTR(schedule_delay, 0444, balloon_stats.schedule_delay);
 static DEVICE_ULONG_ATTR(max_schedule_delay, 0644, balloon_stats.max_schedule_delay);
@@ -206,6 +211,10 @@ static struct attribute *balloon_info_attrs[] = {
 	&dev_attr_current_kb.attr,
 	&dev_attr_low_kb.attr,
 	&dev_attr_high_kb.attr,
+#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
+	&dev_attr_hotplug_kb.attr,
+	&dev_attr_balloon_hotplug_kb.attr,
+#endif
 	NULL
 };
 
Signature · 1 line
1.7.10.4
#1 lore raw

drivers/xen/xen-balloon.c module_exit(balloon_exit); · line 136

Quoted 11 lines · Wei Liu
drivers/xen/xen-balloon.c +5 -0
@@ -129,6 +129,11 @@ module_exit(balloon_exit);
 BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(balloon_stats.current_pages));
 BALLOON_SHOW(low_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_low));
 BALLOON_SHOW(high_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_high));
+#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
+BALLOON_SHOW(hotplug_kb, "%lu\n", PAGES2KB(balloon_stats.hotplug_pages));
+BALLOON_SHOW(balloon_hotplug_kb, "%lu\n",
+	     PAGES2KB(balloon_stats.balloon_hotplug));
+#endif

Extending the kernel's ABI requires justification. How are these values useful for userspace tools? If it's just for debug purposes, using debugfs would be preferred.

David

author
#2 lore raw
Quoted 17 lines · David Vrabel

drivers/xen/xen-balloon.c module_exit(balloon_exit); · line 136

Quoted 11 lines · Wei Liu
drivers/xen/xen-balloon.c +5 -0
@@ -129,6 +129,11 @@ module_exit(balloon_exit);
 BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(balloon_stats.current_pages));
 BALLOON_SHOW(low_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_low));
 BALLOON_SHOW(high_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_high));
+#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
+BALLOON_SHOW(hotplug_kb, "%lu\n", PAGES2KB(balloon_stats.hotplug_pages));
+BALLOON_SHOW(balloon_hotplug_kb, "%lu\n",
+	     PAGES2KB(balloon_stats.balloon_hotplug));
+#endif

Extending the kernel's ABI requires justification. How are these values useful for userspace tools? If it's just for debug purposes, using debugfs would be preferred.

My original thought is that userspace tools have the right to know how many pages balloon driver has. Missing the hotplug pages is not very desirable. But I have yet known any tools that require balloon hotplug page stat -- after all they probably don't know there's such a thing is nothing is exported. Also note that these BALLOON_SHOW fields are read-only, so exporting more stats won't in any way affect system behavior.

If you prefer debugfs I can switch to use that.

Wei.

Quoted 1 line

David

#3 lore raw
Quoted 19 lines · Wei Liu
Quoted 17 lines · David Vrabel

drivers/xen/xen-balloon.c module_exit(balloon_exit); · line 136

Quoted 11 lines · Wei Liu
drivers/xen/xen-balloon.c +5 -0
@@ -129,6 +129,11 @@ module_exit(balloon_exit);
 BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(balloon_stats.current_pages));
 BALLOON_SHOW(low_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_low));
 BALLOON_SHOW(high_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_high));
+#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
+BALLOON_SHOW(hotplug_kb, "%lu\n", PAGES2KB(balloon_stats.hotplug_pages));
+BALLOON_SHOW(balloon_hotplug_kb, "%lu\n",
+	     PAGES2KB(balloon_stats.balloon_hotplug));
+#endif

Extending the kernel's ABI requires justification. How are these values useful for userspace tools? If it's just for debug purposes, using debugfs would be preferred.

Quoted 3 lines

My original thought is that userspace tools have the right to know how many pages balloon driver has. Missing the hotplug pages is not very desirable.

What tools needs the value and how will it use it to make sensible decisions?

If there isn't an answer and it just for diagnostics/debug then debugfs is the right place.

David

author
#4 lore raw
Quoted 20 lines · David Vrabel
Quoted 19 lines · Wei Liu
Quoted 17 lines · David Vrabel

drivers/xen/xen-balloon.c module_exit(balloon_exit); · line 136

Quoted 11 lines · Wei Liu
drivers/xen/xen-balloon.c +5 -0
@@ -129,6 +129,11 @@ module_exit(balloon_exit);
 BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(balloon_stats.current_pages));
 BALLOON_SHOW(low_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_low));
 BALLOON_SHOW(high_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_high));
+#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
+BALLOON_SHOW(hotplug_kb, "%lu\n", PAGES2KB(balloon_stats.hotplug_pages));
+BALLOON_SHOW(balloon_hotplug_kb, "%lu\n",
+	     PAGES2KB(balloon_stats.balloon_hotplug));
+#endif

Extending the kernel's ABI requires justification. How are these values useful for userspace tools? If it's just for debug purposes, using debugfs would be preferred.

Quoted 7 lines
Quoted 3 lines

My original thought is that userspace tools have the right to know how many pages balloon driver has. Missing the hotplug pages is not very desirable.

What tools needs the value and how will it use it to make sensible decisions?

I see this issue the other way around. Without this information tools cannot make correct decision, because it cannot possibly know there even exists hotplug pages in balloon driver. Adding this is not for the sake of existing tool, but for the sake of correctness. If you think userspace will never have the need to know this information then debugfs it is.

Quoted 4 lines

If there isn't an answer and it just for diagnostics/debug then debugfs is the right place.

David

#5 lore raw
In reply to Wei Liu
Quoted 6 lines · Wei Liu
Cc Konrad Wilk <[email protected]>
Cc David Vrabel <[email protected]>
Cc Boris Ostrovsky <[email protected]>
---
 drivers/xen/xen-balloon.c |    9 +++++++++

If you are doing that you also need to put information in Documentation/sysfs/abi/something/somewhere.

Quoted 32 lines
 1 file changed, 9 insertions(+)
drivers/xen/xen-balloon.c +9 -0
index e555845..2d4c5a8 100644
@@ -129,6 +129,11 @@ module_exit(balloon_exit);
 BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(balloon_stats.current_pages));
 BALLOON_SHOW(low_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_low));
 BALLOON_SHOW(high_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_high));
+#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
+BALLOON_SHOW(hotplug_kb, "%lu\n", PAGES2KB(balloon_stats.hotplug_pages));
+BALLOON_SHOW(balloon_hotplug_kb, "%lu\n",
+	     PAGES2KB(balloon_stats.balloon_hotplug));
+#endif
 
 static DEVICE_ULONG_ATTR(schedule_delay, 0444, balloon_stats.schedule_delay);
 static DEVICE_ULONG_ATTR(max_schedule_delay, 0644, balloon_stats.max_schedule_delay);
@@ -206,6 +211,10 @@ static struct attribute *balloon_info_attrs[] = {
 	&dev_attr_current_kb.attr,
 	&dev_attr_low_kb.attr,
 	&dev_attr_high_kb.attr,
+#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
+	&dev_attr_hotplug_kb.attr,
+	&dev_attr_balloon_hotplug_kb.attr,
+#endif
 	NULL
 };
 
Signature · 1 line
1.7.10.4