aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenpaging/xenpaging.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix emacs local variable block to use correct C style variable.David Vrabel2013-02-211-1/+1
| | | | | | | The emacs variable to set the C style from a local variable block is c-file-style, not c-set-style. Signed-off-by: David Vrabel <david.vrabel@citrix.com
* Tools: Remove shared page from mem_event/access/paging interfacesTim Deegan2012-03-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | Don't use the superfluous shared page, return the event channel directly as part of the domctl struct, instead. In-tree consumers (xenpaging, xen-access) updated. This is an ABI/API change, so please voice any concerns. Known pending issues: - pager could die and its ring page could be used by some other process, yet Xen retains the mapping to it. - use a saner interface for the paging_load buffer. This change also affects the x86/mm bits in the hypervisor that process the mem_event setup domctl. Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> Acked-by: Tim Deegan <tim@xen.org> Acked-by: Olaf Hering <olaf@aepfle.de> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Tim Deegan <tim@xen.org>
* xenpaging: implement stack of free slots in pagefileOlaf Hering2012-02-201-0/+2
| | | | | | | | | Scanning the slot_to_gfn[] array for a free slot is expensive because evict_pages() always needs to scan the whole array. Remember the last slots freed during page-in requests and reuse them in evict_pages(). Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: move page_buffer into struct xenpagingOlaf Hering2012-02-201-0/+2
| | | | | Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: move pagefile filedescriptor into struct xenpagingOlaf Hering2012-02-201-0/+1
| | | | | Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: no poll timeout while page-out is in progressOlaf Hering2012-02-201-0/+1
| | | | | | | | | | | | | | | | | | | The main loop calls xenpaging_wait_for_event_or_timeout() unconditionally before doing any work. This function calls poll() with a timeout of 100ms. As a result the page-out process is very slow due to the delay in poll(). Call poll() without timeout so that it returns immediately until the page-out is done. Page-out is done when either the policy finds no more pages to nominate or when the requested number of pages is reached. The condition is cleared when a watch event arrives, so that processing the new target is not delayed once again by poll(). v2: - no poll timeout also when large number of evicts is pending Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: use flat index for pagefile and page-in requestsOlaf Hering2012-02-201-7/+3
| | | | | | | | | | | | | | | | | | | | | | | This change is based on an idea by <hongkaixing@huawei.com> and <bicky.shi@huawei.com>. Scanning the victims[] array is time consuming with a large number of target pages. Replace the loop to find the slot in the pagefile which holds the requested gfn with an index. Remove the victims array and replace it with a flat array. This array holds the gfn for a given slot in the pagefile. Adjust all users of the victims array. Rename variable in main() from i to slot to clearify the meaning. Update xenpaging_evict_page() to pass a pointer to xen_pfn_t to xc_map_foreign_pages(). Update policy_choose_victim() to return either a gfn or INVALID_MFN. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: convert mem_event_t to struct mem_eventOlaf Hering2012-01-091-3/+3
| | | | | Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: convert xenpaging_t to struct xenpagingOlaf Hering2012-01-091-3/+3
| | | | | Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: convert xenpaging_victim_t to struct victimOlaf Hering2012-01-091-2/+2
| | | | | Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: add cmdline interface for pagerOlaf Hering2011-11-201-0/+1
| | | | | | | | | | | | | | | | | | | Introduce a cmdline handling for the pager. This simplifies libxl support, debug and mru_size are not passed via the environment anymore. The new interface looks like this: xenpaging [options] -f <pagefile> -d <domain_id> options: -d <domid> --domain=<domid> numerical domain_id of guest. This option is required. -f <file> --pagefile=<file> pagefile to use. This option is required. -m <max_memkb> --max_memkb=<max_memkb> maximum amount of memory to handle. -r <num> --mru_size=<num> number of paged-in pages to keep in memory. -d --debug enable debug output. -h --help this output. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: use guests tot_pages as working targetOlaf Hering2011-11-201-1/+1
| | | | | | | | | This change reverses the task of xenpaging. Before this change a fixed number of pages was paged out. With this change the guest will not have access to more than the given number of pages at the same time. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: track the number of paged-out pagesOlaf Hering2011-11-201-0/+1
| | | | | | | This change is required by subsequent changes. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: remove xc_dominfo_t from paging_tOlaf Hering2011-11-201-2/+2
| | | | | | | | Remove xc_dominfo_t from paging_t, record only max_pages. This value is used to setup internal data structures. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: use batch of pages during final page-inOlaf Hering2011-09-131-2/+5
| | | | | | | Map up to RING_SIZE pages in exit path to fill the ring instead of populating one page at a time. Signed-off-by: Olaf Hering <olaf@aepfle.de>
* xenpaging: remove private mem_event.hOlaf Hering2011-06-101-3/+8
| | | | | | | | tools/xenpaging/mem_event.h is only included in xenpaging.h. Add the contents into that file and remove mem_event.h. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: implement stopping of pager by sending SIGTERM/SIGINTOlaf Hering2011-06-101-0/+3
| | | | | | | | Write all paged-out pages back into the guest if the pager is interrupted by ctrl-c or if it receives SIGTERM. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: move num_pages into xenpaging structOlaf Hering2011-06-101-0/+1
| | | | | | | | | | Move num_pages into struct xenpaging. num_pages will be used by the policy in a subsequent patch. Also remove a memset, the victims array is allocated with calloc. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: drop xc.c, remove xc filesOlaf Hering2011-06-101-1/+0
| | | | | | | Finally remove xc.c/xc.h and its references since both are empty now. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: drop xc.c, remove xc_platform_info_tOlaf Hering2011-06-101-1/+0
| | | | | | | xc_platform_info_t is not used in xenpaging. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: add xs_handle to struct xenpagingOlaf Hering2011-06-221-0/+1
| | | | | | | | | | A xs_handle is currently used in the xc_mem_paging_flush_ioemu_cache() function and will be used by a subsequent patch. Add it to struct xenpaging. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* tools: merge several bitop functions into xc_bitops.hOlaf Hering2011-06-101-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | Bitmaps are used in save/restore, xenpaging and blktap2. Merge the code into a private xc_bitops.h file. All users are single threaded, so locking is not an issue. The array of bits is handled as volatile because the x86 save/restore code passes the bitmap to the hypervisor which in turn modifies the bitmap. blktap2 uses a private bitmap. There was a possible overflow in the bitmap_size() function, the remainder was not considered. ia64 save/restore uses a bitmap to send the number of vcpus to the host. x86 save/restore uses a bitmap to track dirty pages. This bitmap is shared with the hypervisor. An unused function count_bits() was removed and a new bitmap_size() function is now used. xenpaging uses 3 private bitmaps to track the gfns which are in paged-out state. It had a copy of some Linux bitops.h, which is now obsolete. Also the BITS_PER_LONG macro was hardcoded to 64 which made it impossible to run 32bit tools on a 64bit host. Wether this works at all has to be tested, yet. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: remove unused spinlock in pagerOlaf Hering2011-06-101-1/+0
| | | | | | | | | | | | The spinlock code in the pager is a no-op because xenpaging is a single threaded application. There is no locking when put_response() places a response into the ringbuffer. The only locking is inside the hypervisor, where mem_event_put_request() and mem_event_get_response() lock the ringbuffer to protect multiple vcpus from each other. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: specify policy mru_size at runtimeKeir Fraser2011-01-111-0/+1
| | | | | | | | | | The environment variable XENPAGING_POLICY_MRU_SIZE will change the mru_size in the policy at runtime. Specifying the mru_size at runtime allows the admin to keep more pages in memory so guests can make more progress. Its also good for development to reduce the value to put more pressure on the paging related code paths. Signed-off-by: Olaf Hering <olaf@aepfle.de>
* xenpaging: remove domain_id and mfn from struct xenpaging_victimKeir Fraser2011-01-111-4/+0
| | | | | | | | | | | | Remove unused member 'mfn' from struct xenpaging_victim. xenpaging operates on a single guest, so it needs only a single domain_id. Remove domain_id from struct xenpaging_victim and use the one from paging->mem_event where needed. Its not used in the policy. This saves 4MB runtime data with a 1GB pagefile. Signed-off-by: Olaf Hering <olaf@aepfle.de>
* libxc: eliminate static variables, use xentoollog; API changeKeir Fraser2010-05-281-1/+1
| | | | | | | | | | | | | | | | | | | | This patch eliminate the global variables in libxenctrl (used for logging and error reporting). Instead the information which was in the global variables is now in a new xc_interface* opaque structure, which xc_interface open returns instead of the raw file descriptor; furthermore, logging is done via xentoollog. There are three new parameters to xc_interface_open to control the logging, but existing callers can just pass "0" for all three to get the old behaviour. All libxc callers have been adjusted accordingly. Also update QEMU_TAG for corresponding qemu change. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* Make Citrix copyright strinsg consistent.Keir Fraser2009-12-181-1/+1
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* User-land tool for memory paging.Keir Fraser2009-12-171-0/+72
This tool will page out the specified number of pages from the specified domain. When a paged out page is accessed, Xen will issue a request and notify the tool over an event channel. The tool will process ther request, page the page in, and notify Xen. The current (default) policy tracks the 1024 most recently paged in pages and will not choose to evict any of those. This is done with the assumption that if a page is accessed, it is likely to be accessed again soon. Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>