Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Add swapping and pinning capability to Palacios
[palacios.git] / palacios / include / palacios / vmm_swapping.h
1 /*
2  * This file is part of the Palacios Virtual Machine Monitor developed
3  * by the V3VEE Project with funding from the United States National 
4  * Science Foundation and the Department of Energy.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
10  * Copyright (c) 2014, The V3VEE Project <http://www.v3vee.org> 
11  * All rights reserved.
12  *
13  * Author: Daniel Zuo <pengzuo2014@u.northwestern.edu>
14  *         Nikhat Karimi <nikhatkarimi@gmail.com>
15  *         Ahalya Srinivasan <AhalyaSrinivasan2015@u.northwestern.edu>
16  *         Peter Dinda <pdinda@northwestern.edu>
17  *
18  * This is free software.  You are permitted to use,
19  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
20  */
21
22
23 #ifndef __VMM_SWAPPING_H
24 #define __VMM_SWAPPING_H
25
26
27 #ifdef __V3VEE__ 
28
29 #include <palacios/vmm_types.h>
30 #include <palacios/vmm_lock.h>
31 #include <interfaces/vmm_file.h>
32
33 typedef enum {
34     V3_SWAP_NEXT_FIT, 
35     V3_SWAP_RANDOM,
36     V3_SWAP_LRU,     // this is not the droid you're looking for
37 } v3_swapping_strategy_t;
38
39 // for inclusion in the vm struct
40 struct v3_swap_impl_state {
41     // per-VM lock should be held when changing
42     // swap state or the swapping elements of base region state
43     v3_lock_t lock;
44     uint32_t enable_swapping:1;
45     v3_swapping_strategy_t strategy;
46     uint64_t host_mem_size; // allocated space in bytes
47     uint64_t swap_count; 
48     uint64_t last_region_used; // for use by V3_SWAP_NEXT_FIT
49     // This is the swap file on disk 
50     v3_file_t swapfd; 
51 };
52
53
54 // for inclusion in the region 
55 struct v3_swap_region_state {
56     uint64_t last_accessed;  // timestamp
57 };
58
59
60 struct v3_mem_region;
61
62 typedef struct v3_xml v3_cfg_tree_t;
63
64 int v3_init_swapping();
65 int v3_deinit_swapping();
66
67 int v3_init_swapping_vm(struct v3_vm_info *vm, v3_cfg_tree_t *config);
68 int v3_deinit_swapping_vm(struct v3_vm_info *vm);
69
70 // not needed yet
71 //int v3_init_swapping_core(struct guest_info *core);
72 //int v3_deinit_swapping_core(struct guest_info *core);
73
74 int v3_pin_region(struct v3_vm_info *vm, struct v3_mem_region *region);
75 int v3_unpin_region(struct v3_vm_info *vm, struct v3_mem_region *region);
76
77 // This will automatically swap out a victim if needed
78 int v3_swap_in_region(struct v3_vm_info *vm, struct v3_mem_region *region);
79 // Force a region out
80 int v3_swap_out_region(struct v3_vm_info *vm, struct v3_mem_region *region);
81
82 // drive LRU
83 void v3_touch_region(struct v3_vm_info *vm, struct v3_mem_region *region);
84
85 #endif /* ! __V3VEE__ */
86
87
88 #endif