Commit Graph
21501 Commits
Author SHA1 Message Date
Keir Fraser f55efa2b18 x86 mtrr: Remove (noop) lock_cpu_hotplug().
CPUs coming online sync themselves with current MTRR state at an
appropriate point anyway.

It's not actually possible to have a newly booted CPU immediately have
in-sync MTRR state anyway. It has to be synced up as part of normal
CPU bootstrap procedure. Which is what we do.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-06-01 10:56:07 +01:00
Keir Fraser 01c02ad2a8 x86 mtrr: Fix set_mtrr() race against cpu_online_map changes.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-06-01 10:40:06 +01:00
Keir Fraser 1f60b34911 xl: remove duplicate code in migrate_domain()
libxl_domid_to_name() have already been called in
save_domain_core_begin()->find_domain(), so remove it.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
2010-06-01 07:06:50 +01:00
Keir Fraser 81c0e00a2e libxl: fix domain suspend debug typo.
Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
2010-06-01 07:06:05 +01:00
Keir Fraser 8567eb4c32 xend: PoD check should be for HVM domain only.
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
2010-06-01 07:05:22 +01:00
Keir Fraser f6a50a21e5 xc: deal with xen/evtchn and xen/gntdev device names
This patch makes xc_linux properly deal with:
 1. discovering and creating device nodes if necessary
 2. the new form of xen/<dev> device names soon to be used by the
 kernel

This changes the logic slightly:
 - If a device node already exists with the proper name, then it uses
 it as-is, assuming it has already been correctly created.
 - If the path doesn't exist, or it exists but isn't a device node,
 and
   it has successfully found the major/minor for the device, then
   (re)create the device node.

Since this logic is identical for gntdev and evtchn, make a common
function to handle both.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
2010-06-01 07:04:35 +01:00
Keir Fraser 0b086b2583 xend: Remove broken bits of NUMA code.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-06-01 06:55:23 +01:00
Keir Fraser eddde6561c xen: update_runstate_area for 32 bit PV on HVM guests
The current implementation of update_runstate_area is unable to handle
32 bit PV on HVM guests because the check is_pv_32on64_domain doesn't
cover that case. This patch fixes it.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2010-06-01 06:45:44 +01:00
Keir Fraser d26b575070 x86: Fix guest-pointer-array memmove in __pirq_guest_unbind().
Thanks to Alex Zefefrt for finding this.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-05-28 10:54:07 +01:00
Keir Fraser e693e5f1a7 tools: Build fixes.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-05-28 09:45:50 +01:00
Keir Fraser 455a17fea9 xl/libxtl: Remove glitch in xl migrate log output
* Provide a new XTL_STDIOSTREAM_HIDE_PROGRESS flag in the stdio logger
* Provide a way to adjust the flags after logger setup
* Use these to disable progress output from the migration receiver, as
  the sender is also sending progress information.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2010-05-28 09:38:56 +01:00
Keir Fraser a2b5973ee0 libxc: remove \n from strings passed to PERROR
Previously, the code was inconsistent: some calls to PERROR passed \n
and some did not.  With the new logging arrangements, passing \n is
definitely incorrect.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2010-05-28 09:38:18 +01:00
Keir Fraser 861aef6e15 libxc: save/restore error handling fixes
* Make "read_exact" in libxc always set errno.
* Rename "read_exact" macro in xc_domain_restore.c (which shadows
  real function) to RDEXACT and change all callers.
* Make RDEXACT anamorphically use xch for error reporting rather than
* stderr.
* Call PERROR rather than ERROR when appropriate, so that log messages
  include errno.
* Save errno in noncached_write so that its errno value is always
* right.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2010-05-28 09:37:42 +01:00
Keir Fraser b140baacc3 xl: Allow control of logging level.
The -v option, which must come before the xl command, increases the
logging level each time it is supplied.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-05-28 09:35:12 +01:00
Keir Fraser 1fe4b0e07c libxl: Use the caller's logger (xentoollog)
We now require callers to provide a xentoollog_logger* for
libxl_ctx_init, and use that for all our own logging and also for
xc_interface_open.

Corresponding change to xl.c.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-05-28 09:34:42 +01:00
Keir Fraser 4046aa9cbe libxl: Fix up some incorrect printf formats
We need to use PRIu32 for domids, and also to pass arguments in the
right order.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-05-28 09:31:43 +01:00
Keir Fraser 0f02f4e0e8 libxc: Use new DBGPRINTF for a few debugging output messages
oubuf and batch restore write messages should be sent with level
XTL_DEBUG so that they don't disturb progress output even with -v.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-05-28 09:31:09 +01:00
Keir Fraser 5cc436c1d2 libxc: eliminate static variables, use xentoollog; API change
This patch eliminate the global variables in libxenctrl (used for
logging and error reporting).

Instead the information which was in the global variables is now in a
new xc_interface* opaque structure, which xc_interface open returns
instead of the raw file descriptor; furthermore, logging is done via
xentoollog.

There are three new parameters to xc_interface_open to control the
logging, but existing callers can just pass "0" for all three to get
the old behaviour.

All libxc callers have been adjusted accordingly.

