]> xenbits.xensource.com Git - xen.git/log
xen.git
14 years agotimers: Track inactive timers and migrate them on cpu offline.
Keir Fraser [Wed, 2 Jun 2010 12:13:11 +0000 (13:13 +0100)]
timers: Track inactive timers and migrate them on cpu offline.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agotools: assume that special Xen devices have been created by the platform
Keir Fraser [Wed, 2 Jun 2010 09:54:32 +0000 (10:54 +0100)]
tools: assume that special Xen devices have been created by the platform

Remove all the magic surrounding the special Xen devices in Linux
specific code whereby we attempt to figure out what the correct
major:minor number is and check the the existing device has these
numbers etc. In 2010 we really should be able to trust that the
platform has created the devices correctly or provide correct
configuration settings such that they are without resorting to tearing
down the platform configured state and rebuilding it.

tools/hotplug/Linux/xen-backend.rules already contains the necessary
udev rules to create /dev/xen/evtchn and friends in the correct place.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
14 years agoxl: adds shutdown and reboot commands
Keir Fraser [Wed, 2 Jun 2010 09:52:17 +0000 (10:52 +0100)]
xl: adds shutdown and reboot commands
libxl : remote shutdown to work for pure hvm domains

Signed-off-by: Gihan Munasinghe <GMunasinghe@flexiant.com>
14 years agoFix xm man page statement about asynchonous operation
Keir Fraser [Wed, 2 Jun 2010 09:49:35 +0000 (10:49 +0100)]
Fix xm man page statement about asynchonous operation

The man page for xm command states that many commands acts
asynchronously which is not true. According to my experience most
commands does act synchronously with several exceptions, like create,
shutdown, mem-set and vcpu-set commands so this fixes the paragraph
available in this xm man page.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
14 years agox86: On CPU offline, freed stack should be *un*guarded.
Keir Fraser [Wed, 2 Jun 2010 09:38:55 +0000 (10:38 +0100)]
x86: On CPU offline, freed stack should be *un*guarded.

Fix stupid typo.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agoVMX: does EPT capabilities detection strictly according to Intel SDM.
Keir Fraser [Tue, 1 Jun 2010 13:25:59 +0000 (14:25 +0100)]
VMX: does EPT capabilities detection strictly according to Intel SDM.

Signed-off-by: Xin Li <xin.li@intel.com>
14 years agox86: During cpu offline, cpu_disable_scheduler() cannot fail.
Keir Fraser [Tue, 1 Jun 2010 12:57:44 +0000 (13:57 +0100)]
x86: During cpu offline, cpu_disable_scheduler() cannot fail.

BUG on this scenario.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agosmp_call_function/on_selected_cpus/on_each_cpu all return void.
Keir Fraser [Tue, 1 Jun 2010 10:04:08 +0000 (11:04 +0100)]
smp_call_function/on_selected_cpus/on_each_cpu all return void.

