Commit Graph
20534 Commits
Author SHA1 Message Date
Keir Fraser ca2b264d69 libxenlight: fix uuid code
- Use proper constants
- Use functions from the uuid library
- Fix broken pointer handling in libxl_dominfo

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.com>
2009-12-01 13:45:45 +00:00
Keir Fraser 491a51514a libxenlight: avoid writing empty values to xenstore
Prevent segmentation fault caused by empty values
in key-value pairs for the /vm/ subdirectory
when creating a pv domain.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.com>
2009-12-01 13:44:13 +00:00
Keir Fraser 421b4ddbc1 sysctl: Fix mis-allocation of number for XEN_SYSCTL_lockprof_op
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-12-01 13:41:38 +00:00
Keir Fraser c9ee7a756b Revert 20523:bd52fff29e6e "Remove redundant tests in __start_xen()"
Consensus is that code is clearer with the tests, even though they are
redundant.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-12-01 13:39:51 +00:00
Keir Fraser fc50aaf0d8 xentop: Add tmem-freeable info when tmem is active
(No change to xentop output when tmem is inactive.)

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-12-01 13:38:18 +00:00
Keir Fraser 1fd93d4f8c xenstat: Linux dom0 statistics for case we use network bonding
I've created a patch that alters dom0 statistics (if empty like in
case of network bonding) and puts network bridge statistics
instead. It's been tested with network bonding both enabled and
disabled and also by creating a standalone network bridge without
bonding... It was working fine in all my tests...

Signed-off-by: Michal Novotny <minovotn@redhat.com>
2009-12-01 13:37:20 +00:00
Keir Fraser d1956b62b0 Report hardware tsc frequency even for emulated tsc
I was starting some documentation for tsc_mode and
realized this discussion was never resolved.  Currently
when TSC is emulated the pvclock algorithm reports
to a PV OS Xen's system clock hz rate (1GHz).  Linux
at boottime samples the TSC rate and shows it in
dmesg and the rate is also shown in the "cpu MHz"
field in /proc/cpuinfo.  So when TSC is emulated,
it appears that the processor MHz is 1000.0, which
is likely to be confusing to many Xen users.

This patch changes the reported hz rate to the
hz rate of the initial machine on which the guest
is booted and retains that reported hz rate across
save/restore/migration.

Jeremy has pointed out that reporting 1000.0 MHz is
useful because it shows that TSC is being emulated.
However, with the new tsc_mode default where
a guest may start with native TSC and switch to
emulated TSC after migration, users are likely to
get even more confused.  And "xm debug-key s"
reveals not only whether TSC is being emulated but
also the frequency so is more descriptive anyway.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-12-01 13:36:22 +00:00
Keir Fraser cfbf78694e tools: avoid cpu over-commitment if numa=on
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
2009-12-01 13:35:28 +00:00
Keir Fraser e4bc73337a libxenlight: fix segfault when reading blktap2 devs
This patch fixes a possible segfault when reading from
/sys/class/blktap2/devices, if the line read is empty.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-12-01 13:34:38 +00:00
Keir Fraser a2bfc84506 libxenlight: fix multiple console with stubdoms
libxenlight doesn't handle properly the multiple pv console case,
needed to support an emulated serial in hvm guests with stubdoms.
This patch fixes it.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-12-01 13:34:10 +00:00
Keir Fraser 9e63fdbdc7 x86: Remove redundant tests in __start_xen()
Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
2009-11-30 11:48:36 +00:00
Keir Fraser d922877f6e ia64: eliminate build warnings
Various warnings appeared since 3.4 - eliminate at least some of them.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-11-30 10:58:23 +00:00
Keir Fraser c1fcbadd2c xend: fix bugs in c/s 20321:7a69f773548e "add a config description item for each guest"
Signed-off-by: james song (wei)<jsong@novell.com>
2009-11-30 10:57:42 +00:00
Keir Fraser 58ca38a652 libxenlight: implement blktap2 support
This patch implements blktap2 support in libxenlight; blktap2 is only
enabled if it is actually supported by the host, otherwise we fall
back to the previous code. Also for the moment we pretend that disk
type file is actually tap:aio.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-11-30 10:54:20 +00:00
Keir Fraser d1c7c3ef99 libxenlight: fix suspend/resume
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-11-30 10:53:39 +00:00
Keir Fraser 5a602fc8fb libxenlight: add console command
This patch adds "xl console" command similar to "xm console".