Also update QEMU_TAG for corresponding qemu change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-05-28 09:30:19 +01:00
Keir Fraser 7f9a888af4 xtl: New xentoollog mini-library.
We provide a new header file "xentoollog.h" which defines an interface
that libraries and applications can use for logging.  This avoids
having to wrap each library's log callbacks up, massage arguments to
log callbacks, and so on.

The library's .o files are within libxc to avoid having to create a
separate lib*.a, but callers do not need to #include xenctrl.h and it
should be regarded as a separate API.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-05-28 09:29:15 +01:00
Keir Fraser 36cfb6aa84 libelf: Tidy up logging and remove dependency on stdio.
libelf now permits callers to specify logging callback functions,
rather than a FILE*.  libelf's non-Xen callers are all libxc users, so
the stdio dependency and the default logging callback function (which
calls vfprintf) is now in libxc.

Xen's use of libxc is unaffected in this patch.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2010-05-28 09:27:40 +01:00
Keir Fraser 9683028227 libxc: xc_domain_save.c: rename "write_exact" macro
There is already a "write_exact" function declared in xc_private.h.
So rename this macro to to wrexact.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2010-05-28 09:26:51 +01:00
Keir Fraser 821be8a243 stubdom/newlib: Provide correct names for time.h timezone variables
Newlib unaccountably defines _daylight, _timezone and _tzname, rather
than daylight, timezone and tzname.  The latter are specified in
SuSv3.

