Commit Graph
22348 Commits
Author SHA1 Message Date
Keir Fraser d0cf814150 x86: xsave save/restore support for both PV and HVM guests.
Signed-off-by: Shan Haitao <haitao.shan@intel.com>
Signed-off-by: Han Weidong <weidong.han@intel.com>
2010-11-03 08:17:39 +00:00
Keir Fraser 5a4cecd828 x86 hvm: exposes AVX to guest.
Signed-off-by: Shan Haitao <haitao.shan@intel.com>
Signed-off-by: Han Weidong <weidong.han@intel.com>
2010-11-03 08:16:47 +00:00
Keir Fraser 2d741abb30 x86: Xsave support for PV guests.
Signed-off-by: Shan Haitao <haitao.shan@intel.com>
Signed-off-by: Han Weidong <weidong.han@intel.com>
2010-11-03 08:15:20 +00:00
Keir Fraser 3b0246ea03 Fix ia64 tools build
22066:eccfdeb41b80 replaced tools/libxc/ia64/aclinux.h with
xen/include/acpi/platform/aclinux.h.
Because both are incompatible, tools cannot be built on ia64.

This patch fixes compilation errors by defining identifiers at
ac_ia64_tools.h.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
2010-11-02 07:35:52 +00:00
Gianni Tedesco 7c5f9bb2b5 libxl: fix build since 22325:4ac03710fc32
"libxl: Fix migration of HVM guests" introduces a stat call without
including <sys/stat.h>

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-11-01 18:13:31 +00:00
Keir Fraser 2f58ffa825 x86 hvm: Fixes for 22339:6fae4331d5aa
Primarily fix up register names in public header file for
compatibility with old unmodified versions of virtual firmware and
qemu-dm. Also fixes a bug in the read case of handle_evt_io().

Signed-off-by: Keir Fraser <keir@xen.org>
2010-11-01 14:11:28 +00:00
Keir Fraser dedca852d0 x86_emulate: Fix build with some versions of gcc targeting i386.
Signed-off-by: Keir Fraser <keir@xen.org>
2010-10-31 19:01:33 +00:00
Keir Fraser 61c7ab294f i386: simplify pte_read_atomic()
There's no need for a loop here: if the value to be compared against
and the value to be stored are equal, cmpxchg{,8b} act just like a
load anyway.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-10-29 18:43:01 +01:00
Keir Fraser f0ad21c499 x86 hvm: Introduce pmtimer_change_ioport and HVM_PARAM_ACPI_IOPORTS_LOCATION
By default, Xen will handle the old ACPI IO port. But it can switch to
the new one by setting the HVM_PARAM_ACPI_IOPORTS_LOCATION to 1.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Keir Fraser <keir@xen.org>
2010-10-29 18:42:34 +01:00
Keir Fraser 2911af8256 x86 hvm: Introduce unregister_io_handler
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Keir Fraser <keir@xen.org>
2010-10-29 18:14:01 +01:00
Keir Fraser ddeda0449f VT-d: only scan secondary functions on multi-function devices
Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-10-29 18:06:17 +01:00
Keir Fraser 5100a5ede1 Xen: fix various checks of unsigned integers < 0
Some of these could be benignly discarded by the compiler but some are
actual bugs.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2010-10-29 18:05:50 +01:00
Keir Fraser 9bbfbb1477 ACPI: fix typo
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2010-10-29 18:05:27 +01:00
Keir Fraser 8d2793f2c2 x86: Clean up existing XSAVE support
Signed-off-by: Han Weidong <weidong.han@intel.com>
Signed-off-by: Shan Haitao <haitao.shan@intel.com>
2010-10-29 18:04:46 +01:00
Keir Fraser fd1291a826 X86: Prefer TSC-deadline timer in Xen
The new TSC Deadline Timer offers system software a low overhead
per-logical-thread deadline timer in TSC units.

The timer is implemented via a new architectural 64-bit register,
IA32_TSC_DEADLINE_MSR. Reads and writes of this MSR occur in program
order, but are non-serializing.

The support for this feature is indicated by
CPUID.01H:ECX.TSC_Deadline[bit 24] =3D 1 as documented in the Intel
Architecture Software Developer's Manual.

The LOCAL APIC on new processors has a mode where its underlying
hardware timer can now be accessed via the non-serializing
IA32_TSC_DEADLINE_MSR in TSC tick units.

If this mode is present, prefer it over the traditional LAPIC timer
mode.  KERN_DEBUG dmesg will print "TSC deadline timer enabled" when
TDT is used.

