Commit Graph
20159 Commits
Author SHA1 Message Date
Keir Fraser e4e14402c1 xend: Support "bootloader" mode for "drbd:" devices
To be able to use "bootloader" on drbd devices the following changes
need to be made:

*) Translation of devicename

_parse_uname which is used by blkdev_uname_to_file which is again used
by _configureBootloader in XendDomainInfo needs to be able to resolve
drbd resources to the corresponding blockdevice to feed to the
configured bootloader.

*) Activation of drbd device

If the drbd device isn't in Primary mode when the bootloader tries to
fetch the kernel and initrd, the start of the DomU will fail. To
prevent this the given drbd device will be made Primary before the
bootloader gets executed.

A note on the naming of drbd resouces: drbd uses mostly resource names
in it's userland tools. Because of that drbd VBDs, if configured with
the "drbd:" type, should always use the drbd resource name as
suggested by the drbd documentation at
http://www.drbd.org/users-guide-emb/s-xen-configure-domu.html. My
patches assume that the VBDs are named accordingly.

Signed-off-by: Michael Renner <michael.renner@geizhals.at>
2009-09-04 08:42:10 +01:00
Keir Fraser 35c865110a xend: fix domain_migrate
When the guest(pv-on-hvm guest that cannot suspend) reboot in
LiveMigration, the disconnecting of src-side is not transmitted to
dist-side. As a result, the error processing on the dist side is not
executed.

Signed-off-by: Tomonari Horikoshi <t.horikoshi@jp.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-04 08:34:45 +01:00
Keir Fraser 4bda558243 vt-d: fix Dom0 S3 resume.
When resuming from Dom0 S3, here 'irq' is -1, so we can't use it at
all. We should always use iommu->irq.

With the patch applied on the current tip 20153 and using the 2.6.18
Dom0, Dom0 S3 works fine (at least on my DQ35).

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-09-03 09:51:37 +01:00
Keir Fraser a980249c45 x86 vpt: Small performance fixes.
1. once one-shot timer is fired, IRQ is raised repeatedly forever.
2. Test pending_intr_nr before pt_irq_masked(), as it is cheaper.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2009-09-03 09:50:46 +01:00
Keir Fraser 4dd7eb9f09 xm: Add "tap2" to attach blocktap disks to VM
I detected a problem when using XenAPI.  When I started a VM by
using xm create command, blocktap disks were not attached to the
VM.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-09-03 09:49:41 +01:00
Keir Fraser 28807cd268 x86: com devices's irqaction shouldn't free.
Since irqs of serial devices are initialized in early Xen and
its irqaction is not allocated from heap, so doesn't need free
in release irq logic.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-03 07:37:27 +01:00
Keir Fraser ab3ea9b17e [IOMMU] dynamic VTd page table for HVM guest
This patch makes HVM's VTd page table dynamic just like what PV guest
does, so that avoid the overhead of maintaining page table until a PCI
device is truly assigned to the HVM guest.

Signed-Off-By: Zhai, Edwin <edwin.zhai@intel.com>
2009-09-03 07:29:29 +01:00
Keir Fraser e997adf2ce libxenguest: Remove unused static inline function is_loadable_phdr()
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-09-02 16:15:05 +01:00
Keir Fraser 89a647853f Enable some SCSI drivers in pvops kernel config
Enables a couple of SCSI host controllers which are found in our test
farm but not enabled in the default upstream kernel.  The new drivers
are compiled as modules which is pretty harmless so this should be
safe.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2009-09-02 16:12:41 +01:00
Keir Fraser 4ea5c1f4df x86: Remove the redundant logic in set_msi_affinity
Remove the redundant logic in set_msi_affinity. And it is introduced
accidently, maybe something wrong when I generated the patch.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-09-02 11:40:04 +01:00
Keir Fraser 7e3088ca7f xm: Make cpu_{cap|weight} available when using XenAPI
Currently, cpu_weight parameter and cpu_cap parameter in domain=20
configuration files are ignored when using XenAPI.
The parameters are available by this patch.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-09-02 11:39:27 +01:00
Keir Fraser b2af489074 x86: rdtsc emulation (PV and HVM) must be monotonically increasing
The Intel SDM (section 18.10) clearly states that rdtsc
returns a "monotonically increasing unique value".
Current emulation code for rdtsc (both PV and HVM) returns
only a monotonically-non-decreasing (non-unique) value,
so ensure stale value is always incremented.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-09-02 11:39:02 +01:00
Keir Fraser 0bdd52018f pygrub: Match bare-metal GRUB behavior for passwords
The password support patch already merged didn't match the bare-metal
GRUB behavior so I created a patch to match it. If password is entered
in grub.conf file, pressing `p` is required exactly like when using
"real" (bare-metal) GRUB. New options are available after the correct
password is entered.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
2009-09-02 11:38:24 +01:00
Keir Fraser 029ff8b67a x86 hvm: remove pt_reset()
Virtual platform timers are not sync'ed with guest's TSC any more
since c/s 17716. Thus pt_reset is now useless.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2009-09-01 11:36:51 +01:00
Keir Fraser 049607ff33 x86 passthru:: graphics passthrough
This patch supports basic gfx passthrough on xen side:
  - add a VGA type for gfx passthrough, and get the size of VGA bios
  of passthrouged gfx in hvmloader
  - add a config option 'gfx_passthru' for gfx passthrough

