]> xenbits.xensource.com Git - xen.git/log
xen.git
12 years agoocaml: eventchn: in the interface, we don't have to give implementation details
David Scott [Wed, 20 Mar 2013 20:24:43 +0000 (20:24 +0000)]
ocaml: eventchn: in the interface, we don't have to give implementation details

Remove the mention of the C function names from the .mli -- this is only
needed in the implementation .ml

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoocaml: eventchn: add a 'type t' to represent an event channel
David Scott [Wed, 20 Mar 2013 20:24:42 +0000 (20:24 +0000)]
ocaml: eventchn: add a 'type t' to represent an event channel

It's a common OCaml convention to add a 'type t' in a module to
represent the main "thing" that the module is about. We add an
opaque type t and to_int/of_int functions for those who really
need it, in particular:

  1. to_int is needed for debug logging; and
  2. both to_int and of_int are needed for anyone who communicates
     a port number through xenstore.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoMerge branch 'xenstore-syslog' of git://github.com/djs55/xen into staging
Ian Campbell [Thu, 11 Apr 2013 10:47:06 +0000 (11:47 +0100)]
Merge branch 'xenstore-syslog' of git://github.com/djs55/xen into staging

12 years agoMAINTAINERS: add entry for the OCaml tools
David Scott [Mon, 18 Mar 2013 15:52:53 +0000 (15:52 +0000)]
MAINTAINERS: add entry for the OCaml tools

I hereby volunteer myself to maintain the OCaml tools (/tools/ocaml)
in particular:
  * the OCaml bindings
  * the OCaml xenstored

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen: arm: remove PSR_MODE_MASK from public interface.
Ian Campbell [Fri, 15 Mar 2013 13:15:50 +0000 (13:15 +0000)]
xen: arm: remove PSR_MODE_MASK from public interface.

This is also defined in sys/ptrace.h on arm64 which breaks the tools build due
to multiple definitions. I expect this is really a bug in the kernel and/or
glibc but we don't really need this symbol in the public headers, at least not
right now, so move it into include/asm instead.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agoxen: arm64 uses the same I/O ABI as arm32
Ian Campbell [Fri, 15 Mar 2013 13:15:49 +0000 (13:15 +0000)]
xen: arm64 uses the same I/O ABI as arm32

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agotools: memshr: arm64 support
Ian Campbell [Fri, 15 Mar 2013 13:15:47 +0000 (13:15 +0000)]
tools: memshr: arm64 support

I'm not mad keen on propagating these sorts of asm atomic operations throughout
our code base. Other options would be:

- use libatomic-ops, http://www.hpl.hp.com/research/linux/atomic_ops/, although
  this doesn't seem to be as widespread as I would like (not in RHEL5 for
  example)
- use a pthread lock. This is probably the simplest/best option but I wasn't
  able to figure out the locking hierarchy of this code

So I've copped out and just copied the appropriate inlines here.

I also nuked some stray ia64 support and fixed a coment in the arm32 version
while I was here.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agotools: libxc: arm64 support
Ian Campbell [Fri, 15 Mar 2013 13:15:46 +0000 (13:15 +0000)]
tools: libxc: arm64 support

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
12 years agotools: only check for Python devel tools if not cross-compiling.
Ian Campbell [Fri, 15 Mar 2013 13:15:45 +0000 (13:15 +0000)]
tools: only check for Python devel tools if not cross-compiling.

tools/python and tools/pygrub are already skipped in tools/Makefile when
cross-compiling, so no point in checking for the prerequisites either.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agotools: only build blktap1 on x86
Ian Campbell [Fri, 15 Mar 2013 13:15:44 +0000 (13:15 +0000)]
tools: only build blktap1 on x86

It does not cross-compile for ARM and no sane new port is going to use it.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agoblktap2: use sys/eventfd.h if it is available
Ian Campbell [Fri, 15 Mar 2013 13:15:43 +0000 (13:15 +0000)]
blktap2: use sys/eventfd.h if it is available

arm64 only has the eventfd2 system call and using the libc wrapper when
available hides this from us. eventfd() has been in libc since glibc 2.8.

This code is already Linux specific.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agotools: Use AC_SYS_LARGEFILE instead of calling getconf(1)
Ian Campbell [Fri, 15 Mar 2013 13:15:42 +0000 (13:15 +0000)]
tools: Use AC_SYS_LARGEFILE instead of calling getconf(1)

getconf is not cross-compile friendly since it reports the features of the host
and not the target. There doesn't appear to be a $triplet-getconf.

AC_SYS_LARGEFILE arranges for #defines to appear in config.h however Xen's
build system expects these to be part of C{PP}FLAGS. Since I'm not confident
that everything in Xen includes config.h I instead arrange for the result of
running AC_SYS_LARGERFILE to end up in CFLAGS.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agox86: don't pass negative time to gtime_to_gtsc()
Jan Beulich [Thu, 11 Apr 2013 10:07:55 +0000 (12:07 +0200)]
x86: don't pass negative time to gtime_to_gtsc()

scale_delta(), which is being called by that function, doesn't cope
with that.

Also print a warning message, so hopefully we can eventually figure why
occasionally a negative value results from the calculation in the first
place.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agoxen: arm: define 64-bit guest hypercall calling convention.
Ian Campbell [Tue, 12 Mar 2013 15:48:36 +0000 (15:48 +0000)]
xen: arm: define 64-bit guest hypercall calling convention.

As well as using x<N> rather than r<N> registers for passing arguments/results
as mandate the use of x16 as the hypercall number.

Add some pedantry about struct alignment layout referencing the ARM Procedure
Calling Standard to avoid confusion with the previous "OABI" convention. While
at it also mandate that hypercall argument structs are always little endian.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agoarm: tweak/improve logging for host SMP
Ian Campbell [Wed, 6 Mar 2013 08:54:36 +0000 (08:54 +0000)]
arm: tweak/improve logging for host SMP

Make the "CPU<n> booted" message fit in with the surrounding logging.

Log which CPU is taking an unexpected trap.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agoarm: gic: fix build on arm64
Ian Campbell [Wed, 6 Mar 2013 08:54:35 +0000 (08:54 +0000)]
arm: gic: fix build on arm64

lr_mask is a uint64_t and so needs to be printed with PRIx64.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agoarm: vgic: fix race between evtchn upcall and evtchnop_send
Ian Campbell [Wed, 6 Mar 2013 08:54:34 +0000 (08:54 +0000)]
arm: vgic: fix race between evtchn upcall and evtchnop_send