Bootparam "tdt=off" is available to revert to LAPIC timer mode.

This patch is based on original work by Len Brown for Linux kernel.

cc: Len Brown <len.brown@intel.com>
Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Keir Fraser <keir@xen.org>
2010-10-29 10:40:14 +01:00
Keir Fraser 9dbd100737 vtd: consolidate VT-d quirks into a single file quirks.c
Consolidate VT-d quirks into a single file - quirks.c.  This includes
quirks to workaround OEM BIOS issue with VT-d enabling in IGD, Cantiga
VT-d buffer flush issue, Cantiga IGD Vt-d low power related errata,
and a quirk to workaround issues related to wifi direct assignment.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
Reviewed-by: Jan Beulich <JBeulich@novell.com>
2010-10-29 10:29:14 +01:00
Keir Fraser bb6a9806b8 credit2: Trace and debug key tweaks
* Add traces for credit reset and scheduling a tasklet
* Remove tsc for traces which probably don't need them
* Print domain info in the debug dump

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2010-10-29 10:20:33 +01:00
Keir Fraser 1b561702db credit2: Fix runq_tickle to use idle, tickled masks
The previous code had a bug where, if a second vcpu woke up and ran
runq_tickle before the first vcpu had actually started running on a
tickled processor, the code would choose the same cpu to tickle, and
the result would be a "missed tickle" -- only one of the vcpus would
run, despite having idle processors.

This change:
* Keeps a mask of idle cpus
* Keeps a mask of cpus which have been tickled, but not entered
schedule yet.

The new tickle code first looks at the set of idle-but-not-tickled
cpus; if it's not empty, it tickles one.

If that doesn't work, it looks at the set of not-idle-but-not-tickled
cpus, finds the one with the lowest credit; if that's lower than the
waking vcpu, it tickles that one.

If any cpu is tickled, its bit in the tickled mask is set, and cleared
when schedule() is called.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2010-10-29 10:20:08 +01:00
Keir Fraser 432b2c403e credit2: Make fake runq map initilization explicit
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2010-10-29 10:19:30 +01:00
Keir Fraser 708261e496 hvmloader: Configure gPXE to use serial console
Sometimes we would rather connect to an HVM's serial console than it's
VGA display. In this case we cannot see or interact with the ethernet
booting process. This is a bit annoying so let's just enable it.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
2010-10-29 10:17:07 +01:00
Ian Jackson 16febcc2cb QEMU_TAG update 2010-10-28 12:28:49 +01:00
Juergen Gross e57101211f avoid numa placement of cpus with active cpupools
When using cpupools don't pin vcpus to numa nodes as this might
conflict with the cpupool definition.
numa placement should be handled by cpupool configuration instead.

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-10-28 12:22:09 +01:00
Ian Campbell 2526ff6cc9 libxl: Fix migration of HVM guests
In the default "QemuDeviceModelRecord"-style HVM tail of the migration
protocol the size of the qemu save record is unknown at the receiver
and therefore it must read until EOF. This is not compatible with the
xl migration protocol which contains a post-migration handshake and
therefore cannot close the socket on the sending end.

What is required is an explicit length field for the save record,
which the "RemusDeviceModelState"-style HVM tail includes.

Rather than overload the "RemusDeviceModelState" name for a non-Remus
use case (on off chance that they need to diverge for some reason in
the future) introduce a third style called "DeviceModelRecord0002"
which is identical to current "RemusDeviceModelState"-style.

Hopefully the inclusion of a number here will allow easier extension
in the future without needing to come up with increasingly less
helpful names!

Also propagate errors from xc_domain_save and
libxl__domain_suspend_common to callers.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-10-28 12:19:43 +01:00
Ian Campbell 7134cbcc19 xl: support -w (wait) option in xl shutdown
improves compatibility with xm.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-10-28 12:16:48 +01:00
Patrick Colp 59600ef8ac tools: caml-stubdom: fix "red zone" bug
According to the AMD64 ABI, the 128-byte area below %rsp is reserved
for scratch space and should not be used by signal, interrupt, or
exception handlers. However, Mini-OS does not adhere to this
interface. As a result, the -mno-red-zone flag must be provided to gcc
in order to force code to be compiled without this assumption. In the
case of the c-stubdom or the ioemu stubdom, Makefile configuration and
flags are inherited from Xen, which includes this flag. However, in
the case of the ocaml stubdom, since an independent ocaml version is
pulled and compiled, with its own make system in place, this flag is
not present.

