Commit Graph
7176 Commits
Author SHA1 Message Date
Keir Fraser 39c0fe0403 rombios: compute checksum for roms bigger than a segment
From: Glauber Costa <glommer@redhat.com>
From: "Sebastian Herbszt" <herbszt@gmx.de>
Ported by: Akio Takebe <takebe_akio@jp.fujitsu.com>
2009-06-04 10:36:01 +01:00
Keir Fraser ef63071d01 hvmloader: Scan for gpxe-capable NICs until one is found.
Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-06-03 16:12:34 +01:00
Keir Fraser 36b33a52e7 xend: requested_vslots is no longer needed
...following removal of the boot-time pci passthru protocol.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-03 11:19:51 +01:00
Keir Fraser 4b48ffd60a blktap: fix empty QCOW images (bug 1430 part 2)
Empty QCOW images consist of only the L1 table, this results in a
file size which is not sector-aligned. Since blktap uses O_DIRECT, the
block aligned read of the L1 table will go beyond the end of file and
thus returns the actual file size and not the expected length.
This patch checks whether at least the L1 table has been read.

This should fix bug 1430.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
2009-06-03 11:11:50 +01:00
Keir Fraser 2f78e9cccf blktap: fix and use ROUNDUP macro (bug 1430 part 1)
As pointed out in Xen Bugzilla 1430 in the blktap QCOW driver the
rounding function is wrong in line 824 of block-qcow.c.
This patch replaces this (and other roundings) with the already
existing ROUNDUP macro (and fixes the usual macro pitfall).

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
2009-06-03 11:11:04 +01:00
Keir Fraser 09c8ee7eac blktap2: human readable output for tapdisk2 creation problems
This patch fixes the "file object has no attribute find" failure
we've been seeing when starting blktap2 devices and adds more
meaningful error output to conditions where the tapdisk2 process is
unable to create a blktap2 device.

Signed-off-by: Dutch Meyer <dmeyer@cs.ubc.ca>
2009-06-03 11:10:07 +01:00
Keir Fraser 44d374adc0 xend: pci: improve the assignability checking
1) fix some small typos in util/pci.py;
2) find_all_the_multi_functions(): BDFs of a multi-function PCIe
device could be different in all the 3 fields (bus, device, function),
so we need self.find_parent() and list all t
he BDFs below the parent;
3) to assign a device of the must-be-co-assigned devices, we require
all the related devices should be owned by pciback;
4) detect and disallow duplicate pci string specified in guest config
file due to carelessness.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-06-02 11:50:16 +01:00
Keir Fraser d2c78b31b5 tmem: shared ephemeral (SE) pool (clustering) fixes
Tmem can share clean page cache pages for Linux domains
in a virtual cluster (currently only the ocfs2 filesystem
has a patch on the Linux side).  So when one domain
"puts" (evicts) a page, any domain in the cluster can
"get" it, thus saving disk reads.  This functionality
is already present; these are only bug fixes.

- fix bugs when an SE pool is destroyed
- fixes in parsing tool for xm tmem-list output for SE pools
- incorrect locking in one case for destroying an SE pool
- clearer verbosity for transfer when an SE pool is destroyed
- minor cleanup: merge routines that are mostly duplicate

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-06-01 18:37:27 +01:00
Keir Fraser cf57498e90 libxc: Implement stub xc_gnttab_map_table() for non-linux.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-06-01 15:52:19 +01:00
Keir Fraser d06a984487 libxc: Exchange a page for PV guest
This patch support exchange a page for a suspended PV guest from user
space.

The basic idea to offline a page is:
1) mark a page offline pending
2) If the page is owned by a HVM domain, user have to live migrate it.
    In future, with stub-domain support, we can also exchange the page
    without migration.
3) If the page is owned by a PV domain, we will try to exchange the
offline pending page to a new one and free the old page.

This patch achieves item 3.

The method to exchange the offline pending page for PV domain is:

1) Suspend the guest.
2) If the page is being granted out, return with offline pending.
3) Get a copy for the content
4) Scan all page table page to see if any reference to the offending
page, if yes, make the entry to be non-present to reduce the reference
count.
5) After update all page tables, user space tools will try to exchange
the old page. If the new mfn has no reference anymore (i.e.
count_info & count_mask =3D 1), the exchange will allocate a new page,
update the m2p and return success, otherwise it will return fail.
6) If step 5 is success, user space tools will update the content of
the new page  change the p2m table, and change all entries scaned in
step 4 to point to new entry.
if step failed, it will try to undo step 4 to revert page table.
7) Resume the guest.

Please refer to thread in
http://www.mailinglistarchive.com/xen-devel@lists.xensource.com/msg63084.html
for more information.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2009-06-01 14:15:48 +01:00
Keir Fraser 1472f8177f libxc: Export xc_core_arch_map_p2m_writable()
This patch firstly change the xc_core_arch_map_p2m() to map the p2m to
be writable, then it export this function.
One notice for this patch is, caller should make sure change the p2m
in flight will not cause trouble.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2009-06-01 14:13:53 +01:00
Keir Fraser 8b9c6bce94 libxc: Add a function to map a domain's grant table.
Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2009-06-01 14:13:20 +01:00
Keir Fraser 602097e84b libxc: export xc_map_m2p() so that it can be called outside.
Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2009-06-01 14:12:53 +01:00
Keir Fraser 79cda3bac9 Export page offline hypercalls to user space tools.
Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2009-06-01 14:08:58 +01:00
Keir Fraser 630ec346ad blktap: Revert parts of c/s 19349.
Caused blktapctrl pipes to be created with uninitialised variable in name.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-06-01 14:02:26 +01:00
Keir Fraser 48a793e4b0 xend: Fix HVM domain restore (undefined HVM_ImageHandler.superpages).
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-05-30 13:25:32 +01:00
Keir Fraser c6f4657fa8 Revert 19657:9ff5c79b0ceb
Breaks automated localhost migration tests:
    for xx in x:
    TypeError: iteration over non-sequence

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-05-30 13:21:08 +01:00
Keir Fraser 69cf305aa7 xend: Add serialise_pci_opts() and split_pci_opts()
This centralises some code.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-05-29 09:33:06 +01:00
Keir Fraser 9995f10739 xend: Fix check for request to detach non-existent device
This fixes the check for a request to detatch a non-existent device
in pci_device_configure. The previous check was bogus because the
format of AUTO_PHP_SLOT_STR is not the same as that of x['vslot'].

However, it works in a slightly non-obvious way, checking that vslot
hasn't been altered from its initial value AUTO_PHP_SLOT_STR. To
make this shceme a little clearer, use an empty string as the inital
value.

Formting issues asside, neither AUTO_PHP_SLOT_STR nor the empty
string are valid values for x['vslot']. In the event
of invalid data (indicating a bug), it should be caught by
self.hvm_destroyPCIDevice.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-05-29 09:32:40 +01:00
Keir Fraser 9c0aebdd02 xend: hot-plug PCI devices at boot-time
Currently there are two interfaces to pass-through PCI devices:
1. A method driven through per-device xenstore entries that is used at
boot-time
2. An event-based method used for hot-plug.

This seems somewhat redundant and makes extending the code cumbersome
and prone to error - often the change needs to be made twice, in
two different ways.

This patch unifies PCI pass-through by using the existing event-based
method at boot-time.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-05-29 09:32:02 +01:00
Keir Fraser 1e03bc6f02 xend: use popen2 module instead of subprocess for Python 2.3
On Python 2.3, xend cannot started:
    File
    "usr/lib/python2.3/site-packages/xen/xend/server/BlktapController.=
py", line 3, in ?
      import subprocess
  ImportError: No module named subprocess

This patch uses `popen2' instead of `subprocess' for Python 2.3.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
2009-05-29 09:29:58 +01:00
Keir Fraser a480caa3c5 blktap2: fix a compilation error (missing PATH_MAX)
Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
2009-05-29 09:28:15 +01:00
Keir Fraser 6b6ac58efc xm: Unify the output of pci-list
This is another attempt at having pci-list produce consistent output.
Without this change there differences in the output of both vslots
and domain occur for domains that have never been started and domains
that have been started.

