Commit Graph
6752 Commits
Author SHA1 Message Date
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
Keir Fraser 30c988711c $(XEN_ROOT) absolutification fixes for ioemu-remote (incl stubdom)
* Move code for generating an absolute version of XEN_ROOT
   into a common make variable set in Config.mk
 * Use this common code when invoking make -C ioemu-dir clean
   from tools/, which avoids a problem where `make clean' fails
   because qemu's (ioemu-remote's) build system wants to run
   `make clean' in `tests' but XEN_ROOT is a confection involving
   ../'s.
 * Use this common code in stubdom/Makefile, instead of $(abspath...)
   as the latter is a relatively new feature in GNU make and is not
   available in all the places that we want to be able to build
   (cf c/s 17997:3f23e01d31985899dbd1660b166f229f1ee74292)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2008-09-12 13:15:36 +01:00
Keir Fraser b0a9e1205f xenstore: Fix a memory leak in 'xs_is_domain_introduced'.
Signed-off-by: Konrad Rzeszutek <konrad@virtualiron.com>
2008-09-11 18:00:06 +01:00
Keir Fraser e8ca11f2f6 xendomains script: A few bug fixes.
Contributed-by: Artur Linhart <AL.LINUX@bcpraha.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2008-09-11 15:16:11 +01:00
Keir Fraser a3e1f638ca xm: domid casting bug
- This patch fixes a small casting bug in xm.  The value of domid was
  not returned as an int, causing commands like 'xm vncviewer domid'
  to fail.

Signed-off-by: George Coker <gscoker@alpha.ncsc.mil>
2008-09-11 11:58:08 +01:00
Keir Fraser 4b4f92e98d x86, xend: Fix processing of cpuid config parameters
There is an python indentation issue keeping the full range of syntax
for the cpuid config file parameter from working correctly.  This
patch fixes that.  It also fixes some misspelling and a missing 'x' in
two of the example config files (must have 32 bits represented for
cpuid registers).

Signed-off-by: Bruce Rogers <brogers@novell.com>
2008-09-10 10:51:48 +01:00
Keir Fraser 792f9bc05e xc_domain_save: Do not poll-wait for guest to shutdown -- it should
already be suspended when the (*suspend)() function returns.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-09-09 15:33:27 +01:00
Keir Fraser 93bce41b77 ioemu: Fix bug in map cache
This small patch fixes an issue leading to a crash (segfault, although
with earlier changesets I was seeing sigbus - not sure what changed)
in qemu-dm when the following conditions occur:

1. A valid mapping for a bucket on a low address exists

2. Immediately after accessing memory mapped in this bucket, an access
occurs to a high (beyond assigned ram) address beyond the 1GB limit
for 32bit map cache wrapping around to the previous bucket's entry
number.

3. The next call to map cache again accesses the low address.

In this scenario, the guest mem for the low bucket has been unmapped
by the remap_bucket caused by 2., but because the valid_mapping
bit-test fails, map_cache returns before last_address_index has been
updated. The subsequent call to map_cache therefore never remaps the
low, valid bucket and instead returns a vaddr pointing to memory that
has failed to get mapped.

Signed-off-by: Trolle Selander <trolle.selander@eu.citrix.com>
2008-09-09 15:05:58 +01:00
Keir Fraser 8a64d79e8d ioemu: various fixes to 18394:dade7f0bdc8d
- fix ioemu segv with old firmware
  Without notifying ioemu of address, ioemu will segv.

- fix qemu-dm segv with malicous firmware
  If notifying ioemu more than once, ioemu will segv.