As a default optimisation (no optimisation flags specified), gcc
generates function header code that uses mov instead of push (to save
a few instructions). However, with the 128-byte scratch space
assumption in place, registers are moved onto the stack *before* %rsp
is updated. This results in cases where when a function is being
called, *after* the first mov <foo>, <offset>(%rsp) but *before* the
%rsp update, sub <bar>, %rsp, if an interrupt is fired, then the stack
will be clobbered (as Mini-OS uses the application stack for its
stack, pushing registers onto the stack on entry and popping them off
on exit).

This patch fixes this issue by passing the -mno-red-zone flag to the
ocaml configure script in the stubdom Makefile.

Signed-off-by: Patrick Colp <pjcolp@cs.ubc.ca>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-10-28 12:15:41 +01:00
Ian Jackson a07b5b8acd libxl: Fix format string abuses / vulnerabilities
There are a few places where libxl__xs_write is passed a variable
value to write to xenstore, but the semantics are that the first char*
is a format string.  So use "%s".

This fixes the following errors reported by some newer compilers:
 libxl.c: In function "libxl_create_cpupool":
 libxl.c:3981: error: format not a string literal and no format arguments
 libxl.c:3983: error: format not a string literal and no format arguments
 libxl.c: In function "libxl_cpupool_movedomain":
 libxl.c:4095: error: format not a string literal and no format arguments

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Gianni Tedesco <gianni.tedesco@citrix.com>
2010-10-28 12:05:45 +01:00
Gianni Tedesco 1e346e3f47 libxl: fix dom0 minimum memory threshold check
libxl_set_memory_target tries to set the memory target for a given
domain to new_target_memkb. The function includes a check to make sure
that dom0's memory is not reduced below a minimal threshold ie.
LIBXL_MIN_DOM0_MEM. However, this check is performed before the
new_target_memkb variable is properly initialised - when the value is
always zero. This means that the check always fails. Fix this by moving
the test to happen after the proper initialisation of new_target_memkb.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-10-28 12:02:22 +01:00
Gianni Tedesco 576b10f44c gdbsx: Makefiles: correctly generate dependencies
gdbsx hacks CFLAGS to remove optimisations for easier debugging, however
this breaks dep generation due to an early evaluation of CFLAGS and
leaves stale files called "..d" after a make clean. We could possibly
fix this by separating dep generation from the rest of CFLAGS but it
seems a little invasive. The gdbsx hackers can do their own thing during
development and testing anyway...

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
2010-10-28 11:47:26 +01:00
Gianni Tedesco 9de2eedc20 ocaml: Makefile: delete dependency files during make clean
Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-10-28 11:46:20 +01:00
Gianni Tedesco 7d241c5962 tools: Makefile: delete qemu during make distclean
The top-level makefile claims this to be the expected behaviour so make
it so.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-10-28 11:45:54 +01:00
Gianni Tedesco d7249faf39 libxl: Makefile: delete temporary files during make clean
Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-10-28 11:45:09 +01:00
Gianni Tedesco 66272c31d5 blktap2: Makefiles: delete symlinks and deps during make clean
Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-10-28 11:44:17 +01:00
Miroslav Rezanina 0f114a5181 Do not wait for memory teardown when live migrate
When trying to live migrate guest with great memory (e.g. 20 GB),
there's delay caused by destroying source copy of domain.  To speed up
this process we can close socket before starting guest destroy, as
source guest is not running anymore.

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-10-28 11:40:32 +01:00
Ian Campbell 31e4f2432e libxc: fix xc_version by handling all known command types.
xend was crashing since 22289:ca4a781c8ae8 due to missing handling of
XENVER_commandline.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2010-10-27 12:24:28 +01:00
Ian Jackson 47c1755f36 Merge 2010-10-26 12:22:52 +01:00
Tim Deegan 5717f51369 "kdd" Windows debugger stub.
kdd runs in dom0, attaches to a domain and speaks the Windows kd serial
protocol over a TCP connection (which should go to kd or windbg, e.g.
by having another VM with its virtual COM1 set up as a TCP listener).