In order to address this I have taken the approach of
using integers where possible and explicitly formating them,
rather than relying on string representations that are present in
data structures.

I have also re-used the common part of the format, to try
and mitigate. the possibility of future inconsistencies there.

This patch also:
* Removes trailing whitespace
* Removes unnecessary brackets and whitespace from print invocations
* Prints the header outside of the loop to avoid having
  to maintain a state variable

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-05-29 09:27:31 +01:00
Keir Fraser f09d7f0b59 Serialize iptables calls in hotplug scripts
iptables cannot correctly handle situations when more than one command
is trying to set netfilter rules. In such situations, iptables may fail
with EAGAIN, which results in iptables: Unknown error
18446744073709551615.

Such situation can easily happen when multiple network devices are
configured for a domain as vif hotplug scripts are called in parallel
for all of the network devices.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2009-05-28 11:07:19 +01:00
Keir Fraser e1ae548d42 blktap2: Fix build with gcc3. Cannot handle defining a function which
is passed a struct-by-value which is not yet fully defined. Thus
defining a request struct which contains a pointer to a function which
is passed-by-value an instance of that request structure is
impossible. We work around it by defining the function poiinter as
void* and then casting in one place.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-05-28 11:01:00 +01:00
Keir Fraser 44c1edcdb5 xend: Update info['platform']['pci']
This patch updates info['platform']['pci'] for PCI devices
assignment to domains.

When a domain is started, xend confirms by using xc.test_assign_device
whether PCI devices can be assigned to the domain.  For the
confirmation, info['platform']['pci'] must be an appropriate value.
However, info['platform']['pci'] may be not appropriate.  Because
info['platform']['pci'] isn't almost always updated even if the PCI
device configuration of the domain was changed by using xm
pci-attach/detach.  This patch updates info['platform']['pci'] to the
appropriate value when domains are started.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-05-28 10:06:01 +01:00
Keir Fraser 60dadd604d blktap2: fix tapdisk-channel.c
This patch fixes the following error.
cc1: warnings being treated as errors
In file included from usr/include/sys/resource.h:25,
                 from tapdisk-daemon.c:559:
usr/include/bits/resource.h: In function 'main':
usr/include/bits/resource.h:33: warning: ISO C90 forbids mixed
declarations and code

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2009-05-28 10:03:29 +01:00
Keir Fraser 3026986b0f blktap2: fix makefile of blktap2
- clean up to use SUBDIRS-y
- With parallel make, libvhd might not be created before
  link. guarantee it.
- use LDFLAGS for link which is set by upper level makefiles.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2009-05-28 10:02:57 +01:00
Keir Fraser b3bde375d3 udev-script: udev rule for pci_iomul device.
This patch adds udev rule for pci_iomul device to
create /dev/xen/pci_iomul.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2009-05-28 10:00:55 +01:00
Keir Fraser b0a6b12293 [IA64] adjust ia64 xc_domain_restore() signature
This patch fixes the following error.
ia64/xc_ia64_linux_restore.c:546: error: conflicting types for
xc_domain_restore
./xenguest.h:49: error: previous declaration of xc_domain_restore was
here
make[4]: *** [ia64/xc_ia64_linux_restore.o] Error 1

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2009-05-27 12:00:51 +01:00
Keir Fraser 07943d8e2d xend: Device duplicate check fix
I've checked the duplicate-check code here and I found that's checked
only in the context of one domain but not cross-domain. The thing is
that we should check tap/vbd device cross-domain not to allow another
guest to use the same disk image in some circumstances to prevent VM's
disk corruption.

The patch included denies disk image addition under those
circumstances:

1. We're adding read-only disk that's already used as write-exclusive

2. We're adding write-shared disk that's already used as
write-exclusive

3. We're adding write-exclusive disk that's already used

4. We're adding read-only disk that's already used as write-shared*
(because of I/O caching issues etc.)