Usually such cases don't happen, but malicious guest can
do it intentionally.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2008-09-09 15:02:51 +01:00
Keir Fraser 03a0c0a048 libxc: fix xc_memory_op(): handles XENMEM_remove_from_phsymap case.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2008-09-09 15:02:32 +01:00
Keir Fraser a69a857adb Revert 18415:3e72ab517e44 (xend: move the call to XendDevices.destroy_device_state())
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2008-09-09 14:45:23 +01:00
Keir Fraser 652f427342 xentrace 7/7: Add option to log to a circular buffer and dump to disk
on signal.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Trolle Selander <trolle.selander@eu.citrix.com>
2008-09-08 16:02:13 +01:00
Keir Fraser be608b5e9b xentrace 6/7: Updated formats file.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Trolle Selander <trolle.selander@eu.citrix.com>
2008-09-08 16:00:53 +01:00
Keir Fraser a9318ed8b2 xentrace 4/7: Add some missing things to the xentrace options string
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Trolle Selander <trolle.selander@eu.citrix.com>
2008-09-08 15:52:50 +01:00
Keir Fraser 0705c231d9 xc_save: ignore the first suspend event channel notification
I've noticed that the suspend event channel becomes pending as soon as
it is bound. I'm not sure why or whether this is intentional, but it
means that the suspend function will return before the domain has
completed suspending unless the first notification is cleared. Without
this patch, xc_domain_save may find that the guest has not suspended
and sleep in 10ms chunks until it does. Typically this is several
milliseconds of wasted time.

From: Brendan Cully <brendan@cs.ubc.ca>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-09-08 11:16:23 +01:00
Keir Fraser 112dcc7dd0 xc_save: Clean up (*suspend)() callback hook.
Sigend-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-09-08 11:13:03 +01:00
Keir Fraser a2567b2631 xc_save: Janitorial work.
Remove an unused variable.
Replace errx by warnx when cleanup code follows.

From: Brendan Cully <brendan@cs.ubc.ca>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-09-08 10:55:09 +01:00
Keir Fraser 406b8494bb lsevtchn: Improve this evtchn reporting tool.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-09-05 11:56:35 +01:00
Keir Fraser b95d528041 ioemu: fix offset of MSI-X memory-mapped table.
Current code does not set dev->msix->table_off variable.
The offset of MSI-X memory mapped table is treated as 0.
The wrong region is unmapped from guest physical memory space.
As a result, guest device driver can't access memory mapped resource.

Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
2008-09-05 11:18:20 +01:00
Keir Fraser 8790685cfd xsm: A few hacks to get XSM-disabled (aka dummy) mode working.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-09-04 16:29:38 +01:00
Keir Fraser 1df7998ba6 xsm: Fix __import__() usage on Python 2.4 and earlier.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-09-04 11:55:48 +01:00
Keir Fraser a8c72fbc90 ioemu: support PCI Express Capability Structure version 1.
Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
2008-09-04 11:28:17 +01:00
Keir Fraser 3129d6f2ea xsm, flask: sample flask policy
- The patch includes a policy for xen that can be booted into
  enforcing mode and supports creation and management of
  paravirtualized guests.  The policy follows the dom0/domU usage
  model, extension to other models or the addition of management or IO
  permissions should be much more straightforward now. The option
  flask_enforcing=1 can be passed on the xen line in grub to boot
  into enforcing mode.

- The policy provides a basic policy for booting the platform and
  creating a domU with the label system_u:object_r:domU_t.  The policy
  can be easily extended to support new types by modifying the xen.te
  source file.

- The policy includes some basic macros which may be helpful in
  extending the policy.

- The policy is compatible with and requires the most recent XSM
  patch, xsm-flask-io-sysctl-hooks-090308.diff.

- The policy is not built as part of the make all as it requires the
  SELinux policy compiler which may/may not be installed on all
  systems.  Users must go into the tools/flask/policy directory and
  explicitly compile the policy.

Signed-off-by: George Coker <gscoker@alpha.ncsc.mil>
2008-09-04 11:26:25 +01:00
Keir Fraser 06cfe5df7b xsm, python tools: remove autogenerated xsm.py
- The patch does away with the autogenerated xsm.py file and
introduces a config parameter in xend-config.sxp to determine the
security module. The parameter is (xsm_module_name {acm, dummy,
flask}).  The default setting/option is dummy.  .hgignore is also
updated to stop ignoring xsm.py on commits.

- The patch has created an xsconstant for XS_POLICY_FLASK and updated
  the toolchain to check the instance of XS_POLICY_USE.  XS_POLICY_USE
  evalauates to XS_POLICY_FLASK or XS_POLICY_ACM or XS_POLICY_DUMMY
  depending on configuration.