Signed-off-by: Ben Lin <ben.y.lin@intel.com>
Signed-off-by: Weidong Han <weidong.han@intel.com>
2009-09-01 11:36:16 +01:00
Keir Fraser bfc341a65c x86: Make the hypercall PHYSDEVOP_alloc_irq_vector hypercall dummy.
This patch tends to make the hypercall PHYSDEVOP_alloc_irq_vector
dummy, and defer vector allocation to programe ioapic entries by
dom0. Basically, dom0 shouldn't touch vector namespace which is only
used by hypervisor for servicing real device's interrupts. And this
patch also makes broken NetBSD dom0 work again.

Signed-off-by: Xiantao Zhang <xiantao.zhang.intel.com>
2009-09-01 11:34:31 +01:00
Keir Fraser c6a3252083 [IA64] Further irq-vector fix.
Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-09-01 11:32:47 +01:00
Keir Fraser 18e7740068 xend: Fix c/s 20137 -- do not redefine built-in name 'str'.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-31 18:17:26 +01:00
Keir Fraser dc7a191f9d x86 hvm: Clean up VLAPIC interfaces a little, and fix vlapic_ipi().
A boolean flag was overflowing a uint8_t.

Thanks to Dongxiao Xu at Intel for tracking down the bug.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-31 10:54:32 +01:00
Keir Fraser d3904eaa46 [IA64] Fix serial console freeze issue
20110:6e83b0ec2d70 is incomplete. irq_to_vector() is still required,
otherwise the serial console freezes without sync_console.

I confirmed that dom0 booted up without sync_console.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
2009-08-31 10:17:09 +01:00
Keir Fraser bc05036624 libxc: Avoid a constant-zero-sized memset().
Some environments warn about this, which fails the build.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-31 10:14:26 +01:00
Keir Fraser bf6b9756fa xend: Greater verbosity on domain creation failure
Attached patch makes error reporting more verbose when
xc.domain_create() fails or raises an Exception.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-08-31 10:12:10 +01:00
Keir Fraser 68461397a3 x86/numa: fix c/s 20120 (Fix SRAT check for discontig memory)
That change converted the (wrong) assumption of contiguous nodes'
memory to a similarly wrong one of assuming discontiguous memory (i.e.
each node having separate E820 table entries). The code ought to be
able to deal with both, though, and I hope this change makes it so.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Acked-by: Alex Williamson <alex.williamson@hp.com>
2009-08-31 10:10:17 +01:00
Keir Fraser 66c5b440e1 properly __initdata-annotate command line option string buffers
Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-08-31 10:09:12 +01:00
Keir Fraser 088b657e65 x86: properly __init-annotate time.c
Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-08-31 10:08:38 +01:00
Keir Fraser e351818d40 introduce size_param()
With there being several instances of custom_param() where the handler
is just invoking parse_size_and_unit(), it seems to make sense to
introduce a simplifying abstraction.

Also fix serial_txbufsz not having been guaranteed to be a power of
two.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-08-31 10:06:53 +01:00
Keir Fraser 2ea33061b3 x86_emulate: honor failure of in_longmode()
Failure of in_longmode() shouldn't be treated the same as the function
returning 'true'.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-08-31 09:54:25 +01:00
Keir Fraser e4c0d3679f x86, ept: remove execute permission for granted pages' P2M entries
When backporting c/s 20026 I noticed that granted pages get execute
permission, which doesn't seem desirable (and has been avoided for PV
guests for quite a while).

Even for p2m_mmio_direct is seems suspicious to allow execution, but
me being less certain here I left it as is for the time being.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-08-31 09:51:45 +01:00
Keir Fraser 77980d7d07 Adjust non-default sized console ring allocation
Using xmalloc() for objects that are guaranteed to be at least as
large as a page is wasteful, as it will always result in more (here:
double the amount) being allocated.

The other adjustments are more cosmetic:
- Updating conring and conring_size can be done so NMI/MCE generated
  messages don't use the new (larger) size with the old (smaller)
  buffer.