Signed-off-by: Tomasz Wroblewski <tomasz.wroblewski@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-11-30 10:47:36 +00:00
Keir Fraser c5d895be23 libxenlight: fix hvm flag when no hvmloader
Signed-off-by: Tomasz Wroblewski <tomasz.wroblewski@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-11-30 10:41:28 +00:00
Keir Fraser f0a60fa636 x86/mm: set_p2m_entry() should return 0 on error
set_p2m_entry() ignores halfway errors.
It should return 0 on error.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
2009-11-30 10:38:58 +00:00
Keir Fraser ad86c7de55 xm: Allow detaching vif by MAC address
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-11-27 08:09:26 +00:00
Keir Fraser d210b9fc62 VT-d: Free unused interrupt remapping table entry
This patch changes the IRTE allocation method, and frees unused
IRTE when device is de-assigned.

Signed-Off-By: Zhai Edwin <edwin.zhai@intel.com>
2009-11-27 08:05:18 +00:00
Keir Fraser dd14c75ad4 build: Execute mk_dsdt with path
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-11-27 07:56:38 +00:00
Keir Fraser c7679119e4 hvmloader: Auto-generate IRQ routing tables in ACPI DSDT.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-11-26 15:27:00 +00:00
Keir Fraser b549d6e6e3 libxenlight: implement pause and unpause
this patch adds domain pause and unpause commands to xl, implementing
them using the already exiting functions libxl_domain_pause and
libxl_domain_unpause.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-11-26 14:49:40 +00:00
Keir Fraser c3517d3d2a hvmloader: Auto-generate the lengthy pattern-based sections of ACPI DSDT.
At the same time, replace a lengthy linear GPE notification method,
with a logarithmic binary chop. Based on a patch by Simon Horman.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-11-26 13:51:16 +00:00
Keir Fraser 74127b5e90 x86: Remove redundant logic for mp_register gsi.
For xen's irq and gsi, they are identity mapped, and doesn't
need to record the irq and gsi mapping in this array, in addition
the mapping maybe not correct, since dom0 may not figure the GSI
from 16 on.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-11-26 11:35:27 +00:00
Keir Fraser 3e64b93244 x86 shadow: don't try to unsshadow for p2m changes after the shadows
have been torn down.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2009-11-26 11:31:16 +00:00
Keir Fraser 38457bf1f8 Revert 20505:44ea369eefc1 2009-11-26 11:30:42 +00:00
Keir Fraser c6560c9861 x86: Always respect guest setting CR4.TSD
Also fix guest reads of CR4.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-11-26 11:24:50 +00:00
Keir Fraser 833cce002f x86 shadow: fix race when domain is dying
There are some cases that shadow_write_p2m_entry() is called after
the domain is killed. It causes Xen to crash.

- Race between xc_map_foreign_batch from qemu-dm and "xm destroy"
  command.
- The hypervisor calls domain_crash when PoD fails.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2009-11-26 11:02:30 +00:00
Keir Fraser 8978cc08d9 Implement rdtscp emulation and rdtscp_aux "support"
The rdtscp instruction (and the associated TSC_AUX
msr) are present on most recent AMD processors,
and on the Nehalem and future Intel processors.
Cpuid has a bit to detect the presence of this feature.

Xen intentionally does not expose the cpuid rdtscp bit
to PV OS's or to HVM guests, but PV apps can see this
bit and, as a result, may choose to use the rdtscp
instruction.  When a PV guest with such an app is migrated
to a machine that does not have rdtscp support, the
app will get killed due to an invalid op.  Fix this
by emulating the rdtscp instruction.  We also need
to emulate rdtscp in the case where the machine has
rdtscp support, but rdtsc emulation is enabled (which
is unfortunately a different path: a privileged op).

