aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_dom.c
Commit message (Collapse)AuthorAgeFilesLines
* libxl,xl: add max_event_channels option to xl configuration fileDavid Vrabel2013-10-141-0/+7
| | | | | | | | | | | | | | | | | | | Add the 'max_event_channels' option to the xl configuration file to limit the number of event channels that domain may use. Plumb this option through to libxl via a new libxl_build_info field and call xc_domain_set_max_evtchn() in the post build stage of domain creation. A new LIBXL_HAVE_BUILDINFO_EVENT_CHANNELS #define indicates that this new field is available. The default value of 1023 limits the domain to using the minimum amount of global mapping pages and at most 5 xenheap pages. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
* libxl: Fix function libxl__domain_resume_device_modelrwxybh2013-08-021-0/+1
| | | | | | | Add a break line in function libxl__domain_resume_device_model Signed-off-by: Bingheng Yan <rwxybh@126.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: automatic placement deals with node-affinityDario Faggioli2013-04-171-14/+16
| | | | | | | | | | | | | | | | Which basically means the following two things: 1) during domain creation, it is the node-affinity of the domain --rather than the vcpu-affinities of its VCPUs-- that is affected by automatic placement; 2) during automatic placement, when counting how many VCPUs are already "bound" to a placement candidate (as part of the process of choosing the best candidate), both vcpu-affinity and node-affinity are considered. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
* libxl: allow for explicitly specifying node-affinityDario Faggioli2013-04-171-0/+1
| | | | | | | | | | By introducing a nodemap in libxl_domain_build_info and providing the get/set methods to deal with it. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xl: Implement XENMEM_claim_pages support via 'claim_mode' global configKonrad Rzeszutek Wilk2013-04-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The XENMEM_claim_pages hypercall operates per domain and it should be used system wide. As such this patch introduces a global configuration option 'claim_mode' that by default is disabled. If this option is enabled then when a guest is created there will be an guarantee that there is memory available for the guest. This is an particularly acute problem on hosts with memory over-provisioned guests that use tmem and have self-balloon enabled (which is the default option for them). The self-balloon mechanism can deflate/inflate the balloon quickly and the amount of free memory (which 'xl info' can show) is stale the moment it is printed. When claim is enabled a reservation for the amount of memory ('memory' in guest config) is set, which is then reduced as the domain's memory is populated and eventually reaches zero. If the reservation cannot be meet the guest creation fails immediately instead of taking seconds/minutes (depending on the size of the guest) while the guest is populated. Note that to enable tmem type guests, one needs to provide 'tmem' on the Xen hypervisor argument and as well on the Linux kernel command line. There are two boolean options: (0) No claim is made. Memory population during guest creation will be attempted as normal and may fail due to memory exhaustion. (1) Normal memory and freeable pool of ephemeral pages (tmem) is used when calculating whether there is enough memory free to launch a guest. This guarantees immediate feedback whether the guest can be launched due to memory exhaustion (which can take a long time to find out if launching massively huge guests) and in parallel. [v1: Removed own claim_mode type, using just bool, improved docs, all per Ian's suggestion] [v2: Updated the comments] [v3: Rebase on top 733b9c524dbc2bec318bfc3588ed1652455d30ec (xl: add vif.default.script)] [v4: Fixed up comments] [v5: s/global_claim_mode/claim_mode/] [v6: Ian Jackson's feedback: use libxl_defbool, better comments, etc] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: run libxl__arch_domain_create() much earlier.Tim Deegan2013-03-281-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Among other things, arch_domain_create() sets the shadow(/hap/p2m) memory allocation, which must happen after vcpus are assigned (or the shadow op will fail) but before memory is allocated (or we might run out of p2m memory). libxl__build_pre(), which already sets similar things like maxmem, semes like a reasonable spot for it. That needed a bit of plumbing to get the right datastructure from the caller. As a side-effect, the return code from libxl__arch_domain_create() is no longer ignored. This bug was analysed in: From: "Jan Beulich" <JBeulich@xxxxxxxx> "Re: [Xen-devel] [xen-unstable test] 16788: regressions - FAIL" Date: Mon, 04 Mar 2013 16:34:53 +0000 http://lists.xen.org/archives/html/xen-devel/2013-03/msg00191.html Reported-by: Jan Beulich <JBeulich@suse.com> Signed-off-by: Tim Deegan <tim@xen.org> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: Ian Campbell <ian.campbell@citrix.com>
* libxl: Made it possible to use 'timer='delay_for_missed_ticks'Konrad Rzeszutek Wilk2013-02-261-1/+1
| | | | | | | | | | The assertion only allows values of 1 (no_delay_for_missed_ticks) up to 3 (one_missed_tick_pending). It should be possible to use the value of 0 (delay_for_missed_ticks) for the timer configuration option. Acked-by: Ian Campbell <ian.cambell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* xen/arm: compile and run libxl/xlStefano Stabellini2013-02-151-47/+7
| | | | | | | | | | | | Move tsc, rtc, memmap_limit, localtime and shadow settings from libxl__build_pre to libxl__arch_domain_create. Get the console and xenstore pfn's from struct xc_dom_image for autotranslated guests. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: Cleanup, use LOG* and GCSPRINTF macro in libxl_dom.cRoss Philipson2013-02-151-58/+39
| | | | | | Signed-off-by: Ross Philipson <ross.philipson@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: HVM firmware passthrough supportRoss Philipson2013-02-151-17/+115
| | | | | | | | | | | | | | | | | | | | | | This patch introduces support for two new parameters in libxl: smbios_firmware=<path_to_smbios_structures_file> acpi_firmware=<path_to_acpi_tables_file> The changes are primarily in the domain building code where the firmware files are read and passed to libxc for loading into the new guest. After the domain building call to libxc, the addresses for the loaded blobs are returned and written to xenstore. LIBXL_HAVE_FIRMWARE_PASSTHROUGH is defined in libxl.h to allow users to determine if the feature is present. This patch also updates the xl.cfg man page with descriptions of the two new parameters for firmware passthrough. Signed-off-by: Ross Philipson <ross.philipson@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: switch to using the new xc_hvm_build() libxc API.Ross Philipson2013-02-151-6/+13
| | | | | | Signed-off-by: Ross Philipson <ross.philipson@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: fix xcflags assignment in libxl__domain_suspendOlaf Hering2013-02-051-3/+3
| | | | | | | | | Currently ->xcflags remains 1 because the braces are placed incorrectly. Put each logical unit into its own braces to fix assigment to xcflags. Signed-off-by: Olaf Hering <olaf@aepfle.de> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: qemu trad logdirty: Tolerate ENOENT on ret pathIan Jackson2012-12-131-1/+1
| | | | | | | | | | | It can happen in error conditions that lds->ret_path doesn't exist, and libxl__xs_read_checked signals this by setting got_ret=NULL. If this happens, fail without crashing. Reported-by: Alex Bligh <alex@alex.org.uk>, Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl_dom: Call the right switch logdirty for the right DM.Anthony PERARD2012-10-081-3/+42
| | | | | | | | | | | | This patch dispatch the switch logdirty call depending on which device model version is running. The call to qemu-xen right now is synchronous, not like the one to qemu-xen-traditional. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: make domain resume API asynchronousIan Campbell2012-08-231-1/+1
| | | | | | | | | | | | | | | | | | Although the current implementation has no asynchromous parts I can envisage it needing to do bits of create/destroy like functionality which may need async support in the future. To do this make the meat into an internal libxl__domain_resume function in order to satisfy the no-internal-callers rule for the async function. Since I needed to touch the logging to s/ctx/CTX/ anyway switch to the LOG* helper macros. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Roger Pau Monne <roger.pau@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: remus: mark TODOs more clearlyIan Jackson2012-08-031-4/+5
| | | | | | | | | | | | | Change the TODOs in the remus code to "REMUS TODO" which will make them easier to grep for later. AIUI all of these are essential for use of remus in production. Also add a new TODO and a new assert, to check rc on entry to remus_checkpoint_dm_saved. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: have NUMA placement deal with cpupoolsDario Faggioli2012-07-261-14/+26
| | | | | | | | | | | | | | | | | In such a way that only the cpus belonging to the cpupool of the domain being placed are considered for the placement itself. This happens by filtering out all the nodes in which the cpupool has not any cpu from the placement candidates. After that ---as cpu pooling not necessarily happens at NUMA nodes boundaries--- we also make sure only the actual cpus that are part of the pool are considered when counting how much processors a placement candidate provides. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: enable automatic placement of guests on NUMA nodesDario Faggioli2012-07-261-0/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a domain does not have a VCPU affinity, try to pin it automatically to some PCPUs. This is done taking into account the NUMA characteristics of the host. In fact, we look for a combination of host's NUMA nodes with enough free memory and number of PCPUs for the new domain, and pin it to the VCPUs of those nodes. Deciding which placement is the best happens by means of some heuristics. For instance, smaller candidates are better, both from a domain perspective (less memory spreading among nodes) and from the entire system perspective (smaller memory fragmentation). In case of candidates of equal sizes (i.e., with the same number of nodes), the amount of free memory and the number of domains' vCPUs already pinned to the candidates' nodes are both considered. Very often, candidates with greater amount of memory are the one we wants, as this is good for keeping memory fragmentation under control. However, we do not want to overcommit some node too much, just because it has a lot of memory, and that's why the number of vCPUs must be accounted for. This all happens internally to libxl, and no API for driving the mechanism is provided for now. This matches what xend already does. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Tested-by: Andre Przywara <andre.przywara@amd.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: fix transaction leak in logdirty error pathIan Jackson2012-07-251-0/+1
| | | | | | | | | | | | | libxl__domain_suspend_common_switch_qemu_logdirty would leak t if there was an error. Fix this. Also, document the intended usage for libxl__xs_transaction_* in the doc comment in libxl_internal.h. Reported-by: Ian Campbell <Ian.Campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: fix bug the number of running vcpu inconsistent with config fileZhang, Yang Z2012-07-241-0/+1
| | | | | | | | | | | | The following patch will fix the bug 1825. http://bugzilla.xen.org/bugzilla/show_bug.cgi?id=1825 When using memcpy to update vcpu_online, the high bits of vcpu_online may unmodified if the size of avail_vcpus less than vcpu_online. So we need to clear it before the memory copying. Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com> Acked-by: Ian Campbell <ian.campbelL@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: rename libxl_cpumap to libxl_bitmapDario Faggioli2012-07-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | And leave to the caller the burden of knowing and remembering what kind of bitmap each instance of libxl_bitmap is. This is basically just some s/libxl_cpumap/libxl_bitmap/ (and some other related interface name substitution, e.g., libxl_for_each_cpu) in a bunch of files, with no real functional change involved. A specific allocation helper is introduced, besides libxl_bitmap_alloc(). It is called libxl_cpu_bitmap_alloc() and is meant at substituting the old libxl_cpumap_alloc(). It is just something easier to use in cases where one wants to allocate a libxl_bitmap that is going to serve as a cpu map. This is because we want to be able to deal with both cpu and NUMA node maps, but we don't want to duplicate all the various helpers and wrappers. While at it, add the usual initialization function, common to all libxl data structures. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.eu.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: log on failure in cpupool_info and libxl__domain_cpupoolIan Campbell2012-06-291-1/+6
| | | | | | | | | Also in cpupool_info propagate the failure value from libxl_cpumap_alloc. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* libxl: correct type of cpupool variable.Ian Campbell2012-06-291-1/+1
| | | | | | | | | libxl__domain_cpupool returns int and can return ERROR_* so we need to use a signed type. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* libxl: initialise cpupoolinfo in libxl__domain_schedulerIan Campbell2012-06-291-0/+1
| | | | | | | | | | If libxl_cpupool_info fails then we would call libxl_cpupoolinfo_dispose on an uninitialised struct, and possibly free an invalid pointer. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* libxl: Make libxl__domain_save_device_model asynchronousIan Jackson2012-06-281-35/+65
| | | | | Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: prepare for asynchronous writing of qemu save fileIan Jackson2012-06-281-15/+39
| | | | | | | | | | | | | | | | | | * Combine the various calls to libxl__device_model_savefile into one at the start of libxl__domain_suspend, storing the result in the dss. Consequently a few functions take a dss instead of some or all of their other arguments. * Make libxl__domain_save_device_model's API into an asynchronous style which takes a callback. The function is, however, still synchronous; it will be made actually async in the next patch. * Consequently make libxl__remus_domain_checkpoint_callback into an asynchronous callback. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxl: wait for qemu to acknowledge logdirty commandIan Jackson2012-06-281-12/+165
| | | | | | | | | | | | | | | | | | | | | | | | The current migration code in libxl instructs qemu to start or stop logdirty, but it does not wait for an acknowledgement from qemu before continuing. This might lead to memory corruption (!) Fix this by waiting for qemu to acknowledge the command. Unfortunately the necessary ao arrangements for waiting for this command are unique because qemu has a special protocol for this particular operation. Also, this change means that the switch_qemu_logdirty callback implementation in libxl can no longer synchronously produce its return value, as it now needs to wait for xenstore. So we tell the marshalling code generator that it is a message which does not need a reply. This turns the callback function called by the marshaller into one which returns void; the callback function arranges to later explicitly sends the reply to the helper, when the xs watch triggers and the appropriate value is read from xenstore. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: rename libxl_dom:save_helper to physmap_pathIan Jackson2012-06-281-4/+4
| | | | | | | | | | "save_helper" isn't very descriptive. Also it is now confusing because it reads like it might refer to the libxl-save-helper executable which runs xc_domain_save and xc_domain_restore. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
* libxl: domain save/restore: run in a separate processIan Jackson2012-06-281-16/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libxenctrl expects to be able to simply run the save or restore operation synchronously. This won't work well in a process which is trying to handle multiple domains. The options are: - Block such a whole process (eg, the whole of libvirt) while migration completes (or until it fails). - Create a thread to run xc_domain_save and xc_domain_restore on. This is quite unpalatable. Multithreaded programming is error prone enough without generating threads in libraries, particularly if the thread does some very complex operation. - Fork and run the operation in the child without execing. This is no good because we would need to negotiate with the caller about fds we would inherit (and we might be a very large process). - Fork and exec a helper. Of these options the latter is the most palatable. Consequently: * A new helper program libxl-save-helper (which does both save and restore). It will be installed in /usr/lib/xen/bin. It does not link against libxl, only libxc, and its error handling does not need to be very advanced. It does contain a plumbing through of the logging interface into the callback stream. * A small ad-hoc protocol between the helper and libxl which allows log messages and the libxc callbacks to be passed up and down. Protocol doc comment is in libxl_save_helper.c. * To avoid a lot of tedium the marshalling boilerplate (stubs for the helper and the callback decoder for libxl) is generated with a small perl script. * Implement new functionality to spawn the helper, monitor its output, provide responses, and check on its exit status. * The functions libxl__xc_domain_restore_done and libxl__xc_domain_save_done now turn out to want be called in the same place. So make their state argument a void* so that the two functions are type compatible. The domain save path still writes the qemu savefile synchronously. This will need to be fixed in a subsequent patch. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: domain save: API changes for asynchronyIan Jackson2012-06-281-35/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the internal and external APIs for domain save (suspend) to be capable of asynchronous operation. The implementation remains synchronous. The interfaces surrounding device model saving are still synchronous. Public API changes: * libxl_domain_save takes an ao_how. * libxl_domain_remus_start takes an ao_how. If the libxl_domain_remus_info is NULL, we abort rather than returning an error. * The `suspend_callback' function passed to libxl_domain_save is never called by the existing implementation in libxl. Abolish it. * libxl_domain_save takes its flags parameter as an argument. Thus libxl_domain_suspend_info is abolished. * XL_SUSPEND_* flags renamed to LIBXL_SAVE_*. * Callers in xl updated. Internal code restructuring: * libxl__domain_suspend_state member types and names rationalised. * libxl__domain_suspend renamed from libxl__domain_suspend_common. (_common here actually meant "internal function"). * libxl__domain_suspend takes a libxl__domain_suspend_state, which where the parameters to the operation are filled in by the caller. * xc_domain_save is now called via libxl__xc_domain_save which can itself become asynchronous. * Consequently, libxl__domain_suspend is split into two functions at the callback boundary; the second half is libxl__xc_domain_save_done. * libxl__domain_save_device_model is now called by the actual implementation rather than by the public wrapper. It is already in its proper place in the domain save execution sequence. So officially make it part of that execution sequence, renaming it to domain_save_device_model. * Effectively, rewrite the public wrapper functions libxl_domain_suspend and libxl_domain_remus_start. * Remove a needless #include <xenctrl.h> * libxl__domain_suspend aborts on unexpected domain types rather than mysteriously returning EINVAL. * struct save_callbacks moved from the stack to the dss. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: domain restore: reshuffle, preparing for aoIan Jackson2012-06-281-44/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are going to arrange that libxl, instead of calling xc_domain_restore, calls a stub function which forks and execs a helper program, so that restore can be asynchronous rather than blocking the whole toolstack. This stub function will be called libxl__xc_domain_restore. However, its prospective call site is unsuitable for a function which needs to make a callback, and is buried in two nested single-call-site functions which are logically part of the domain creation procedure. So we first abolish those single-call-site functions, integrate their contents into domain creation in their proper temporal order, and break out libxl__xc_domain_restore ready for its reimplementation. No functional change - just the following reorganisation: * Abolish libxl__domain_restore_common, as it had only one caller. Move its contents into (what was) domain_restore. * There is a new stage function domcreate_rebuild_done containing what used to be the bulk of domcreate_bootloader_done, since domcreate_bootloader_done now simply starts the restore (or does the rebuild) and arranges to call the next stage. * Move the contents of domain_restore into its correct place in the domain creation sequence. We put it inside domcreate_bootloader_done, which now either calls libxl__xc_domain_restore which will call the new function domcreate_rebuild_done, or calls domcreate_rebuild_done directly. * Various general-purpose local variables (`i' etc.) and convenience alias variables need to be shuffled about accordingly. * Consequently libxl__toolstack_restore needs to gain external linkage as it is now in a different file to its user. * Move the xc_domain_save callbacks struct from the stack into libxl__domain_create_state. In general the moved code remains almost identical. Two returns in what used to be libxl__domain_restore_common have been changed to set the return value and "goto out", and the call sites for the abolished and new functions have been adjusted. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: domain save: rename variables etc.Ian Jackson2012-06-281-136/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Preparatory work for making domain suspend asynchronous: * Rename `struct suspendinfo' to `libxl__domain_suspend_state' and move it to libxl_internal.h. * Rename variables `si' to `dss'. * Change the stack-allocated state and callbacks from struct suspendinfo si; struct save_callbacks callbacks; struct restore_callbacks callbacks; to libxl__domain_suspend_state dss[1]; struct save_callbacks callbacks[1]; struct restore_callbacks callbacks[1]; so that it may be referred to as a pointer variable everywhere. * Rename the variable `flags' (in libxl__domain_suspend_state) to `xcflags', to help distinguish it from the other `flags' which is passed in from the calling application in libxl_domain_suspend_info. Abolish the local variable in libxl__domain_suspend_common, as it can use the one in the dss. * Move the prototypes of suspend-related functions in libxl_internal.h to after the definition of the state struct. * Replace several ctx variables with gc variables and consequently references to ctx with CTX. Change references to `dss->gc' in the functional code to simply `gc'. * Use LOG* rather than LIBXL__LOG* in a number of places. * In libxl__domain_save_device_model use `rc' instead of `ret'. * Introduce and use `gc' and `domid' in libxl__domain_suspend_common_callback. * Wrap some long lines. * Add an extra pair of parens for clarity in a flag test. * Remove two pointless casts from void* to a struct*. No functional change whatsoever. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxc: xc_domain_restore, make toolstack_restore const-correctIan Jackson2012-06-281-2/+2
| | | | | | | Update the one provider of this callback, in libxl. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: allow setting more than 31 vcpusYang Zhang2012-06-281-3/+3
| | | | | | | | | | | | In current implementation, it uses integer to record current avail cpus and this only allows user to specify 31 vcpus. In following patch, it uses cpumap instead integer which make more sense than before. Also there is no limit to the max vcpus. Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: propagate down the error from libxl_domain_sched_params_setDario Faggioli2012-06-141-2/+4
| | | | | | | | So that the caller (e.g., libxl__build_post() ) knows and can deal with it. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: introduce LIBXL_DOMAIN_TYPE_INVALIDDario Faggioli2012-06-061-4/+5
| | | | | | | | | | | | | | | | | | | | | | | To avoid recent gcc complaining about: libxl.c: In function 'libxl_primary_console_exec': libxl.c:1233:9: error: case value '4294967295' not in enumerated type 'libxl_domain_type' [-Werror=switch] Also: - have all the call sites of libxl__domain_type() return with error in case the function returns LIBXL_DOMAIN_TYPE_INVALID; - adjust all other code segments where -Wswitch makes would claim that LIBXL_DOMAIN_TYPE_INVALID is not handled by adding a "default: abort();" clause. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> [ ijc -- use LIBXL_DOMAIN_TYPE_INVALID instead of -1 for libxl_domain_build_info.type's keyvar_init_val. -- what used to be libxl_primary_console_exec is now in libxl__primary_console_find so resolve the rejected hunk accordingly ] Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: expose a single get/setter for domain scheduler parametersIan Campbell2012-06-011-1/+1
| | | | | | | | | | | | | | | | This is consistent with having a single struct for all parameters. Effectively renames and exports libxl__sched_set_params as libxl_domain_sched_params_set. libxl_domain_sched_params_get is new. Improve const correctness of the setters while I'm here. Use shorter LOG macros when touching a line anyway. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: move libxl__sched_set_params into libxl.cIan Campbell2012-06-011-27/+0
| | | | | | | | | | All the other sched functions are here and I'm just about to make those static functions as I make libxl__sched_set_params the public function. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: make it possible to explicitly specify default sched paramsIan Campbell2012-06-011-21/+13
| | | | | | | | | | | | | | | | | | | To do so we define a discriminating value which is never a valid real value for each parameter. While there: - removed libxl_sched_*_domain in favour of libxl_domain_sched_params. - use this new functionality for the various xl commands which set sched parameters, which saves an explicit read-modify-write in xl. - removed call of xc_domain_getinfolist from a few functions which weren't actually using the result (looks like a cut and paste error) - fix xl which was setting period for a variety of different config keys. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: rename libxl_sched_params to libxl_domain_sched_paramsIan Campbell2012-06-011-1/+2
| | | | | | | | | | Remove credit scheduler global options from the struct, they were never used anyway. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: add internal function to get a domain's schedulerIan Campbell2012-06-011-0/+35
| | | | | | | | | | | | | | | This takes into account cpupools. Add a helper to get the info for a single cpu pool, refactor libxl_list_cpupool t use this. While there fix the leaks due to not disposing the partial list on realloc failure in that function. Fix the failure of sched_domain_output to free the poolinfo list. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: do not overwrite user supplied config when running bootloaderIan Campbell2012-05-291-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently when running the bootloader libxl will update b_info->u.pv.kernel, .ramdisk, .cmdline and .bootloader. This can expose internal details, such as temporary paths in /var/run/xen/bootloader.*/ to the user. This is problematic because it means that the user cannot re-use the struct as is. This does not effect xl in Xen 4.2+ since it always reparses the guest config and reinitialises the build info, however it did cause issues with reboot in 4.1 (reported by Dmitry Morozhnikov) and may cause issues for other users of libxl. Instead make the libxl bootloader infrastructure provide output to its caller which is slurped into the internal libxl__domain_build_state datastructure. If no bootloader is configured then the bootloader instead propagates the user supplied b_info config. In order to simplify this push the error handling for the case where there is no bootdisk down into libxl__bootloader_run. In principal there is no reason why it shouldn't be possible to do a pure netboot guest with a suitable bootloader, but I don't fix that here. This change allow us to make the libxl_file_reference an internal API, and eventually we might be able to get rid of it. Also removes the publix libxl_run_bootloader interface, neither xl nor libvirt use it. I am proposing this for 4.2 due to the API change. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> [ ijc -- reduced log message in libxl__build_pv from INFO to DEBUG ] Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: Remus - suspend/postflush/commit callbacksShriram Rajagopalan2012-05-181-2/+54
| | | | | | | | | | | | | | | | | | | | | * Add libxl callback functions for Remus checkpoint suspend, postflush (aka resume) and checkpoint commit callbacks. * suspend callback is a stub that just bounces off libxl__domain_suspend_common_callback - which suspends the domain and saves the devices model state to a file. * resume callback currently just resumes the domain (and the device model). * commit callback just writes out the saved device model state to the network and sleeps for the checkpoint interval. * Introduce a new public API, libxl_domain_remus_start (currently a stub) that sets up the network and disk buffer and initiates continuous checkpointing. * Future patches will augment these callbacks/functions with more functionalities like issuing network buffer plug/unplug commands, disk checkpoint commands, etc. Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: QMP stop/resume & refactor QEMU suspend/resume/saveShriram Rajagopalan2012-05-181-19/+61
| | | | | | | | | | | | | | Implement QMP stop and resume functionality and split device model save into 3 parts: suspend_dm(domid) save_dm(domid, fd) resume_dm(domid) Integrate Device model suspend into suspend_common_callback Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl_qmp: remove libxl__qmp_migrate, introduce libxl__qmp_saveStefano Stabellini2012-05-111-10/+1
| | | | | | | | | | Following the recent changes to upstream Qemu, the best monitor command to suit or needs is "xen-save-devices-state" rather than "migrate". This patch removes libxl__qmp_migrate and introduces libxl__qmp_save instead, that uses "xen-save-devices-state". Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* libxl: save/restore qemu's physmapStefano Stabellini2012-05-111-1/+162
| | | | | | | | Read Qemu's physmap from xenstore and save it using toolstack_save. Restore Qemu's physmap using toolstack_restore. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* libxc: introduce XC_SAVE_ID_TOOLSTACKStefano Stabellini2012-05-111-1/+1
| | | | | | | | Introduce a new save_id to save/restore toolstack specific extra information. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* libxl: set domain scheduling parameters while creating the domUDieter Bloms2012-04-251-0/+36
| | | | | | | | | | | | | | the domain specific scheduling parameters like cpu_weight, cap, slice, ... will be set during creating the domain, so this parameters can be defined in the domain config file [ Improved the documentation wording slightly. -iwj ] Signed-off-by: Dieter Bloms <dieter@bloms.de> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: make most libxl_FOO_path() functions internal.Ian Campbell2012-04-121-1/+1
| | | | | | | | | | Only libxl_xen_config_dir_path and libxl_lock_dir_path are used outside the library. Also bindir, sbindir, sharedir and xenpagingdir appeared to be completely unused so nuke them. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: fix rtc_timeoffset settingLin Ming2012-04-241-2/+15
| | | | | | | | | | | | | | | | libxl__domain_build_info_setdefault may be called several times, so rtc_timeoffset can't be setted in it. Move rtc_timeoffset setting logic to libxl__build_pre. Reported-by: Teck Choon Giam <giamteckchoon@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Lin Ming <mlin@ss.pku.edu.cn> Committed-by: Ian Jackson <ian.jackson.citrix.com> --- tools/libxl/libxl_create.c | 9 --------- tools/libxl/libxl_dom.c | 17 +++++++++++++++-- 2 files changed, 15 insertions(+), 11 deletions(-)