- The size printed can be in KiB (for the value to be easier to grasp)
  since it is always a multiple of the default of 16KiB.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-08-31 09:51:05 +01:00
Keir Fraser b05c476cf6 x86: fix get_free_pirq
GSI should not be allocated for other purpose, so change
the hard code limit.

Also fix the out of loop checking, it should be '<' instead of
'=='.

Signed-off-by: Qing He <qing.he@intel.com>
2009-08-31 09:47:30 +01:00
Keir Fraser d4fc7ea04d x86: softtsc for PV domains
Implement softtsc (TSC emulation) for userland code in PV domains.  It
currently is tied to the existing "softtsc" Xen boot option (which
does the same thing but for HVM domains).  Later it should be tied to
a vm.cfg option, but this is sufficient for now to obtain performance
degradation data for PV environments that heavily utilize rdtsc.  To
record emulation frequency, use debug-key "s".

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-27 11:25:34 +01:00
Keir Fraser fbed278604 x86: fix msi_free_irq().
1) We should invoke destroy_irq() before msix_put_fixmap().
2) destroy_irq() invokes mask_msi_irq() eventually, so we can remove
the duplicate mask operation in the 'if' statement here.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-08-27 10:13:13 +01:00
Keir Fraser 4062d9c27b [HVM] add super page support for HVM migration
This patch try to allocate 2M pages on target side based on analysis
of pfn sequence sent from source side for HVM migration.

The algorithm is: If pseudo-phys page is not yet populated in target
domain, AND it is first page of a 2MB extent, AND no other pages in
that extent are yet populated, AND the next pages in the save-image
stream populate that extent in order, THEN allocate a super page. If
the next 511 pages (to make the 2MB extent) are split across a batch
boundary, we have to optimistically allocate a super page in this
batch, and then break it into several 4K pages in the next batch,
which is speculative.

This patch is also friendly to PV guest migration.

Signed-Off-By: Zhai Edwin <edwin.zhai@intel.com>
2009-08-27 10:12:41 +01:00
Keir Fraser 7a530cd968 xend: Do not pass pointer to a 16-bit domid_t to PyArg_ParseTuple()
when it expects a full integer.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-26 15:41:59 +01:00
Keir Fraser c50b989b44 xend: Flask MLS security label handling
Changed the way security labels are handled to allow domains to be
labeled with Flask MLS security labels.  Changed the error message
generated when an invalid context is submitted to be more useful.

Signed-off-by: Machon B. Gregory <mbgrego@tycho.ncsc.mil>
Signed-off-by: George S. Coker, II <gscoker@alpha.ncsc.mil>
2009-08-26 15:35:14 +01:00
Keir Fraser adfa96375a stubdom: Backport fix for SIZE_MAX from newlib 1.17.0
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-25 16:26:02 +01:00
Keir Fraser 78c9b2a64b Accurate accounting for credit scheduler
Rather than debit a full 10ms of credit on a scheduler tick
(probabilistic), debit credits accurately based on time stamps.

The main problem this is meant to address is an attack on the
scheduler that allows a rogue guest to avoid ever being debited
credits.  The basic idea is that the rogue process checks time (using
rdtsc) periodically, and yields after 9.5ms.  Using this technique, a
guest can "steal" 95% of the cpu.  This is particularly an issue in
cloud environments.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-08-25 15:36:37 +01:00
Keir Fraser c4651bd31d xend: Fix typos in configure_vtpm
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-08-25 14:59:09 +01:00
Keir Fraser 92f8888d40 x86 numa: Fix SRAT check for discontig memory
We currently compare the sum of the pages found in the SRAT table to
the address of the highest memory page found via the e820 table to
validate the SRAT.  This is completely bogus if there's any kind of
discontiguous memory, where the sum of the pages could be much smaller
than the address of the highest page.  I think all that's necessary is
to validate that each usable memory range in the e820 is covered by an
SRAT entry.  This might not be the most efficient way to do it, but
there are usually a relatively small number of entries on each side.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
2009-08-25 14:58:42 +01:00
Keir Fraser 1e52826824 xen/xsm/flask: Fix Flask MLS context generation
Signed-off-by:  Stephen D. Smalley <sds@tycho.nsa.gov>
2009-08-25 14:58:07 +01:00
Keir Fraser 6c6b085bec pygrub: Set path in #! line of pygrub, too
pygrub currently has a hardcoded path of /usr/bin/python which is not
correct if the version of python at install time is not the same as
that at build time.  This patch uses the existing install-wrap and
python/get-path machinery.

