Commit Graph
2761 Commits
Author SHA1 Message Date
Keir Fraser 925b2ca585 pci: add pci option support for XML-RPC server
Allow the per-device options for passthrough pci devices
for exmaple, in domain config file:
    pci = ['01:00.0,opt1=val1,opt2=val2', '01:00.1' ]
or in the PCI hotplug case:
    xm pci-attach -o opt1=val1 --options=opt2=val2 <domid> 01:00.0 6

This patch is for xml-rpc server

Signed-off-by: Qing He <qing.he@intel.com>
2009-01-08 11:25:43 +00:00
Keir Fraser 15c5bb9f92 xend: Fix error handling in device_create().
Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
2009-01-06 14:01:39 +00:00
Keir Fraser dca0b1a805 vtd hotplug: check if a device can be hot-plugged.
When we statically assign a pci device (the pci=3D['xx:xx.x'] string
in guest config file) to guest, we make many checkings (for instance,
if the device is specified in 'pciback.hide', if it has
non-page-aligned MMIO BARs, if it has a proper FLR capability, if the
related devices should be co-assigned). However, with respect to the
guest hotplug, we only check if the device exists and not assigned yet
-- this is not enough, for instance, now xend allows us to assign an
in-use device (being used by Dom0) to an HVM guest (because
xc.test_assigned() returns OK) -- this will cause disaster... The
patch adds some necessary checkings.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-01-05 11:14:18 +00:00
Keir Fraser 5bbed21d17 PoD memory 9/9: xend integration
Xend integration for PoD functionality.
* Add python bindings for xc_hvm_domain_build() and
xc_domain_memory_set_pod_target()
* Always call xc_hvm_domain_build(), with memsize = memory_static_max
and target=memory_dynamic_max
* When setting a new memory target:
 + First make sure we actually have enough free memory for the target
setting to succeed
 + Call set_pod_target() with the new target, to Xen can do the Right
 Thing.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-01-05 10:47:03 +00:00
Keir Fraser 1e5e52220f xend: Actually restrict a domU's access to xenstore when we mean to --
this means that in some cases it cannot be owner of its own xenstore
nodes.