On ARM the evtchn upcall is done by using a local PPI interrupt. However the
guest will clear the evtchn_upcall_pending bit before it EOIs that PPI (which
happens late). This means vgic_vcpu_inject_irq (called via
vcpu_mark_events_pending) sees the PPI as in flight and ends up not reinjecting
it, if this happens after the guest has finished its event channel processing
loop but before the EOI then we have lost the upcall.

To fix this we need to check if an evtchn upcall is pending when returning to
the guest and if so reinject the PPI.

We therefore also need to call gic_restore_pending_irqs on the exit to guest
path in order to pickup any newly inject IRQ and propagate it into a free LR.
This doesn't currently support bumping a lower priority interrupt out of the
LRs in order to inject a new higher priority interrupt. We don't yet implement
interrupt prioritisation (and guests don't use it either) so this will do for
now.

Since gic_restore_pending_irqs is now called in the return to guest path it is
called with interrupts disabled and accordingly must use the
irqsave/irqrestore spinlock primitives.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agoarm: vgic: typo s/securty/security/
Ian Campbell [Wed, 6 Mar 2013 08:54:32 +0000 (08:54 +0000)]
arm: vgic: typo s/securty/security/

At least we were consistent, but lets be correct too

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agoarm: consolidate setup of hypervisor traps and second stage paging
Ian Campbell [Wed, 6 Mar 2013 08:54:29 +0000 (08:54 +0000)]
arm: consolidate setup of hypervisor traps and second stage paging

In particular be sure to initisalise HCR_EL2 on secondary processors.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
[ ijc -- adjusted due to unapplied "trap guest WFI" by s/HCR_TWI// ]

12 years agoarm: initialise VCPU SCTLR in vcpu_initialise
Ian Campbell [Wed, 6 Mar 2013 08:54:28 +0000 (08:54 +0000)]
arm: initialise VCPU SCTLR in vcpu_initialise

Ensuring a sane initial starting state for vcpus other than domain 0s.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agox86: allow AMD MSRs injected via xen-mceinj
Christoph Egger [Thu, 11 Apr 2013 08:11:44 +0000 (10:11 +0200)]
x86: allow AMD MSRs injected via xen-mceinj

Signed-off-by: Christoph Egger <chegger@amazon.de>
12 years agox86: show handler for Xen-internal interrupts
Jan Beulich [Wed, 10 Apr 2013 16:27:32 +0000 (18:27 +0200)]
x86: show handler for Xen-internal interrupts

... in 'i' debug key output.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86/MSI: cleanup to prepare for multi-vector MSI
Jan Beulich [Wed, 10 Apr 2013 15:30:19 +0000 (17:30 +0200)]
x86/MSI: cleanup to prepare for multi-vector MSI

The major aspect being the removal of the overload of the MSI entry's
mask_base field for MSI purposes - a proper union is being installed
instead, tracking both the config space position needed and the number
of vectors used (which is going to be 1 until the actual multi-vector
MSI patches arrive).

It also corrects misleading information from debug key 'M': When
msi_get_mask_bit() returns a negative value, there's no mask bit, and
hence output shouldn't give the impression there is.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
12 years agoxen/arm: phys_timer fixes
Stefano Stabellini [Wed, 20 Feb 2013 18:16:37 +0000 (18:16 +0000)]
xen/arm: phys_timer fixes

Do not unmask the emulated phys_timer when the related Xen timer
expires.
Do not inject the phys_timer interrupt if it is masked.

Do not let the user set CNTx_CTL_PENDING directly.

Set CNTx_CTL_PENDING when the phys_timer expires and clear it when the
phys_timer is disabled or the compare value is changed.

Define offset and cval as uint64_t given that they can't be negative and
they are used as uint64_t arguments.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: don't set the internal Xen timer if virt_timer is masked
Stefano Stabellini [Mon, 18 Feb 2013 16:02:29 +0000 (16:02 +0000)]
xen/arm: don't set the internal Xen timer if virt_timer is masked

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: dump gic debug info from arch_dump_domain_info
Stefano Stabellini [Mon, 18 Feb 2013 16:02:28 +0000 (16:02 +0000)]
xen/arm: dump gic debug info from arch_dump_domain_info

Print some useful GIC debug information when arch_dump_domain_info is
called ('q' debug key).

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agox86: debugging code for platform timer wrap problem
Jan Beulich [Tue, 9 Apr 2013 11:33:52 +0000 (13:33 +0200)]
x86: debugging code for platform timer wrap problem

This is intentionally adding code not well formatted (so it stands out)
and expected to be reverted as soon as the problem with the timer wraps
has been spotted.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
12 years agox86: serialize page table population in map_domain_page_global()
Tim Deegan [Tue, 9 Apr 2013 08:30:33 +0000 (10:30 +0200)]
x86: serialize page table population in map_domain_page_global()

Looking at map_domain_page_global, there doesn't seem to be any locking
preventing two CPUs from populating a page of global-map l1es at the
same time.

Signed-off-by: Tim Deegan <tim@xen.org>
12 years agoxl: Accept a list for usbdevice in config file
George Dunlap [Tue, 2 Apr 2013 14:10:13 +0000 (14:10 +0000)]
xl: Accept a list for usbdevice in config file

Allow the "usbdevice" key to accept a list of USB devices, and pass
them in using the new usbdevice_list domain build element.

For backwards compatibility, still accept singleton values.

Also update the xl.cfg manpage, adding information about how to pass
through host devices.

as applied:
 - Fix trailing whitespace and wrap some lines in xl_cmdimpl.c -iwj
v2:
 - Add some verbiage to make it clear that "usb" is for emulated devices
 - Reference qemu manual for more usbdevice options

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agolibxl: Allow multiple USB devices on HVM domain creation
George Dunlap [Tue, 2 Apr 2013 14:11:33 +0000 (14:11 +0000)]
libxl: Allow multiple USB devices on HVM domain creation

This patch allows an HVM domain to be created with multiple USB
devices.

Since the previous interface only allowed the passing of a single
device, this requires us to add a new element to the hvm struct of
libxl_domain_build_info -- usbdevice_list.  For API compatibility, the
old element, usbdevice, remains.

If hvm.usbdevice_list is set, each device listed will cause an extra
"-usbdevice [foo]" to be appended to the qemu command line.

Callers may set either hvm.usbdevice or hvm.usbdevice_list, but not
both; libxl will throw an error if both are set.

In order to allow users of libxl to write software compatible with
older versions of libxl, also define LIBXL_HAVE_BUILDINFO_USBDEVICE_LIST.
If this is defined, callers may use either hvm.usbdevice or
hvm.usbdevice_list; otherwise, only hvm.usbdevice will be available.

as applied:
 - Fix whitespace errors -iwj
v3:
 - Duplicate functionality in both "new" and "old", since we're not
   unifying the two anymore.
v2:
 - Throw an error if both usbdevice and usbdevice_list are set
 - Update and clarify definition based on feedback
 - Previous patches means this works for both traditional and upstream

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agoxl: default autoballoon option to "auto"
David Vrabel [Thu, 4 Apr 2013 17:21:12 +0000 (17:21 +0000)]
xl: default autoballoon option to "auto"

In xl.conf, autoballoon="auto" will do the right thing for most
people.  Make it the default (instead of "on").

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agoxl: extend autoballoon xl.conf option with an "auto" option
David Vrabel [Thu, 4 Apr 2013 17:21:12 +0000 (17:21 +0000)]
xl: extend autoballoon xl.conf option with an "auto" option

autoballoon=1 is not recommened if dom0_mem was used to reduce the
amount of dom0 memory.  Instead of requiring users to change xl.conf
if they do this, extend the autoballoon option with a new choice:
"auto".

With autoballoon="auto", autoballooning will be disabled if dom0_mem
was used on the Xen command line.

For consistency, accept "on" and "off" as valid autoballoon options (1
and 0 are still accepted).

The default remains "on" for now.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agotools/ocaml: Correct META for libxl bindings
Andrew Cooper [Wed, 3 Apr 2013 20:24:47 +0000 (20:24 +0000)]
tools/ocaml: Correct META for libxl bindings

This was missed by c/s 23936:cdb34816a40a which renamed xl -> xenlight

[ 23936:cdb34816a40a is 7ceaa0c7449e841d7ca7db889c3041dc3fedbb3b in git -iwj ]

Reported-by: alien@rmail.be
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
12 years agovpmu intel: Dump vpmu infos in 'q' keyhandler
Dietmar Hahn [Mon, 8 Apr 2013 15:58:16 +0000 (17:58 +0200)]
vpmu intel: Dump vpmu infos in 'q' keyhandler

This patch extends the printout of the VPCU infos of the keyhandler 'q'.
If vPMU is enabled is on the VCPU and active lines are printed like
(when running HVM openSuSE-12.3 with 'perf top');

(XEN)     vPMU running
(XEN)       general_0: 0x000000ffffff3ae1 ctrl: 0x000000000053003c
(XEN)       fixed_1:   0x000000ff90799188 ctrl: 0xb

This means general counter 0 and fixed counter 1 are running with showing
their contents and the contents of their configuration msr.

Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Jun Nakajima <jun.nakajima@intel.com>
12 years agovpmu intel: Use PMU defines instead of numerals and bit masks
Dietmar Hahn [Mon, 8 Apr 2013 15:57:17 +0000 (17:57 +0200)]
vpmu intel: Use PMU defines instead of numerals and bit masks

This patch uses the new defines in Intel vPMU to replace existing numerals and
bit masks.

Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Jun Nakajima <jun.nakajima@intel.com>
12 years agovpmu intel: Better names and replacing numerals with defines
Dietmar Hahn [Mon, 8 Apr 2013 15:55:49 +0000 (17:55 +0200)]
vpmu intel: Better names and replacing numerals with defines

This patch renames core2_counters to core2_fix_counters for better
understanding the code and subtitutes 2 numerals with defines in fixed counter
handling.

Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Jun Nakajima <jun.nakajima@intel.com>
12 years agoremus: init sch_plug module based on kernel version
Shriram Rajagopalan [Fri, 5 Apr 2013 15:16:05 +0000 (15:16 +0000)]
remus: init sch_plug module based on kernel version

remus: init sch_plug module based on kernel version

sch_plug module, for network buffering, is available as part of linux
kernel (from 3.4 onwards), as opposed to an out-of-tree module.
The netlink message format to talk to the in-kernel module is different from
that of the old version.  So, before initializing the Plug Qdisc, check
the kernel version and use the appropriate message format.

Also change the names of the constants to reflect the format used by the mainline
module [CHECKPOINT -> BUFFER , RELEASE -> RELEASE_ONE ].

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
12 years agodefer event channel bucket pointer store until after XSM checks
Jan Beulich [Fri, 5 Apr 2013 07:59:03 +0000 (09:59 +0200)]
defer event channel bucket pointer store until after XSM checks

Otherwise a dangling pointer can be left, which would cause subsequent
memory corruption as soon as the space got re-allocated for some other
purpose.

This is CVE-2013-1920 / XSA-47.

Reported-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
12 years agox86/mm/shadow: spurious warning when unmapping xenheap pages.
Tim Deegan [Thu, 28 Mar 2013 10:32:17 +0000 (10:32 +0000)]
x86/mm/shadow: spurious warning when unmapping xenheap pages.

Xenheap pages will always have an extra typecount, taken in
share_xen_page_with_guest(), which doesn't come from a shadow PTE.
Adjust the warning in sh_remove_all_mappings() to account for it.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Tim Deegan <tim@xen.org>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
12 years agoVMX: Always disable SMEP when guest is in non-paging mode
Stefan Bader [Thu, 4 Apr 2013 08:37:19 +0000 (10:37 +0200)]
VMX: Always disable SMEP when guest is in non-paging mode

commit e7dda8ec9fc9020e4f53345cdbb18a2e82e54a65
  VMX: disable SMEP feature when guest is in non-paging mode

disabled the SMEP bit if a guest VCPU was using HAP and was not
in paging mode. However I could observe VCPUs getting stuck in
the trampoline after the following patch in the Linux kernel
changed the way CR4 gets set up:
  x86, realmode: read cr4 and EFER from kernel for 64-bit trampoline

The change will set CR4 from already set flags which includes the
SMEP bit. On bare metal this does not matter as the CPU is in non-
paging mode at that time. But Xen seems to use the emulated non-
paging mode regardless of HAP (I verified that on the guests I was
seeing the issue, HAP was not used).

Therefor it seems right to unset the SMEP bit for a VCPU that is
not in paging-mode, regardless of its HAP usage.

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Dongxiao Xu <dongxiao.xu@intel.com>
12 years agox86/S3: Restore broken vcpu affinity on resume
Ben Guthro [Tue, 2 Apr 2013 07:52:32 +0000 (09:52 +0200)]
x86/S3: Restore broken vcpu affinity on resume

When in SYS_STATE_suspend, and going through the cpu_disable_scheduler
path, save a copy of the current cpu affinity, and mark a flag to
restore it later.

Later, in the resume process, when enabling nonboot cpus restore these
affinities.

Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86: irq_move_cleanup_interrupt() must ignore legacy vectors
Jan Beulich [Tue, 2 Apr 2013 06:30:03 +0000 (08:30 +0200)]
x86: irq_move_cleanup_interrupt() must ignore legacy vectors

Since the main loop in the function includes legacy vectors, and since
vector_irq[] gets set up for legacy vectors regardless of whether those
get handled through the IO-APIC, it must not do anything on this vector
range. In fact, we should never get past the move_cleanup_count check
for IRQs not handled through the IO-APIC. Adding a respective assertion
woulkd make those iterations more expensive (due to the lock acquire).

For such an assertion to not have false positives we however ought to
suppress setting up IRQ2 as an 8259A interrupt (which wasn't correct
anyway), which is being done here despite the assertion not actually
getting added.

Furthermore, there's no point iterating over the vectors past
LAST_HIPRIORITY_VECTOR, so terminate the loop accordingly.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86/hvm: Centralize and simplify the RTC IRQ logic.
Tim Deegan [Thu, 28 Mar 2013 11:27:31 +0000 (11:27 +0000)]
x86/hvm: Centralize and simplify the RTC IRQ logic.

This keeps the behaviour of strobing the IRQ line every time any RTC
interrupt source is raised.  I rather suspect (based on the behaviour
of the MC146818A RTC) that we ought to be suppressing all subsequent
interrupts whenever RTC_IRQF is set, but this way avoids making
guest-visible changes.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86/hvm: Let the guest miss a few ticks before resetting the timer.
Tim Deegan [Thu, 28 Mar 2013 13:07:06 +0000 (13:07 +0000)]
x86/hvm: Let the guest miss a few ticks before resetting the timer.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86/hvm: Avoid needlessly resetting the periodic timer.
Tim Deegan [Thu, 28 Mar 2013 12:19:32 +0000 (12:19 +0000)]
x86/hvm: Avoid needlessly resetting the periodic timer.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86/hvm: Run the RTC periodic timer on a consistent time series.
Tim Deegan [Thu, 28 Mar 2013 12:00:46 +0000 (12:00 +0000)]
x86/hvm: Run the RTC periodic timer on a consistent time series.

When the RTC periodic timer gets restarted, align it to the VM's boot
time, not to whatever time it is now.  Otherwise every read of REG_C
will restart the current period

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
12 years agohvm: Clean up vlapic_reg_write() error propagation.
Keir Fraser [Thu, 28 Mar 2013 20:16:37 +0000 (20:16 +0000)]
hvm: Clean up vlapic_reg_write() error propagation.

In particular, correctly propagate errors through vlapic_apicv_write()
and hvm_x2apic_msr_write().

Signed-off-by: Keir Fraser <keir@xen.org>
12 years agoMerge branch 'docs.v3' of git://xenbits.xen.org/people/konradwilk/xen into staging
Ian Jackson [Thu, 28 Mar 2013 15:59:21 +0000 (15:59 +0000)]
Merge branch 'docs.v3' of git://xenbits.xen.org/people/konradwilk/xen into staging

12 years agolibxl: run libxl__arch_domain_create() much earlier.
Tim Deegan [Thu, 14 Mar 2013 12:39:39 +0000 (12:39 +0000)]
libxl: run libxl__arch_domain_create() much earlier.

Among other things, arch_domain_create() sets the shadow(/hap/p2m)
memory allocation, which must happen after vcpus are assigned (or the
shadow op will fail) but before memory is allocated (or we might run
out of p2m memory).

libxl__build_pre(), which already sets similar things like maxmem,
semes like a reasonable spot for it.  That needed a bit of plumbing to
get the right datastructure from the caller.

As a side-effect, the return code from libxl__arch_domain_create() is
no longer ignored.

This bug was analysed in:
    From: "Jan Beulich" <JBeulich@xxxxxxxx>
    "Re: [Xen-devel] [xen-unstable test] 16788: regressions - FAIL"
    Date: Mon, 04 Mar 2013 16:34:53 +0000
    http://lists.xen.org/archives/html/xen-devel/2013-03/msg00191.html

Reported-by: Jan Beulich <JBeulich@suse.com>
Signed-off-by: Tim Deegan <tim@xen.org>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
12 years agotools/blktap2: Handle read/write interrupts in blktap2 control plane.
Dr. Greg Wettstein [Thu, 28 Mar 2013 07:50:34 +0000 (07:50 +0000)]
tools/blktap2: Handle read/write interrupts in blktap2 control plane.

The following patch:

tools: Retry blktap2 tapdisk message on interrupt.

Addressed a long standing regression with the blktap2 control
plane.  An interruption of the select system call would
prematurely terminate the message sequence needed to properly
shutdown a blktap2 tapdisk instance.

Ian Jackson correctly noted that the read and write systems calls
responsible for receiving and sending the control messages could
also return EINTR resulting in similar effects.  While this
regression was not noted in field testing this patch adds support
to re-start the calls to provide a technically complete
implementation of control plane management in the presence of
signals.

Signed-off-by: Dr. Greg Wettstein <xen@wind.enjellic.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agohvm: Improve APIC INIT/SIPI emulation, fixing it for call paths other than x86_emulate().
Keir Fraser [Thu, 28 Mar 2013 11:44:11 +0000 (11:44 +0000)]
hvm: Improve APIC INIT/SIPI emulation, fixing it for call paths other than x86_emulate().

In particular, on broadcast/multicast INIT/SIPI, we handle all target
APICs at once in a single invocation of the init/sipi tasklet. This
avoids needing to return an X86EMUL_RETRY error code to the caller,
which was being ignored by all except x86_emulate().

The original bug, and the general approach in this fix, pointed out by
Intel (yang.z.zhang@intel.com).

Signed-off-by: Keir Fraser <keir@xen.org>
12 years agoACPI/APEI: revert "accept validly sized ERST on Intel systems only for now"
Jan Beulich [Thu, 28 Mar 2013 08:06:19 +0000 (09:06 +0100)]
ACPI/APEI: revert "accept validly sized ERST on Intel systems only for now"

With the recent two fixes to ERST handling, this should no longer be
necessary.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
12 years ago.gitignore: Add some flask files
Ian Jackson [Wed, 27 Mar 2013 17:13:33 +0000 (17:13 +0000)]
.gitignore: Add some flask files

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>
12 years agox86/EFI: permit setting variable with non-zero attributes
Jan Beulich [Wed, 27 Mar 2013 07:46:28 +0000 (08:46 +0100)]
x86/EFI: permit setting variable with non-zero attributes

This must have been a copy-and-paste mistake - get_variable uses
op->misc as output only, and wants to make sure it's zero for future
extensibility. For set_variable, this is an input though, and hence
the check is wrong.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agovpmu intel: Add cpuid handling when vpmu disabled
Dietmar Hahn [Tue, 26 Mar 2013 13:24:25 +0000 (14:24 +0100)]
vpmu intel: Add cpuid handling when vpmu disabled

Even though vpmu is disabled in the hypervisor in the HVM guest the call of
cpuid(0xa) returns informations about usable performance counters.
This may confuse guest software when trying to use the counters and nothing
happens.
This patch clears most bits in registers eax and edx of cpuid(0xa) instruction
for the guest when vpmu is disabled:
 - version ID of architectural performance counting
 - number of general pmu registers
 - width of general pmu registers
 - number of fixed pmu registers
 - width of ixed pmu registers

Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86: reserve pages when SandyBridge integrated graphics
Xudong Hao [Tue, 26 Mar 2013 13:22:07 +0000 (14:22 +0100)]
x86: reserve pages when SandyBridge integrated graphics

SNB graphics devices have a bug that prevent them from accessing certain
memory ranges, namely anything below 1M and in the pages listed in the
table.

Xen does not initialize below 1MB to heap, i.e. below 1MB pages don't be
allocated, so it's unnecessary to reserve memory below the 1 MB mark
that has not already been reserved.

So reserve those pages listed in the table at xen boot if set detect a
SNB gfx device on the CPU to avoid GPU hangs.

Signed-off-by: Xudong Hao <xudong.hao@intel.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agodocs: Document the XenBus structure.
Konrad Rzeszutek Wilk [Mon, 28 Jan 2013 18:21:59 +0000 (13:21 -0500)]
docs: Document the XenBus structure.

Mark-up for inclusion of generated docs.

Acked-by: Ian Campbell <ian.campbel@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
12 years agodocs: Document start_info changes in Xen 4.2.
Konrad Rzeszutek Wilk [Mon, 28 Jan 2013 18:20:29 +0000 (13:20 -0500)]
docs: Document start_info changes in Xen 4.2.

The  25833:bb85bbccb1c9. "x86/32-on-64: adjust Dom0 initial page table layout"
fixes a bug in the reported value of pt_base versus where the page tables
actually start. This documents this in the start of the world header note.

This clarifies the implied understanding that the page table space is
pointed by pt_base. As in it is ".. implied that the range of page-tables
is the range [pt_base, pt_base + nr_pt_frames), whereas that that range
here indeed is [pt_base - 2, pt_base -2 + nr_pt_frames)" (Jan Beulich).

Also make it crystal clear that pt_base == %cr3.

Acked-by: Jan Beulich <JBeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
12 years agodocs: Document the dom0_vga_console_info structure.
Konrad Rzeszutek Wilk [Mon, 28 Jan 2013 18:02:04 +0000 (13:02 -0500)]
docs: Document the dom0_vga_console_info structure.

Mark-up for inclusion of generated docs.

Acked-by: Ian Campbell <ian.campbel@citrix.com>
[v2: s/dom9/dom0/]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
12 years agodocs: Document the shared structure.
Konrad Rzeszutek Wilk [Mon, 28 Jan 2013 17:59:05 +0000 (12:59 -0500)]
docs: Document the shared structure.

Mark-up for inclusion of generated docs.

Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
12 years agodocs: Add some extra details to the ELF note.
Konrad Rzeszutek Wilk [Wed, 30 Jan 2013 17:06:23 +0000 (12:06 -0500)]
docs: Add some extra details to the ELF note.

Such as how the string values MUST be NULL terminated ASCII.

Acked-by: Ian Campbell <ian.campbel@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
12 years agodocs: Document the ELF_FEATURES entry
Konrad Rzeszutek Wilk [Mon, 28 Jan 2013 17:24:02 +0000 (12:24 -0500)]
docs: Document the ELF_FEATURES entry

Mark-up for inclusion of generated docs.

Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
12 years agodocs: Document the ELF notes
Konrad Rzeszutek Wilk [Mon, 28 Jan 2013 17:10:50 +0000 (12:10 -0500)]
docs: Document the ELF notes

Mark-up for inclusion of generated docs.

Acked-by: Ian Campbell <ian.campbel@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
12 years agotrace: Add reason for NMI exit TRAP
Konrad Rzeszutek Wilk [Mon, 25 Mar 2013 15:57:31 +0000 (16:57 +0100)]
trace: Add reason for NMI exit TRAP

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
12 years agotrace: Add the other variant of do_block
Konrad Rzeszutek Wilk [Mon, 25 Mar 2013 15:57:22 +0000 (16:57 +0100)]
trace: Add the other variant of do_block

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
12 years agotrace: Add trace events for IRQ activities
Konrad Rzeszutek Wilk [Mon, 25 Mar 2013 15:57:14 +0000 (16:57 +0100)]
trace: Add trace events for IRQ activities

This expands the format to include the class of TRC_HW_IRQ.
This means that instead of:

CPU28  1753521436727 (+    3252)  unknown (0x0000000000802008)  [ 0x0000006c 0x4605709c 0x4605b682 0x00000000 0x00000000 0x00000000 0x00000000 ]

we now see:

CPU28  1753521436727 (+    3252)  do_irq [ irq = 108, began = 1174761628us, ended = 1174779522us ]

Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
12 years agotrace: Use correct trace class for power management changes
Konrad Rzeszutek Wilk [Mon, 25 Mar 2013 15:57:03 +0000 (16:57 +0100)]
trace: Use correct trace class for power management changes

Previous to this patch we would see in the trace file:

CPU28  1753503175371 (+    8496)  unknown (0x0000000000801002)  [ 0x00000004 0x4158a498 0x000003a1 0x000027e6 0x00000000 0x00000000 0x00000000 ]
CPU28  1753505321239 (+ 2145868)  unknown (0x0000000000801003)  [ 0x00000004 0x4166dca7 0x000000fa 0x00000000 0x00000000 0x00000000 0x00000000 ]
CPU28  1753505343756 (+   22517)  unknown (0x0000000000801002)  [ 0x00000004 0x41670fe5 0x00001284 0x00003766 0x00000000 0x00000000 0x00000000 ]
CPU28  1753521413711 (+16069955)  unknown (0x0000000000801003)  [ 0x00000004 0x41d1e02c 0x000000ab 0x00000000 0x00000000 0x00000000 0x00000000 ]

instead of:
CPU28  1753503175371 (+    8496)  cpu_idle_entry  [ C0 -> C4, acpi_pm_tick = 1096328344, expected = 929us, predicted = 10214us ]
CPU28  1753505321239 (+ 2145868)  cpu_idle_exit   [ C4 -> C0, acpi_pm_tick = 1097260199, irq = 250 0 0 0 ]
CPU28  1753505343756 (+   22517)  cpu_idle_entry  [ C0 -> C4, acpi_pm_tick = 1097273317, expected = 4740us, predicted = 14182us ]
CPU28  1753521413711 (+16069955)  cpu_idle_exit   [ C4 -> C0, acpi_pm_tick = 1104273452, irq = 171 0 0 0 ]

The patch that added the cpu_idle_[entry|exit] was using the
TRC_HW_IRQ class (0x00802000) instead of TRC_HW_PM (0x00801000)
as a base.

Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
12 years agoAMD IOMMU: allow disabling only interrupt remapping when certain IVRS consistency...
Jan Beulich [Mon, 25 Mar 2013 15:55:22 +0000 (16:55 +0100)]
AMD IOMMU: allow disabling only interrupt remapping when certain IVRS consistency checks fail

After some more thought on the XSA-36 and specifically the comments we
got regarding disabling the IOMMU in this situation altogether making
things worse instead of better, I came to the conclusion that we can
actually restrict the action in affected cases to just disabling
interrupt remapping. That doesn't make the situation worse than prior
to the XSA-36 fixes (where interrupt remapping didn't really protect
domains from one another), but allows at least DMA isolation to still
be utilized.

To do so, disabling of interrupt remapping must be explicitly requested
on the command line - respective checks will then be skipped.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Suravee Suthikulanit <suravee.suthikulpanit@amd.com>
12 years agoVT-d: deal with 5500/5520/X58 errata
Malcolm Crossley [Mon, 25 Mar 2013 13:31:27 +0000 (14:31 +0100)]
VT-d: deal with 5500/5520/X58 errata

http://www.intel.com/content/www/us/en/chipsets/5520-and-5500-chipset-ioh-specification-update.html

Stepping B-3 has two errata (#47 and #53) related to Interrupt
remapping, to which the workaround is for the BIOS to completely disable
interrupt remapping.  These errata are fixed in stepping C-2.

Unfortunately this chipset stepping is very common and many BIOSes are
not disabling interrupt remapping on this stepping .  We can detect this in
Xen and prevent Xen from using the problematic interrupt remapping feature.

The Intel 5500/5520/X58 chipset does not support VT-d
Extended Interrupt Mode(EIM). This means the iommu_supports_eim() check
always fails and so x2apic mode cannot be enabled in Xen before this quirk
disables the interrupt remapping feature.

Signed-off-by: Malcolm Crossley <malcolm.crossley@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Gate the function call to check the quirk on interrupt remapping being
requested to get enabled, and upon failure disable the IOMMU to be in
line with what the changes for XSA-36 (plus follow-ups) did.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: "Zhang, Xiantao" <xiantao.zhang@intel.com>
12 years agoIOMMU: properly check whether interrupt remapping is enabled
Jan Beulich [Mon, 25 Mar 2013 13:28:31 +0000 (14:28 +0100)]
IOMMU: properly check whether interrupt remapping is enabled

... rather than the IOMMU as a whole.

That in turn required to make sure iommu_intremap gets properly
cleared when the respective initialization fails (or isn't being
done at all).

Along with making sure interrupt remapping doesn't get inconsistently
enabled on some IOMMUs and not on others in the VT-d code, this in turn
allowed quite a bit of cleanup on the VT-d side (if desired, that
cleanup could of course be broken out into a separate patch).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: "Zhang, Xiantao" <xiantao.zhang@intel.com>
12 years agoxenconsoled: use array index to keep track of pollfd
Wei Liu [Tue, 19 Mar 2013 17:45:49 +0000 (17:45 +0000)]
xenconsoled: use array index to keep track of pollfd

If we use pointers to reference elements inside array, it is possible that we
get wild pointer after realloc(3) copies array and returns a new pointer.

Keep track of element indexes inside the array can solve this problem.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Marcus Granado <marcus.granado@citrix.com>
Tested-by: Marcus Granado <marcus.granado@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agolibxl: Streamline vnc argument generation code
George Dunlap [Mon, 11 Mar 2013 13:57:47 +0000 (13:57 +0000)]
libxl: Streamline vnc argument generation code

Makes the following changes to the vnc generation code:
* Simplifies and comments it, making it easier to read and grok
* Throws an error if duplicate values of display are set, rather
  than the current very un-intuitive behavior.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agotools: Retry blktap2 tapdisk message on interrupt.
Dr. Greg Wettstein [Tue, 19 Mar 2013 07:26:33 +0000 (07:26 +0000)]
tools: Retry blktap2 tapdisk message on interrupt.

Re-start blktap2 IPC select call on interrupt.

We hunted this miserable bug for a long time.

The teardown of a blktap2 tapdisk instance is being carried out
inconsistently up to and including the 4.2.1 release.  The
problem appears to be a classic 'Heisenbug' which disappears if a
single function call is added to the tapdisk shutdown path.  It
is likely this bug has been in existence for the life of the
blktap2 code.

Control messages to manipulate a tapdisk instance are sent over a
UNIX domain socket.  A select call is used on both the read and
write paths to wait on I/O and to set a timeout for the
transmission and reception of the control plane messages.

The existing code fails receipt or transmission of the control message
on any type of error return from the select call.  The xl control
process receives an interrupt while waiting in the select call which
in turn causes an error return with SIGINT as the return code.

This prematurely terminates the teardown of the tapdisk instance
leaving it in various states of shutdown.  Since multiple messages
are needed to implement a full teardown the tapdisk instance can be
left in various states ranging from fully connected to only the minor
being left allocated.

The fix is straight forward.  Check the return code from the
select call and re-try read or write of the control message if
errno is sent to EINTR.  The problem manifests itself in the read
path but there appears to be little reason to not add the fix to
the write path as well.  Both paths appear to be cut-and-paste
copies of each other.

Signed-off-by: Dr. Greg Wettstein <greg@enjellic.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agotools/firmware: Fix ovmf build with gcc version different from 4.4
fantonifabio@tiscali.it [Mon, 18 Mar 2013 10:59:53 +0000 (10:59 +0000)]
tools/firmware: Fix ovmf build with gcc version different from 4.4

Signed-off-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
12 years agoACPI, APEI: Add apei_exec_run_optional
Huang Ying [Fri, 22 Mar 2013 11:46:25 +0000 (12:46 +0100)]
ACPI, APEI: Add apei_exec_run_optional

Some actions in APEI ERST and EINJ tables are optional, for example,
ACPI_EINJ_BEGIN_OPERATION action is used to do some preparation for
error injection, and firmware may choose to do nothing here.  While
some other actions are mandatory, for example, firmware must provide
ACPI_EINJ_GET_ERROR_TYPE implementation.

Original implementation treats all actions as optional (that is, can
have no instructions), that may cause issue if firmware does not
provide some mandatory actions.  To fix this, this patch adds
apei_exec_run_optional, which should be used for optional actions.
The original apei_exec_run should be used for mandatory actions.

Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
12 years agoACPI/APEI: Unlock apei_iomaps_lock on error path
Andrew Cooper [Fri, 22 Mar 2013 08:43:38 +0000 (09:43 +0100)]
ACPI/APEI: Unlock apei_iomaps_lock on error path

This causes deadlocks during early boot on hardware with broken/buggy
APEI implementations, such as a Dell Poweredge 2950 with the latest
currently available BIOS.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Don't use goto or another special error path, as handling the error
case in normal flow is quite simple.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
12 years agox86/HPET: deal with event having expired while interrupt was masked
Jan Beulich [Wed, 20 Mar 2013 15:57:04 +0000 (16:57 +0100)]
x86/HPET: deal with event having expired while interrupt was masked

Commit 2d8a282 ("x86/HPET: fix FSB interrupt masking") may cause the
HPET event to occur while its interrupt is masked. In that case we need
to "manually" deliver the event.

Unfortunately this requires the locking to be changed: For one, it was
always bogus for handle_hpet_broadcast() to use spin_unlock_irq() - the
function is being called from an interrupt handler, and hence shouldn't
blindly re-enable interrupts (this should be left up to the generic
interrupt handling code). And with the event handler wanting to acquire
the lock for two of its code regions, we must not enter it with the
lock already held. Hence move the locking into
hpet_{attach,detach}_channel(), permitting the lock to be dropped by
set_channel_irq_affinity() (which is a tail call of those functions).

Reported-by: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Sander Eikelenboom <linux@eikelenboom.it>
Acked-by: Keir Fraser <keir@xen.org>
12 years agoACPI/ERST: Name table in otherwise opaque error messages
Andrew Cooper [Wed, 20 Mar 2013 09:02:52 +0000 (10:02 +0100)]
ACPI/ERST: Name table in otherwise opaque error messages

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Fix spelling and lower severities.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
12 years agoVT-d: Enumerate IOMMUs when listing capabilities
Andrew Cooper [Wed, 20 Mar 2013 09:02:26 +0000 (10:02 +0100)]
VT-d: Enumerate IOMMUs when listing capabilities

This saves N identical console log lines on a multi-iommu server.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
12 years agox86: BITS_PER_LONG is now always 64
Jan Beulich [Wed, 20 Mar 2013 09:00:52 +0000 (10:00 +0100)]
x86: BITS_PER_LONG is now always 64

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agoAMD/IOMMU: Process softirqs while building dom0 iommu mappings
Andrew Cooper [Wed, 20 Mar 2013 09:00:01 +0000 (10:00 +0100)]
AMD/IOMMU: Process softirqs while building dom0 iommu mappings

Recent changes which have made their way into xen-4.2 stable have pushed the
runtime of construct_dom0() over 5 seconds, which has caused regressions in
XenServer testing because of our 5 second watchdog.

The root cause is that amd_iommu_dom0_init() does not process softirqs and in
particular the nmi_timer which causes the watchdog to decide that no useful
progress is being made.

This patch adds periodic calls to process_pending_softirqs() at the same
interval as the Intel variant of this function.  The server which was failing
with the watchdog test now boots reliably with a timeout of 1 second.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
12 years agooxenstored: Allow oxenstored to use syslog at levels other than Debug
David Scott [Tue, 19 Mar 2013 16:57:34 +0000 (16:57 +0000)]
oxenstored: Allow oxenstored to use syslog at levels other than Debug

We now log different kinds of events at different levels. The convention
is now:

new/end_connection:    Debug
coalesce:              Debug
conflict:              Debug
commit:                Debug
regular ops:           Info
start/end_transaction: Debug
error (ENOENT):        Debug
error (any other):     Warn
watch:                 Info

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
12 years agooxenstored: enable logging via syslog, if specified in the config file.
David Scott [Tue, 19 Mar 2013 16:53:01 +0000 (16:53 +0000)]
oxenstored: enable logging via syslog, if specified in the config file.

To log to files the config file should contain:
   xenstored-log-file = /var/log/xenstored.log
   access-log-file = /var/log/xenstored-access.log

(These two files are still the built-in defaults. The log format is
unchanged.)

To log to syslog the config file should contain:
   xenstored-log-file = syslog:<facility>
   access-log-file = syslog:<facility>

where <facility> is the syslog facility to use (e.g. 'daemon' 'local2')

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
12 years agooxenstored: Re-add ocaml syslog binding
David Scott [Tue, 19 Mar 2013 16:42:40 +0000 (16:42 +0000)]
oxenstored: Re-add ocaml syslog binding

This was lost in the OCaml xenstored log merge of 10/Oct/2011.

The binding isn't exported as a shared "log" library, instead it is kept
local to xenstored.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
12 years agox86/HPET: mask interrupt while changing affinity
Jan Beulich [Mon, 18 Mar 2013 16:13:32 +0000 (17:13 +0100)]
x86/HPET: mask interrupt while changing affinity

While being unable to reproduce the "No irq handler for vector ..."
messages observed on other systems, the change done by 5dc3fd2 ('x86:
extend diagnostics for "No irq handler for vector" messages') appears
to point at the lack of masking - at least I can't see what else might
be wrong with the HPET MSI code that could trigger these warnings.

While at it, also adjust the message printed by aforementioned commit
to not pointlessly insert spaces - we don't need aligned tabular output
here.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agoMAINTAINERS: Remove myself from AMD IOMMU maintainer
Wei Wang [Mon, 18 Mar 2013 10:57:54 +0000 (11:57 +0100)]
MAINTAINERS: Remove myself from AMD IOMMU maintainer

Signed-off-by: Wei Wang <wawei@amazon.com>
12 years agoQEMU_TAG update
Ian Jackson [Fri, 15 Mar 2013 18:29:36 +0000 (18:29 +0000)]
QEMU_TAG update

12 years agoxl: add vif.default.script
Roger Pau Monne [Wed, 13 Mar 2013 17:42:17 +0000 (17:42 +0000)]
xl: add vif.default.script

Replace vifscript with vif.default.script. The old config option is
kept for backwards compatibility.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: George Dunlap <george.dunlap@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agoxl: add vif.default.bridge
Roger Pau Monne [Wed, 13 Mar 2013 17:42:17 +0000 (17:42 +0000)]
xl: add vif.default.bridge

This is a replacement for defaultbridge xl.conf option. The now
deprecated defaultbridge is still supported.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agoxl: allow specifying a default gatewaydev in xl.conf
Roger Pau Monne [Wed, 13 Mar 2013 17:42:17 +0000 (17:42 +0000)]
xl: allow specifying a default gatewaydev in xl.conf

This adds a new global option in the xl configuration file called
"vif.default.gatewaydev", that is used to specify the default
gatewaydev to use when none is passed in the vif specification.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Tested-by: Ulf Kreutzberg <ulf.kreutzberg@hosteurope.de>
Cc: Ulf Kreutzberg <ulf.kreutzberg@hosteurope.de>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agoxl/libxl: add gatewaydev/netdev to vif specification
Roger Pau Monne [Wed, 13 Mar 2013 17:42:17 +0000 (17:42 +0000)]
xl/libxl: add gatewaydev/netdev to vif specification

This option is used by the vif-route hotplug script. A new more
descriptive name is used, "gatewaydev", but "netdev" is also supported
as a deprecated backwards compatible option.

This option was supported in the past, according to
http://wiki.xen.org/wiki/Vif-route, so we should also support it in
libxl.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Tested-by: Ulf Kreutzberg <ulf.kreutzberg@hosteurope.de>
Cc: Ulf Kreutzberg <ulf.kreutzberg@hosteurope.de>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agox86/mm: avoid undefined behavior in IS_NIL()
Xi Wang [Fri, 15 Mar 2013 09:26:17 +0000 (10:26 +0100)]
x86/mm: avoid undefined behavior in IS_NIL()

Since pointer overflow is undefined behavior in C, some compilers such
as clang optimize away the check !((ptr) + 1) in the macro IS_NIL().

This patch fixes the issue by casting the pointer type to uintptr_t,
the operations of which are well-defined.

Signed-off-by: Xi Wang <xi@mit.edu>
With that, we also need to avoid the overflow in NIL().

Note that either part of the change results in the respective macros to
become unsuitable for use with "void".

Signed-off-by: Jan Beulich <jbeulich@suse.com>
12 years agotools: libxl: unbreak build after ec41430ef6a7
Ian Campbell [Thu, 14 Mar 2013 09:45:57 +0000 (09:45 +0000)]
tools: libxl: unbreak build after ec41430ef6a7

libxl_create.c: In function ‘libxl__domain_build_info_setdefault’:
libxl_create.c:109: error: ‘info’ undeclared (first use in this function)
libxl_create.c:109: error: (Each undeclared identifier is reported only once
libxl_create.c:109: error: for each function it appears in.)
cc1: warnings being treated as errors
libxl_create.c:108: error: suggest explicit braces to avoid ambiguous ‘else’
libxl_create.c: At top level:
libxl_create.c:141: error: expected identifier or ‘(’ before ‘if’
...

Fix is to insert the missing opening brace and s/info/b_info/ in one spot.

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>
12 years agox86: extend diagnostics for "No irq handler for vector" messages
Jan Beulich [Thu, 14 Mar 2013 11:10:53 +0000 (12:10 +0100)]
x86: extend diagnostics for "No irq handler for vector" messages

By storing the inverted IRQ number in vector_irq[], we may be able to
spot which IRQ a vector was used for most recently, thus hopefully
permitting to understand why these messages trigger on certain systems.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86/mem_access: check for errors in p2m->set_entry().
Tim Deegan [Thu, 7 Mar 2013 14:23:05 +0000 (14:23 +0000)]
x86/mem_access: check for errors in p2m->set_entry().

These calls ought always to succeed.  Assert that they do rather than
ignoring the return value.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
12 years agox86/mem_sharing: check for errors in p2m->set_entry().
Tim Deegan [Thu, 7 Mar 2013 14:08:24 +0000 (14:08 +0000)]
x86/mem_sharing: check for errors in p2m->set_entry().

This call ought always to succeed.  Assert that it does rather than
ignoring the return value.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
12 years agox86/ept: check for errors in a few callers of ept_set_entry.
Tim Deegan [Thu, 7 Mar 2013 13:22:32 +0000 (13:22 +0000)]
x86/ept: check for errors in a few callers of ept_set_entry.

AFAICT in all these cases we have the p2m lock and have just checked
that the p2m trie is populated so the call should succeed.  Make it
explicit with ASSERT() rather than just ignoring the result.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
12 years agox86/mm: warn if we ever run out of shadow/hap pool for p2m/lgd ops.
Tim Deegan [Thu, 7 Mar 2013 12:49:52 +0000 (12:49 +0000)]
x86/mm: warn if we ever run out of shadow/hap pool for p2m/lgd ops.

Even if the error propagates up through the p2m ops to the caller,
it'll look like ENOMEM, which won't be obviously a shadow-pool problem.

Warn on the console, once per domain.

Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
12 years agox86/mm: use bool_t for flags in shadow-pagetable structs
Tim Deegan [Thu, 7 Mar 2013 12:37:12 +0000 (12:37 +0000)]
x86/mm: use bool_t for flags in shadow-pagetable structs

and reshuffle the domain struct to pack a little better.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
12 years agolibxl: use qemu-xen (upstream QEMU) as device model by default
Stefano Stabellini [Tue, 4 Dec 2012 13:06:35 +0000 (13:06 +0000)]
libxl: use qemu-xen (upstream QEMU) as device model by default

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>