None of them can fail, so a return code is pointless.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agox86 mtrr: Remove (noop) lock_cpu_hotplug().
Keir Fraser [Tue, 1 Jun 2010 09:56:07 +0000 (10:56 +0100)]
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>
14 years agox86 mtrr: Fix set_mtrr() race against cpu_online_map changes.
Keir Fraser [Tue, 1 Jun 2010 09:40:06 +0000 (10:40 +0100)]
x86 mtrr: Fix set_mtrr() race against cpu_online_map changes.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agoxl: remove duplicate code in migrate_domain()
Keir Fraser [Tue, 1 Jun 2010 06:06:50 +0000 (07:06 +0100)]
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>
14 years agolibxl: fix domain suspend debug typo.
Keir Fraser [Tue, 1 Jun 2010 06:06:05 +0000 (07:06 +0100)]
libxl: fix domain suspend debug typo.

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
14 years agoxend: PoD check should be for HVM domain only.
Keir Fraser [Tue, 1 Jun 2010 06:05:22 +0000 (07:05 +0100)]
xend: PoD check should be for HVM domain only.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
14 years agoxc: deal with xen/evtchn and xen/gntdev device names
Keir Fraser [Tue, 1 Jun 2010 06:04:35 +0000 (07:04 +0100)]
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>
14 years agoxend: Remove broken bits of NUMA code.
Keir Fraser [Tue, 1 Jun 2010 05:55:23 +0000 (06:55 +0100)]
xend: Remove broken bits of NUMA code.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agoxen: update_runstate_area for 32 bit PV on HVM guests
Keir Fraser [Tue, 1 Jun 2010 05:45:44 +0000 (06:45 +0100)]
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>
14 years agox86: Fix guest-pointer-array memmove in __pirq_guest_unbind().
Keir Fraser [Fri, 28 May 2010 09:54:07 +0000 (10:54 +0100)]
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>
14 years agotools: Build fixes.
Keir Fraser [Fri, 28 May 2010 08:45:50 +0000 (09:45 +0100)]
tools: Build fixes.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agoxl/libxtl: Remove glitch in xl migrate log output
Keir Fraser [Fri, 28 May 2010 08:38:56 +0000 (09:38 +0100)]
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>
14 years agolibxc: remove \n from strings passed to PERROR
Keir Fraser [Fri, 28 May 2010 08:38:18 +0000 (09:38 +0100)]
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>
14 years agolibxc: save/restore error handling fixes
Keir Fraser [Fri, 28 May 2010 08:37:42 +0000 (09:37 +0100)]
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>
14 years agoxl: Allow control of logging level.
Keir Fraser [Fri, 28 May 2010 08:35:12 +0000 (09:35 +0100)]
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>
14 years agolibxl: Use the caller's logger (xentoollog)
Keir Fraser [Fri, 28 May 2010 08:34:42 +0000 (09:34 +0100)]
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>
14 years agolibxl: Fix up some incorrect printf formats
Keir Fraser [Fri, 28 May 2010 08:31:43 +0000 (09:31 +0100)]
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>
14 years agolibxc: Use new DBGPRINTF for a few debugging output messages
Keir Fraser [Fri, 28 May 2010 08:31:09 +0000 (09:31 +0100)]
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>
14 years agolibxc: eliminate static variables, use xentoollog; API change
Keir Fraser [Fri, 28 May 2010 08:30:19 +0000 (09:30 +0100)]
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>
14 years agoxtl: New xentoollog mini-library.
Keir Fraser [Fri, 28 May 2010 08:29:15 +0000 (09:29 +0100)]
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>
14 years agolibelf: Tidy up logging and remove dependency on stdio.
Keir Fraser [Fri, 28 May 2010 08:27:40 +0000 (09:27 +0100)]
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>
14 years agolibxc: xc_domain_save.c: rename "write_exact" macro
Keir Fraser [Fri, 28 May 2010 08:26:51 +0000 (09:26 +0100)]
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>
14 years agostubdom/newlib: Provide correct names for time.h timezone variables
Keir Fraser [Fri, 28 May 2010 08:26:25 +0000 (09:26 +0100)]
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>
14 years agoxl: Move "extern" declarations to xl.h
Keir Fraser [Fri, 28 May 2010 08:25:34 +0000 (09:25 +0100)]
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>
14 years agoxl: Combine headers into one header file.
Keir Fraser [Fri, 28 May 2010 08:25:07 +0000 (09:25 +0100)]
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>
14 years agoiommu: Map correct permissions in IOMMU on grant read-only map request.
Keir Fraser [Fri, 28 May 2010 08:08:00 +0000 (09:08 +0100)]
iommu: Map correct permissions in IOMMU on grant read-only map request.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agoiommu: Specify access permissions to iommu_map_page().
Keir Fraser [Fri, 28 May 2010 07:48:50 +0000 (08:48 +0100)]
iommu: Specify access permissions to iommu_map_page().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agoHAP: Add hardware capability check for 2MB super page.
Keir Fraser [Fri, 28 May 2010 07:14:54 +0000 (08:14 +0100)]
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>
14 years agoxl: print BDF parse errors
Keir Fraser [Fri, 28 May 2010 07:12:15 +0000 (08:12 +0100)]
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>
14 years agoxl: fix pci-detach usage message
Keir Fraser [Fri, 28 May 2010 07:11:47 +0000 (08:11 +0100)]
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>
14 years agoxl: fix PCI resource parsing
Keir Fraser [Fri, 28 May 2010 07:10:48 +0000 (08:10 +0100)]
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>
14 years agoUpdate QEMU_TAG to 805ed3b20492d2f4bb465bfda65cedd286e23209
Keir Fraser [Fri, 28 May 2010 07:09:38 +0000 (08:09 +0100)]
Update QEMU_TAG to 805ed3b20492d2f4bb465bfda65cedd286e23209

