Keir Fraser [Mon, 7 Jun 2010 14:49:46 +0000 (15:49 +0100)]
xl: init scripts (v2)
Now the init script is called xencommons and, as the name suggests, it
is a common script between xl and xend because it is used to start
xenconsoled, xenstored and xenbackendd and the initialization of these
three daemons has been removed from xend. The global
xen_toolstack=xl/xend variable has been removed. Regarding the
network setup, I made the vif scripts follow the same pattern as the
other scripts in xen-backend: a new script called vif-setup is
executed unconditionally. vif-setup is going to do the right thing
depending on the value of the environmental variable "script" (same
technique used before), defaulting to vif-bridge. In the common
scenario the toolstack doesn't need to set the variable "script"
because vif-bridge is going to be called anyway. There is no global
network script to setup the network bridges with xl, so if you are
using xl without xend, you need to manually configure the bridges
using your distro network setup, or, if you are lazy, you can just add
something like:
Keir Fraser [Mon, 7 Jun 2010 14:46:48 +0000 (15:46 +0100)]
x86 mce: Change the method to get the extended MCA information.
Several changes to get the extended MCA information:
a) Use the x86_mcinfo_reserve in mcinfo_extended to reserve buffer
from
mc_info, instead of using the stack
b) For intel's extended MSR, we don't need write them one
by one as the MSR are continous
c) We don't need enum mca_extinfo, since we can consider
the extended MSR as either per bank, or global. Currently
we add a hook in global data collection, and didn't call
register intel_get_extended_msrs as callback. Later that
hook can be replaced by cleaner way
Keir Fraser [Mon, 7 Jun 2010 06:49:07 +0000 (07:49 +0100)]
xl: fix 'xl help' command
xl help 'command' should give the help of the 'command',
but current it does not, it just gives a full list of xl
supported commands. This patch fix it.
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Keir Fraser [Mon, 7 Jun 2010 06:19:43 +0000 (07:19 +0100)]
xend: A few blktap2 fixes
1. Bug fix for error: "Error: Device /dev/xvdp (51952, tap2) is
already connected." (xenstore does not clean after DomU stoped)
2. Bug fix for error: "File 'vhd:/path/.../disk.img' doesn't exist."
(not correct parsing)
3. Bug fix for error: "Error: Device 51952 not connected" (in config
file for DomU we should be use prefix "tap2:tapdisk:xxx" for devices
from (aio, ram, qcow, vhd, remus) or "tap:tapdisk:xxx" for devices
from (sync, vmdk, qcow2, ioemu))
4. Bug fix for error: "Disk is not accessible" (if use 'tap2'-device
type, then '/dev/xpvd' may not be accessible immediately after its
creation)
Keir Fraser [Mon, 7 Jun 2010 06:05:54 +0000 (07:05 +0100)]
Add xl init scripts
this patch adds an init script for xl, so that it can be used without
xend installed on the system. In cases in which both toolstacks are
present, only one init script will be run, dependening on the value of
xen_toolstack in /etc/sysconfig/xen_toolstack. Please note that a
correct value of xen_toolstack (either xl or xend), is required now.
The network script and the vif script to be used with xl can be
specified in /etc/sysconfig/xenlightdaemons. Xl sets the vif script
to xl-vif-script by default, that reads /etc/sysconfig/xenlightdaemons
and calls the vif script set there. A port to a debian system should
be straightforward, just replacing /etc/sysconfig with /etc/default
everywhere.
Keir Fraser [Fri, 4 Jun 2010 09:05:42 +0000 (10:05 +0100)]
Add a safety valve to the HVM RTC model for big time jumps
If xen's time leaps forward by a large amount, the RTC will try to
model a tick for every second that it thinks has passed. This can
livelock a CPU with a series of timer requests each of which fires
immediately and requests the next one.
This patch treats a delay of more than a day between ticks as a
special case, abandoning the attempt to catch up. That should be good
enough to avoid livelock but doesn't fix the underlying time problem.
Keir Fraser [Wed, 2 Jun 2010 09:54:32 +0000 (10:54 +0100)]
tools: assume that special Xen devices have been created by the platform
Remove all the magic surrounding the special Xen devices in Linux
specific code whereby we attempt to figure out what the correct
major:minor number is and check the the existing device has these
numbers etc. In 2010 we really should be able to trust that the
platform has created the devices correctly or provide correct
configuration settings such that they are without resorting to tearing
down the platform configured state and rebuilding it.
tools/hotplug/Linux/xen-backend.rules already contains the necessary
udev rules to create /dev/xen/evtchn and friends in the correct place.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Keir Fraser [Wed, 2 Jun 2010 09:49:35 +0000 (10:49 +0100)]
Fix xm man page statement about asynchonous operation
The man page for xm command states that many commands acts
asynchronously which is not true. According to my experience most
commands does act synchronously with several exceptions, like create,
shutdown, mem-set and vcpu-set commands so this fixes the paragraph
available in this xm man page.
Signed-off-by: Michal Novotny <minovotn@redhat.com>
Keir Fraser [Tue, 1 Jun 2010 09:56:07 +0000 (10:56 +0100)]
x86 mtrr: Remove (noop) lock_cpu_hotplug().
CPUs coming online sync themselves with current MTRR state at an
appropriate point anyway.
It's not actually possible to have a newly booted CPU immediately have
in-sync MTRR state anyway. It has to be synced up as part of normal
CPU bootstrap procedure. Which is what we do.
Keir Fraser [Tue, 1 Jun 2010 06:04:35 +0000 (07:04 +0100)]
xc: deal with xen/evtchn and xen/gntdev device names
This patch makes xc_linux properly deal with:
1. discovering and creating device nodes if necessary
2. the new form of xen/<dev> device names soon to be used by the
kernel
This changes the logic slightly:
- If a device node already exists with the proper name, then it uses
it as-is, assuming it has already been correctly created.
- If the path doesn't exist, or it exists but isn't a device node,
and
it has successfully found the major/minor for the device, then
(re)create the device node.
Since this logic is identical for gntdev and evtchn, make a common
function to handle both.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Keir Fraser [Tue, 1 Jun 2010 05:45:44 +0000 (06:45 +0100)]
xen: update_runstate_area for 32 bit PV on HVM guests
The current implementation of update_runstate_area is unable to handle
32 bit PV on HVM guests because the check is_pv_32on64_domain doesn't
cover that case. This patch fixes it.
Keir Fraser [Fri, 28 May 2010 08:38:56 +0000 (09:38 +0100)]
xl/libxtl: Remove glitch in xl migrate log output
* Provide a new XTL_STDIOSTREAM_HIDE_PROGRESS flag in the stdio logger
* Provide a way to adjust the flags after logger setup
* Use these to disable progress output from the migration receiver, as
the sender is also sending progress information.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Keir Fraser [Fri, 28 May 2010 08:38:18 +0000 (09:38 +0100)]
libxc: remove \n from strings passed to PERROR
Previously, the code was inconsistent: some calls to PERROR passed \n
and some did not. With the new logging arrangements, passing \n is
definitely incorrect.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Keir Fraser [Fri, 28 May 2010 08:37:42 +0000 (09:37 +0100)]
libxc: save/restore error handling fixes
* Make "read_exact" in libxc always set errno.
* Rename "read_exact" macro in xc_domain_restore.c (which shadows
real function) to RDEXACT and change all callers.
* Make RDEXACT anamorphically use xch for error reporting rather than
* stderr.
* Call PERROR rather than ERROR when appropriate, so that log messages
include errno.
* Save errno in noncached_write so that its errno value is always
* right.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Keir Fraser [Fri, 28 May 2010 08:30:19 +0000 (09:30 +0100)]
libxc: eliminate static variables, use xentoollog; API change
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>
Keir Fraser [Fri, 28 May 2010 08:29:15 +0000 (09:29 +0100)]
xtl: New xentoollog mini-library.
We provide a new header file "xentoollog.h" which defines an interface
that libraries and applications can use for logging. This avoids
having to wrap each library's log callbacks up, massage arguments to
log callbacks, and so on.
The library's .o files are within libxc to avoid having to create a
separate lib*.a, but callers do not need to #include xenctrl.h and it
should be regarded as a separate API.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Fri, 28 May 2010 08:27:40 +0000 (09:27 +0100)]
libelf: Tidy up logging and remove dependency on stdio.
libelf now permits callers to specify logging callback functions,
rather than a FILE*. libelf's non-Xen callers are all libxc users, so
the stdio dependency and the default logging callback function (which
calls vfprintf) is now in libxc.
Xen's use of libxc is unaffected in this patch.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Keir Fraser [Fri, 28 May 2010 07:14:54 +0000 (08:14 +0100)]
HAP: Add hardware capability check for 2MB super page.
While setting the HAP entry previously, we only check the hardware
capability for 1GB super page. This patch adds hardware capability
check for 2MB superpage
Also, Intel SDM doesn't exclude 1GB feature for 32/pae
host. Therefore remove the BUG_ON() check in common code.
Keir Fraser [Fri, 28 May 2010 07:10:48 +0000 (08:10 +0100)]
xl: fix PCI resource parsing
The parsing of PCI resources has two problems:
1. it assumes devices are 32-bits, whereas the fields in the
"resources" file can have full 64-bit values
2. it only parses the first resource because the format string is
missing a \n
Fix both of these up, which allows my Intel 82574L to work with MSI-X.
However, this should probably be using a PCI access library rather
than rummaging around in /sys/bus/pci...
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Keir Fraser [Thu, 27 May 2010 08:04:46 +0000 (09:04 +0100)]
x86: Speed up PV-guest superpage mapping
The current version of superpage mapping takes a PGT_writable
reference to every page in a superpage each time it is mapped. This
is extremely slow, so slow that applications become unusable.
My solution for this is to introduce a superpage table in the
hypervisor, similar to the frametable structure for pages. Currently
this table only has a type_info element. There are three types a
superpage can have, SGT_mark, SGT_dynamic, or SGT_none.
In normal operation, the first time a superpage is mapped, a
PGT_writable reference is taken to each page in the superpage, and the
superpage is set to type SGT_dynamic and the superpage typecount is
incremented. On subsequent mappings and unmappings, only the
superpage typecount changes. On the last unmap, the PGT_writable
reference on each page is removed.
The SGT_mark type is set and cleared through two new MMUEXT
hypercalls, mark_super and unmark_super. When the hypercall is made,
the superpage's type is set to SGT_mark and a PGT_writable reference
is taken to its pages. On unmark, the type is cleared and the
reference removed.
If a page is already set to SGT_dynamic when mark_super is called, the
type is changed to SGT_mark and no additional PGT_writable reference
is taken. If there are still outstanding mappings of this superpage
when unmark_super is called, the type is set to SGT_dynamic and the
PGT_writable reference is not removed.
Fast superpage mapping is only supported on 64 bit hypervisors. For
32 bit hyperviors, superpage mapping is supported but will be
extremely slow.
Signed-off-by: Dave McCracken <dave.mccracken@oracle.com>
Keir Fraser [Thu, 27 May 2010 07:21:24 +0000 (08:21 +0100)]
xenconsoled: Discard guest console data in bigger chunks
Discard guest console data in bigger chunks so that there are fewer
discontinuities in the console data. Also avoid discarding data if
space is available at the front of the buffer by reclaiming that
space.
Patch from: Christian Limpach <Christian.Limpach@citrix.com> Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Keir Fraser [Wed, 26 May 2010 09:52:15 +0000 (10:52 +0100)]
pyGrub: Use proper bootloader class when entering command manually
Use the proper bootloader class when entering the boot commands
manually (i.e. using the 'c' option). Before this patch the bootloader
was always treated to be Grub but when user is using Grub2/ExtLinux or
Lilo it's rather confusing. After applying this patch the proper
bootloader image class is being used, e.g. Grub2Image for Grub2
etc. when you define the boot commands manually using the 'c' command
in pyGrub.
Also, fix for using isconfig has been applied since if there is not fs
set in the run_grub() method the read_config() would fail since it's
trying to access undefined self.cf which is now being set to parser()
from cfg_list.
Signed-off-by: Michal Novotny <minovotn@redhat.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Keir Fraser [Wed, 26 May 2010 07:15:31 +0000 (08:15 +0100)]
tools: Fix time offset when localtime=0
localtime can be stored in vm config as a string, resulting in
incorrect calculation of rtc_timeoffset. Cast localtime to int
to ensure rtc_timeoffset is calculated properly.
Keir Fraser [Wed, 26 May 2010 07:13:47 +0000 (08:13 +0100)]
xl: Some small fixes
- When use mem-set, I got suspicious error output:
# xl mem-set 1 256g
setting domid 1 memory to : 268435456
[0] libxl.c:2535:libxl_set_memory_target: memory_dynamic_max must be
less than or equal to memory_static_max
: Success
- String generated by strdup() should be freed
- When using 'xl help', mem-max and mem-set's output is not as intend,
and it also breaks bash completion, fix it.
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Keir Fraser [Wed, 26 May 2010 07:12:15 +0000 (08:12 +0100)]
xl: allow nameless domains to be named
At present, find_domain() will exit(2) if you specify a domain by
number, but that domain doesn't have a corresponding name. However,
nothing seem to critically depend on common_domname being set, and the
test prevents dom0 or other nameless domains from being named. So
just remove the check.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Acked-by: Yang Hongyang <yanghy@cn.fujitsu.com>