The vif device duplicate check remains the same it was and it's
checked in the context of current domain only so that behaviour has
been preserved.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
2009-05-27 11:28:45 +01:00
Keir Fraser 86475c9213 xm: Specify sensible default for superpages domain config option.
Signed-off-by: Dave McCracken <dcm@mccr.org>
2009-05-27 11:21:59 +01:00
Keir Fraser e420ef1e73 rombios: fix trying to boot from next device
If boot="ndc", rombios cannot try to boot next device.
Because rombios jump to the boot vector without pushing return
address, gPXE code and so on cannot return if it fail to boot.

Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
2009-05-27 11:19:38 +01:00
Keir Fraser bd5573a630 blktap2: a completely rewritten blktap implementation
Benefits to blktap2 over the old version of blktap:

* Isolation from xenstore - Blktap devices are now created directly on
   the linux dom0 command line, rather than being spawned in response
   to XenStore events.  This is handy for debugging, makes blktap
   generally easier to work with, and is a step toward a generic
   user-level block device implementation that is not Xen-specific.

* Improved tapdisk infrastructure: simpler request forwarding, new
   request scheduler, request merging, more efficient use of AIO.

* Improved tapdisk error handling and memory management.  No
   allocations on the block data path, IO retry logic to protect
   guests
   transient block device failures.  This has been tested and is known
   to work on weird environments such as NFS soft mounts.

* Pause and snapshot of live virtual disks (see xmsnap script).

* VHD support.  The VHD code in this release has been rigorously
   tested, and represents a very mature implementation of the VHD
   image
   format.

* No more duplication of mechanism with blkback.  The blktap kernel
   module has changed dramatically from the original blktap.  Blkback
   is now always used to talk to Xen guests, blktap just presents a
   Linux gendisk that blkback can export.  This is done while
   preserving the zero-copy data path from domU to physical device.

These patches deprecate the old blktap code, which can hopefully be
removed from the tree completely at some point in the future.

Signed-off-by: Jake Wires <jake.wires@citrix.com>
Signed-off-by: Dutch Meyer <dmeyer@cs.ubc.ca>
2009-05-26 11:52:31 +01:00
Keir Fraser 6009f4ddb2 Transcendent memory ("tmem") for Xen.
Tmem, when called from a tmem-capable (paravirtualized) guest, makes
use of otherwise unutilized ("fallow") memory to create and manage
pools of pages that can be accessed from the guest either as
"ephemeral" pages or as "persistent" pages.  In either case, the pages
are not directly addressible by the guest, only copied to and fro via
the tmem interface.  Ephemeral pages are a nice place for a guest to
put recently evicted clean pages that it might need again; these pages
can be reclaimed synchronously by Xen for other guests or other uses.
Persistent pages are a nice place for a guest to put "swap" pages to
avoid sending them to disk.  These pages retain data as long as the
guest lives, but count against the guest memory allocation.

Tmem pages may optionally be compressed and, in certain cases, can be
shared between guests.  Tmem also handles concurrency nicely and
provides limited QoS settings to combat malicious DoS attempts.
Save/restore and live migration support is not yet provided.

Tmem is primarily targeted for an x86 64-bit hypervisor.  On a 32-bit
x86 hypervisor, it has limited functionality and testing due to
limitations of the xen heap.  Nearly all of tmem is
architecture-independent; three routines remain to be ported to ia64
and it should work on that architecture too.  It is also structured to
be portable to non-Xen environments.

Tmem defaults off (for now) and must be enabled with a "tmem" xen boot
option (and does nothing unless a tmem-capable guest is running).  The
"tmem_compress" boot option enables compression which takes about 10x
more CPU but approximately doubles the number of pages that can be
stored.

Tmem can be controlled via several "xm" commands and many interesting
tmem statistics can be obtained.  A README and internal specification
will follow, but lots of useful prose about tmem, as well as Linux
patches, can be found at http://oss.oracle.com/projects/tmem .

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-05-26 11:05:04 +01:00
Keir Fraser e25dc9429b xm, xend: passthrough: Add assigned_or_requested_vslot()
Add an accessor to simplify accessing vslot if available,
otherwise requested_vslot.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-05-26 10:04:10 +01:00
Keir Fraser b562a316db xend: Fix xm pci-detach for inactive devices
In the case where a device is attached to an inactive domain
and then removed before the domain is activated it won't have
a vslot assigned, but it should still be valid to remove it.

