X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_module%2Fpalacios-vnet.c;h=4b2377241ec3c285fe2abbf20b344427551b8b05;hb=4ca005982593fbdd7f4204ec9805b5f86edf5155;hp=297852d6863cb2d370a52255b40dc704ba61be61;hpb=139d7b7b65f1a5d7c335fca4abb6d61d12b8aaff;p=palacios.git diff --git a/linux_module/palacios-vnet.c b/linux_module/palacios-vnet.c index 297852d..4b23772 100644 --- a/linux_module/palacios-vnet.c +++ b/linux_module/palacios-vnet.c @@ -14,8 +14,8 @@ #include #include -#include "mm.h" #include "palacios.h" +#include "mm.h" #include "palacios-vnet.h" #include "linux-exts.h" @@ -86,7 +86,12 @@ static void * host_create_timer(unsigned long interval, void (* timer_fun)(void * priv_data), void * data){ - struct host_timer * timer = (struct host_timer *)kmalloc(sizeof(struct host_timer), GFP_KERNEL); + struct host_timer * timer = (struct host_timer *)palacios_alloc(sizeof(struct host_timer)); + + if (!timer) { + ERROR("Unable to allocate timer in VNET\n"); + return NULL; + } timer->interval = interval; timer->timer_fun = timer_fun; @@ -130,10 +135,16 @@ host_del_timer(void * vnet_timer){ del_timer(&(timer->timer)); - kfree(timer); + palacios_free(timer); } +static void * +host_allocate_pages(int num_pages, unsigned int alignment, int node_id, int constraint) +{ + // allocates pages preferentially on the caller's node + return palacios_allocate_pages(num_pages, alignment, node_id, constraint); +} @@ -156,9 +167,11 @@ static struct vnet_host_hooks vnet_host_hooks = { .mutex_free = palacios_mutex_free, .mutex_lock = palacios_mutex_lock, .mutex_unlock = palacios_mutex_unlock, + .mutex_lock_irqsave = palacios_mutex_lock_irqsave, + .mutex_unlock_irqrestore = palacios_mutex_unlock_irqrestore, - .print = palacios_print, - .allocate_pages = palacios_allocate_pages, + .print = palacios_print_scoped, + .allocate_pages = host_allocate_pages, .free_pages = palacios_free_pages, .malloc = palacios_alloc, .free = palacios_free,