The rdtscp instruction reads the TSC_AUX register which
presumably is set by the OS (and, in the case of
tsc_mode==pvrdtscp, will be set by Xen).  HV Linux
and PV Linux will not set TSC_AUX because the
cpuid rdtscp bit is not propogated by Xen; I'm told that
Windows always sets TSC_AUX to zero.  So for PV guests
running on rdtscp-capable hardware (that don't use
tsc_mode==pvrdtscp), always set TSC_AUX to zero.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-11-26 11:00:49 +00:00
Keir Fraser 05bafb26f1 libxc: Fix 32-vs-64 bitness issue in saving vcpu contexts in core dump
Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-11-26 11:00:15 +00:00
Keir Fraser f0e8b55eb1 xm: Fix maxvcpus support
Signed-off-by: Michal Novotny <minovotn@redhat.com>
2009-11-26 10:57:26 +00:00
Keir Fraser f9abceac96 xend: little fix for tap
Need get dev type after create tap device as device_create did.

Signed-off-by: Wei Kong <weikong.cn@gmail.com>
2009-11-26 10:56:49 +00:00
Keir Fraser 1a2c608279 libxenlight: move logging macros to the public header
This patch moves the logging macros to the public header so that they
can be reused by the client of the library.  It also refactors the
code to create the qemu logfile into a generic function that can be
reused to create generic xen logfiles under /var/log/xen.  Finally xl
is changed to log to file when running in background.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-11-25 14:19:50 +00:00
Keir Fraser 6eeeaeb211 libxenlight: clean up the domain when it dies
This patch adds two functions to libxenlight to be able to recognize
when a particular domain dies. After creating a domain, xl uses these
functions to wait for its death and clean up its resources.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-11-25 14:19:20 +00:00
Keir Fraser 3da979eea1 x86 time: Fix build and clean up.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-11-25 14:15:57 +00:00
Keir Fraser 33fc368b24 x86 hpet: Do nothing in hpet_broadcast_exit() if no timer deadline.
From: "Jiang, Yunhong" <yunhong.jiang@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-11-25 14:12:58 +00:00
Keir Fraser 24d568bab3 libxenlight: implement stubdom support
this patch implements stubdom support for libxenlight:

- it adds two functions to find the stubdom domid of a domain and to
figure out if a certain domain is actually a stubdom;

- it moves all the device init functions from xl.c to libxl.c because
they are needed to setup the devices of stubdoms;

- it fixes some bugs in the pci setup that prevented pci passthrough
from working correctly with stubdoms.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-11-25 14:11:37 +00:00
Keir Fraser 68a94cf528 xm: Add maxvcpus support
this is patch to add maxvcpus support to xen xm command. It's using
vcpu_avail bitmask and sets the number of vcpus to maxvcpus if
present.  If it's not present, old behavior is preserved.

In domain config file you can define it as follows:

maxvcpus = 4
vcpus = 2

this automatically sets vcpus to 4 and corresponding bitmask to
present 2 vcpus in the guest with option to increase it up to 4
vcpus. If maxvcpus is not present, the old behavior for vcpus is
preserved, ie.  you can set vcpus to some number of vcpus to be used
and the vcpu_avail is set appropriately to use all of them. Only when
you use maxvcpus and vcpus new vcpu_avail value is calculated to show
PV guest the desired number of vcpus only.

It's been tested using RHEL-5 32-bit PV guest with maxvcpus = 4 and
vcpus = 2 and also the previous setup of vcpus = 2 only... In both
cases I was able to use 'xm vcpu-set {domainId} {numberOfVCPUs}' to
increase move vcpu count from 0 to maxvcpus/vcpus so it was working as
designed.

Signed-off-By: Michal Novotny<minovotn@redhat.com>
2009-11-25 14:11:02 +00:00
Keir Fraser 7d5eee4f2c cpuidle: Add decaying history logic to menu idle predictor
this patch is ported from linux upstream git commit
816bb611e41be29b476dc16f6297eb551bf4d747

the original description is:
"
Add decaying history of predicted idle time, instead of using the last
early wakeup. This logic helps menu governor do better job of
predicting idle time.

With this change, we also measured noticable (~8%) power savings on a
DP server system with CPUs supporting deep C states, when system was
lightly loaded. There was no change to power or perf on other load
conditions.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
"

In Xen environment, we also observe this patch reduce the idle power
fluctuation.  In one DP server, when system is purely idle, the watts
stdev/average reduce from 6% to 2%. it is helpful for idle power
measurement accuracy.  There is no performance and power change when
system is loaded.