I don't think that there are any other cases where vslot can
be invalid.
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-05-26 10:03:09 +01:00
Keir Fraser 6a9b5290e9 Add support for superpages (hugepages) in PV domain
This patch adds the option "superpages" to the domain configuration
file. If it is set, the domain is populated using 2M pages.

This code does not support fallback to small pages.  If the domain can
not be created with 2M pages, the  create will fail.

The patch also includes support for saving and restoring domains with
the superpage flag set.  However, if a domain has freed small pages
within its physical page array and then extended the array, the
restore will fill in those freed pages.  It will then attempt to
allocate more than its memory limit and will fail.  This is
significant because apparently Linux does this during boot, thus a
freshly booted Linux image can not be saved and restored successfully.

Signed-off-by: Dave McCracken <dcm@mccr.org>
2009-05-26 09:58:38 +01:00
Keir Fraser 1d89b44561 stubdom: 'file' based disk sharing
Allow 'file' based disks, that are blkback based disks, to be shared
between the guest domain and the stubdom. It does so exploiting the
same exception introduced in the previous patch "stubdoms phy disks
sharing". Now we can remove the hack in stubdom-dm that forces "file"
disks to be opened using blktap instead of blkback.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-05-26 09:50:35 +01:00
Keir Fraser c04c51bbf9 xend: Fix typo in usage of new auxbin.xen_configdir() function
Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
2009-05-21 04:31:47 +01:00
Keir Fraser 9f6d07bac9 tools: get rid of hardcoded config dirs
Remove *all* hardcoded "/etc/xen" strings in python code.

Additionally, it removes pygrub_path from osdep.py. Its use has been
replaced with auxbin.pathTo("pygrub").

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-05-20 15:27:30 +01:00
Keir Fraser e7da8a7b69 xend: remove spurious pci_len from getDeviceSxprs
Cc: Zhai Edwin <edwin.zhai@intel.com>
Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Cc: Dexuan Cui <dexuan.cui@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-05-20 15:13:36 +01:00
Keir Fraser c7367160e4 ocaml-xenstored: Allow to build ocaml xenstored instead of C version
To use, set CONFIG_OCAML_XENSTORED=y at build time.
Then the build system will automatically download the remote repo
to tools/ocaml-xenstored.

Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
2009-05-19 14:13:20 +01:00
Keir Fraser 1f876c2e6e tools: Fix an obvious xgettext build typo.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-05-19 13:38:05 +01:00
Keir Fraser c3122a4018 xend: Fix xm pci commands for inactive managed domains.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-05-19 02:23:32 +01:00
Keir Fraser 41af6f38d9 xend: Make hotplug script timeouts configurable
In some configurations, when dom0 is busy with I/O, it may take
several minutes to complete all hotplug scripts required when a new
domain is being created. As device create timeout is set to 100
seconds, users get "hotplug scripts not working" error instead of a
new domain.

This patch makes both DEVICE_CREATE_TIMEOUT and DEVICE_DESTROY_TIMEOUT
configurable in xend-config.sxp to allow users to easily adapt hotplug
timeouts to their environment.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2009-05-19 02:18:48 +01:00
Keir Fraser 9125594e4e python: get rid of hardcoded search pathes in python code.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-05-19 02:16:37 +01:00
Keir Fraser 2e1b6a8dcc xentrace: Trace IRQs and entry/exit timestamps.
From: Dulloor <dulloor@gmail.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-05-19 02:08:01 +01:00
Keir Fraser f770d340f1 xend: adjust relocation buffer size
This can greatly improve ssl relocation performance (to about 1/3
compared with buffersize 1024).

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
2009-05-19 01:50:00 +01:00
Keir Fraser 94c3a1b680 tools: clean up handling of xen config and scripts directories.
For now hardcode /etc w/o a prefix as there are hardcoded
config paths in the code which would break otherwise.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-05-19 01:48:18 +01:00