Commit Graph
23575 Commits
Author SHA1 Message Date
Olaf Hering 305ed55b97 xenpaging: drop xc.c, remove xc_platform_info_t
xc_platform_info_t is not used in xenpaging.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
2011-06-10 10:47:07 +02:00
Olaf Hering c08db66946 xenpaging: drop xc.c, remove ASSERT
The ASSERT is not needed, victim is never NULL.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
2011-06-10 10:47:06 +02:00
Olaf Hering faa19e60da xenpaging: add xs_handle to struct xenpaging
A xs_handle is currently used in the xc_mem_paging_flush_ioemu_cache()
function and will be used by a subsequent patch.
Add it to struct xenpaging.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2011-06-22 14:47:09 +01:00
Olaf Hering aa1355f971 tools: merge several bitop functions into xc_bitops.h
Bitmaps are used in save/restore, xenpaging and blktap2.  Merge the code into a
private xc_bitops.h file. All users are single threaded, so locking is not an
issue. The array of bits is handled as volatile because the x86 save/restore
code passes the bitmap to the hypervisor which in turn modifies the bitmap.

blktap2 uses a private bitmap. There was a possible overflow in the
bitmap_size() function, the remainder was not considered.

ia64 save/restore uses a bitmap to send the number of vcpus to the host.

x86 save/restore uses a bitmap to track dirty pages. This bitmap is shared with
the hypervisor. An unused function count_bits() was removed and a new
bitmap_size() function is now used.

xenpaging uses 3 private bitmaps to track the gfns which are in paged-out
state.  It had a copy of some Linux bitops.h, which is now obsolete. Also the
BITS_PER_LONG macro was hardcoded to 64 which made it impossible to run 32bit
tools on a 64bit host. Wether this works at all has to be tested, yet.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
2011-06-10 10:47:03 +02:00
Ian Jackson 9c1ebbba30 libxl: remove and hgignore testenum.c
This is an output file from the test idl generator and should not have
been committed.

Reported-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-06-22 14:43:53 +01:00
Ian Jackson e93ad8b732 QEMU_TAG update 2011-06-21 18:28:53 +01:00
Ian Campbell a53cb5b82d libxl: autogenerate to_string and from_string functions for Enumerations.
The generated strings are the lower case enum value names, with underscores.
Accepted string for parsing are the same but are case insensitive.

We provide a table of strings->value for each Enumeration as well as a
convenience function to perform a lookup.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-06-21 18:26:39 +01:00
Carsten Schiers dbf20f55f0 xl: improve compatibility with xm
/etc/init.d/xendomains relies on simple pattern matching from sructures
being printed by "xl list -l" command. so update xl implementation to
match.

Signed-off-by: Carsten Schiers <carsten@schiers.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-06-21 18:24:34 +01:00
Mike McClurg bec8caf43b tools/ocaml: ask compiler for correct library
OCaml libraries will live in /usr/local/ if the user compiles OCaml
from source. This patch asks the OCaml compiler where we should look
for libraries.

NB: it may be that we should do the same thing for the NetBSD case,
but I don't have a BSD box to test this out.

Signed-off-by: Mike McClurg <mike.mcclurg@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-06-21 18:01:51 +01:00
Marek Marczykowski b6c23c86fe libxl: add all pci devices to xenstore at once (during VM create)
When adding pci devices one by one, pciback notice only the first one. For
every next, "state" is left as is (usualy "4" in that time), so backend will
not rescan xenstore. So when VM is starting all devices should be added at once
and then backend can initialize it.

This applies only to pci, because only pci backend have one xenstore dir for
multiple devices.

Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-06-21 17:50:47 +01:00
Zhigang Wang 1f2591ba35 make xendomains service save/migrate vms under /etc/xen/auto only
Currently, xendomains service will save or migrate all the running domains in
the host on stop.

