aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenpaging
Commit message (Collapse)AuthorAgeFilesLines
...
* xenpaging: use batch of pages during final page-inOlaf Hering2011-09-133-19/+42
| | | | | | | 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>
* tools: fix build after recent xenpaging changesTim Deegan2011-06-271-1/+1
| | | | | | | xenpaging now uses pthreads, so must link appropriately. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenpaging: remove private mem_event.hOlaf Hering2011-06-103-63/+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-104-3/+104
| | | | | | | | 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: add watch thread to catch guest shutdownOlaf Hering2011-06-101-2/+38
| | | | | | | | | If xenpaging is started manually then no event is sent to xenpaging when the guest is shutdown or rebooted. Add a watch on the @releaseDomain node to leave the loop and gracefully shutdown the pager. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: add helper function for unlinking pagefileOlaf Hering2011-06-101-2/+12
| | | | | | | | Unlink pagefile in the signal handler and also in the exit path. This does not leave a stale pagefile if an error occoured. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: pass integer to xenpaging_populate_pageOlaf Hering2011-06-101-10/+6
| | | | | | | | | Pass gfn as integer to xenpaging_populate_page(). xc_map_foreign_pages() takes a pointer to a list of gfns, but its a const pointer. So writing the value back to the caller is not needed. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: start paging in the middle of gfn rangeOlaf Hering2011-06-101-0/+4
| | | | | | | | Set the starting gfn to somewhere in the middle of the gfn range to avoid paging during BIOS startup. This can speedup booting of a guest. 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-102-16/+15
| | | | | | | | | | 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: remove local domain_id variableOlaf Hering2011-06-101-5/+3
| | | | | | | | | Remove the local domain_id variable, it is already fetched from paging->mem_event in other places. Update the sprintf format string to use unsigned argument. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: catch xc_mem_paging_resume errorsOlaf Hering2011-06-101-2/+3
| | | | | | | | In the unlikely event that xc_mem_paging_resume() fails, do not overwrite the error with the return value from xc_evtchn_notify() Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: remove return values from functions that can not failOlaf Hering2011-06-101-15/+4
| | | | | | | | get_request() and put_response() can not fail, remove return value and update calling functions. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: remove srand callOlaf Hering2011-06-101-3/+0
| | | | | | | | The policy uses now a linear algorithm instead of a random one. Remove the call to srand(). Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: do not bounce p2mt back to the hypervisorOlaf Hering2011-06-221-4/+0
| | | | | | | | do not bounce p2mt back to the hypervisor because p2m_mem_paging_populate() and p2m_mem_paging_resume() dont make use of p2mt. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: correct dropping of pages to avoid full ring bufferOlaf Hering2011-06-101-11/+11
| | | | | | | | | | | | | | Doing a one-way channel from Xen to xenpaging is not possible with the current ring buffer implementation. xenpaging uses the mem_event ring buffer, which expects request/response pairs to make progress. The previous patch, which tried to establish a one-way communication from Xen to xenpaging, stalled the guest once the buffer was filled up with requests. Correct page-dropping by taking the slow path and let p2m_mem_paging_resume() consume the response from xenpaging. This makes room for yet another request/response pair and avoids hanging guests. 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-106-105/+1
| | | | | | | 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, move xc_wait_for_event_or_timeoutOlaf Hering2011-06-103-44/+45
| | | | | | | | | Move xc_wait_for_event_or_timeout() into xenpaging and massage it a bit for further changes in subsequent patches. Include poll.h instead of sys/poll.h. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: drop xc.c, move xc_mem_paging_flush_ioemu_cacheOlaf Hering2011-06-103-20/+15
| | | | | | | | | Move xc_mem_paging_flush_ioemu_cache() into xenpaging and massage it a bit to use the required members from xenpaging_t. Also update type of rc to match xs_write() return value. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* xenpaging: drop xc.c, remove xc_wait_for_eventOlaf Hering2011-06-102-5/+0
| | | | | | | xc_wait_for_event is not used in xenpaging. 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-104-36/+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: drop xc.c, remove ASSERTOlaf Hering2011-06-102-8/+0
| | | | | | | The ASSERT is not needed, victim is never NULL. 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-222-0/+15
| | | | | | | | | | 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-106-484/+10
| | | | | | | | | | | | | | | | | | | | | | | | 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-104-87/+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>
* tools: Remove $(CFLAGS) from links lines.Ian Campbell2011-03-311-1/+1
| | | | | | | | The relevant variable in these circumstances is called $(LDFLAGS). Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools: drop further uses of -Wp,-MD,.$(@F).d to generate dependencies.Ian Campbell2011-03-231-3/+0
| | | | | | | | | | 19025:bd78714b8594 switched to "-MMD -MF" in preference, adding the correct runes to tools/Rules.mk but appears to have missed some other uses of -Wp,... Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools: Drop XEN_XC variableIan Campbell2011-03-211-3/+2
| | | | | | | | | There is nothing to include in the python bindings source directory and likely never was/will be ... Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools: remove unnecessary uses of -I.Ian Campbell2011-03-211-1/+0
| | | | | | | | | | It's not needed unless you are including headers in the current directory _and_ you can't use "" instead of <> because the headers are to be installed. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* build: Make XEN_ROOT an absolute path.Keir Fraser2011-03-171-1/+1
| | | | | | | | Otherwise make can search the path relative to certain standard paths such as /usr/include (e.g., the line '-include $(XEN_ROOT)/.config' in Config.mk suffers from this). Signed-off-by: Keir Fraser <keir@xen.org>
* tools/xenpaging: fix return value from xc_mem_paging_flush_ioemu_cacheIan Jackson2011-01-111-1/+1
| | | | | | | | | | | | | | | | | While using xenpaging, "Error flushing ioemu cache" message will be shown even if the "flush-cache" command is sent to xenstore correctly. That is because xenpaging assumes xc_mem_paging_flush_ioemu_cache() returns non-zero value when the operation fails. But xc_mem_paging_flush_ioemu_cache() returns the return value from xs_write() which is zero on error. So, we should invert the return value from xs_write() and return -1 on error, or 0 on success, like other xc_ functions. Signed-off-by: Han-Lin Li <Han-Lin.Li@itri.org.tw> Author: Olaf Hering <olaf@aepfle.de> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenpaging: drop paged pages in guest_remove_pageKeir Fraser2011-01-111-15/+24
| | | | | | | | | Simply drop paged-pages in guest_remove_page(), and notify xenpaging to drop its reference to the gfn. If the ring is full, the page will remain in paged-out state in xenpaging. This is not an issue, it just means this gfn will not be nominated again. Signed-off-by: Olaf Hering <olaf@aepfle.de>
* xenpaging: make three functions staticKeir Fraser2011-01-111-3/+3
| | | | | | | xenpaging_init(), xenpaging_teardown() and xenpaging_evict_page() are only used in file scope, so they can be marked static. Signed-off-by: Olaf Hering <olaf@aepfle.de>
* xenpaging: print page-in/page-out progressKeir Fraser2011-01-111-0/+2
| | | | | | | | | Now that DPRINTF is triggered only when the environment variable XENPAGING_DEBUG is found, make such a debug session actually useful by printing the entire page-out/page-in process. The 'Got event from Xen' message alone is not helpful. Signed-off-by: Olaf Hering <olaf@aepfle.de>
* xenpaging: mkdir /var/lib/xen/xenpaging during make installKeir Fraser2011-01-111-0/+1
| | | | | | | pagefiles go to /var/lib/xen/xenpaging directory, create this directory during make install Signed-off-by: Olaf Hering <olaf@aepfle.de>
* xenpaging: specify policy mru_size at runtimeKeir Fraser2011-01-113-5/+27
| | | | | | | | | | 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-114-29/+18
| | | | | | | | | | | | 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>
* mem_access: mem event additions for accessJoe Epstein2011-01-071-1/+1
| | | | | | | | | | | | | | | * Adds an ACCESS memory event type, with RESUME as the action. * Refactors the bits in the memory event to store whether the memory event was a read, write, or execute (for access memory events only). I used bits sparingly to keep the structure somewhat the same size. * Modified VMX to report the needed information in its nested page fault. SVM is not implemented in this patch series. Signed-off-by: Joe Epstein <jepstein98@gmail.com> Acked-by: Keir Fraser <keir@xen.org> Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
* libxc: convert evtchn interfaces to use an opaque handle typeIan Campbell2010-12-235-17/+17
| | | | | | | | | | | | This makes the interface consistent with the changes made to the main interface in 21483:779c0ef9682c. Also fix some references to "struct xc_interface" which should have been simply "xc_interface" in tools/xenpaging, and update QEMU_TAG to pull in the corresponding qemu change. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenpaging: update xch usageOlaf Hering2010-12-143-29/+32
| | | | | | | | Instead of passing xch around, use the handle from xenpaging_t. In the updated functions, use a local xch variable. Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenpaging: do not use DPRINTF/ERROR if xch handle is unavailableOlaf Hering2010-12-141-4/+2
| | | | | | | | | | | | Fix DPRINTF/ERROR usage. Both macros reference a xch variable in local scope. If xc_interface_open fails and after xc_interface_close, both can not be used anymore. Use standard fprintf for this case. Remove the code to print the exit value, its not really useful. Its a left-over for debugging from an earlier patch. Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenpaging: remove duplicate xc_interface_close callOlaf Hering2010-12-141-2/+0
| | | | | | | | Fix double-free in xc_interface_close() because xenpaging_teardown() releases the *xch already. Remove second xc_interface_close() call. Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenpaging: print number of evicted pagesOlaf Hering2010-12-141-1/+1
| | | | | | | Print number of evicted pages after evict loop. Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenpaging: print DPRINTF ouput if XENPAGING_DEBUG is in environmentOlaf Hering2010-12-141-7/+4
| | | | | | | | | No DPRINTF output is logged because the default loglevel is to low in libxc. Recognize the XENPAGING_DEBUG environment variable to change the default loglevel at runtime. Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenpaging: remove perror usage in xenpaging_init error pathOlaf Hering2010-12-141-1/+1
| | | | | | | | Use the libxc error macro to report errors if initialising xenpaging fails. Also report the actual errno string. Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenpaging: close xch handle in xenpaging_init error pathOlaf Hering2010-12-141-0/+1
| | | | | | | Just for correctness, close the xch handle in the error path. Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xenpaging: increase recently used pages from 4MB to 64MBKeir Fraser2010-11-261-1/+1
| | | | | | | | Increase recently used pages from 4MB to 64MB. Keeping more pages in memory allows the guest to make more progress if the paging file spans the entire guest memory. Signed-off-by: Olaf Hering <olaf@aepfle.de>
* xenpaging: handle temporary out-of-memory conditions during page-inKeir Fraser2010-11-261-7/+20
| | | | | | | | | | | p2m_mem_paging_prep() should return -ENOMEM if a new page could not be allocated. This can be handled in xenpaging to retry the page-in. Right now such condition would stall the guest because the requested page will not come back, xenpaging simply exits. So xenpaging could very well retry the allocation forever to rescue the guest. Signed-off-by: Olaf Hering <olaf@aepfle.de>
* xenpaging: print xenpaging cmdline optionsKeir Fraser2010-11-261-0/+2
| | | | | | | Print xenpaging arguments to simplify domain_id mapping from xenpaging logfile to other logfiles and Xen console output. Signed-off-by: Olaf Hering <olaf@aepfle.de>
* xenpaging: allow negative num_pages and limit num_pagesKeir Fraser2010-11-261-2/+7
| | | | | | | | Simplify paging size argument. If a negative number is specified, it means the entire guest memory should be paged out. This is useful for debugging. Also limit num_pages to the guests max_pages. Signed-off-by: Olaf Hering <olaf@aepfle.de>
* xenpaging: notify policy only on resumeKeir Fraser2010-11-261-4/+5
| | | | | | | | | | | | If a page is requested more than once, the policy is also notified more than once about the page-in. However, a page-in happens only once. Any further resume will only unpause the other vcpu. The multiple notify will put the page into the mru list multiple times and it will unlock other already resumed pages too early. In the worst case, a page that was just resumed can be evicted right away, causing a deadlock in the guest. Signed-off-by: Olaf Hering <olaf@aepfle.de>