14 years agox86: Warn on CPU hot-add to tsc-reliable system
Keir Fraser [Fri, 28 May 2010 07:03:02 +0000 (08:03 +0100)]
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>
14 years agox86: Synchronize slave TSC to master if necessary, during cpu bringup
Keir Fraser [Thu, 27 May 2010 08:39:47 +0000 (09:39 +0100)]
x86: Synchronize slave TSC to master if necessary, during cpu bringup

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agox86: Speed up PV-guest superpage mapping
Keir Fraser [Thu, 27 May 2010 08:04:46 +0000 (09:04 +0100)]
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>
14 years agovmx: Fix c/s 21433:095e4b964f99: Must save host MSRs on cpu init
Keir Fraser [Thu, 27 May 2010 07:34:44 +0000 (08:34 +0100)]
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>
14 years agolibxl: Do not provide arbitrary string as format specifier to printf.
Keir Fraser [Thu, 27 May 2010 07:26:52 +0000 (08:26 +0100)]
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>
14 years agoxenconsoled: Discard guest console data in bigger chunks
Keir Fraser [Thu, 27 May 2010 07:21:24 +0000 (08:21 +0100)]
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>
14 years agoxenstore: Make sure that libxs reports an error if xenstored drops
Keir Fraser [Thu, 27 May 2010 07:20:26 +0000 (08:20 +0100)]
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>
14 years agoxenctx: Add --kernel-start option, to set the user/kernel split
Keir Fraser [Thu, 27 May 2010 07:19:47 +0000 (08:19 +0100)]
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>
14 years agopyGrub: Use proper bootloader class when entering command manually
Keir Fraser [Wed, 26 May 2010 09:52:15 +0000 (10:52 +0100)]
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>
14 years agotools: Fix time offset when localtime=0
Keir Fraser [Wed, 26 May 2010 07:15:31 +0000 (08:15 +0100)]
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>
14 years agoAllow space in vbd path name
Keir Fraser [Wed, 26 May 2010 07:14:51 +0000 (08:14 +0100)]
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>
14 years agoxl: Some small fixes
Keir Fraser [Wed, 26 May 2010 07:13:47 +0000 (08:13 +0100)]
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>
14 years agoxl: allow nameless domains to be named
Keir Fraser [Wed, 26 May 2010 07:12:15 +0000 (08:12 +0100)]
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>
14 years agocompat-guest accessor macros do not need address check for hvm guests.
Keir Fraser [Wed, 26 May 2010 07:09:38 +0000 (08:09 +0100)]
compat-guest accessor macros do not need address check for hvm guests.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agox86 EPT: Only flush EPT TLB if the previous entry was valid
Keir Fraser [Wed, 26 May 2010 07:08:46 +0000 (08:08 +0100)]
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>
14 years agohvm: Extend the CPUID whitelist to include Intel's AES-NI intructions
Keir Fraser [Wed, 26 May 2010 07:02:33 +0000 (08:02 +0100)]
hvm: Extend the CPUID whitelist to include Intel's AES-NI intructions

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agox86 shadow: Avoid remove-all-shadows after shadow teardown
Keir Fraser [Wed, 26 May 2010 07:01:21 +0000 (08:01 +0100)]
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>
14 years agohvm: Handle extreme wallclock offsets safely.
Keir Fraser [Wed, 26 May 2010 06:59:52 +0000 (07:59 +0100)]
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>
14 years agocpupool: Clean up unused prorotype and duplicate trace call.
Keir Fraser [Wed, 26 May 2010 06:48:09 +0000 (07:48 +0100)]
cpupool: Clean up unused prorotype and duplicate trace call.

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
14 years agoxl: Add subcommand 'xl dmesg'
Keir Fraser [Wed, 26 May 2010 06:45:51 +0000 (07:45 +0100)]
xl: Add subcommand 'xl dmesg'

Can be used to read and/or clear dmesg buffer.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
14 years agox86 hvm: implement vector callback for evtchn delivery
Keir Fraser [Tue, 25 May 2010 10:28:58 +0000 (11:28 +0100)]
x86 hvm: implement vector callback for evtchn delivery

Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agolibxl: small build fix to pass uint8_t to tolower().
Keir Fraser [Tue, 25 May 2010 10:00:55 +0000 (11:00 +0100)]
libxl: small build fix to pass uint8_t to tolower().

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
14 years agoxend: Add interface name definition support for xend-relocation-address
Keir Fraser [Tue, 25 May 2010 08:08:34 +0000 (09:08 +0100)]
xend: Add interface name definition support for xend-relocation-address

