Commit Graph
22987 Commits
Author SHA1 Message Date
Tim Deegan e4cdd74f02 xen: add "lto=y" option to build Xen with link-time optimizations.
This involves gathering object files from .asm (which will be binary)
and object files from .c (which will be in LTO format) separately
until the final link.

Only tested for x86_64 Xen builds using Clang/LLVM bitcode; it should be
possible to do the same with newer GCCs and GIMPLE.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
2011-03-07 11:34:09 +00:00
Tim Deegan 436323c065 xen: add "clang=y" option to build Xen with clang/llvm instead of gcc.
Tested with svn snapshot of clang and llvm from 17 February 2011.
Only x86_64 hypervisor builds (make dist-xen clang=y) are supported
and I haven't even begun to look at cross-compiling.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
2011-03-07 11:21:11 +00:00
Tim Deegan cde9655edd x86: redefine REX64_PREFIX for clang, which doesn't like 'rex64/'.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
2011-03-07 11:21:11 +00:00
Tim Deegan b021dd99f4 Xen: remove run_in_exception_handler() and recode its only caller
(dump_execution_state()) as its own bug-trap.

This is needed to compile xen with clang, which can't handle using a
function name in an asm immediate.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
2011-03-07 11:21:11 +00:00
Tim Deegan 024456981b credit2: remove two nested functions, replacing them with static ones
and passing the outer scope's variables in explicitly.
This is needed to compile xen with clang.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
2011-03-07 11:21:11 +00:00
Tim Deegan d694e3d8c5 xen: adjust cpumask initializers to suit clang's incomplete gccisms.
This is needed to compile xen with clang.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
2011-03-07 11:21:11 +00:00
Tim Deegan df79b5a8de x86: redefine a few empty macros as explicit nops.
This is needed to compile xen with clang.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
2011-03-07 11:21:11 +00:00
Tim Deegan 794d4b9e85 x86: add explicit size suffixes to some assembly instructions.
This is needed to compile xen with clang.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
2011-03-07 11:21:11 +00:00
Tim Deegan 2631574781 x86: make spinlock's 16-bit asm operand explicitly 16-bit.
This is needed to compile xen with clang.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
2011-03-07 11:21:11 +00:00
Keir Fraser e63aa7c25b x86: Cache read of cpu_state in __cpu_die() for subsequent BUG_ON check.
Otherwise compiler may re-read cpu_state for the BUG_ON and see a
modified value causing erroneous BUG.

Signed-off-by: Keir Fraser <keir@xen.org>
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
2011-03-05 16:02:33 +00:00
Keir Fraser e00d02009d sched_credit: Hold lock while dump scheduler info
Dump runq with debug key 'r' may cause dead loop like below:

(XEN) active vcpus:
(XEN)     1: [1.0] pri=0 flags=0 cpu=0 credit=263 [w=256]
(XEN)     2: [0.2] pri=0 flags=0 cpu=5 credit=284 [w=256]
(XEN)     3: [0.2] pri=0 flags=0 cpu=5 credit=282 [w=256]
...
(XEN)  xxxxx: [0.2] pri=0 flags=0 cpu=2 credit=54 [w=256]
...
(XEN)  xxxxx: [0.2] pri=0 flags=0 cpu=3 credit=-48 [w=256]
...

This means the active vcpu 0.2 became non-active with the active list
element empty just after it was accessed in the loop '2:'.

We should always hold a lock before access scheduler related list,
even in the debug purpose dump code.

Signed-off-by: Wei Gang <gang.wei@intel.com>
2011-03-05 11:36:21 +00:00
Keir Fraser 87fe7478aa x86: On CPU offline, fix master waiting for slave to be fully dead.
On two back-to-back CPU offline operations, on second offline the
cpu_state var will be CPU_STATE_DEAD from the first offline. Hence
__cpu_die() will incorrectly not wait for the second slave to fully
die and set cpu_state itself.

The fix is to set cpu_state to a new value, CPU_STATE_DYING, earlier
during CPU offline, before __cpu_die() starts to execute.

Original diagnosis and patch by Liu, Jinsong <jinsong.liu@intel.com>