Change XENDOMAINS_AUTO_ONLY=true. Then on service stop, it will only
save or migrate all VMs under XENDOMAINS_AUTO (/etc/xen/auto), but always
shutdown all the running VMs.

It's a way to cleanly shutdown all the running VMs on system reboot. If you
want to save/migrate a VM, create a link to /etc/xen/auto.

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-06-21 17:48:00 +01:00
Stefano Stabellini ef75d43042 libxl: always set list out parameter of libxl_device_pci_list_assigned
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-06-21 17:35:57 +01:00
Olaf Hering 7910d6f2a5 xenpaging: remove unused spinlock in pager
The spinlock code in the pager is a no-op because xenpaging is a single
threaded application. There is no locking when put_response() places a
response into the ringbuffer.
The only locking is inside the hypervisor, where mem_event_put_request() and
mem_event_get_response() lock the ringbuffer to protect multiple vcpus from
each other.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
2011-06-10 10:47:02 +02:00
Philipp Hahn f37f72f2cc tools/blktap2: tapdisk2 executable usage message documents -D option
Signed-off-by: Philipp Hahn <hahn@univention.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-06-21 16:51:43 +01:00
Olaf Hering d25db55e86 xenctx: add option -C to dump context for all vcpus
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
2011-06-17 14:22:56 +02:00
Olaf Hering 84a7507768 xenctx: move xc_* access out of dump_ctx
move xc_* access out of dump_ctx.
Update code paths to return an error instead of calling exit().
On error unpause the guest if it was paused by xenctx.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
2011-06-17 14:11:52 +02:00
Olaf Hering 79a7f14f57 xenctx: move all globals into struct xenctx
Move all globals used for options and libxc data into a new struct xenctx.
This is used in subsequent changes.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
2011-06-17 14:10:18 +02:00
Olaf Hering 8c779c0f47 xenctx: recognize also -S option for --stack-trace
Update help text.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
2011-06-17 14:09:32 +02:00
Daniel Stodden 707c078455 tools: xen-ringwatch: spot, and work around, broken frontend/backend ring I/O
Adds tool support to debug backends which expose I/O ring state in
sysfs. Currently supports /sys/devices/xen-backend/vbd-*-*/io_ring
nodes for block I/O, where implemented.

Primary function is to observe ring state make progress over a period
of time, then report stuck message queue halves where pending
consumer/event are not moving.

Adding --kick will re-issue event notifications to frontends, and/or
kick backends out of wait state.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-06-21 15:38:52 +01:00
Yongjie Ren cd703ed548 libxl: remove O_CLOEXEC in xl_cmdimpl.c
Some old linux kernels such as 2.6.18 don't define O_CLOEXEC, so
remove O_CLOEXEC in xl_cmdimpl.c and replace with fcntl.

Signed-off-by: Yongjie Ren <yongjie.ren@intel.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-06-21 15:31:34 +01:00
Tim Deegan 43d588d6ae x86/mm/shadow: adjust early-unshadow heuristic for PAE guests.
PAE guests have 8-byte PTEs but tend to clear memory with 4-byte writes.
This means that when zeroing a former pagetable every second 4-byte
write is unaligned and so the consecutive-zeroes --> unshadow
heuristic never kicks in.  Adjust the heuristic not to reset when
a write is >= 4 bytes and writing zero but not PTE-aligned.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-06-20 13:16:14 +01:00
Keir Fraser a51d11c6e8 xen-detect: Fix cpuid asm for 32-bit PIC compilation.
Signed-off-by: Keir Fraser <keir@xen.org>
2011-06-17 08:08:13 +01:00
Keir Fraser 2a46078cad tasklets: Switch a few tasklets to run in softirq context.
There are a couple of others which may also be safe. I've converted
only the most obvious one.

Signed-off-by: Keir Fraser <keir@xen.org>
2011-06-16 16:57:22 +01:00
Keir Fraser eed054473d tasklets: Allow tasklets to be created that run in softirq context.
Where this is safe, it can reduce latency and cpu overhead compared
with scheduling the idle vcpu to perform the same tasklet work.