- Flask relies on the current value of ssidref returned by dominfo to
  ensure that the label to sid mapping is consistent.  ssidref had
  been pop'ed from the dominfo object.  The patch addresses this
  issue.

- Flask python module style cleanups.

Signed-off-by: George Coker <gscoker@alpha.ncsc.mil>
2008-09-04 11:23:08 +01:00
Keir Fraser 87fd15ceee xend: move the call to XendDevices.destroy_device_state()
This patch moves the call to XendDevices.destroy_device_state() to the
function _remove_domain. Previously only Xen-API calls were calling
the destroy_device_state() function.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2008-09-03 10:38:33 +01:00
Keir Fraser c93d35a368 xend: Fix Bug 1336
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2008-09-02 12:06:56 +01:00
Keir Fraser a06cb3d8d8 ioemu: fix multiple pci-attach/pci-detach by removing the meaningless irq_index
For HVM guest, we can't do pci-attach/pci-detach for >64 times due to
the meaningless checking in pci_register_device(). I made a test of
300 times of attach/detach and everything now works well.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2008-09-01 10:48:09 +01:00
Keir Fraser f1a381df9c cross-install: Only apply in tools directory, and automatically wrap $INSTALL.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-30 08:36:02 +01:00
Keir Fraser d6c3ce8cb9 Update the URL for the ACPI compiler sources.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2008-08-29 16:07:36 +01:00
Keir Fraser 309459216a Run cross-compilation-aware install wrapper script.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-29 16:06:41 +01:00
Keir Fraser ec6869dadc pv-grub: fix example file
Apparently 64MB is too short for the domain builder.
No kernel option should be passed, as they are provided by menu.lst,
and would only confuse grub.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-08-29 10:45:09 +01:00
Keir Fraser 1ceec08ea2 hvmloader: skip upper field of 64 bit base address register.
Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
2008-08-28 09:59:49 +01:00
Keir Fraser bf1bb3fa7e ioemu, passthru: make upper field of 64 bit bar writable.
Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
2008-08-28 09:58:01 +01:00
Keir Fraser 309af15419 xend: Cleanup destroy and destroyDomain methods
When domains are destroyed, _prepare_phantom_paths() method
and _cleanup_phantom_devs() method are called twice as follows.

destroy()@XendDomainInfo.py
    _prepare_phantom_paths() --------------- 1
    _cleanupVm()
    destroyDomain()
        _prepare_phantom_paths() ----------- 2
        xc.domain_destroy_hook()
        xc.domain_pause()
        do_FLR()
        xc.domain_destroy()
        XendDomain.remove_domain()
        cleanupDomain()
        _cleanup_phantom_devs() ------------ 1
    _cleanup_phantom_devs() ---------------- 2
    XendDomain.domain_delete_by_dominfo()

This is a cleanup patch.  It combines destroyDomain() method
into destroy() method, then _prepare_phantom_paths() method and
_cleanup_phantom_devs() method are called only once.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2008-08-28 09:44:13 +01:00
Keir Fraser 2e8459a4fc stubdom: make xc_map_foreign_ranges use malloc instead of stack space
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-08-28 09:40:10 +01:00
Keir Fraser 8a68b82ff1 libxc: Use vcpu_guest_context_any_t instead of two pages
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-08-27 16:23:10 +01:00
Keir Fraser f844c8910a hvmloader: Fix e820_malloc() after bug I introduced in c/s 18383
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-27 15:16:13 +01:00
Keir Fraser 86e881097c tools/xenmon/Makefile: Move LDFLAGS after $<
gcc expects libraries needed for object files to be specified after
the object. Linking usually does not fail, unless it is optimized (for
instance, using -Wl,-as-needed).

