Commit Graph
7221 Commits
Author SHA1 Message Date
Keir Fraser 99951f1845 xend: pass-through: Clean up hvm_destroyPCIDevice()
There seems to be little need to use the domain, bus, slot and
function to look up the virtual slot to pass as the argument to
hvm_destroyPCIDevice(), only to have hvm_destroyPCIDevice() use the
virtual slot for the sole purpose of looking up the domain, bus, slot
and function.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-17 07:39:27 +01:00
Keir Fraser 97fbb6346a xend: pass-through: Use common parsing code in getDeviceConfiguration()
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-17 07:39:03 +01:00
Keir Fraser a96eef5ee3 xend: pass-through: Use common parsing code in parse_pci_configuration()
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-17 07:38:42 +01:00
Keir Fraser fc1e96389c xend: pass-through: Add pci_tuple_to_dict()
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-17 07:38:03 +01:00
Keir Fraser 63524b0e43 xend: pass-through: Use generic code in pci_opts_list_to_sxp()
Use dev_dict_to_sxp() inside pci_opts_list_to_sxp() now that it is
available.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-17 07:37:26 +01:00
Keir Fraser ce004c4b0f xend: pass-through: Move pci conversion functions to pci.py
Move dev_dict_to_sxp() into XendSXPDev.py.  Move
pci_convert_dict_to_sxp() and pci_convert_sxp_to_dict() to pci.py,
where other similar functions live.  This makes these functions
accessible outside of the XendConfig class.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-17 07:36:47 +01:00
Keir Fraser 29baf765df Subject: xend: pass-through: Add pci_dict_cmp()
pci_dict_cmp() compares the two pci devices in dict format.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-17 07:35:51 +01:00
Keir Fraser 5a6a2f7e9b xend: pass-through: Common parse_pci_name()
Share some parsing code between different parts of xm.

This has the side-effect that the device specification for
hot-plug may now include the VSLOT and OPTS as per device
specifictions in the domain configuration file.

  SEQ:BUS:DEV.FUNC[,OPT...]

  e.g. 0000:00:01.00@6

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-17 07:34:59 +01:00
Keir Fraser 60c32a612f stubdom: update config example to reflect that the serial option can
now be used.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-06-17 07:23:40 +01:00
Keir Fraser ac663c94f0 xenconsole: fix assumption about printed max domid length.
Also snprintf includes the final '\0' in the char count.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-06-17 07:23:06 +01:00
Keir Fraser 6f1d3ce238 Introduce mechanism to check standard conformance of headers
While pretty simplistic, it appears to serve the purpose at the moment
(i.e. it spotted two places where a GNU extension was used withou
proper preprocessor conditionals). The "simplistic" here includes that
the checking gets only done for native builds, and ia64 gets excluded
due to its arch-specific header intentionally (for whatever reason)
checking that anonymous struct/unions can be used.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-06-17 07:21:03 +01:00
Keir Fraser c93bd0e6ea tmem: fix 32-on-64 support
This implicitly required coverting the tmem_op structure from
anonymous to standard struct/union sub-fields, and extending the
get-fields.sh helper script to deal with typedef-ed guest handles used
as types of translated compound type fields.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-06-17 07:14:02 +01:00
Keir Fraser 9ed6a7c5dd xend: support for older pciutils without -vmm option, and improve
error handling in get_info_from_lspci().

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
2009-06-16 11:53:47 +01:00
Keir Fraser afd4c19a15 xend: pass-through: Use common parsing code in preprocess_pci()
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-16 11:41:31 +01:00
Keir Fraser bf17cf4c4c xend: pass-through: Use PCIDevice as the parameter for the constructor for PCIQuirk
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-16 11:39:02 +01:00
Keir Fraser 6c4c01bd43 xend: pass-through: Remove PciDeviceNotFoundError, it is never used
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-16 11:38:33 +01:00
Keir Fraser 52ecedb262 xend: pass-through: sxp.merge() cant deal with values being a list
sxp.merge() can't deal with values being a list so instead
of storing pci options as:

[ 'opts', [ 'key1' 'value1'], [ 'key2', 'value2'], ...]

store them as:

[ 'opts', [ 'key1' 'value1'], ['opts', [ 'key2', 'value2']], ...

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-16 11:37:41 +01:00
Keir Fraser fb8a264cd0 xend: pass-through: cleanupDevice: move and remove recently added vslot entry
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-16 11:36:40 +01:00
Keir Fraser 005f6dc9a8 xend: pass-through: tidy up PciController()
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-16 11:36:03 +01:00
Keir Fraser e5c65dc72e xend: pass-through: fix typo: spx -> sxp
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-16 11:35:16 +01:00
Keir Fraser 678e6d8b30 xend: pass-through: Only call setupOneDevice() once per device
As observed by Dexuan Cui, when PCI devices are passed through at
domain-creation-time setupOneDevice() will be called twice.

Once via setupDevice() and once via econfigureDevice() which
is called in pci_device_configure().

This patch removes the first of these.

Cc: Dexuan Cui <dexuan.cui@intel.com>
Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-16 11:33:23 +01:00
Keir Fraser 7e03843de6 xend: support multiple consoles per domain
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-06-16 11:25:37 +01:00
Keir Fraser c811d0d548 xenconsole: support for multiple consoles per domain
This patch adds a new command line argument to xenconsole to specify
to which console to connect to in case a domain has more than one.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-06-16 11:24:58 +01:00
Keir Fraser 78c4e40239 tools/xenballoond: add tmem capability to directed/self-ballooning
and monitor tool

This patch adds tmem support to the largely unknown/unused
xenballoond scripts that implement both self-ballooning and
a foundation for directed-ballooning.  Tmem and automated
ballooning are highly complementary in that, when ballooning
is over-aggressive, paging and swapping can increase noticably.
Precache preserves evicted pages that may be needed again soon
(thus eliminating disk reads) and preswap provides memory-based
swapping that occurs if ballooning is insufficiently responsive
to a sudden increase in activity and memory demand (thus
eliminating disk writes and reads).

There are two changes in this patch:

1) The xenballoond service is a convenient place to implement
   userland "preswap shrinking".**
2) The xenballoon-monitor script is a convenient place to
   report (and view with "watch -d") the frequent memory
   rebalancing that results from tmem usage on a busy system.

Note that for best results (and for the monitor script to
work), the xenstore-* tools should be installed on each guest.

(** In a disk-based swap device, stale pages are often left
  on-disk even after they are no longer needed or valid; they
  are simply overwritten if/when the disk blocks are needed
  again, which may be a very long time.  Preswap behaves
  much like a disk, but uses precious pages of memory that
  count against a guest's memory allocation; thus stale
  pages are very undesirable.  Preswap shrinking periodically
  attempts to remove stale pages from preswap by using a
  sysfs interface created by the linux-side tmem patch.)

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-06-16 11:17:28 +01:00
Keir Fraser 9c7be4de83 Fix dependencies in tools/include/xen-foreign/Makefile
Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-06-16 11:01:17 +01:00
Keir Fraser 51e4a7555d xend: allow config file compatibility with new tap syntax
Recently the format of the tap syntax in the config file changed to
using a 4 part specifier (tap:tapdisk:<format>:<filename>) instead
of the old 3-part one (tap:<qcow>:<filename>).
This breaks compatibility with existing config files: a guest start
will throw a Python exception and will be aborted.
AFAICS currently tap:tapdisk is redundant, so the attached patch
simply catches the above mentioned exception and tries to parse the
old format in this case.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
2009-06-16 11:00:29 +01:00
Keir Fraser 3e71ff4418 xend: Show "bootable" information only once in 'xm list --long'
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-06-16 10:55:36 +01:00
Keir Fraser 71489b7cd2 blktap2/vhd, daemon: serialize subdirs-all and subdirs-install
make install in vhd and daemon, subdirs-all and subdirs-install
are invoked parallel causing nasty error.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
2009-06-16 10:54:10 +01:00
Keir Fraser 54c07de022 xend: pci: fix extract_the_exact_pci_names()
Changeset 19726: d8b7b51f482b neglects the case pci_names could be
types.ListType.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-06-08 12:24:14 +01:00
Keir Fraser 819d2f263c blktap2: README updates
As promised, this brings the long out-of-sync documentation up to
date, and adds some getting started information about tapdisk driver
development - I get the occasional email on this latter subject.

Signed-off-by: Dutch Meyer <dmeyer@cs.ubc.ca>
2009-06-05 09:31:23 +01:00
Keir Fraser 532f0ae513 xend: Convert the type of superpages to integer to fix a TypeError.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-06-05 09:30:36 +01:00
Keir Fraser 57d9503643 xm: Remove redundant os.waitpid() call from do_console()
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-06-04 10:57:39 +01:00
Keir Fraser e6e2645a53 xend: pci: only extract the exact pci BDFs
On some hosts:
[root@localhost ~]# ls /sys/bus/pci/devices/0000:00:05.0/
0000:00:05.0:pcie00  0000:05:00.0          class   driver  local_cpus
resource          subsystem_vendor
0000:00:05.0:pcie01  broken_parity_status  config  enable  modalias
subsystem         uevent
0000:00:05.0:pcie02  bus                   device  irq     power
subsystem_device  vendor

Here we should only get 0000:05:00.0, but we also get 0000:00:05.0
unexpectedly. With this patch, xend only extracts the exact BDF(s).

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-06-04 10:47:56 +01:00
Keir Fraser a161e0d852 xm: Don't die when trying to conect the console to short-lived domains
As observed by Mick Joran, if short-lived domain exits cleanly
then os.waitpid() will throw the following exception. This appears
to be because the child process that is used to start the domain
has detached from its parent.