Signed-off-by: Keir Fraser <keir@xen.org>
2011-06-16 16:56:31 +01:00
Stefano Stabellini f903829902 pv-on-hvm: hvm_domain_use_pirq return positive no matter if the evtchn is bound
This patch fixes PV on HVM interrupt remapping with recent Linux
kernels and upstream qemu.  hvm_domain_use_pirq should return positive
even if the evtchn is not currently bound. If it doesn't assert_irq
ends up injecting legacy interrupts even after the guest disabled the
irq.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2011-06-16 16:17:35 +01:00
Keir Fraser 16e0daef46 Protect xen/stdarg.h for multiple inclusion.
Signed-off-by: Keir Fraser <keir@xen.org>
2011-06-16 16:14:51 +01:00
Juergen Gross ce907519dd Use same data array for INTEL and AMD cpufreq handling
The AMD and INTEL specific parts of cpufreq handling used different
per-cpu data structures with nearly identical semantics.  Fold the two
structures into one by adding a generic architecture data item.

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
2011-06-16 16:12:20 +01:00
Andrew Cooper ef54fbe923 KEXEC: prevent panic on the kexec path when talking to the DMAR
hardware

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
2011-06-16 16:11:13 +01:00
Keir Fraser 67a5fec63e x86_emulate: Fix decode of FUCOMIP %stN.
Signed-off-by: Keir Fraser <keir@xen.org>
2011-06-15 20:33:58 +01:00
Jan Beulich 5dae074ae5 x86: sync thermal monitor LVT handling with Linux
As of 2.6.33, Linux checks that the thermal monitor LVT isn't set to
SMI delivery mode on just the value read on the boot CPU. As of 2.6.39
it additionally avoids writing back the saved value when its delivery
mode is FIXED (as this can cause APIC errors).

Changes done here that aren't in Linux are
- write back the boot CPU value also if delivery mode is FIXED, but
  there is also a valid vector
- print the messages when bailing out only once (on the boot CPU)
- when doing the final (enabling) write to the LVT, don't re-read the
  old value from the APIC, as we have it in a local variable already

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-06-15 20:25:13 +01:00
Jan Beulich 1d4a5602fc x86/apic: check maxlvt before accessing certain LVT fields
This follows Linux, including in not checking maxlvt for certain
accesses to APIC_LVTERR.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-06-15 20:24:41 +01:00
Jan Beulich ed6229185f x86-64: fix incorrect assertion in __maddr_to_virt()
When memory map sparseness reduction is in use, machine address ranges
can't validly be compared directly against the total size of the
direct mapping range.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-06-15 20:24:09 +01:00
Andrew Cooper 2de77fa3cd KEXEC: correctly revert x2apic state when kexecing
Introduce the boolean variable 'kexecing' which indicates to functions
whether we are on the kexec path or not.  This is used by
disable_local_APIC() to try and revert the APIC mode back to how it
was found on boot.

We also need some fudging of the x2apic_enabled variable.  It is used
in multiple places over the codebase to mean multiple things,
including:
    What did the user specifify on the command line?
    Did the BIOS boot me in x2apic mode?
    Is the BSP Local APIC in x2apic mode?
    What mode is my Local APIC in?

Therefore, set it up to prevent a protection fault when disabling the
IOAPICs.  (In this case, it is used in the "What mode is my Local APIC
in?" case, so the processor doesnt suffer a protection fault because
of trying to use x2apic MSRs when it should be using xapic MMIO)

Finally, make sure that interrupts are disabled when jumping into the
purgatory code.  It would be bad to service interrupts in the Xen
context when the next kernel is booting.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
2011-06-15 16:16:41 +01:00
Andrew Cooper f6239c2a1e IOMMU: add crash_shutdown iommu_op
The kdump kernel has problems booting with interrupt/dma
remapping enabled, so we need a new iommu_ops called
crash_shutdown which is basically suspend but doesn't
need to bother saving state.

