aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-04 20:19:35 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-04 20:19:35 +0000
commitdf751fa8bfed4408ca091a7badd75c5ab80f71de (patch)
tree5c45ae730f07c0ffc2057778a2ebd1c1419ac5a3 /monitor.c
parent8d371d4bceb308c29a5db4c21c984e06c9d56371 (diff)
downloadqemu-df751fa8bfed4408ca091a7badd75c5ab80f71de.zip
qemu-df751fa8bfed4408ca091a7badd75c5ab80f71de.tar.gz
qemu-df751fa8bfed4408ca091a7badd75c5ab80f71de.tar.bz2
Add ballooning infrastructure.
Balloon devices allow you to ask the guest to allocate memory. This allows you to release that memory. It's mostly useful for freeing up large chunks of memory from cooperative guests. Ballooning is supported by both Xen and VirtIO. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5873 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/monitor.c b/monitor.c
index 22360fc..a928c3e 100644
--- a/monitor.c
+++ b/monitor.c
@@ -34,6 +34,7 @@
#include "block.h"
#include "audio/audio.h"
#include "disas.h"
+#include "balloon.h"
#include <dirent.h>
#include "qemu-timer.h"
#include "migration.h"
@@ -1390,6 +1391,23 @@ static void do_inject_nmi(int cpu_index)
}
#endif
+static void do_balloon(int value)
+{
+ ram_addr_t target = value;
+ qemu_balloon(target << 20);
+}
+
+static void do_info_balloon(void)
+{
+ ram_addr_t actual;
+
+ actual = qemu_balloon_status();
+ if (actual == 0)
+ term_printf("Ballooning not activated in VM\n");
+ else
+ term_printf("balloon: actual=%d\n", (int)(actual >> 20));
+}
+
static const term_cmd_t term_cmds[] = {
{ "help|?", "s?", do_help,
"[cmd]", "show the help" },
@@ -1475,6 +1493,8 @@ static const term_cmd_t term_cmds[] = {
"", "cancel the current VM migration" },
{ "migrate_set_speed", "s", do_migrate_set_speed,
"value", "set maximum speed (in bytes) for migrations" },
+ { "balloon", "i", do_balloon,
+ "target", "request VM to change it's memory allocation (in MB)" },
{ NULL, NULL, },
};
@@ -1542,6 +1562,8 @@ static const term_cmd_t info_cmds[] = {
"", "show SLIRP statistics", },
#endif
{ "migrate", "", do_info_migrate, "", "show migration status" },
+ { "balloon", "", do_info_balloon,
+ "", "show balloon information" },
{ NULL, NULL, },
};