The related Gentoo bug is 135145 [ https://bugs.gentoo.org/135145 ].

From: Robert Buchholz <rbu@gentoo.org>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-27 15:02:38 +01:00
Keir Fraser 86cf63d6f4 ioemu: Add SEEK_STAT in all non-error cases except sleep request,
since our seek times are virtually 0.  Although this flag is
deprecated by newer ATA standards, Linux at least checks it for CD
drives, and would timeout in some cases if we do not set it.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-08-27 14:57:23 +01:00
Keir Fraser d818f3cb7c hvm: Use main memory for video memory.
When creating an HVM domain, if e.g. another domain is created before
qemu allocates video memory, the extra 8MB memory ballooning is not
available any more, because it got consumed by the other domain.

This fixes it by taking video memory from the main memory:

- make hvmloader use e820_malloc to reserve some of the main memory
  and notify ioemu of its address through the Xen platform PCI card.
- add XENMAPSPACE_mfn to the xen_add_to_physmap memory op, to allow
  ioemu to move the MFNs between the original position and the PCI
  mapping, when LFB acceleration is disabled/enabled
- add a remove_from_physmap memory op, to allow ioemu to unmap it
  completely for the case of old guests with acceleration disabled.
- add xc_domain_memory_translate_gpfn_list to libxc to allow ioemu to
  get the MFNs of the video memory.
- have xend save the PCI memory space instead of ioemu: if a memory
  page is there, the guest can access it like usual memory, so xend
  can safely be responsible to save it.  The extra benefit is that
  live migration will apply the logdirty optimization there too.
- handle old saved images, populating the video memory from ioemu if
  really needed.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-08-27 14:53:39 +01:00
Keir Fraser 2f43a7baa9 xend: fix LinuxImageHandler debugging output
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-08-27 09:47:08 +01:00
Keir Fraser 63193f3f4d PyGRUB: fix menu flicker
To avoid flickers, PyGRUB has to avoid spurious ncurses refresh as
much as possible, in particular before the complete screen is drawn,
and eventually call doupdate last.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-08-27 09:46:38 +01:00
Keir Fraser 55c1a137e7 stubdom: drop debugging message
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-08-27 09:46:09 +01:00
Keir Fraser 43e1fddd0c vtd: do FLR before xc.domain_destroy()
When we "xm destroy" a guest with assigned devices, in
xen/common/domain.c:domain_kill(), we relinquish guest's memory first,
then invoke domain_destroy() -> complete_domain_destroy() ->
arch_domain_destroy() -> pci_release_devices()/iommu_domain_destroy().

Between relinquish_memory() and domain_destroy(), a device may be
issuing DMA request and access guest's relinquished  memory.

We can do_FLR() to quiesce devices before xc.domain_destroy().

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2008-08-26 14:11:39 +01:00
Keir Fraser 2a82334fcc xend: Avoid multiple assignments to same dict key in pci_convert_sxp_to_dict
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2008-08-26 10:14:32 +01:00
Keir Fraser 64a86b092f hvmloader: Debug build incorporates HVM environment tests which must
pass for the HVM guest to successfully boot.

Currently only one test (REP INS across page boundaries) but more will
be added in future.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-21 15:18:05 +01:00
Keir Fraser 93b891026d xentrace: Fix typo in xentrace_formats file.
Signed-off-by: Yang Xiaowei <xiaowei.yang@intel.com>
Signed-off-by: Zhou Ting <ting.g.zhou@intel.com>
2008-08-21 11:12:21 +01:00
Keir Fraser 97b6b26dad ioemu: Fix unmapping issue on hot-removing pass-thru device
Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
2008-08-20 09:02:15 +01:00
Keir Fraser 154ef9e3cc vtd: Don't do FLR when we create domain or hotplug device into guest.
VT-d hot-plug is done in such a way:  1) xend sends 'pci-ins' command
to ioemu via xenstore; 2) ioemu creates pass-through device and raises
SCI to guest OS; guest OS loads device driver, and device driver
initializes the hot-plugged device; 3) xend does FLR. There is a race
condition about 2) and 3). If 3) runs slow, we have troubles. Thanks
for Yuji Shimada's locating the issues.

We can work around the issues by not doing FLR when we create domain
or hotplug device into guest, namely, we only do FLR when we destroy
domain or hotplug device from guest.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
2008-08-19 10:51:41 +01:00