Add a new feature for xend-relocation-address option to support
definition by interface name which can be useful for people having
e.g. a cluster environment with multiple network interfaces on all of
the machines with only one reserved to be registered to a private
cluster network. This way they won't need to specify the relocation
address manually on all the machines but just simple providing the
interface name to get the IP address from would do the job (all the
machines have to have this interface named the same to make it
working, of course).

Technically it reads the interface name and gets its IP address using
ioctl call of SIOCGIFADDR and if the interface doesn't have the
address, i.e. if non-existing interface or hostname was provided the
original ifname is returned to preserve the old behaviour.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
14 years agoiommu: Gracefully fail to initialise iommu on generic x86 platforms.
Keir Fraser [Sat, 22 May 2010 05:36:41 +0000 (06:36 +0100)]
iommu: Gracefully fail to initialise iommu on generic x86 platforms.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agox86: TSC handling cleanups (version 2)
Keir Fraser [Sat, 22 May 2010 05:31:47 +0000 (06:31 +0100)]
x86: TSC handling cleanups (version 2)

"I am removing the tsc_scaled variable that is never actually used
because when tsc needs to be scaled vtsc is 1.  I am also making this
more explicit in tsc_set_info.  I am also removing hvm_domain.gtsc_khz
that is a duplicate of d->arch.tsc_khz.  I am using scale_delta(delta,
&d->arch.ns_to_vtsc) to scale the tsc value before returning it to the
guest like in the pv case.  I added a feature flag to specify that the
pvclock algorithm is safe to be used in an HVM guest so that the guest
can now use it without hanging."

Version 2 fixes a bug which breaks PV domU time.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agoRevert 21339:804304d4e05d "x86: TSC handling cleanups"
Keir Fraser [Fri, 21 May 2010 15:21:39 +0000 (16:21 +0100)]
Revert 21339:804304d4e05d "x86: TSC handling cleanups"

It very much breaks PV domU boot.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agoxl: fix block-attach command parsing
Keir Fraser [Fri, 21 May 2010 14:25:10 +0000 (15:25 +0100)]
xl: fix block-attach command parsing

Fix two command-line parsing problems:
 - the argc check is wrong: it must be provided with the frontend
 device
 - the ro/rw mode is optional, so default to rw if it is absent

Also, update the usage message accordingly.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
14 years agox86: Remove obsolete inquire_remote_apic()
Keir Fraser [Thu, 20 May 2010 16:22:15 +0000 (17:22 +0100)]
x86: Remove obsolete inquire_remote_apic()

Integrated APICs do not have this facility. Which means no
multi-processor machine in more than a decade.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agop2m: move phystable into p2m
Keir Fraser [Thu, 20 May 2010 14:30:49 +0000 (15:30 +0100)]
p2m: move phystable into p2m

Moves phys_table from struct domain to struct p2m_domain.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agoocaml: fix ocaml xc compilation on 32 bit
Keir Fraser [Thu, 20 May 2010 13:12:14 +0000 (14:12 +0100)]
ocaml: fix ocaml xc compilation on 32 bit

  cc1: warnings being treated as errors
  xc_lib.c: In function 'xc_domain_get_pfn_list':
  xc_lib.c:1217: error: assignment from incompatible pointer type

The XEN_DOMCTL_getmemlist interface has been 32/64 invariante since
13594:30af6cfdb05c and uint64_t is now the correct type for the PFN
list on all word sizes.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
14 years agoxentop: fix NULL pointer dereference
Keir Fraser [Thu, 20 May 2010 13:10:07 +0000 (14:10 +0100)]
xentop: fix NULL pointer dereference

On my system, I'm getting SIGSEGVs in xentop because
xenstat_node_domain() is returning NULL.  Skip the loop if it does
rather than crashing.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agovmx: Convert more initialisation BUG()s into clean failures.
Keir Fraser [Wed, 19 May 2010 21:59:52 +0000 (22:59 +0100)]
vmx: Convert more initialisation BUG()s into clean failures.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agox86: When failing smp_callin() properly clean up before halting.
Keir Fraser [Wed, 19 May 2010 21:49:28 +0000 (22:49 +0100)]
x86: When failing smp_callin() properly clean up before halting.

In particular we must clear_local_APIC() else LAPIC NMI watchdog will
continue to fire and use a stack which no longer exists.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agox86: During boot, initialise cpu-numa info for all present CPUs.
Keir Fraser [Wed, 19 May 2010 20:14:57 +0000 (21:14 +0100)]
x86: During boot, initialise cpu-numa info for all present CPUs.

