#include <linux/timer.h>
#include <vnet/vnet.h>
-#include "mm.h"
#include "palacios.h"
+#include "mm.h"
#include "palacios-vnet.h"
#include "linux-exts.h"
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;
static void
host_reset_timer(void * vnet_timer, unsigned long interval){
- struct host_timer * timer = (struct host_timer *)timer;
+ struct host_timer * timer = (struct host_timer *)vnet_timer;
timer->interval = interval;
}
del_timer(&(timer->timer));
- kfree(timer);
+ palacios_free(timer);
}
+static void *
+host_allocate_pages(int num_pages, unsigned int alignment, int node_id)
+{
+ // allocates pages preferentially on the caller's node
+ return palacios_allocate_pages(num_pages, alignment, node_id, 0, 0);
+}
.timer_stop = host_stop_timer,
.timer_reset = host_reset_timer,
- .thread_start = palacios_start_kernel_thread,
+ .thread_start = palacios_create_and_start_kernel_thread,
.thread_sleep = host_kthread_sleep,
.thread_wakeup = host_kthread_wakeup,
.thread_stop = host_kthread_stop,
.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,