(It does not address the currently-existing bug that the get-path
machinery works by assuming that `python' is a symlink, rather than
querying the python interpreter for its version.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2009-08-25 14:57:45 +01:00
Keir Fraser 1b14383998 xend: Add support for URI ('file:' and 'data:' scheme) for PV/kernel
and PV/ramdisk

Add support for 'file:' and 'data:' URI schemes for the parameters
'PV/kernel' and 'PV/ramdisk' in the VM.create() call. The 'data:'
scheme handling enables using a file which is stored inside the
management system (from where the XenAPI call is send) as kernel or
ramdisk.

Notes:
o all included: a detailed description can be found in the xenapi
documentation
o bumped up the version of the API document to 1.0.8 (because of
(minimal) interface extension)
o Future enhancements (like http:, ftp: schemes) fit seamlessly into
the current design / classes
o Unittest cases and xm-test case included

Signed-off-by: Andreas Florath <xen@flonatel.org>
2009-08-25 14:56:54 +01:00
Keir Fraser 552cd79c66 libxc: More LZMA/BZIP fixes.
- Fix an error message in xc_try_bzip2_decode()
 - Check library installation on demand using a Makefile function,
   rather than generating a dependency file. Cleaner and avoids a race
   on generating the dep file.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-24 08:27:30 +01:00
Keir Fraser b0ae5f8bd1 vtpm: Upgrade to using tpm_emulator-0.5.1
The newer version of the emulator contains several bug fixes, one that
we were seeing in our use of vtpm.

This patch also defines TPM_STRONG_PERSISTENCE for the new emulator.

A couple of important notes about this patch:
-This has only been tested on PVM domU's. In theory it should work for
HVM but I have not tried it at all and can guarantee nothing.
-All the relevant changes in tools/vtpm/vtpm.patch have been ported
to tpm_emulator-0.5.1.
-None of the changes in tpm_emulator.patch have been ported. In
particular this means the BUILD_EMULATOR option, which as I understand
lets you use the tpm_emulator in dom0 for a machine that does
not have a real hardware TPM does not work. This functionality should
be easy to add though because the new emulator already comes with a
kernel module interface.
-No considerations were made for the VTPM_MULTI_VM feature (which is
supposedly unfinished). This patch may or may not break any progress
made on that feature.

Signed-off-by: Matt Fioravante <Matthew.Fioravante@jhuapl.edu>
2009-08-24 08:08:52 +01:00
Keir Fraser 2ac9ced4cb xend: Allow vtpm instance uuid to be specified on domain creation
Right now xen will create a new vtpm instance everytime you start up a
domU, even if you specify the instance parameter in your config file.
Each vtpm instance is then given a uuid and the vtpm.db file maps
instance numbers to uuid numbers.

This patch is a hack that lets you explicitly set the uuid of your
vtpm instance. Everytime you boot up your domU now the vtpm will get
that uuid and thus it will always get the same vtpm instance number
instead of being generated a new one.

So for example, in your config file you would do something like this
vtpm = [ 'backend=0,uuid=dcdb124b-9fed-4040-b149-dd2dfd8d094c' ]

Signed-off-by: Matt Fioravante <Matthew.Fioravante@jhuapl.edu>
2009-08-24 08:05:46 +01:00
Keir Fraser 63afd80f48 vtpm: Fix hashed-memory file writing.
There is a bug in the vtpm_manager that has to do with hashing and
saving the NVM memory files (vtpm_dm_%d.data). The file is not
truncated when it is written and this results in the hash becoming
invalid because of the extra bits at the end of the file.

This patch adds O_TRUNC to the flags when opening the file.

More details on this issue are in the bug report on bugzilla=20
http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=3D1488

Signed-off-by: Matt Fioravante <Matthew.Fioravante@jhuapl.edu>
2009-08-24 08:03:46 +01:00
Keir Fraser 0810208cf1 x86: run timers when populating Dom0's P2M table
When booting Dom0 with huge amounts of memory, and/or memory accesses
being sufficiently slow (due to NUMA effects), and the ACPI PM timer
or a high frequency HPET being used, the time it takes to populate the
M2P table may significantly exceed the overflow time of the platform
timer, screwing up time management to the point where Dom0 boot fails.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-08-24 08:02:08 +01:00
Keir Fraser 2db97700d4 x86: Ensure irq is disabled before taking vector_lock.
Fixed debug lock issue for taking vector lock.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-08-21 17:14:35 +01:00
Keir Fraser 9731b3ca8b ia64: Fix ia64 build issue introduced by per-cpu vector changes.
ia64 has no per-cpu vector support, so change the related APIs back
through defining macros.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-08-21 17:13:54 +01:00
Keir Fraser f6b66ffe92 Update .hgignore for tools/libxc/.zlib.deps 2009-08-21 17:13:17 +01:00