Previously we would skip ones we didn't bring online.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agovmx: Do not modify global vmx_vm{entry,exit}_control fields in init_vmcs_config()
Keir Fraser [Wed, 19 May 2010 19:46:05 +0000 (20:46 +0100)]
vmx: Do not modify global vmx_vm{entry,exit}_control fields in init_vmcs_config()

The function shoudl only have single-domain effect.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agox86: Remove debug code from previous changeset.
Keir Fraser [Wed, 19 May 2010 17:41:15 +0000 (18:41 +0100)]
x86: Remove debug code from previous changeset.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agox86: Fail CPU bringup cleanly if it cannot initialise HVM.
Keir Fraser [Wed, 19 May 2010 17:40:15 +0000 (18:40 +0100)]
x86: Fail CPU bringup cleanly if it cannot initialise HVM.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agokexec: Fix dodgy use of cpu_present_map protecting percpu data access.
Keir Fraser [Wed, 19 May 2010 17:38:19 +0000 (18:38 +0100)]
kexec: Fix dodgy use of cpu_present_map protecting percpu data access.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agocpupools: Quieten debug messages.
Keir Fraser [Wed, 19 May 2010 16:07:07 +0000 (17:07 +0100)]
cpupools: Quieten debug messages.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agox86: Streamline the CPU early boot process.
Keir Fraser [Wed, 19 May 2010 14:42:03 +0000 (15:42 +0100)]
x86: Streamline the CPU early boot process.

Mainly this involves getting rid of a bunch of cpumasks and replacing
with a single 'cpu_state' enumeration to track progress and allow
master-slave handshaking.

Cleaning this stuff up is a prerequisite for safely handling slave
failure (e.g., out of memory, invalid slave CPU capabilities,
...). This will get fixed up in a future patch.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agoxen-hptool: A few usage cleanups.
Keir Fraser [Wed, 19 May 2010 13:18:56 +0000 (14:18 +0100)]
xen-hptool: A few usage cleanups.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agorcu: Migrate RCU work when taking a CPU offline.
Keir Fraser [Wed, 19 May 2010 13:06:37 +0000 (14:06 +0100)]
rcu: Migrate RCU work when taking a CPU offline.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agoxl: Check for dom0 when instructed to destroy a domain.
Keir Fraser [Wed, 19 May 2010 11:53:44 +0000 (12:53 +0100)]
xl: Check for dom0 when instructed to destroy a domain.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
14 years agoxl: Add subcommand "xl debug-keys"
Keir Fraser [Wed, 19 May 2010 11:51:16 +0000 (12:51 +0100)]
xl: Add subcommand "xl debug-keys"

Can be used to send debug keys to Xen.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
14 years agolibxl: Add tmem support commands
Keir Fraser [Wed, 19 May 2010 11:48:32 +0000 (12:48 +0100)]
libxl: Add tmem support commands

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
14 years agotimers: Migrate timers away from an offlined CPU.
Keir Fraser [Wed, 19 May 2010 10:54:31 +0000 (11:54 +0100)]
timers: Migrate timers away from an offlined CPU.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agox86 nmi: Enable/disable dynamically on each CPU during hotplug.
Keir Fraser [Wed, 19 May 2010 10:39:08 +0000 (11:39 +0100)]
x86 nmi: Enable/disable dynamically on each CPU during hotplug.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agoFix CPU hotplug after percpu data handling changes.
Keir Fraser [Wed, 19 May 2010 10:15:26 +0000 (11:15 +0100)]
Fix CPU hotplug after percpu data handling changes.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agoVT-d: Fix ATS enabling for device assignment
Keir Fraser [Wed, 19 May 2010 07:22:06 +0000 (08:22 +0100)]
VT-d: Fix ATS enabling for device assignment

Currently, Xen only enables ATS in Xen booting. When an ATS capable
device is assigned to guest, ATS is actually not enabled because FLR
before assignment causes it to be disabled. Thus ATS cannot be used in
guest. This patch enables ATS in domain_context_mapping. This ensures
ATS is enabled in assignment because FLR is earlier than
domain_context_mapping call. Therefore ATS can be used in guest. This
patch also implements disable_ats_device to disable ATS when the
device is deassigned from a domain.

Signed-off-by: Weidong Han <weidong.han@intel.com>
14 years agolibxl: Compilation and other small fixes
Keir Fraser [Wed, 19 May 2010 07:20:46 +0000 (08:20 +0100)]
libxl: Compilation and other small fixes