Signed-off-by: Yu Ke <ke.yu@intel.com>
2009-11-25 14:06:17 +00:00
Keir Fraser 08a0b4ab0d Replace tsc_native config option with tsc_mode config option
(NOTE: pvrdtscp mode not finished yet, but all other
modes have been tested so sooner seemed better than
later to submit this fairly major patch so we can get
more mileage on it before next release.)

New tsc_mode config option supercedes tsc_native and
offers a more intelligent default and an additional
option for intelligent apps running on PV domains
("pvrdtscp").

For PV domains, default mode will determine if the initial
host has a "safe"** TSC (meaning it is always synchronized
across all physical CPUs).  If so, all domains will
execute all rdtsc instructions natively; if not,
all domains will emulate all rdtsc instructions but
providing the TSC hertz rate of the initial machine.
After being restored or live-migrated, all PV domains will
emulate all rdtsc instructions.  Hence, this default mode
guarantees correctness while providing native performance
in most conditions.

For PV domains, tsc_mode==1 will always emulate rdtsc
and tsc_mode==2 will never emulate rdtsc.  For tsc_mode==3,
rdtsc will never be emulated, but information is provided
through pvcpuid instructions and rdtscp instructions
so that an app can obtain "safe" pvclock-like TSC information
across save/restore and live migration. (Will be completed in
a follow-on patch.)

For HVM domains, the default mode and "always emulate"
mode do the same as tsc_native==0; the other two modes
do the same as tsc_native==1.  (HVM domains since 3.4
have implemented a tsc_mode=default-like functionality,
but also can preserve native TSC across save/restore
and live-migration IFF the initial and target machines
have a common TSC cycle rate.)

** All newer AMD machines, and Nehalem and future Intel
machines have "Invariant TSC"; many newer Intel machines
have "Constant TSC" and do not support deep-C sleep states;
these and all single-processor machines are "safe".

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-11-25 14:05:28 +00:00
Keir Fraser 83371c34bc hvmloader: Advertise ECC memory in SMBIOS tables.
Microsoft's Windows logo certified hardware requires ECC; since the
SVVP certification runs the same test on the guest, Xen domains will
currently fail it.

From: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-11-25 14:04:46 +00:00
Keir Fraser 7ec2f53230 x86: Add a new physdev_op PHYSDEVOP_setup_gsi for GSI setup.
GSI 0-15 is setup by hypervisor, and GSI > =16 is setup by dom0
this physdev_op PHYSDEVOP_setup_gsi. This patch can help dom0
to get rid of intrusive changes of ioapic.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-11-24 14:43:07 +00:00
Keir Fraser 24cb0f67ea tmem: fix freeable memory accounting error
Fix tmem accounting error that causes an "apparent"
memory leak, creating false negatives when testing
memory availability for launching a new domain.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-11-24 14:38:37 +00:00
Keir Fraser c8ec7e22d6 tmem: Fix another race in tmem on domain destroy.
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-11-24 14:37:59 +00:00
Keir Fraser 1a9b225d38 Revert 20457:1bbc132675a2
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-11-23 15:19:38 +00:00
Keir Fraser 57bc0df07c pygrub: add basic support for parsing grub2 style grub.cfg file
This represents a very simplistic aproach to parsing these file.  It
is basically sufficient to parse the files produced by Debian
Squeeze's version of update-grub. The actual grub.cfg syntax is much
more expresive but not apparently documented apart from a few
examples...

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2009-11-23 08:06:54 +00:00
Keir Fraser ccc76c47de pygrub: track the title of an item as an independant field
separate to the other fields.

This makes the list of lines within a GrubImage 0 based rather than 1
based therefore adjust the user interface parts to suit.

This is in preparation for grub2 support where the syntax for the item
title does not fit the existing usage.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2009-11-23 08:06:19 +00:00
Keir Fraser 1142ec6cf0 pygrub: factor generic Grub functionality into GrubConf base classes
and inherit from these classes to implement Grub-legacy functionality.

Use a tuple of (parser-object,configuration-file) in pygrub to allow
for multiple parsers.

Makes way for grub2 support.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2009-11-23 08:05:49 +00:00
Keir Fraser a9c7cc22db xend: pci: show error msg properly if pciback/pci-stub are not loaded
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-11-23 07:23:07 +00:00