Make sure that crash_shutdown is called on the kexec
path.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
2011-06-15 16:10:11 +01:00
Andrew Cooper 46f391252b IOMMU VTD BUG: disable Extended Interrupt Mode when disabling Interupt
Remapping

Experimental evidence shows that Extended Interrupt Mode remains in
effect even after Interrupt Remapping is disabled in each DMAR Global
Command Register.  A consiquence of this is that when we switch from
x2apic mode back to xapic mode, and disable interrupt remapping for
the kdump kernel, interrupts passing through the IO APICs are in
x2apic format as opposed xapic.  This causes a triple fault in the
kexec kernel.

As EIM is explicitly set up each time Interrup Remapping is enabled,
it is safe for us to clobber this when taring down.

Also, change the header definition of IRTA_REG_EIME_SHIFT.  It caused
verbose and error-prone code, and was only used in 1 place before.  We
now have IRTA_EIME which is the specific bit in the register.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
2011-06-15 16:07:45 +01:00
Yang, Wei bfb9f7deda Enable RDWRGSFS feature support for HVM guests
Write/read FS/GS base instructions enable user level code to
read/write FS & GS segment base registers for thread local storage.

Signed-off-by: Yang, Wei <wei.y.yang@intel.com>
2011-06-15 16:06:48 +01:00
George Dunlap ef99df4b11 x86/hvm: Crash domain rather than guest on unexpected PIO IO state
Under certain conditions, if an IO gets into an unexpected state,
hvmemul_do_io can return X86EMUL_UNHANDLEABLE.  Unfortunately,
handle_pio() does not expect this state, and calls BUG() if it sees
it, crashing the host.

Other HVM io-related code crashes the guest in this case.  This patch
makes handle_pio() do the same.

The crash was seen when executing crash_guest in dom0 to forcibly
crash the guest.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2011-06-15 16:05:14 +01:00
Tim Deegan e06b727ba1 Nested VMX: n2 MSR handling and capability exposure
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-06-15 13:33:58 +01:00
Eddie Dong 8119b4ce0c Nested VMX: Add VMXE bits in virtual CR4
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-06-09 16:24:09 +08:00
Eddie Dong 4489afd031 Nested VMX: Lazy FPU for n2 guest
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-06-09 16:24:09 +08:00
Eddie Dong 3bafd4a909 Nested VMX: VM exit handler of n2-guest
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-06-09 16:24:09 +08:00
Eddie Dong 479d4619fd Nested VMX: interrupt/exception handling for n2 guest
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-06-09 16:24:09 +08:00
Eddie Dong 9390642b7f Nested VMX: Switch shadow/virtual VMCS between n1/n2 guests.
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-06-09 16:24:09 +08:00
Eddie Dong 7291860737 Nested VMX: Extend VMCS control fields for n2 guest
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-06-09 16:24:09 +08:00
Eddie Dong 7a2ff64627 Nested VMX: Emulation of VMRESUME/VMLAUNCH
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-06-09 16:24:09 +08:00
Eddie Dong 3e03ad766e Nested VMX: Add APIs to switch n1/n2 VMCS.
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-06-09 16:24:09 +08:00
Eddie Dong 33a7028fec Nexted VMX: Emulation of guest VMREAD
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-06-09 16:24:09 +08:00
Eddie Dong d4c5b9db5a Nested VMX: Emulation of guest VMWRITE
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-06-09 16:24:09 +08:00
Eddie Dong d52ba01f4a Nested VMX: Emulation of guest VMCLEAR
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-06-09 16:24:09 +08:00
Eddie Dong 4969cde6b9 Nested VMX: Emulation of guest VMPTRST
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-06-09 16:24:09 +08:00