Ian Campbell [Tue, 1 Feb 2011 19:26:36 +0000 (19:26 +0000)]
libxc: maintain a small, per-handle, cache of hypercall buffer memory
Constantly m(un)locking memory can have significant overhead on
systems with large numbers of CPUs. This was previously fixed by
20841:fbe8f32fa257 but this was dropped during the transition to
hypercall buffers.
Introduce a small cache of single page hypercall buffer allocations
which can be resused to avoid this overhead.
Add some statistics tracking to the hypercall buffer allocations.
The cache size of 4 was chosen based on these statistics since they
indicated that 2 pages was sufficient to satisfy all concurrent single
page hypercall buffer allocations seen during "xl create", "xl
shutdown" and "xl destroy" of both a PV and HVM guest therefore 4
pages should cover the majority of important cases.
This fixes http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1719.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Reported-by: Zheng, Shaohui <shaohui.zheng@intel.com> Tested-by: Haitao Shan <maillists.shan@gmail.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
The current libxl_set_memory_target function subtracts a negative amount
from an uint32_t variable without checking if the operation wraps
around.
This patch fixes this bug (that I previously believed to be an
hypervisor issue):
http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1729
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Campbell [Tue, 1 Feb 2011 19:23:31 +0000 (19:23 +0000)]
tools: disable linker --as-needed option.
The Xen build system is not currently compatible with the --as-needed
linker option. The proper fix for this is turning out to be rather
invasive to the build system so simply disable for now with the
intention of revisiting for the 4.2 release.
The --no-as-needed option is available at least since binutils 2.15
(released in May 2004) and hence I think can be unconditionally relied
on.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Reported-by: Nathan March <nathan@gt.net> Tested-by: Nathan March <nathan@gt.net> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Michael Young [Tue, 1 Feb 2011 19:19:58 +0000 (19:19 +0000)]
tools/Makefiles: install libvhd and libblktap with INSTALL_PROG
Shared libraries should be executable.
(rpm (4.9.0) doesn't automatically supply a "provides" entry for a
library unless it is executable. Non-executable libraries can cause
other trouble too.)
Signed-off-by: Michael Young <m.a.young@durham.ac.uk> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Michael Young [Tue, 1 Feb 2011 19:18:42 +0000 (19:18 +0000)]
docs: Bring comments about NetworkManager and bridging up to date
Update a comment about NetworkManager not supporting bridging in
Fedora 11 to refer instead to Fedora 14. Clarify the wording.
Signed-off-by: Michael Young <m.a.young@durham.ac.uk> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Michael Young [Tue, 1 Feb 2011 19:16:28 +0000 (19:16 +0000)]
tools/hotplug: Fix proxy arp messing about to use correct device
Fix an anomaly in /etc/xen/scripts/network-route.
Currently this script contains
netdev=${netdev:-eth${vifnum}}
ie. netdev is set to eth${vifnum} by default. Unfortunately vifnum
is not set anywhere in the xen code so the default is actually the
broken "eth". And anyway the vif number (which is what vifnum ought
to be) is not relevant.
The patch changes the default to eth0 (which is what the comment at
the top of the file says it should be).
Signed-off-by: Michael Young <m.a.young@durham.ac.uk> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Andre Przywara [Tue, 1 Feb 2011 19:05:51 +0000 (19:05 +0000)]
xl: output illegal option character
Though illegal characters on xl command lines are catched, the user
isn't currently informed which one was not right.
This patch fixes this by printing the faulting character.
Signed-off-by: Andre Przywara <andre.przywara@amd.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Fri, 28 Jan 2011 19:37:49 +0000 (19:37 +0000)]
libxc: Do not use dom0 physmem as parameter to lzma decoder
It's not clear why a userspace lzma decode would want to use that
particular value, what bearing it has on anything or why it would
assume it could use 1/3 of the total RAM in the system (potentially
quite a large amount of RAM) as opposed to any other limit number.
Instead, hardcode 32Mby.
This reverts 22830:c80960244942, removes the xc_get_physmem/physmem
function entirely, and replaces the expression at the call site with a
fixed constant.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <Ian.Campbell@eu.citrix.com> Cc: Christoph Egger <Christoph.Egger@amd.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Fri, 28 Jan 2011 18:39:09 +0000 (18:39 +0000)]
libxl: prevent creation of domains with duplicate names
libxl_domain_rename is where domain names are assigned. Therefore
this is where we check that no two domains have the same name. As a
special exception, domains whose names are "" are not considered to
clash.
We also take special care not to mind if we try to rename a domain to
the name it already has.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Fri, 28 Jan 2011 18:38:26 +0000 (18:38 +0000)]
libxl: during domain destruction, do not complain if no devices dir to destroy
Previously calling libxl__devices_destroy on a half-constructed or
half-destroyed domain would sometimes complain along these lines:
libxl: error: libxl_device.c:327:libxl__devices_destroy /local/domain/29/device is empty
This is (a) not a reasonable thing to complain about and (b) not an
accurate description of all the things that that particular failure of
libxl__xs_directory might mean.
Change the code to check errno, so that if errno==ENOENT we silently
continue, not destroying any devices, and if errno!=ENOENT, properly
log the problem and fail.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Fri, 28 Jan 2011 18:37:25 +0000 (18:37 +0000)]
libxl: internals: document the error behaviour of various libxl__xs_* functions
Many of the functions in libxl_xshelp.c simply return 0 on error, and
leave the errno value from xenstore in errno. Document this more
clearly.
Also fix a >75 column line.
No functional change.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Fri, 28 Jan 2011 18:36:54 +0000 (18:36 +0000)]
libxl, xl: fixes to domain creation cleanup logic (domid values)
libxl__domain_make makes some assumptions about the way its caller
treats its uint32_t *domid parameter: specifically, if it fails it may
have partially created the domain and it does not every destroy it.
But it does not initialise it. Document this assumption in a comment,
and assert on entry that domid not a guest domain id, to ensure that
the caller has properly initialised it.
Introduce a function libxl_domid_valid_guest to help with this.
This is not intended to produce any practical functional change in
current code.
Secondly, libxl_create_stubdom calls libxl__domain_make and has no
code to tear down the domain again on error. This is complicated to
fix (since it may even be possible for the the domain to be left in a
state where it's not possible to tell that it was going to be a
stubdom for some other domain). So for now simply leave a fixme
comment.
Finally, in 22739:d839631b6048 we introduced "-1" as a sentinel "no
such domain" value for domid. However, domid is a uint32 so testing
it with "if (domid > 0)" as we do in 22740:ce208811f540 is wrong
because it always triggers. Instead use libxl_domid_valid_guest.
This fix means that that if "xl create" fails, it will not try to
destroy the domain "-1". Previously you'd see this message:
libxl: error: libxl.c:697:libxl_domain_destroy non-existant domain -1
whose "-1" many readers may have thought was an error code, but which
is actually supposedly a domain id.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Fri, 28 Jan 2011 18:34:52 +0000 (18:34 +0000)]
libxl: fix error handling (xenstore transaction leak) in libxl__domain_make
libxl__domain_make could under some circumstances leak the xenstore
transaction (stored in the variable t). Also, failures to commit the
xenstore transaction for reasons other than EAGAIN would be ignored (!)
Fix this as follows:
* Initialise t to 0 (not a valid transaction id), and when the
transaction is successfully committed or rolled back, reset it.
* Change all the instances of: libxl__free_all(&gc); return error;
to instead do: rc=error; goto out;
* Use the out stanza for exiting, setting rc=0 on success first.
* Explicitly abort the transaction in the out stanza.
Also add a note by the calls manipulating the gc, to note that as this
is an internal function, the gc should really be set up and destroyed
by its caller. But let's not do that at this stage of the 4.1 release
cycle.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Andre Przywara [Fri, 28 Jan 2011 17:56:00 +0000 (17:56 +0000)]
xl: fix incorrect display of illegal option character
according to the getopt(3) manpage (and to my testing) getopt returns
'?' if an unknown option character is found and stores the insulting
character in optopt.
This patch fixes the broken output in such a situation:
root@dosorca:/data/images# xl vcpu-list -j
option `?' not supported.
Name ID VCPU CPU State Time(s) CPU Affinity
Domain-0 0 0 0 -b- 193.1 any cpu
turns into:
root@dosorca:/data/images# xl vcpu-list -j
option `j' not supported.
Name ID VCPU CPU State Time(s) CPU Affinity
Domain-0 0 0 0 -b- 193.1 any cpu
Signed-off-by: Andre Przywara <andre.przywara@amd.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Andre Przywara [Fri, 28 Jan 2011 17:45:24 +0000 (17:45 +0000)]
xl: fix xl cpupool-list <poolid>
The help screen of xl cpupool-list promises to allow a CPU pool to
be named on the command line, which will then be listed only.
Probably caused by a "DeMorgan brain twist" this specific CPU pool
is _omitted_ instead. The patch fixes this, so single CPU pools
can be explicitly listed again.
Signed-off-by: Andre Przywara <andre.przywara@amd.com> Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Andre Przywara [Fri, 28 Jan 2011 17:43:50 +0000 (17:43 +0000)]
xl: remove unimplemented -l stub for cpupool-list
Although advertised via the usage output, xl cpupool-list -l just
returns ERROR_NI, which does not show up on the console. Instead the
output is empty, which is not exactly what --long hints to. To avoid
confusion remove the line from the help output and just ignore the -l
option properly until it gets finally implemented.
Signed-off-by: Andre Przywara <andre.przywara@amd.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Juergen Gross [Fri, 28 Jan 2011 17:41:15 +0000 (17:41 +0000)]
xl: fix broken cpupool-numa-split
The implementation of xl cpupool-numa-split is broken. It adds nodes
to the wrong pool. This was probably a copy and paste error which
happened when libxl_cpupool_cpuadd_node() was introduced.
Reported-by: Andre Przywara <andre.przywara@amd.com> Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com> Acked-by: George Dunlap <george.dunlap@citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
libxl: when using pygrub, do not segfault if no blktap
Running xl create configfile where configfile includes the lines
bootloader = "/usr/bin/pygrub"
disk = [ 'file:/dev/mapper/vg0-partname,xvda1,w' ]
then xl segfaults at the line
ret = strdup(dev);
of libxl_device_disk_local_attach() in tools/libxl/libxl.c . The
problem is that dev is not set if libxl__blktap_enabled(&gc) is false
or if phystype isn't recognized. In the latter case we want to skip
that line and return NULL, but if libxl__blktap_enabled(&gc) is false
we should be returning something, at least in the cases where the
device has a name in the host which we can just refer to.
Also improve the error message when QCOW or QCOW2 are specified, and
avoid using an uninitialised value of "ret".
Signed-off-by: M A Young <m.a.young@durham.ac.uk> Signed-off-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Fri, 28 Jan 2011 16:43:53 +0000 (16:43 +0000)]
libxl: correct error path in libxl_userdata_retrieve
Firstly, if libxl_read_file_contents fails, it doesn't really leave
*data and *datalen_r undefined - it leaves them unchanged. Tighten up
the spec for the benefit of libxl_userdata_retrieve.
Secondly, libxl_userdata_retrieve ignored errors, assuming they were
all ENOENT. Instead it should fail on unexpected errors.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Jim Fehlig <jfehlig@novell.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Currently, cur_pages (which is used as index into page_array for
fetching gfns) is used to judge whether it is proper here to allocated
1G pages. However, cur_pages == page_array[cur_pages] only holds true
when it is below 4G. When it is above 4G, page_array[cur_pages] -
cur_pages = 256M.
As a result, when guest has 10G memory, 8 1G-pages are allocated. But
only 2 of them have their corresponding gfns 1G aligned. The other 6
are forced to split to 2M pages, as their starting gfns are 4G+256M,
5G+256M .................
Inside the patch, true gfns are used instead of cur_pages to fix this
issue.
Signed-off-by: Shan Haitao <haitao.shan@intel.com> Acked-by: George Dunlap <george.dunlap@citrix.com>
Daniel Kiper [Thu, 27 Jan 2011 19:51:47 +0000 (19:51 +0000)]
tools/security: Adjust secpol_tool.c for change to xc_interface_open
xc_interface_open() was called with improper number of arguments. It
is fixed by this patch.
This appears to have been missed by 21483:779c0ef9682c. The interface
change also included the return type (int->xc_interface *) but that
was already covered in 21483.
Acked-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Daniel Kiper <dkiper@net-space.pl> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Thu, 27 Jan 2011 19:42:40 +0000 (19:42 +0000)]
Config.mk: commented-out CONFIG_QEMU example now uses `pwd`/$(XEN_ROOT)
If you actually set it to a relative path, the qemu build breaks.
So this commented-out rune (an example) should arrange to be absolute.
Unfortunately XEN_ROOT is itself relative so the previous attempt to
fix this (22772:654563af359f) didn't work. So use `pwd`.
Tested-by: M A Young <m.a.young@durham.ac.uk> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Christoph Egger [Thu, 27 Jan 2011 19:03:42 +0000 (19:03 +0000)]
libxc: break xc_get_physmem out into os-dependent files
NetBSD doesn't have sysconf(_SC_PHYS_PAGES).
Factor physmem() out into os-dependent files and rename it to
xc_get_physmem() so as not to pollute the namespace.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Thu, 27 Jan 2011 18:59:07 +0000 (18:59 +0000)]
xl: Revert "xl: avoid creating domains with duplicate names"
This reverts commit 22820:310cc33bfc81. This functionality should not
be in the domain parsing logic. It needs to be in libxl_domain_make.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Thu, 27 Jan 2011 16:17:27 +0000 (16:17 +0000)]
hvm: allow pass-through of new FPU/ALU CPUID features
there are some new CPUID features that are safe for guests to see, as
they don't require OS awareness (FPU/ALU related instructions only).
Among features for new AMD CPUs there is also the PCLMULQDQ bit, which
Intel CPU have already for quite a while.
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Wei Wang [Thu, 27 Jan 2011 16:10:52 +0000 (16:10 +0000)]
amd iommu: reduce io page level for hvm guest (1/3)
Since in most case, 2 or 3 - level IO page tables are sufficient, this
patch updates page table level for device assignment to reduces
overhead of dma translation
Ian Jackson [Thu, 27 Jan 2011 14:59:04 +0000 (14:59 +0000)]
libxc: provide XENCTRL_HAS_XC_INTERFACE feature test macro
This makes it easier for out-of-tree callers to tell which version of
the libxc interface this version of xenctrl.h provides.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <Ian.Campbell@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Fengzhe Zhang [Thu, 27 Jan 2011 11:31:46 +0000 (11:31 +0000)]
vtd: Fix for irq bind failure after PCI attaching 32 times
Originally when detaching a PCI device, pirq_to_emuirq and pirq_to_irq
are freed via hypercall do_physdev_op. Now in function
pt_irq_destroy_bind_vtd, duplicated logic is added to free
pirq_to_emuirq, but not pirq_to_irq. This causes do_physdev_op fail to
free both emuirq and irq. After attaching a PCI device for 32 times,
irq resources run out. This patch removes the redundant logic.
After starting the xenstored, xenconsoled, xenbackendd and running xl
create I get this:
libxl: error: libxl.c:53:libxl_ctx_init Is xenstore daemon running?
failed to stat /var/run/xenstore.pid: No such file or directory
cannot init xl context
The reason for the failure is that the NetBSD startup script
creates the file
/var/run/xenstored.pid
but libxl checks for
/var/run/xenstore.pid
Attached patch makes this consistent across Linux and NetBSD by
changing the Linux name (to the more-conventional food.pid form).
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Wed, 26 Jan 2011 16:05:09 +0000 (16:05 +0000)]
xl: avoid creating domains with duplicate names
Do not create the domain if another domain with the same name is already
running.
This is another error-checking function at rather too high a level:
this should be moved into libxl_domain_rename in 4.2.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Wed, 26 Jan 2011 11:58:45 +0000 (11:58 +0000)]
libxl: band-aid for functions which return literal "-1"
Many libxl functions erroneously return "-1" on error, rather than
some ERROR_* value.
To deal with this, invent a new ERROR_NONSPECIFIC "-1" which indicates
that "the function which generated this error code is broken".
Fix up the one we care about for forthcoming duplicate domain
detection (libxl_name_to_domid) and the others following the same
pattern nearby; leave the rest for post-4.1.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Ian Campbell [Wed, 26 Jan 2011 11:47:52 +0000 (11:47 +0000)]
libxl: only check size of regular files when validating a virtual disk
st_size is only valid for regular files and not block devices.
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>
Keir Fraser [Wed, 26 Jan 2011 08:56:44 +0000 (08:56 +0000)]
x86: physdev_[un]map_pirq() use rcu_lock_target_domain_by_id().
More idiomatic, and avoids accidental failure to check caller
privilege. For example, the unmap path was not checking for any
privilege before calling unmap_domain_pirq_emuirq(), which can't be
right.
Wei Gang [Wed, 26 Jan 2011 08:54:12 +0000 (08:54 +0000)]
x86: Fix pirq teardown on domain destruction.
The privilege check in unmap_domain_pirq() fails since the teardown
completes in RCU (idle domain) context. We can remove the check since
it is covered in physdev_op() already, which is the only potentially
unprivileged caller.
Keir Fraser [Wed, 26 Jan 2011 08:45:40 +0000 (08:45 +0000)]
x86: blacklist new AMD CPUID bits for PV domains
there are some new CPUID bits (and leaves) which Dom0 and PV domains
should not see to avoid trouble, since we don't emulate the features.
The most prominent one is a topology leaf, which contains information
specific to the physical CPU, not the virtual one. To avoid confusion
(and possibly crashes) due to a confused Dom0 scheduler simply disable
these bits.
Signed-off-by: Andre Przywara <andre.przywara@amd.com> Signed-off-by: Keir Fraser <keir@xen.org>
Gianni Tedesco [Tue, 25 Jan 2011 18:27:43 +0000 (18:27 +0000)]
xl: Check domain existance when doing domain identifier lookups
[ Code formatting fixed up to conform to libxl style. -iwj ]
Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.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>
Ian Jackson [Tue, 25 Jan 2011 18:24:36 +0000 (18:24 +0000)]
xl: fix up some minor mistakes in error messages
perl -i~ -pe 's/\\n.\"/\\n\"/' tools/libxl/*.c
Reported-by: Gianni Tedesco <gianni.tedesco@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Gianni Tedesco <gianni.tedesco@citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
xl: Perform minimal validation of virtual disk file while parsing config file
This patch performs some very basic validation on the virtual disk
file passed through the config file. This validation ensures that we
don't go too far with the initialization like spawn qemu and more
while there could be some potentially fundamental issues.
[ Patch fixed up to work with PHYSTYPE_EMPTY 22808:6ec61438713a -iwj ]
Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.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/xl: support empty disk paths (ejected cdroms)
Support empty disk paths, including in domain config files, for
compatibility with xend. This allows a domain to be created with a
cdrom which is initially in the "ejected" (no cd present) state.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Gianni Tedesco [Tue, 25 Jan 2011 17:02:47 +0000 (17:02 +0000)]
libxl: Check a domain exists before destroying it
Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
libxl: libxl_ctx_init checks for xenstored pid file
This is a proxy for whether xenstored is running. Otherwise the
failure modes are unfortunate (hangs, or mysterious error messages).
If and when we have a stubdom xenstored this will need to be
revisited, if not before.
Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
user virtual [Tue, 25 Jan 2011 16:42:00 +0000 (16:42 +0000)]
tools/hotplug/Linux: fix completely wrong attempts to stop xenwatchdogd
"xen-watchdog stop" attempts to kill non existing "watchdogd" but
misses the running "xenwatchdogd". This also provokes errors during
install and Debian package management.
Signed-off-by: user virtual <virtualusr@gmail.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>
tools: Change the name of the qemu save file at restore time
Change the name of the qemu save file to qemu-resume at restore time so
that it doesn't collide with the name of the next save file.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Fri, 21 Jan 2011 17:45:56 +0000 (17:45 +0000)]
libxl: Fix for Windows UP crash on boot using xl
When parameter "vcpus" is not explicitly set in config file, cur_vpus
is initialized to 0 instead of 1, which causes domU crash.
Signed-off-by: Fengzhe Zhang <fengzhe.zhang@intel.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
libxl: fix free of constant string in cdrom insert path
Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Fri, 21 Jan 2011 16:01:12 +0000 (16:01 +0000)]
[VTD][QUIRK] turn off Sandybridge IGD quirk by default
Turn off Sandybridge IGD quirk by default until potential issues such
as MMIO register conflict with OS device driver and proper locking in
preamble and postamble functions are addressed.
Keir Fraser [Fri, 21 Jan 2011 15:58:27 +0000 (15:58 +0000)]
x86:x2apic: Disable x2apic on x86-32 permanently
x2apic initialization on x86_32 uses vcpu pointer before it is
initialized. As x2apic is unlikely to be used on x86_32, this patch
disables x2apic permanently on x86_32. It also asserts the sanity of
vcpu pointer before dereference to prevent further misuse.
George Dunlap [Fri, 21 Jan 2011 15:37:36 +0000 (15:37 +0000)]
p2m: Allow non-leaf entries to be replaced by leaf entries
Allow l2 and l3 p2m tables to be replaced with 2MB and 1GB pages
respectively, freeing the p2m table page properly. This allows, for example,
a sequence of 512 singleton zero pages to be replaced with a superpage
populate-on-demand entry.
Changes:
* Add a p2m_free_ptp() corresponding to p2m_alloc_ptp(), which will
handle everything related to the freeing properly.
* Add p2m_free_entry(), based on ept_free_entry(), which will free
intermediate tables recursively.
* For both ept and p2m, when replacing non-leaf entries with leaf
entries, keep old entry and call *_free_entry() after new entry
has been written and proper flushes have been done.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Ian Jackson [Thu, 20 Jan 2011 17:04:06 +0000 (17:04 +0000)]
libxl: Make domain_shutdown fail if graceful not possible
Currently "xl shutdown" (like "xm shutdown") is not capable of doing
the proper ACPI negotiation with an HVM no-pv-drivers guest which
would be necessary for a graceful shutdown.
Instead (following the ill-advised lead of "xm shutdown") it simply
shoots the guest in the head.
This patch changes the behaviour so that "xl shutdown" fails if the
domain cannot be shut down gracefully for this reason and suggests in
the error message using destroy instead.
Also, check whether the PV shutdown protocol is available before we
try to use it.
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>
Ian Jackson [Thu, 20 Jan 2011 16:32:33 +0000 (16:32 +0000)]
libxl: do not attempt to write "shutdown" dm-command
libxl_domain_destroy writes the command "shutdown" to the xenstore
node with which it communicates with qemu. However:
- qemu does not understand this command and ignores it (printing a
message)
- libxl doesn't wait for the answer and immediately pauses the domain
anyway
- destroy is the ungraceful (force) operation and should not
negotiate with qemu anyway
- even in the graceful shutdown case, there would actually be nothing
that qemu needs to do.
Under some circumstances, this entry in xenstore will survive the
domain's death, ie be leaked.
So remove the erroneous code.
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>
George Dunlap [Mon, 17 Jan 2011 14:29:01 +0000 (14:29 +0000)]
PoD,hap: Fix logdirty mode when using hardware assisted paging
When writing a writable p2m entry for a pfn, we need to mark the pfn
dirty to avoid corruption when doing live migration.
Marking the page dirty exposes another issue, where there are
excessive sweeps for zero pages if there's a mismatch between PoD
entries and cache entries. Only sweep for zero pages if we actually
need more memory.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Jim Fehlig [Tue, 18 Jan 2011 17:23:24 +0000 (17:23 +0000)]
xend: improve psudeo-bootloader support for external block scripts
Userspace tools support external block scripts (e.g. block-drbd
provided by drbd project). The psuedo-bootloader setup code in
xend has a few limitations wrt external block scripts, which this
patch addresses.
blkif.py: parse_uname() utility function should be able to parse a
disk specifier understood by the rest of the tools.
XendDomainInfo.py: Block devices using external block scripts must
be attached to dom0 before running the psuedo-bootloader.
Signed-off-by: Jim Fehlig <jfehlig@novell.com> Tested-by: Shriram Rajagopalan <rshriram@gmail.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Remove some more "drbd" cruft from xend. This is not necessary for
drbd to work with Xen.
Requested-by: Jim Fehlig <jfehlig@novell.com> Tested-by: Shriram Rajagopalan <rshriram@gmail.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Jan Beulich [Tue, 18 Jan 2011 12:28:10 +0000 (12:28 +0000)]
VT-d/ATS: misc fixes
First of all there were three places potentially de-referencing NULL
(two after an allocation failure, and one after a failed lookup).
Second, if ATS_ENABLE was already set, the device would not have got
added to the ats_devices list, potentially resulting in
dev_invalidate_iotlb() doing an incomplete job.
Keir Fraser [Tue, 18 Jan 2011 10:28:22 +0000 (10:28 +0000)]
xen-unstable/blkif: Add trim operation interface
Trim operation is a request for the underlying block device to mark
extents to be erased. Add the operation code and ring data structure
to the public header file.
Trim operations are passed with sector_number as the sector index to
begin trim operations at and nr_sectors as the number of sectors to
be trimmed. The specified sectors should be trimmed if the underlying
block device supports trim operations, or a BLKIF_RSP_EOPNOTSUPP
should be returned. More information about trim operations at;
http://t13.org/Documents/UploadedDocuments/docs2008/
e07154r6-Data_Set_Management_Proposal_for_ATA-ACS2.doc
Jan 10 00:02:26 paris /netbsd: xvif108.0: could not attach sysctl nodes
Jan 10 00:02:57 paris /netbsd: sysctl_createv: sysctl_create(xvif108.0)
returned 22
The kernel driver have recently been fixed and attached patch updates
to the hotplug scripts accordingly.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Daniel De Graaf [Mon, 17 Jan 2011 17:28:30 +0000 (17:28 +0000)]
libxc: Remove set_max_grants in linux
The maximum number of grants is now constrained domain-wide in linux,
so set_max_grants should be a noop there. Previously, this constraint
was per-file-description.
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Christoph Egger [Mon, 17 Jan 2011 17:18:38 +0000 (17:18 +0000)]
libxl: fix guest networking on NetBSD
As previously reported when I start guests with xl then the
guest network does not work because the qemu-ifup script
no longer runs.
NetBSD doesn't have something like udev. Changing xm/xend,
libxl and xenbackendd to make everything behave the same way
is a lot more intrusive than enabling it for NetBSD again.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Campbell [Mon, 17 Jan 2011 17:14:20 +0000 (17:14 +0000)]
tools/blktap, blktap2: include <sys/mount.h> instead of <linux/fs.h>
The former is a userspace sanitised header which contains the
definitions we need. In some distros linux/fs.h defines WRITE which
conflicts with blktaps own use of that name.
Also there is no reason to use <linux/errno.h> over the more normal
<errno.h>.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Fri, 14 Jan 2011 16:38:51 +0000 (16:38 +0000)]
rcupdate: Make rcu_barrier() more paranoia-proof
I'm not sure my original barrier function is correct. It may allow a
CPU to exit the barrier loop, with no local work to do, while RCU work
is pending on other CPUs and needing one or more quiescent periods to
flush the work through.
Although rcu_pending() may handle this, it is easiest to follow
Linux's example and simply call_rcu() a callback function on every
CPU. When the callback has executed on every CPU, we know that all
previously-queued RCU work is completed, and we can exit the barrier.
Keir Fraser [Fri, 14 Jan 2011 15:21:24 +0000 (15:21 +0000)]
hvmloader: Fixes to printf() implementation.
1. Remove unportable O and D format specifiers
2. Fix X format specifier to print upper-case hex characters
3. Fix d format specifier to print -ve numbers
4. Fix handling of int vs. long (although not actually an issue
for the i386 compile target)
5. Don't use the antiquated C 'register' type attribute.
Keir Fraser [Fri, 14 Jan 2011 15:18:02 +0000 (15:18 +0000)]
x86 hvm: Do not check-and-fail on in_atomic() in hvm_copy().
Stub this out for 4.0, as PV-on-HVM drivers hit this case when
performing grant-table hypercalls. Grant-table code currently accesses
guest memory under bug per-domain lock. The test in hvm_copy() is not
necessary until the xenpaging implementation is more complete, which
will not now be until after 4.1.0.
Ian Campbell [Fri, 14 Jan 2011 14:25:31 +0000 (14:25 +0000)]
libxc: build fix with debugging disabled.
Currently hypercalls have only 5 arguments, hypercall->arg[0..4]. Do
not try and print arg[5] else:
cc1: warnings being treated as errors
xenctrl_osdep_ENOSYS.c: In function
'ENOSYS_privcmd_hypercall':
xenctrl_osdep_ENOSYS.c:30: error: array subscript is above
array bounds
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>