* Some of the library functions such as fscanf, system, and asprintf
are declared with warn_unused_result (ubuntu server 9.10), causing
compilation errors in libxl.
* When using asprintf, the caller is responsible for freeing the
memory.
* memset takes wrong size argument in one of the places (caught by
a builtin gcc check).

Signed-off-by: Dulloor Rao <dulloor@gmail.com>
14 years agoxl: recognize the "extra" entry in the domain config file
Keir Fraser [Wed, 19 May 2010 07:18:51 +0000 (08:18 +0100)]
xl: recognize the "extra" entry in the domain config file

"extra" defines extra parameters to be added to the kernel command
line, so append it accordingly.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
14 years agolibxl: Set default shadow memory based on final values for vcpus and memory
Keir Fraser [Wed, 19 May 2010 07:15:05 +0000 (08:15 +0100)]
libxl: Set default shadow memory based on final values for vcpus and memory

Set default shadow memory based on final versions of memory and vcpus,
not on minimum default versions.

Failure mode was failed p2m allocaitons, e.g., with hvm-linux PV
drivers mapping the shared-info page.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
14 years agox86: Remove cpu_possible_map
Keir Fraser [Tue, 18 May 2010 14:18:26 +0000 (15:18 +0100)]
x86: Remove cpu_possible_map

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agox86: Dynamically allocate percpu data area when a CPU comes online.
Keir Fraser [Tue, 18 May 2010 14:13:45 +0000 (15:13 +0100)]
x86: Dynamically allocate percpu data area when a CPU comes online.

At the same time, the data area starts life zeroed.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agox86: Pull dynamic memory allocation out of do_boot_cpu().
Keir Fraser [Tue, 18 May 2010 14:05:54 +0000 (15:05 +0100)]
x86: Pull dynamic memory allocation out of do_boot_cpu().

This has two advantages:
 (a) We can move the allocations to a context where we can handle
     failure.
 (b) We can implement matching deallocations on CPU offline.

Only the idle vcpu structure is now not freed on CPU offline. This
probably does not really matter.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agocpu hotplug: tasklet and timer initialisation is high priority.
Keir Fraser [Tue, 18 May 2010 12:41:55 +0000 (13:41 +0100)]
cpu hotplug: tasklet and timer initialisation is high priority.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agomem_sharing: use paging_mode_hap
Keir Fraser [Tue, 18 May 2010 12:31:24 +0000 (13:31 +0100)]
mem_sharing: use paging_mode_hap

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agox86-hpet: fix booting NULL pointer panic introduced by c/s 21398.
Keir Fraser [Tue, 18 May 2010 12:30:45 +0000 (13:30 +0100)]
x86-hpet: fix booting NULL pointer panic introduced by c/s 21398.

(XEN) Xen call trace:
(XEN)    [<ffff82c48011fb27>] check_lock+0x19/0x49
(XEN)    [<ffff82c48011ff2a>] _spin_lock_irq+0x28/0x4a
(XEN)    [<ffff82c48018fd6d>] hpet_broadcast_exit+0x92/0x1f0
(XEN)    [<ffff82c4801920b2>] acpi_processor_idle+0x62c/0x6e6
(XEN)    [<ffff82c48014e1a1>] idle_loop+0x62/0x73

Signed-off-by: Wei Gang <gang.wei@intel.com>
14 years agoClean up notifier-chain interface and use new interface in CPU hotplug.
Keir Fraser [Tue, 18 May 2010 12:23:02 +0000 (13:23 +0100)]
Clean up notifier-chain interface and use new interface in CPU hotplug.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agoxl: allow scaling suffix on memory sizes in mem-set and mem-max
Keir Fraser [Tue, 18 May 2010 10:38:12 +0000 (11:38 +0100)]
xl: allow scaling suffix on memory sizes in mem-set and mem-max

Allow mem-set and mem-max to take 'b', 'k', 'm', 'g' and 't' as
scaling suffixes for bytes, kilobytes, mega, etc.  An unadorned number
is still treated as kilobytes so no existing users should be affected.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
14 years agox86: Allow PV superpages to work with live migration
Keir Fraser [Tue, 18 May 2010 10:24:04 +0000 (11:24 +0100)]
x86: Allow PV superpages to work with live migration

PV superpages currently do not work with live migration.  They fall
over dead when the shadow page table is enabled for dirty tracking.
The HVM support for superpages in this code has been tested and found
to work just fine for PV superpages.  This patch modifies the test
macro to allow the code to work with PV superpages.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>