OSError: [Errno 10] No child processes

Cc: Mick Jordan <Mick.Jordan@sun.com>
Signed-off-by: Simon Horman <horms@verge.ent.au>
2009-06-04 10:46:13 +01:00
Keir Fraser 45cb888069 blktap2: fix parallel Make.
sub make in tools/blktap2/daemon/lib and tools/lvd/lib
can be triggered many times at the same time which results in
weired link error because one target is linking a library while
another target is trying to recreate the library.

This patch makes it invoke submake only once.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2009-06-04 10:45:24 +01:00
Keir Fraser 57dde9ed01 xm: pass-through: sort the output of xm pci-list
Other than being arguably more human readable,
this patch reconciles the output differences between
using Xen API and xmlrpc to manipulate domains.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-04 10:43:44 +01:00
Keir Fraser 9a2e04d1d1 xend: pass-through: Use AUTO_PHP_SLOT as unknown vslot
This fixes a few cases where 0 is still used for an known vslot.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-04 10:43:20 +01:00
Keir Fraser 54ceba35a1 xm: xen-api, pass-through: create: Use vslot for hotplug_slot
Using func for hotplug_slot is not correct, although func is often
zero, previously zero meant please pick a vslot and asking xend to
pick a vslot was the only method available.

This resolves the following error when using Xen API:
$ xm create hvm.conf
...
Internal error: Timed out waiting for device model action.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-04 10:41:50 +01:00
Keir Fraser 7059aee491 xend: xen-api, pass-through: Add create_dpci_from_sxp()
Move some duplicated code into create_dpci_from_sxp()

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-04 10:41:13 +01:00
Keir Fraser a5582cb100 xm, xend: xen-api: DPCI.get_hotplug_slot() returns a decimal
xm uses the following code to read pci information using Xen API:

    ppci_ref =3D server.xenapi.DPCI.get_PPCI(dpci_ref)
    ppci_record =3D server.xenapi.PPCI.get_record(ppci_ref)
    dev =3D {
        "domain":   int(ppci_record["domain"]),
        "bus":      int(ppci_record["bus"]),
        "slot":     int(ppci_record["slot"]),
        "func":     int(ppci_record["func"]),
        "vslot":    int(server.xenapi.DPCI.get_hotplug_slot(dpci_ref))
    }

As the domain, bus, slot and func values are returned as string
representations of decimal, it makes sense for get_hotplug_slot() to
also return string representations of decimal.

As it is, the int() conversion will break cause xm to fail with
an error if the vslot is in the range 0xa-0xf or 0x1a-0x1f.

$ xm pci-list debian
Error: Invalid argument.

And the int() conversion will return the wrong value if
the vslot is in the range 0x10-0x19.

This patch also alters XendDPCI to store hotplug_vslot as an integer
rather than a string. This is consitent with the way other
values are stored inside XendDPCI.

get_hotplug_slot() returning a string is not consistent
with other calls inside XendDPCI, which return integers.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-04 10:40:24 +01:00
Keir Fraser 418ab3dcc0 xend: pass-through: prefix vslot with 0x in device configration
I don't know of the historical reasons for this, but by convention
hex values are stored without a leading '0x' in the backend and
with a leading '0x' in the device configuration.

This patch also removes handling of the case where vslot is missing
from the backend, should never occur.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-04 10:39:32 +01:00
Keir Fraser 431c6dde55 xm: xen-api, pass-through: Dont pass empty opts
Internally xend doesn't know how to handle empty opts.
This code ensures that opts is only included in the sxpr
if its value will be non-empty.

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-04 10:39:03 +01:00
Keir Fraser 823f4b145f xm: xen-api: Install create.dtd in SHAREDIR
* Install create.dtd in SHAREDIR
* Use SHAREDIR/create.dtd
* import os.path.join into xenapi_create.py,
  it already seems to be used many times

Resolves the following error when using XenAPI:

$ xm create hvm.conf
Couldn't open resource '/usr/share/xen/create.dtd' at
/usr/share/xen/create.dtd:1:0

Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-04 10:38:13 +01:00
Keir Fraser 2cad22d41f xend: pass-through: report attach errors from device model
Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Cc: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-06-04 10:37:39 +01:00
Keir Fraser 310311cd88 libxc: fix link error on ia64
On ia64, xen-unstable 19698:f72d26c00002 cannot be built:
../../tools/libxc/libxenguest.so: undefined reference to
`xc_core_arch_map_p2m_writable'
../../tools/libxc/libxenguest.so: undefined reference to `xc_map_m2p'

Because xc_offline_page.c requires xc_map_m2p() in xc_domain_save.c,
xc_offline_page.c must be compiled only if CONFIG_MIGRATE=3Dy.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
2009-06-04 10:36:36 +01:00
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