This patch moves the logging macros to the public header so that they
can be reused by the client of the library. It also refactors the
code to create the qemu logfile into a generic function that can be
reused to create generic xen logfiles under /var/log/xen. Finally xl
is changed to log to file when running in background.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
This patch adds two functions to libxenlight to be able to recognize
when a particular domain dies. After creating a domain, xl uses these
functions to wait for its death and clean up its resources.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
this patch implements stubdom support for libxenlight:
- it adds two functions to find the stubdom domid of a domain and to
figure out if a certain domain is actually a stubdom;
- it moves all the device init functions from xl.c to libxl.c because
they are needed to setup the devices of stubdoms;
- it fixes some bugs in the pci setup that prevented pci passthrough
from working correctly with stubdoms.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
this is patch to add maxvcpus support to xen xm command. It's using
vcpu_avail bitmask and sets the number of vcpus to maxvcpus if
present. If it's not present, old behavior is preserved.
In domain config file you can define it as follows:
maxvcpus = 4
vcpus = 2
this automatically sets vcpus to 4 and corresponding bitmask to
present 2 vcpus in the guest with option to increase it up to 4
vcpus. If maxvcpus is not present, the old behavior for vcpus is
preserved, ie. you can set vcpus to some number of vcpus to be used
and the vcpu_avail is set appropriately to use all of them. Only when
you use maxvcpus and vcpus new vcpu_avail value is calculated to show
PV guest the desired number of vcpus only.
It's been tested using RHEL-5 32-bit PV guest with maxvcpus = 4 and
vcpus = 2 and also the previous setup of vcpus = 2 only... In both
cases I was able to use 'xm vcpu-set {domainId} {numberOfVCPUs}' to
increase move vcpu count from 0 to maxvcpus/vcpus so it was working as
designed.
Signed-off-By: Michal Novotny<minovotn@redhat.com>
this patch is ported from linux upstream git commit
816bb611e41be29b476dc16f6297eb551bf4d747
the original description is:
"
Add decaying history of predicted idle time, instead of using the last
early wakeup. This logic helps menu governor do better job of
predicting idle time.
With this change, we also measured noticable (~8%) power savings on a
DP server system with CPUs supporting deep C states, when system was
lightly loaded. There was no change to power or perf on other load
conditions.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
"
In Xen environment, we also observe this patch reduce the idle power
fluctuation. In one DP server, when system is purely idle, the watts
stdev/average reduce from 6% to 2%. it is helpful for idle power
measurement accuracy. There is no performance and power change when
system is loaded.
Signed-off-by: Yu Ke <ke.yu@intel.com>
(NOTE: pvrdtscp mode not finished yet, but all other
modes have been tested so sooner seemed better than
later to submit this fairly major patch so we can get
more mileage on it before next release.)
New tsc_mode config option supercedes tsc_native and
offers a more intelligent default and an additional
option for intelligent apps running on PV domains
("pvrdtscp").
For PV domains, default mode will determine if the initial
host has a "safe"** TSC (meaning it is always synchronized
across all physical CPUs). If so, all domains will
execute all rdtsc instructions natively; if not,
all domains will emulate all rdtsc instructions but
providing the TSC hertz rate of the initial machine.
After being restored or live-migrated, all PV domains will
emulate all rdtsc instructions. Hence, this default mode
guarantees correctness while providing native performance
in most conditions.
For PV domains, tsc_mode==1 will always emulate rdtsc
and tsc_mode==2 will never emulate rdtsc. For tsc_mode==3,
rdtsc will never be emulated, but information is provided
through pvcpuid instructions and rdtscp instructions
so that an app can obtain "safe" pvclock-like TSC information
across save/restore and live migration. (Will be completed in
a follow-on patch.)
For HVM domains, the default mode and "always emulate"
mode do the same as tsc_native==0; the other two modes
do the same as tsc_native==1. (HVM domains since 3.4
have implemented a tsc_mode=default-like functionality,
but also can preserve native TSC across save/restore
and live-migration IFF the initial and target machines
have a common TSC cycle rate.)
** All newer AMD machines, and Nehalem and future Intel
machines have "Invariant TSC"; many newer Intel machines
have "Constant TSC" and do not support deep-C sleep states;
these and all single-processor machines are "safe".
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Microsoft's Windows logo certified hardware requires ECC; since the
SVVP certification runs the same test on the guest, Xen domains will
currently fail it.
From: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
GSI 0-15 is setup by hypervisor, and GSI > =16 is setup by dom0
this physdev_op PHYSDEVOP_setup_gsi. This patch can help dom0
to get rid of intrusive changes of ioapic.
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Fix tmem accounting error that causes an "apparent"
memory leak, creating false negatives when testing
memory availability for launching a new domain.
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
This represents a very simplistic aproach to parsing these file. It
is basically sufficient to parse the files produced by Debian
Squeeze's version of update-grub. The actual grub.cfg syntax is much
more expresive but not apparently documented apart from a few
examples...
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
separate to the other fields.
This makes the list of lines within a GrubImage 0 based rather than 1
based therefore adjust the user interface parts to suit.
This is in preparation for grub2 support where the syntax for the item
title does not fit the existing usage.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
and inherit from these classes to implement Grub-legacy functionality.
Use a tuple of (parser-object,configuration-file) in pygrub to allow
for multiple parsers.
Makes way for grub2 support.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
When allocating kbdfront and fbfront structures, we should zero them
since we do not initialize all fields.
Signed-Off-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
In a lot of places in MiniOS frontends, xenbus_watch_path_token is
used instead of xenbus_watch_path to get more precise wake ups. To
free those, xenbus_unwatch_path_token has to be used instead of
xenbus_unwatch_path, else the unwatch operation will fail. This fixes
spurious watch events left by pv-grub.
Signed-Off-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
Otherwise the highlighting and line length trimming does not work as
expected and the display appears corrupted.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
pygrub doesn't support the "savedefault" command and will error out if
menu.lst uses the "default saved" directive. We might as well start on
the first entry in this case instead of failing.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Now that we have pcifront_watches to dynamically initialize pcifront
we don't need a call to init_pcifront in pcilib and pcifront_scan
anymore; we should just wait for the frontend to connect to the
backend instead.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
The attached patch cleans up a few minor problems in the bzip2/lzma
decompression support, pointed out by Jiri in internal review. In
particular, it fixes a possible memory leak on realloc() error, it
fixes a shifting typo, and it changes the xc_dom_printf()'s to be a
bit clearly about which compression routine is in-use.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
This patch adds support for XCP Windows paravirtual drivers to run on
Xen. The drivers are currently provided in binary-only format from
Citrix. At a minimum, this patch is useful for performance comparisons
vs GPLPV drivers.
Live migration and save/resume are functional but set the guest clock
to the 1970's. The clock must be manually adjusted for the guest's ntp
to resume accurate timekeeping.
Before rebooting windows at the end of driver installation create the
registry key
HKLM\System\CurrentControlSet\Services\xenevtchn\Parameters. Add to it
a DWORD called SetFlags with a value of 0x10000000.
Signed-off-by: Keith Coleman <keith@scaltro.com>
This patch fixes the following warning:
xen/lowlevel/checkpoint/libcheckpoint.c: In function
`delete_suspend_timer':
xen/lowlevel/checkpoint/libcheckpoint.c:352: warning: assignment
makes integer from pointer without a cast
Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
In particular:
- all the temporary flexarrays allocated in the create
device functions must be freed;
- all the strings that don't need to be modified can be added as they
are
to these temporary flexarrays instead of duplicating them;
- any data returned to the user shouldn't be added to the global
memory tracker so that the user can free it whenever he wishes.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
This patch makes xl create check whether qemu-dm has started
correctly, and causes it to fail immediately with appropriate errors
if not. There are other bugfixes too.
More specifically:
* libxl_create_device_model forks twice rather than once so that the
process which calls libxl does not end up being the actual parent
of qemu. That avoids the need for the qemu-dm process to be reaped
at some indefinite time in the future.
* The first fork generates an intermediate process which is
responsible for writing the qemu-dm pid to xenstore and then merely
waits to collect and report on qemu-dm's exit status during
startup. New arguments to libxl_create_device_model allow the
preservation of its pid so that a later call can check whether the
startup is successful.
* The core of this functionality (the double fork, waitpid, signal
handling and so forth) is abstracted away into a new facility
libxl_spawn_... in libxl_exec.c.
Consequential changes:
* libxl_wait_for_device_model now takes a callback function parameter
which is called repeatedly in the loop iteration and allows the
caller to abort the wait.
* libxl_exec no longer calls fork; there is a new libxl_fork.
* There is a hook to override waitpid, which will be necessary for
some callers.
Remaining problems and other issues I noticed or we found:
* The error handling is rather inconsistent still and lacking in
places.
* destroy_device_model can kill random dom0 processes (!)
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
osdeps.[hc] previously mistakenly declared and defined [v]asprintf.
These functions are available in the libc on most platforms. Also,
osdeps.h is used by xc.c but xc.c is not part of the library, so
osdeps.h is part of the public interface and should have a better
name.
So now, instead:
* osdeps.h is libxl_osdeps.h.
* _GNU_SOURCE is #defined in libxl_osdeps.h so that we get the system
[v]asprintf (and various other functions)
* libxl_osdeps.h is included first in every libxl*.c file (it needs
to be before any system headers so that _GNU_SOURCE) takes effect.
* osdeps.[hc] only provide their own reimplementation of [v]asprintf
if NEED_OWN_ASPRINTF is defined. Currently it is not ever defined
but this is provided for any platform which needs it.
* While I was editing the #includes in each .c file, I put them all
into the same order: "libxl_osdeps.h", then system headers,
then local headers.
* xs.h is included in libxl.h. This is needed for "bool"; it has to
not be typedefed in libxl.h because otherwise we get a duplicate
definition when including xs.h.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* Introduce new variants of the logging functions which include
errno values (converted using strerror) in the messages passed to
the
application's logging callback.
* Use the new errno-including logging functions everywhere where
appropriate. In general, xc_... functions return errno values or 0;
xs_... functions return 0 or -1 (or some such) setting errno.
* When libxl_xs_get_dompath fails, do not treat it as an allocation
error. It isn't: it usually means xenstored failed.
* Remove many spurious \n's from log messages. (The applications log
callback is expected to add a \n if it wants to do that, so libxl's
logging functions should be passed strings without \n.)
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
This patch enables directed EOI on latest processor. With this, the
broadcast of EOI would be suppressed upon LAPIC EOI, so VMM is
required to perform a directed EOI to the IOxAPIC generating the
interrupt by writting to its EOI register.(Pls. refer SDM 3A 10.5.5)
This is useful for ioapic_ack_old to avoid the spurious interrupt
storm, which is the reason why ioapic_ack_new is used.
Signed-Off-By: Zhai Edwin <edwin.zhai@intel.com>
This patch enables P2P upstream forwarding in ACS capable PCIe
switches. The enabling is conditioned on iommu_enabled variable.
This code solves two potential problems in virtualization environment
where a PCIe device is as signed to a guest domain using a HW iommu
such as VT-d:
1) Unintentional failure caused by guest physical address programmed
into the device's DMA that happens to match the memory address range
of other downstream ports in the same PCIe switch. This causes the
PCI transaction to go to the matching downstream port instead of go to
the root complex to get translated by VT-d as it should be.
2) Malicious guest software intentionally attacks another downstream
PCIe device by programming the DMA address into the assigned device
that matches memory address range of the downstream PCIe port.
Corresponding ACS filtering code is already in upstream control panel
code that do not allow PCI device passthrough to guests if it is
behind a PCIe switch that does not have ACS capability or with ACS
capability but is not enabled.
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
This patch makes pv guest work correctly with libxenlight. It also
implements support for vfb and vkbd, starting qemu in xenpv mode. Both
xenconsole and qemu are supported as console backends.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tmem double-frees a high-level data structure causing memory
corruption under certain circumstances.
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Two gdprintk's that are rarely encountered with tmem disabled
are frequent but meaningless when tmem is enabled. Printing
these tens-to-hundreds of times per second (in certain
circumstances even higher) slows down domain execution.
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
The original assertion is too strict, as it includes the A/D bits of
the PTE, which (by design) can change under our feet.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
If we want to check the functionality of libgcrypt, we shouldn't test
a function only exported by openssl, but instead the one actually used
in the code.
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Tmem fails to put_domain so a dying domain never gets
properly shut down. Also, fix race condition when
domain is dying by not allowing any new ops to succeed.
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>