This bug was pointed out by Daniel Berrange at Red Hat. This patch is
my own more generic fix that automatically covers a range of callers
(albeit the patch is arguably a bit of a hack ;-).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-12-18 17:18:28 +00:00
Keir Fraser 6ac1537ba7 tools: Fix a few error-path memory leaks.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-12-09 12:53:19 +00:00
Keir Fraser b90edb337d xend: Remember bootable flag for vbds in xenstore
When xend is restarted, bootable flags of all disk devices are lost
and then the first disk is marked as bootable by a "compatibility
hack". When a guest domain is created with a mixture of several vbd
and tap devices, the compatibility hack may fail to choose the right
bootable device. Thus preventing the guest to be restarted. This patch
fixes this behavior by remembering bootable flag for each disk device
in xenstore database.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2008-12-09 12:45:45 +00:00
Keir Fraser ce4d300de0 xend: Fix memory allocation bug after hvm reboot in numa system
Recently we find a bug on Nahelem machine (totally with two nodes, 6G
memory (3G in each node):
- Start a HVM guest with its all VCPUS pinned to node1, so all its
memory is allocated from node1.
- Reboot the HVM.
- There will be some memory allocated from node0 even there is enough
free memory on node1.

Reason: For security issues, xen will not put all the pages of a dying
hvm to domheap directly, but put them in scrub list and wait for handled
by page_scrub_softirq(). If the dying hvm have a lot of memory,
page_scrub_softirq() will not handle all of them before the start the
hvm. There are some pages belong to node1 still in scrub list, new hvm
can't use pages in it. So this hvm will get different memory
distribution than before. Before changeset 18304, page_scrub_softirq()
can be excuted parallel between all the cpus. Changeset 18305
serialise page_scrub_softirq() and Changeset 18307 serialise
page_scrub_softirq() with a new lock to avoid holding up acquiring
page_scrub_lock in free_domheap_pages(). Those changeset slow the ability
to handle pages in scrub list. So the bug becomes more obvious after.

Patch: This patch modifiers balloon.free to avoid this bug. After
patch, balloon.free will check whether current machine is a numa
system and the new created hvm has all its vcpus in the same node. If
all the conditions above fit, we will wait until all the pages in
scrub list are freed (if waiting time go beyond 20s, we will stop
waiting it.).

This seems to be too restricted at the first glance. We used to only
wait for the free memory size of pinned node is bigger than
required. But as we know HVM memory alloction granularity is 2M. Even
the former condition is satisfied, we still may not find enough
2M-size memory on that node.

Signed-off-by: Ting Zhou <ting.g.zhou@intel.com>
Signed-off-by: Xiaowei Yang <Xiaowei.yang@intel.com>
2008-12-09 12:44:32 +00:00
Keir Fraser a046a6dc89 Fix domain save when guest is in S3.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-12-05 15:54:22 +00:00
Keir Fraser 69dff7d532 xm: Fix xm block-list for inactive managed domains
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2008-12-04 11:32:43 +00:00
Keir Fraser e7a89ddbf9 xend: Remember bootloader settings in xenstore
When xend is restarted, bootloader settings of all running domains are
lost. The attached patches fixes this by saving bootloader and
bootloader_args to xenstore database.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2008-12-04 11:31:37 +00:00
Keir Fraser c4e83a1484 xend: Fix device release for tap devices
I saw an error message when I shut down a domain.  The error
message showed that release of device(vbd/51712) failed.  But the
device was tap, was not vbd.  I think that a cause of the error message is
because _releaseDevices() calls destroyDevice() by wrong device class.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2008-11-28 13:05:58 +00:00
Keir Fraser 2fdd853ff5 xm: Relax the sanity check on guest configuration with XSM-ACM addlabel
The attached patch relaxes the sanity check on guest configuration
when assigning a acm label to the guest. This patch makes a guest
configuration accept a bootloader parameter. This is common for
paravirtualized guests to boot them by using pygrub.

Signed-off-by: INAKOSHI Hiroya <inakoshi.hiroya@jp.fujitsu.com>
2008-11-28 13:04:30 +00:00
Keir Fraser 71a732a2b8 PCI interface changes for PCIE-AER enabling
This patch reflects some pci interface changes in pciif.h in XEN head
file. And also add domain shutdown support in xend for shutting domain
from DOM0 kernel when non-recoverable uncorrected pci error happens.

Signed-off-by: Jiang Yunhong <yunhong.jiang@intel.com>
Signed-off-by: Ke Liping <liping.ke@intel.com>
2008-11-24 11:06:16 +00:00
Keir Fraser ed2dbb7a0f xend: Make _setCPUAffinity() errors nonfatal on domain resume
This patch allows domains to be resumed on different number of CPUs. After
c/s 18764, a domain cannot be resumed when _setCPUAffinity() fails, which
happens when affinity should be set to a non-existent CPU. This patch
makes _setCPUAffinity() errors nonfatal.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2008-11-20 14:17:09 +00:00
Keir Fraser c014d5785e xenapi: fix valid_object typo
Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
2008-11-20 14:14:20 +00:00
Keir Fraser 336c683373 tools: use sysfs interface to balloon driver if present
The pvops dom0 kernel does not expose the balloon driver via
/proc/xen, so use the sysfs interface.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
2008-11-17 15:54:31 +00:00
Keir Fraser 541e42472a Fix to save CPU affinity for xm save/restore
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2008-11-14 14:27:51 +00:00
Keir Fraser 3c66521c46 xm: display domain id on domain creation
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2008-11-13 10:50:50 +00:00
Keir Fraser ac1e2634bc xend, pciif: fix some indentation
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2008-11-12 11:50:25 +00:00
Keir Fraser 21f2630b0f xend: Restore CPU affinity on domain resume.
Move affinity-setting logic into its own function and call from
relevant places.

From: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-11-11 11:06:27 +00:00
Keir Fraser 9d2a3ef6e8 xend, security: Prevent changing of the policy while VMs are migrating
The net changes of this patch are that the reader-side lock is put
into the path of the migration code and the writer lock into the path
of the code that handles the changing of the policy. Simultaneous
migrations of multiple hosts still work after this lock has been added.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2008-11-05 10:23:26 +00:00
Keir Fraser 4b5d0b9cfb xend: Add a multi-reader-single-writer lock implementation
This patch adds a reader-writer lock primitive to xend since python
does not provide it by default. The implementation is based on a
condition variable. Some test code is appended at the end of the file.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2008-11-05 10:22:19 +00:00
Keir Fraser 9cec91aba5 xend: ioport & irq persistence thru reboot
When a domU is configured for a serial port as documented at:
   http://wiki.xensource.com/xenwiki/InstallationNotes

the VM does see the serial port, however when dom0 is rebooted and
the VM started it no longer has access to the serial port.

xm list -l <vm> no longer shows the ioports or irq attributes

Attached patch adds implementation of getDeviceConfiguration(),
returns details dict and implements waitForDevice() to irqif.py and
iopif.py.

Also added preprocess_irq() to create.py.

Signed-off-by: Pat Campbell <plc@novell.com>
2008-11-03 10:23:09 +00:00
Keir Fraser 4b88a787b3 xend: Fix typo in waitForBackend() for phantom VBDs
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2008-10-28 10:37:30 +00:00
Keir Fraser 416b905545 Fix xm scsi-attach/detach/list for inactive managed domains
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2008-10-27 10:03:17 +00:00
Keir Fraser 0de77ea0ad xend: Fix and clean up vscsi_util.py and other files
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2008-10-21 11:43:21 +01:00
Keir Fraser 81d08745ba xend: fix setting vcpus > VCPUs_max
From reading xend code related to changing number of vcpus it appears
setting the number of vcpus to a value greater than VCPUs_max is not
allowed on a running domain.  This restriction is not honored by
setVCpuCount() in XendDomainInfo.py.  Attached patch makes
setVCpuCount() fail if vcpus > VCPUs_max and domain is running.

Also, I think the changes should be reflected in managed config of
running domain if in fact the domain is managed - so unconditionally
call managed_config_save().

BTW, the original code is rather confusing.  Essentially the same
actions are taken regardless if self.info['VCPUs_max'] > vcpus, just
the order of invocation is changed.  But this doesn't seem to matter
since self.info['VCPUs_live'] is not subsequently used.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
2008-10-20 15:17:24 +01:00
Keir Fraser 66e8c0272e xend: Stub out vscsi_get_scsidevices() until issues are addressed.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-10-20 15:05:48 +01:00
Keir Fraser 44a6b9e6d4 Enhance XenAPI for pvSCSI
Basically, I implemented XenAPI for pvSCSI according to the patch of
XenAPI document which I sent before.  However, I renamed the class
name of virtual SCSI devices to "DSCSI".

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2008-10-16 09:50:18 +01:00
Keir Fraser 39407bed9c x86: make injection of spurious page faults configurable per domain
Some distro kernels do not handle spurious page faults so allow these
to be supressed on a per VM basis.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2008-10-15 15:56:26 +01:00
Keir Fraser 5e58cce9f7 hvm: Battery Management virtual firmware and toolstack changes
Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com>
2008-10-14 11:08:15 +01:00
Keir Fraser 39f97ffa29 x86, hvm: Hyper-V guest interface support with small set of enlightenments
A minimal implementation of the Viridian (Hyper-V) guest
interface. The only enlightenments advertised and supported are vAPIC
MSRs and long-spin-wait notifications. The set of enlightenments can
easily be extended in future, as they are found to provide a
performance win, and configured via an extended HVM_PARAM_VIRIDIAN hvm
parameter.

Signed-off-by: Peter Johnston <peter.johnston@citrix.com>
Signed-off-by: Tim Deegan <tim.deegan@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-10-14 10:45:29 +01:00
Keir Fraser 7e3496ba25 xend: fixup the Secondary Bus Reset.
Use the read-modify-write operation.
Change the wrong 'I' to a correct 'H'.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2008-10-13 10:08:36 +01:00
Keir Fraser 27b182400b xend: Fix dev backend path construction.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
2008-10-13 10:03:36 +01:00
Keir Fraser d0fedc8895 xend: Restore bridge control register after secondary bus reset
From: Chris Dalton <cid@hp.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-10-10 11:52:26 +01:00
Keir Fraser de07008fdd xend: Fix the detection of the upmost bridge in the python function find_parent().
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2008-10-10 10:03:28 +01:00
Keir Fraser 7c72e3bf4c xend: Fix typo _gatherDom -> gatherDom.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
2008-10-09 10:06:50 +01:00
Keir Fraser 8c755b0a98 flask: Fix a problem in xend code when starting a guest with XSM/Flask enabled.
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2008-10-08 10:03:47 +01:00
Keir Fraser ac4148f219 xend: Allow guest write access to /local/domain/x/memory
Required for xenballoond, and tools do not need to trust any values
written in that subdirectory.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-10-03 09:37:35 +01:00
Keir Fraser eeed0ffe27 xend: Make only selected subdirs of /local/domain/<domid> writable by the guest.
This protects critical data like
/local/domain/<domid>/console/{tty,limit}. It also means we can trust
.../vm, and hence do not need /vm_path. Various parts of the previous
two changesets disappear.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-10-02 10:37:28 +01:00
Keir Fraser 8fe9e65cb4 xend: Fixes after backend xenstore config changes.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-10-01 14:07:17 +01:00
Keir Fraser e9f884ceda xend: Move some backend configuration info.
This patch moves some dom0 variables and backend device
configuration from frontend directories to
/local/domain/<backdomid>/backend or /vm.

Also,
- /vm_path/<domid> is introduced, referencing the /vm path
- /vm_path/device/backend holds the backend device location,
  rather than storing it in the frontend directory

Signed-off-by: Pascal Bouchareine <pascal@gandi.net>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-10-01 13:35:39 +01:00
Keir Fraser 3ff1f0088a hvm: Default timer_mode=1 (do not delay virtual time for missed
ticks). Most guests prefer this mode compared with screwing with
progress of virtual time.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-09-26 17:09:36 +01:00
Keir Fraser 0ae658ea9f xm: Fix xm start -c / --vncviewer
In xm start the --vncviewer option has no effect, instead -c tries to
both connect to the console and start vncviewer. Additionally, to
start vncviewer it uses the domid variable which is only defined a few
lines later. Thus xm start -c doesn't work at all.

This patch fixes both problems.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-09-25 13:07:43 +01:00
Keir Fraser 0e7c1355bc acm, xend: Catch bad vlan identifiers
Add code to intercept badly formatted VLAN identifiers or
those that are out of range.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2008-09-23 12:30:42 +01:00
Keir Fraser 11825aea19 xend: Refactor vmmetrics destruction.
Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
2008-09-22 11:15:39 +01:00
Keir Fraser bbc10fbb40 xm list: Return unique exit code for non-existent domain
This patch will make xm return a exit code of 3 if `xm list
<non_existant_domain>` is done rather than the generic code of 1.  I
used 3 because XendClient had a macro setup pointing
ERROR_INVALID_DOMAIN to 3.

From: "Shaun R." <mailinglists@unix-scripts.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-09-18 10:41:41 +01:00
Keir Fraser 5c4eccd644 xm: Remove obsolete mechanism using vncviewer -listen
Without this patch, vncviewer processes remain as follows.
This patch fixes it.

> # pgrep -fl vnc
> 4303 vncviewer -log *:stdout:0 -listen 5501
> 5089 vncviewer -log *:stdout:0 -listen 5502
> 5763 vncviewer -log *:stdout:0 -listen 5503

details:
Since 21dd1fdb73d8 there have been (as far as I can see) three
separate mechanisms for achieving a VNC display:
 1. xm spawns vncviewer after getting vnc display info
     from qemu-dm via xenstore  (introduced in 21dd1fdb73d8)
 2. xm spawns vncviewer -listen and qemu-dm connects to it
 3. qemu-dm spawns vncviewer (!)

The latter two are rather strange - No.3 is very strange indeed.
So I decided that rather than try to get No.2 or No.3 on track for
going into qemu upstream, No.2 and No.3 would be dropped.
After discussion on xen-devel the mechanism No.1 was introduced,
above.

No.1 is controlled by the --spawn-vncviewer (and --vncviewer-autopass)
command line options to xm, by analogy with the -c option.

Nos.2 and 3 are controlled by elements of the domain configuration
file - and their code still remains.  So if you turn all of the vnc
options on you can get several vncviewers (although only one of them
will work).

This patch removes the support for the passive connection mode No.2
After all ioemu-remote will never connect to such a vncviewer.
The options to engage this functionality were already removed from
the example config files by Keir in 18241:bf4ef45e6a38.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2008-09-17 13:11:40 +01:00
Keir Fraser 6266fa7f24 xsm: dummy module - implement missing stub
- This minor patch implements the missing stub function
security_label_to_details in the dummy module.  This stub function is
necessary to create domains with network interfaces for modules that
do not implement the security_label_to_details function.

Signed-off-by: George Coker <gscoker@alpha.ncsc.mil>
2008-09-15 11:36:20 +01:00