So do a global search and replace as part of our newlib patching :-(.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2010-05-28 09:26:25 +01:00
Keir Fraser ca1ba18256 xl: Move "extern" declarations to xl.h
Declarations (as opposed to definitions) of external objects should
not appear in .c files.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2010-05-28 09:25:34 +01:00
Keir Fraser 63e8667404 xl: Combine headers into one header file.
This provides a single place to put declarations of external symbols
etc.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2010-05-28 09:25:07 +01:00
Keir Fraser 84d7979493 iommu: Map correct permissions in IOMMU on grant read-only map request.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-05-28 09:08:00 +01:00
Keir Fraser 17d223ff4d iommu: Specify access permissions to iommu_map_page().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-05-28 08:48:50 +01:00
Keir Fraser 6a47fbab76 HAP: Add hardware capability check for 2MB super page.
While setting the HAP entry previously, we only check the hardware
capability for 1GB super page. This patch adds hardware capability
check for 2MB superpage

Also, Intel SDM doesn't exclude 1GB feature for 32/pae
host. Therefore remove the BUG_ON() check in common code.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
2010-05-28 08:14:54 +01:00
Keir Fraser 76a5dc5492 xl: print BDF parse errors
When parsing BDFs for pci-attach/detach, check the return of scanf
rather than operating on random devices.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
2010-05-28 08:12:15 +01:00
Keir Fraser 596cf420ec xl: fix pci-detach usage message
"xl pci-detach -h" shows the usage for pci-attach

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
2010-05-28 08:11:47 +01:00
Keir Fraser c53944ad66 xl: fix PCI resource parsing
The parsing of PCI resources has two problems:

   1. it assumes devices are 32-bits, whereas the fields in the
      "resources" file can have full 64-bit values
   2. it only parses the first resource because the format string is
      missing a \n

Fix both of these up, which allows my Intel 82574L to work with MSI-X.

However, this should probably be using a PCI access library rather
than rummaging around in /sys/bus/pci...

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
2010-05-28 08:10:48 +01:00
Keir Fraser 9cdfe48f9a Update QEMU_TAG to 805ed3b20492d2f4bb465bfda65cedd286e23209 2010-05-28 08:09:38 +01:00
Keir Fraser 0f3f42694c x86: Warn on CPU hot-add to tsc-reliable system
...and provide a boot option to indicate TSCs may be skewed.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-05-28 08:03:02 +01:00
Keir Fraser 8b44f7eb12 x86: Synchronize slave TSC to master if necessary, during cpu bringup
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-05-27 09:39:47 +01:00
Keir Fraser 06ef473029 x86: Speed up PV-guest superpage mapping
The current version of superpage mapping takes a PGT_writable
reference to every page in a superpage each time it is mapped.  This
is extremely slow, so slow that applications become unusable.

My solution for this is to introduce a superpage table in the
hypervisor, similar to the frametable structure for pages.  Currently
this table only has a type_info element.  There are three types a
superpage can have, SGT_mark, SGT_dynamic, or SGT_none.

In normal operation, the first time a superpage is mapped, a
PGT_writable reference is taken to each page in the superpage, and the
superpage is set to type SGT_dynamic and the superpage typecount is
incremented.  On subsequent mappings and unmappings, only the
superpage typecount changes.  On the last unmap, the PGT_writable
reference on each page is removed.

The SGT_mark type is set and cleared through two new MMUEXT
hypercalls, mark_super and unmark_super.  When the hypercall is made,
the superpage's type is set to SGT_mark and a PGT_writable reference
is taken to its pages.  On unmark, the type is cleared and the
reference removed.

If a page is already set to SGT_dynamic when mark_super is called, the
type is changed to SGT_mark and no additional PGT_writable reference
is taken.  If there are still outstanding mappings of this superpage
when unmark_super is called, the type is set to SGT_dynamic and the
PGT_writable reference is not removed.

Fast superpage mapping is only supported on 64 bit hypervisors.  For
32 bit hyperviors, superpage mapping is supported but will be
extremely slow.

Signed-off-by: Dave McCracken <dave.mccracken@oracle.com>
2010-05-27 09:04:46 +01:00
Keir Fraser 92ed5b7e9c vmx: Fix c/s 21433:095e4b964f99: Must save host MSRs on cpu init
Original patch by Dulloor <dulloor@gmail.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-05-27 08:34:44 +01:00
Keir Fraser 56022b3071 libxl: Do not provide arbitrary string as format specifier to printf.
Original patch from Dulloor <dulloor@gmail.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-05-27 08:26:52 +01:00
Keir Fraser 2e5af0a5dc xenconsoled: Discard guest console data in bigger chunks
Discard guest console data in bigger chunks so that there are fewer
discontinuities in the console data.  Also avoid discarding data if
space is available at the front of the buffer by reclaiming that
space.

Patch from: Christian Limpach <Christian.Limpach@citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2010-05-27 08:21:24 +01:00
Keir Fraser a705c15428 xenstore: Make sure that libxs reports an error if xenstored drops
the connection, rather than getting stuck forever.

Patch from: Steven Smith <steven.smith@eu.citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2010-05-27 08:20:26 +01:00
Keir Fraser f4f16d740c xenctx: Add --kernel-start option, to set the user/kernel split
Used when displaying stack traces.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2010-05-27 08:19:47 +01:00
Keir Fraser e779c5d7a3 pyGrub: Use proper bootloader class when entering command manually
Use the proper bootloader class when entering the boot commands
manually (i.e. using the 'c' option). Before this patch the bootloader
was always treated to be Grub but when user is using Grub2/ExtLinux or
Lilo it's rather confusing. After applying this patch the proper
bootloader image class is being used, e.g. Grub2Image for Grub2
etc. when you define the boot commands manually using the 'c' command
in pyGrub.

Also, fix for using isconfig has been applied since if there is not fs
set in the run_grub() method the read_config() would fail since it's
trying to access undefined self.cf which is now being set to parser()
from cfg_list.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2010-05-26 10:52:15 +01:00
Keir Fraser 221bac1943 tools: Fix time offset when localtime=0
localtime can be stored in vm config as a string, resulting in
incorrect calculation of rtc_timeoffset.  Cast localtime to int
to ensure rtc_timeoffset is calculated properly.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
2010-05-26 08:15:31 +01:00
Keir Fraser cf928043f9 Allow space in vbd path name
c/s 20393 breaks existing domain configuration that contains
spaces in the vbd path name.  Fixed by this trivial patch which
provides missing quotes.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
2010-05-26 08:14:51 +01:00
Keir Fraser a8ad76437e xl: Some small fixes
- When use mem-set, I got suspicious error output:
  # xl mem-set 1 256g
  setting domid 1 memory to : 268435456
  [0] libxl.c:2535:libxl_set_memory_target: memory_dynamic_max must be
  less than or equal to memory_static_max
  : Success
- String generated by strdup() should be freed
- When using 'xl help', mem-max and mem-set's output is not as intend,
  and it also breaks bash completion, fix it.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
2010-05-26 08:13:47 +01:00
Keir Fraser 961652b3bd xl: allow nameless domains to be named
At present, find_domain() will exit(2) if you specify a domain by
number, but that domain doesn't have a corresponding name.  However,
nothing seem to critically depend on common_domname being set, and the
test prevents dom0 or other nameless domains from being named.  So
just remove the check.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Acked-by: Yang Hongyang <yanghy@cn.fujitsu.com>
2010-05-26 08:12:15 +01:00
Keir Fraser 48114954f9 compat-guest accessor macros do not need address check for hvm guests.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2010-05-26 08:09:38 +01:00
Keir Fraser 4909262218 x86 EPT: Only flush EPT TLB if the previous entry was valid
Original patch from George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2010-05-26 08:08:46 +01:00
Keir Fraser df54af7dd1 hvm: Extend the CPUID whitelist to include Intel's AES-NI intructions
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2010-05-26 08:02:33 +01:00
Keir Fraser e4a1897ed1 x86 shadow: Avoid remove-all-shadows after shadow teardown
If dom0 alters the p2m of a domain that's being destroyed, we can end
up doing a remove-all-shadows after the shadow hash table has been
freed. Since no hash table implies no shadows, just return
immediately.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2010-05-26 08:01:21 +01:00
Keir Fraser ed8d60c2ae hvm: Handle extreme wallclock offsets safely.
When a VM's wallclock offset is negative enough, gmtime() can be called
with an underflowed uint64, which it then tries to divide into years
by subtraction.  Handle the input as a 40-bit signed integer instead.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2010-05-26 07:59:52 +01:00
Keir Fraser e19dfb3994 cpupool: Clean up unused prorotype and duplicate trace call.
Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
2010-05-26 07:48:09 +01:00