From: Kyle Hale Date: Fri, 27 Jul 2012 03:55:36 +0000 (-0500) Subject: update palacios mempool status when onlining memory in userspace X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=a80196a40e35de0efc20efb3e9466d348d5fd28c update palacios mempool status when onlining memory in userspace /proc/v3vee/v3-mem will now report correctly after memory has been onlined --- diff --git a/linux_module/ioctls.txt b/linux_module/ioctls.txt index 95ea1e6..d1f9f2a 100644 --- a/linux_module/ioctls.txt +++ b/linux_module/ioctls.txt @@ -7,6 +7,7 @@ Global commands (/dev/v3vee) 13 -- (VMM) Free VM 50 -- (VMM) Add physical memory to VMM manager +51 -- (VMM) Reset VMM manager memory counts 55 -- (IFACE) Add PCI HW Device 56 -- (IFACE) Add PCI User Device diff --git a/linux_module/main.c b/linux_module/main.c index 098d8f1..efaa20e 100644 --- a/linux_module/main.c +++ b/linux_module/main.c @@ -174,6 +174,13 @@ out_err: break; } + case V3_RESET_MEMORY: { + if (palacios_init_mm() == -1) { + ERROR("Error resetting Palacios memory\n"); + return -EFAULT; + } + break; + } default: { struct global_ctrl * ctrl = get_global_ctrl(ioctl); diff --git a/linux_module/palacios.h b/linux_module/palacios.h index 0141e38..b80663a 100644 --- a/linux_module/palacios.h +++ b/linux_module/palacios.h @@ -12,6 +12,8 @@ #define V3_FREE_GUEST 13 #define V3_ADD_MEMORY 50 +#define V3_RESET_MEMORY 51 + #define V3_ADD_PCI_HW_DEV 55 #define V3_ADD_PCI_USER_DEV 56 diff --git a/linux_usr/v3_mem_free.c b/linux_usr/v3_mem_free.c index 31a775e..16afaef 100644 --- a/linux_usr/v3_mem_free.c +++ b/linux_usr/v3_mem_free.c @@ -1,6 +1,11 @@ #include #include #include +#include +#include +#include + +#include "v3_ctrl.h" int main(void) { @@ -12,6 +17,7 @@ int main(void) unsigned long amount_allocated = 0; unsigned long long block_size = 0; int i = 0; + int v3_fd; fp = fopen(filepath, "r"); if(fp == NULL) { @@ -61,5 +67,14 @@ int main(void) base_addr++; } + v3_fd = open(v3_dev, O_RDONLY); + if (v3_fd == -1) { + printf("Error opening V3Vee control device\n"); + return -1; + } + + ioctl(v3_fd, V3_RESET_MEMORY, NULL); + close(v3_fd); + return 0; }