Signed-off-by: Keir Fraser <keir@xen.org>
2011-03-05 11:34:41 +00:00
Ian Jackson faf7c3e08d Added signature for changeset 6241fa0ad1a9 2011-03-04 17:33:32 +00:00
Ian Jackson 3c7a69796f Added tag 4.1.0-branched for changeset 6241fa0ad1a9 2011-03-04 17:33:18 +00:00
Ian Jackson 1153faff43 Merge 4.1.0-branched 2011-03-03 18:52:09 +00:00
Wei Gang b99358eeb3 tools: gtracestate: fix several problems
Fixed problems include:
  * previously just print out a error instead of help info
    while running without cmdline parameters.
  * -u & -n lead to Segmentation fault.
  * -c and then use default ranges, the default ranges is not
        50us... but 50000/tsc2us....

Signed-off-by: Wei Gang <gang.wei@intel.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-03 18:51:13 +00:00
Keir Fraser c7f3f82a65 x86, libxc: Fix xc_translate_foreign_address() for PV guests of
different bitness than dom0 (32-bit vs 64-bit).

Original patch by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Keir Fraser <keir@xen.org>
2011-03-03 17:46:44 +00:00
George Dunlap aa6e4a53f6 libxc: Missed one when replacing read_exact with RDEXACT macro
This corrects an error in 21488:dd6bbdc42033.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-03 17:24:27 +00:00
Ian Jackson 3860f61cd1 libxl: correctly initialise yylineno
Sometimes xl would read an uninitialised variable when printing error
messages, resulting in things like this:
  /etc/xen/thing.cfg:1030057088: config parsing error near `"ws08r2-x64-2': lexical error

This is because yylineno is a variable inside the scanner created by
yylex_init, but it is not initialised by yylex_init.
(Debian bug #616099.)

On the way I discovered a lot of complication to do with the calling
convention between bison and flex in reentrant parsers/scanners which
use locations (Debian bug #616100) but as the above change makes the
current code in xen-unstable work I don't propose to do anything else
about that now in our tree.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Tested-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-03 17:11:31 +00:00
Ian Campbell baae0f2bce xl: add "device_model_args" to pass arbitrary extra arguments to device model
The libxl support was already in place so simply plumb it through.
This allows for passing debug options to the device model and provides
a method to work around missing toolstack functionality.

e.g. xl does not current support floppy disks but adding:
     device_model_args = [ "-fda", "/scratch/fdboot.img" ]
allowed me to boot FreeDOS from a floppy image.

I was unable to find any equivalent functionality in xend so this is a
new xl feature.

Moved xmalloc/xrealloc earlier to allow use from parse_config_data.

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-03-03 17:07:40 +00:00
Shriram Rajagopalan dc55dcd8f1 libxc: fix incorrect scanning of pfn array in pagebuf during migration
xc_domain_restore.c:apply_batch function makes two passes over the pfn_types
array in pagebuf to allocate the needed MFNs. The curbatch parameter to this
function specifies the array offset in pfn_types, from where the current scan
should begin. But this variable is not taken into account (index always starts
at 0) during the two passes. While this [bug] does not manifest itsef during
save/restore or live migration, under Remus, xc_domain_restore fails due to
corrupt guest page tables.

(This appears to have been broken by 21588:6c3d8aec202d which reverted
two changesets from before Remus support was added and hence
reintroduced some none-Remus compatible bits.)

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-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-03-03 16:55:27 +00:00
George Dunlap 4804b5c5ae credit2: Add more debugging
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
2011-03-03 15:14:30 +00:00
Liu, Jinsong 67a93c8da5 x86: Fix cpu online/offline bug: mce memory leak.
Current Xen mce logic didn't free mcabanks. This would be a memory
leak when cpu offline.  When repeatly do cpu online/offline, this
memory leak would make xenpool shrink, and at a time point, will call
alloc_heap_pages --> flush_area_mask, which
ASSERT(local_irq_is_enabled()).  However, cpu online is irq disable,
so it finally result in Xen crash.

This patch fix the memory leak bug, and tested OK over 50,000 round
cpu online/offline.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Signed-off-by: Keir Fraser <keir@xen.org>
2011-03-02 10:31:06 +00:00
Keir Fraser 4947f9bdc8 x86: Disable IRQs and do WBINVD first in play_dead().
When we advertise we are dead via cpu_exit_clear(), it is no longer
safe to handle interrupts as our per-cpu vars can go away.

In future, we may want to think about NMI handling in this scenario
too.

Signed-off-by: Keir Fraser <keir@xen.org>
2011-03-02 10:23:23 +00:00
Shan Haitao b0dc112d76 x86: Add warning comment explaining restrictions to play_dead().
Signed-off-by: Shan Haitao <haitao.shan@intel.com>
Signed-off-by: Keir Fraser <keir@xen.org>
2011-03-02 10:01:55 +00:00
Keir Fraser 2bbea265aa Update Xen version to 4.1.0-rc7-pre 2011-02-28 16:55:20 +00:00
Keir Fraser 2de206918f Added signature for changeset 7b6791dbfecd 2011-02-28 16:54:55 +00:00
Keir Fraser 4271b4ddb0 Added tag 4.1.0-rc6 for changeset 7b6791dbfecd 2011-02-28 16:54:27 +00:00
Keir Fraser 4a649c84f5 Update Xen version to 4.1.0-rc6 4.1.0-rc6 2011-02-28 16:54:15 +00:00
Juergen Gross 2e13a886e5 Avoid possible live-lock in vcpu_migrate
If vcpu_migrate is called for two vcpus active on different cpus
resulting in swapping the cpus, a live-lock could occur as both
instances try to take the scheduling lock of the physical cpus in
opposite order.

To avoid this problem the locks are always taken in the same order
(sorted by the address of the lock).

Signed-off-by: Jueregn Gross <juergen.gross@ts.fujitsu.com>
2011-02-28 15:09:33 +00:00
Ian Jackson 80ce9f75e5 xl: allow config filename to precede options
"xm create" supports options which follow the domain config filename.
So xl should do as well.

This is an ad-hoc fixup to the "xl create" command line parser.  We
should revisit the xl command line parser in 4.2.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Reported-by: W. Michael Petullo <mike@flyn.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-02-25 18:43:48 +00:00
Stefano Stabellini 832085e21c xl: fix tap:aio disk parsing
Fix "tap:aio" parsing in xl after 22921

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-02-25 18:41:34 +00:00
George Dunlap c15cad7df6 libxc: Handle failed xc_get_hvm_param in domain save
The domain save code will read an HVM param, and if it's not zero,
make an entry for it.  However, if the hypercall fails for any reason,
the data may not be written, and the value for the previous parameter
may be written in the save file as the parameter that failed.

Initialize the value to zero before each hypercall, so that in case of
a failure, no value will be written.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-02-25 17:26:18 +00:00
Shriram Rajagopalan 8bcd286054 remus: fix incorrect disk_info_t initialization
Fix tapdisk-disktype.c's initialization for remus' disk_info_t,
which is currently initializing the disk name with disk description.

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-02-25 17:23:58 +00:00
Ian Jackson 70628d024d libxl: Multi-device passthrough coldplug: do not wait for unstarted guest
When doing a PCI passthrough, the code checks to see whether there is
an existing backend directory in xenstore with a nonzero "num_devs".
If there isn't, it creates the backend directory with just the
required device.

If there is, it would assume that it was doing hotplug.  If doing
hotplug, it needs to set the "state" node in xenstore to "7"
(reconfiguring) and thus avoid racing with the backend needs to wait
for the backend to be "4" (connected).

However during guest creation, the presence of "num_devs" doesn't
necessarily mean hotplug.  If we are still creating the initial
xenstore setup (ie, adding devices as a subroutine of domain
creation), we can just write the new devices to xenstore.  So do that.

This involves adding a new parameter "starting", indicating that we
are still in domain creation, to libxl_device_pci_add_xenstore (a
misnamed internal function) and its callers.  Its callers include
libxl_device_pci_add which we therefore split into an internal version
with the new parameter, and an external version used only for hotplug
by libxl-using applications.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-02-25 17:15:20 +00:00
Ian Jackson 67743d23a8 libxl: do not ignore errors from libxl_device_pci_add_xenstore in do_pci_add
Without this, some failures of PCI device passthrough would be
ignored.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-02-25 17:13:53 +00:00
Ian Campbell c544f6db0c xl/libxl: treat vif "ip" fields as a simple string
Currently we parse the string as an IPv4 address but this does not
handle IPv6. We then format the IP address as a string into xenstore.
Rather than add further parsing and formatting to support IPv6 simply
treat the field as a string, which it turns out is all xend does.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-02-25 17:03:55 +00:00
Stefano Stabellini 69ec10d36a x86 NMI: continue in case of PCI SERR erros
Memory parity error is only valid for IBM PC-AT, newer machines use
bit 7 (0x80) of 0x61 port for PCI SERR. While memory errors are
usually reported via MCE.

Rename the memory parity error handler to pci serr handler and
print a warning and continue instead of crashing.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2011-02-25 11:29:45 +00:00
Juergen Gross 53582e3da0 cpupool: Avoid race when moving cpu between cpupools
Moving cpus between cpupools is done under the schedule lock of the
moved cpu.  When checking a cpu being member of a cpupool this must be
done with the lock of that cpu being held.  Hot-unplugging of physical
cpus might encounter the same problems, but this should happen only
very rarely.

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Acked-by: Andre Przywara <andre.przywara@amd.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
2011-02-25 11:28:15 +00:00
Keir Fraser a0f5d3f3b7 amd-k8-mce: remove a stray break statement
This was a leftover of converting from a switch to an if/else
somewhere between 3.4 and 4.0.

It also looks suspicious that MCEQUIRK_K7_BANK0 is not actually used
anywhere. Perhaps amd_k7_mcheck_init() and amd_k8_mcheck_init() were
intended to get (partially) folded?

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-02-24 09:33:19 +00:00
Keir Fraser 0132f2f2fc x86: Fix mwait usage when doing cpu offline
When cpu is offlined, it cannot access per cpu variable at all.
This patch avoids using per_cpu variable inside play_dead.

Signed-off-by: Shan Haitao <haitao.shan@intel.com>
Signed-off-by: Wei Gang <gang.wei@intel.com>
2011-02-24 09:32:41 +00:00
Wei Gang 3af87a7ece x86: add strictly sanity check for XSAVE/XRSTOR
Replace most checks on cpu_has_xsave with checks on new fn
xsave_enabled(), do additional sanity checks in the new fn.

Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Keir Fraser <keir.xen@gmail.com>
2011-02-21 09:11:57 +00:00
Christoph Egger 0dba10b8e3 libxl regression: don't require vncpasswd when password is empty string
Don't require an empty password when the guest config file
has the entry
     vncpasswd=''

Instead, do not require a password at all in this case.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-02-18 19:07:11 +00:00
Ian Campbell ce30570ae8 libxl/xl: enable support for routed network configurations.
Add "vifscript" option to xl.conf which configures the default vif
script to use (default remains "vif-bridge")

Write each VIFs "ip" option to xenstore so the vif-route script can
pick it up.

Reported-by: W. Michael Petullo <mike@flyn.org>.
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-02-18 15:32:02 +00:00
Stefano Stabellini b9ef3bf4e1 libxl: fix cd insert/eject
When multiple disks are passed to libxl_wait_for_disk_ejects, watch the
correct disk paths.

Parse the backend type and backend domid from xenstore in
libxl_event_get_disk_eject_info.

libxl_event_get_disk_eject_info must return a valid string in
disk->vdev, while at the moment is free'ed before returning.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-02-18 15:04:19 +00:00
KUWAMURA Shin'ya d721a18a0d [IA64] fix missing header: asm/fpswa.h
This patch fixes the following error in recent kernel:
  ia64/asm/dom_fw_common.h:47:23: error: asm/fpswa.h: No such file or
  directory

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
2011-02-18 10:21:19 +00:00
Signed-off-by: Jim Fehlig fc235724cd libxl: Clear file object on successful munmap()
Clear members of libxl_file_reference when file is successfully unmapped.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-02-17 19:52:20 +00:00
Stefano Stabellini 0cfffb1f9e libxl: remove the entries from xenstore when destroying a disk
Currently we are only changing the backend state but it is not enough to
entirely destroying a disk device: remove all the entries from xenstore
as well.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-02-17 19:50:44 +00:00
Stefano Stabellini 7b289f9e42 libxl: create xenstore backend for empty disks
We still need to create the vbd backend in xenstore even if the disk
format is DISK_FORMAT_EMPTY.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-02-17 19:49:57 +00:00
Stefano Stabellini 1c0d8c69ec xl: fix cdrom_insert parsing
Reuse the same code used to parse the disk line from the VM config file
in cd_insert.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-02-17 19:49:00 +00:00