It doesn't do breakpoints &c yet, and windbg can get quite confused
since the kernel debugger's not actually running, but it's good enough
to extract backtraces from wedged VMs.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2010-10-26 11:56:31 +01:00
Ian Campbell 7f18fb47e5 libxc: correct handling of switch_qemu_logdirty callback return value
The callback return convention follows xc_domain_save and therefore
returns 0 on success and >0 on error, correct the check accordingly.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-10-25 18:15:28 +01:00
Keir Fraser d47f1a444a hvmloader: reduce iasl verbosity
I don't think anyone really needs iasl's banner displayed during the
build process.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-10-24 13:18:26 +01:00
Keir Fraser cd8c5cb75a ia64: fix build in grant table and tmem code
Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-10-24 13:17:42 +01:00
Keir Fraser f9ee068de4 x86: enable support for {rd,wr}{fs,gs}base instructions
... so that once in a while Xen knows of a new CPU feature before
Linux starts making use of it.

While (obviously) I wasn't able to test this, it seemed strait forward
enough to enable anyway.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-10-24 13:17:07 +01:00
Keir Fraser c0d9c5e627 x86: delete not really used ioapic_renumber_irq variable
Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-10-24 13:15:48 +01:00
Keir Fraser a372e7a86e x86/kexec: fix very old regression and make compatible with modern Linux
c/s 13829 lost the (32-bit only) cpu_has_pae argument passed to the
primary kernel's stub (in the 32-bit Xen case only), and Linux
2.6.27/.30 (32-/64-bit) introduced a new argument (for KEXEC_JUMP)
which for now simply gets passed a hardcoded value.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-10-24 13:15:06 +01:00
Keir Fraser d6b5b10530 Allow max_pages to be set to less than tot_pages
The memory allocation code sometimes needs to enforce that a guest
that's been told to balloon down isn't going to expand further
(because it's still executing a previous balloon-up operation).  That
means being able to set the desired max_pages even before the balloon
driver has brought tot_pages down to the right level.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-10-24 13:13:04 +01:00
Keir Fraser 7e6b926a17 cpupools: Make interface more consistent
The current cpupools code interface is a bit inconsistent.  This
patch addresses this by making the interaction for each
vcpu in a pool look like this:

alloc_vdata() -- allocates and sets up vcpu data
insert_vcpu() -- the vcpu is ready to run in this pool
remove_vcpu() -- take the vcpu out of the pool
free_vdata()  -- delete allocated vcpu data

(Previously, remove_vcpu and free_vdata were combined into a "destroy
vcpu", and insert_vcpu was only called for idle vcpus.)

This also addresses a bug in credit2 which was caused by a
misunderstanding of the cpupools interface.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
2010-10-24 13:09:50 +01:00
Ian Campbell 4fd0fc305b libxc: finalise transition to hypercall buffers.
Rename xc_set_xen_guest_handle to set_xen_guest_handle[0] and remove now
unused functions:
  - xc_memalign
  - lock_pages
  - unlock_pages
  - hcall_buf_prep
  - hcall_buf_release

[0] sed -i -e 's/xc_set_xen_guest_handle/set_xen_guest_handle/g' \
	tools/libxc/*.[ch] \
	tools/python/xen/lowlevel/xc/xc.c \
	tools/python/xen/lowlevel/acm/acm.c \
	tools/libxc/ia64/xc_ia64_stubs.c \
	tools/security/secpol_tool.c \
	tools/misc/xenpm.c

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
2010-10-22 15:14:51 +01:00
Ian Campbell f36c8d0c95 libxc: do not align/lock buffers which do not need it
On restore:

region_mfn is passed to xc_map_foreign_range and
xc_map_foreign_bulk. In both cases the buffer is accessed from the
ioctl handler in the kernel and not from any hypercall. Therefore
normal copy_{to,from}_user handling in the kernel will cope with any
faulting access.

p2m_batch is passed to xc_domain_memory_populate_physmap which takes
care of bouncing the buffer already.

On save:

pfn_type is passed to xc_map_foreign_bulk which does not need locking
as per region_mfn above.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
2010-10-22 15:14:51 +01:00
Ian Campbell 254b93fd04 secpol: use hypercall buffers
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
2010-10-22 15:14:51 +01:00
Ian Campbell f327a8b091 xenpm: use hypercall buffers.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
2010-10-22 15:14:51 +01:00
Ian Campbell 33ebf9e235 python xc: use hypercall buffer interface.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
2010-10-22 15:14:51 +01:00
Ian Campbell c3be68bfca python acm: use hypercall buffer interface.
I have a suspicion these routines should be using libxc rather than
reimplementing all the hypercalls again, but I don't have the
enthusiasm to fix it.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
2010-10-22 15:14:51 +01:00