]> xenbits.xensource.com Git - xen.git/log
xen.git
15 years agocpupools, xend: Add missing file XendCPUPool.py
Keir Fraser [Fri, 23 Apr 2010 14:04:26 +0000 (15:04 +0100)]
cpupools, xend: Add missing file XendCPUPool.py

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
15 years agoAdd debug-key 'D' to dump EPT p2m table.
Keir Fraser [Fri, 23 Apr 2010 07:40:58 +0000 (08:40 +0100)]
Add debug-key 'D' to dump EPT p2m table.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
15 years agoxl: support oos domain parameter
Keir Fraser [Fri, 23 Apr 2010 07:39:29 +0000 (08:39 +0100)]
xl: support oos domain parameter

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Acked-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agocpupools: optimise domain creation if pool movement is a no-op
Keir Fraser [Fri, 23 Apr 2010 07:38:35 +0000 (08:38 +0100)]
cpupools: optimise domain creation if pool movement is a no-op

Signed-off by: Juergen Gross <juergen.gross@ts.fujitsu.com>

15 years agoRevert 21224:a7947fd90328 "xend: earlier remove the backend of tapdisk device"
Keir Fraser [Fri, 23 Apr 2010 07:37:19 +0000 (08:37 +0100)]
Revert 21224:a7947fd90328 "xend: earlier remove the backend of tapdisk device"

Consensus is that this is not the correct fix.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoconsole: Make initial static console buffer __initdata.
Keir Fraser [Thu, 22 Apr 2010 16:43:56 +0000 (17:43 +0100)]
console: Make initial static console buffer __initdata.

The previous scheme --- freeing an area of BSS --- did not interact
nicely with device passthrough as IOMMU will not have any Xen BSS area
in guest device pagetables. Hence if the freed BSS space gets
allocated to a guest, DMAs to guest's own memory can fail.

The simple solution here is to always free the static buffer at end of
boot (initmem is specially handled for IOMMUs) and require a
dynamically-allocated buffer always to be created.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoxend: earlier remove the backend of tapdisk device in
Keir Fraser [Thu, 22 Apr 2010 08:44:29 +0000 (09:44 +0100)]
xend: earlier remove the backend of tapdisk device in
xenstore to release the resource allocated in backend driver
lies in dom0'kernel

Blktapctl thread will use qemu-dm connection instead of tapdisk-ioemu
in the case of FV VM. We found the resource like memory allocated for
this Guest can't be free for backend driver couldn't be closed in qemu-dm.

This patch would  remove the backend of tapdisk device earlier in
xenstore to triger qemu-dm to notify the backend driver to release the
resource allocated.
I have tested this patch at the case of
1, save && restore
2, destory && shutdown
3, snapshot

Signed-off-by: James ( Song Wei ) <jsong@novell.com>
15 years agoxend: don't drop device config on domain start failure
Keir Fraser [Thu, 22 Apr 2010 08:42:37 +0000 (09:42 +0100)]
xend: don't drop device config on domain start failure

If domain creation in xend fails before devices are configured, e.g.
insufficient memory, device config is dropped from xend's managed
domain config.

Once xend is restarted, the domain's devices are lost.

This patch fixes a bug in XendConfig where only the device
controller was consulted for device configuration.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
15 years agoHAP 1GB: Add corner case handling for 1GB super page.
Keir Fraser [Thu, 22 Apr 2010 08:41:36 +0000 (09:41 +0100)]
HAP 1GB: Add corner case handling for 1GB super page.

 - Without the check, guest memory allocation will never reach the
   boundary of a 1GB super page.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
15 years agoxl: add "xl info" command
Keir Fraser [Thu, 22 Apr 2010 08:39:58 +0000 (09:39 +0100)]
xl: add "xl info" command

The info subcommand was missing from the xl tool. Use the new libxl
wrapper functions to create a clone of "xm info". The splitting into
several smaller functions is enspired by the implementation in
XendNode.py.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Acked-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxl: add version_info function
Keir Fraser [Thu, 22 Apr 2010 08:39:17 +0000 (09:39 +0100)]
libxl: add version_info function

Xen provides a xen_version hypercall to query the values of several
interesting things (like hypervisor version, commandline used, actual
changeset, etc.). Create a user-friendly and efficient wrapper around
the libxc function to provide values for xl info output.
Since the information is static during the whole runtime, we store
it within the libxl_ctx structure and just deliver the pointer on
subsequent calls.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Acked-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxl: add sched_get_id function
Keir Fraser [Thu, 22 Apr 2010 08:38:39 +0000 (09:38 +0100)]
libxl: add sched_get_id function

To get the name of the currently used scheduler, Xen provides a
sched_id sysctl. Add a libxl wrapper around the libxc function to
query this.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Acked-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxl: extend physinfo structure
Keir Fraser [Thu, 22 Apr 2010 08:37:31 +0000 (09:37 +0100)]
libxl: extend physinfo structure

The libxl version of the physinfo sysctl does not contain some
fields like nr_nodes or capabilities needed for xl info output.
Add them to the structure and the retrieving function.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Acked-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agocpupools [6/6]: Documentation changes
Keir Fraser [Wed, 21 Apr 2010 11:51:53 +0000 (12:51 +0100)]
cpupools [6/6]: Documentation changes

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
15 years agocpupools [5/6]: xm-test add-ons
Keir Fraser [Wed, 21 Apr 2010 11:51:13 +0000 (12:51 +0100)]
cpupools [5/6]: xm-test add-ons

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
15 years agocpupools [4/6]: python/xend changes
Keir Fraser [Wed, 21 Apr 2010 11:50:32 +0000 (12:50 +0100)]
cpupools [4/6]: python/xend changes

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
15 years agocpupools [3/6]: libxen changes
Keir Fraser [Wed, 21 Apr 2010 11:49:41 +0000 (12:49 +0100)]
cpupools [3/6]: libxen changes

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
15 years agocpupools [2/6]: libxc changes
Keir Fraser [Wed, 21 Apr 2010 11:49:00 +0000 (12:49 +0100)]
cpupools [2/6]: libxc changes

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
15 years agocpupools [1/6]: hypervisor changes
Keir Fraser [Wed, 21 Apr 2010 11:48:03 +0000 (12:48 +0100)]
cpupools [1/6]: hypervisor changes

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
15 years agodocs: Add tmem documentation
Keir Fraser [Wed, 21 Apr 2010 07:31:31 +0000 (08:31 +0100)]
docs: Add tmem documentation

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
15 years agoxen: build fix GNU sed vs. BSD sed
Keir Fraser [Wed, 21 Apr 2010 07:30:45 +0000 (08:30 +0100)]
xen: build fix GNU sed vs. BSD sed

Fixes the build error below:

gmake[5]: Entering directory `xen/arch/x86/boot'
gcc  -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -m32
-march=3Di686 -g -fno-strict-aliasing -std=3Dgnu99 -Wall
-Wstrict-prototypes
-Wno-unused-value -Wdeclaration-after-statement  -fno-stack-protector
-Werror -fno-builtin -msoft-float -c reloc.c -o reloc.o
ld -melf_i386 -N -Ttext  -o reloc.lnk reloc.o
ld: invalid hex number `-o'

BSD sed does not support the '+' in the basic re while gnu sed does.
BSD sed supports '+' in the extended re and uses the -E flag while
gnu sed uses -r.

The only difference with the original version is that the '+'
qualifier is replaced with '\{1\,\}' which should work with both BSD
sed and GNU sed.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoTools: add online/offline hotplug user interfaces
Keir Fraser [Wed, 21 Apr 2010 07:29:26 +0000 (08:29 +0100)]
Tools: add online/offline hotplug user interfaces

Exporting cpu on/offline and memory on/offline hotplug interfaces,
so that users can do those (memory/cpu) hotplug actions with
following command line freely:

usage: xen-hptool <command> [args]
    xen-hptool command list:\n\n
    cpu-online    <cpuid>    online CPU <cpuid>
    cpu-offline   <cpuid>    offline CPU <cpuid>
    mem-online    <mfn>      online MEMORY <mfn>
    mem-offline   <mfn>      offline MEMORY <mfn>
    mem-status    <mfn>      query Memory status<mfn>

Signed-off-by: Yunhong Jiang<yunhong.jiang@intel.com>
Signed-off-by: Liping Ke <liping.ke@intel.com>
15 years agotasklet: Add lock-free exit path from do_tasklet() when no work to do.
Keir Fraser [Tue, 20 Apr 2010 13:32:53 +0000 (14:32 +0100)]
tasklet: Add lock-free exit path from do_tasklet() when no work to do.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86: No need to sync_local_execstate() during CPU hot-unplug.
Keir Fraser [Tue, 20 Apr 2010 06:54:47 +0000 (07:54 +0100)]
x86: No need to sync_local_execstate() during CPU hot-unplug.

This is done implicitly when we enter stopmachine_run() context,
because the underlying tasklet mechanism performs the sync before
running a tasklet handler.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86: Rename __sync_lazy_execstate() to __sync_local_execstate().
Keir Fraser [Mon, 19 Apr 2010 16:57:28 +0000 (17:57 +0100)]
x86: Rename __sync_lazy_execstate() to __sync_local_execstate().

This naming scheme is more rational. Also use non-x86-specific
function sync_local_execstate() where possible.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86 hvm: Simplify vlapic init-sipi logic (no async pause logic)
Keir Fraser [Mon, 19 Apr 2010 16:53:10 +0000 (17:53 +0100)]
x86 hvm: Simplify vlapic init-sipi logic (no async pause logic)

This is possible now that tasklets run in idle-vcpu context

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoSynchronise lazy execstate before calling tasklet handlers.
Keir Fraser [Mon, 19 Apr 2010 16:48:20 +0000 (17:48 +0100)]
Synchronise lazy execstate before calling tasklet handlers.

This ensures we are properly running on idle-vcpu state, which certain
things (e.g., use of vmx_vmcs_{enter,exit}) rely on. It also means we
don't need to do the same thing in the stopmachine_run handler.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agotmem: (re-)enable by default
Keir Fraser [Mon, 19 Apr 2010 16:20:43 +0000 (17:20 +0100)]
tmem: (re-)enable by default

Late in the 4.0 release it was discovered that certain order>0
allocations could fail and had no fallback.  This conflicted with
tmem especially when combined with aggressive ballooning.
A hack-y workaround patch was added in time for 4.0 that has
reduced (but not completely eliminated) the problem but
tmem was left disabled-by-default for the 4.0 release.

Re-enable it in xen-unstable by default to help identify cases
where the workaround is insufficient.   Tmem can be
disabled with the no-tmem Xen boot option.  Please report
failures (that are fixed with the no-tmem option) to me.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
15 years agostopmachine: Implement using tasklets rather than a softirq.
Keir Fraser [Mon, 19 Apr 2010 10:47:59 +0000 (11:47 +0100)]
stopmachine: Implement using tasklets rather than a softirq.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86: Simplify freeze_domains() and thaw_domains(). Since they now
Keir Fraser [Mon, 19 Apr 2010 10:34:49 +0000 (11:34 +0100)]
x86: Simplify freeze_domains() and thaw_domains(). Since they now
run in idle-vcpu context, no care needs to be taken about pausing
'current'.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoCleanups to cpu_disable_scheduler().
Keir Fraser [Mon, 19 Apr 2010 10:30:51 +0000 (11:30 +0100)]
Cleanups to cpu_disable_scheduler().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoRevert 21180:11423ce78ee0, 21181:9d5ecf79f1b5, 21185:fddff17c7c74.
Keir Fraser [Mon, 19 Apr 2010 10:16:06 +0000 (11:16 +0100)]
Revert 21180:11423ce78ee0, 21181:9d5ecf79f1b5, 21185:fddff17c7c74.

Unnecessary now that tasklets run in vcpu context.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoSimplify continue_hypercall_on_cpu() now that it runs in vcpu context.
Keir Fraser [Mon, 19 Apr 2010 10:07:14 +0000 (11:07 +0100)]
Simplify continue_hypercall_on_cpu() now that it runs in vcpu context.

We do not need to take so much care over putting the original vcpu to
sleep, as it will not be spinning on progress of the idle vcpu.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoImplement tasklets as running in VCPU context (sepcifically, idle-VCPU context)
Keir Fraser [Mon, 19 Apr 2010 09:12:41 +0000 (10:12 +0100)]
Implement tasklets as running in VCPU context (sepcifically, idle-VCPU context)

...rather than in softirq context. This is expected to avoid a lot of
subtle deadlocks relating to the fact that softirqs can interrupt a
scheduled vcpu.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoMove tasklet implementation into its own source files.
Keir Fraser [Mon, 19 Apr 2010 09:06:42 +0000 (10:06 +0100)]
Move tasklet implementation into its own source files.

This is preparation for implementing tasklets in vcpu context rather
than softirq context. There is no change to the implementation of
tasklets in this patch.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoCalling awk and not gawk in the Xen scripts
Keir Fraser [Mon, 19 Apr 2010 08:00:30 +0000 (09:00 +0100)]
Calling awk and not gawk in the Xen scripts

I noticed that 2 scripts in Xen 4.0.0 are calling "gawk". Normally, in
most distributions, gawk is considered a specific version of awk.
Calling "gawk" and not "awk" generally means that you need
specificities of the "g" version of awk, as opposed to "mawk" which is
another implementation of the same tool.

So, unless I misread the scripts, Xen doesn't need to use gawk but
just any implementation of awk, and the attached patch can safely be
applied.

If I am wrong (which I don't think I am at the first look) and that
there's a reason why gawk is used and not awk, then IMHO, the toplevel
README should mention it in the prerequisites.

From: Thomas Goirand <thomas@goirand.fr>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoxend: support 'ioemu' subtype in tap protocol specification
Keir Fraser [Mon, 19 Apr 2010 07:59:14 +0000 (08:59 +0100)]
xend: support 'ioemu' subtype in tap protocol specification

blktapctrl supports both 'tapdisk' and 'ioemu' subtypes in tap
protocol specification.  Support the 'ioemu' subtype in xend
BlktapController as well.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
15 years agotools/hotplug/Linux/blktap: remove optional tapdisk: prefix
Keir Fraser [Mon, 19 Apr 2010 07:58:43 +0000 (08:58 +0100)]
tools/hotplug/Linux/blktap: remove optional tapdisk: prefix

Perhaps this should even be further generalized (e.g. to remove any
"[!/]*:" pattern prefixes) to be more forward compatible?

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agomce: Add a x86_mcinfo_reserve() function, to reserve space from mc_info.
Keir Fraser [Mon, 19 Apr 2010 07:55:33 +0000 (08:55 +0100)]
mce: Add a x86_mcinfo_reserve() function, to reserve space from mc_info.

With this method, we don't need to collect bank and globalinformation
to a local variable and do x86_mcinfo_add() to copy that information
to mc_info.  This avoid copy and also we can be aware earlier if there
is enough space in the mc_info.

Also extract function that get global/bank information to seperated
function mca_init_bank/mca_init_global.

It's meaningless to get the current information in mce context, keep
it here but should be removed in future.

Also a flag added to mc_info, to indicate some information is lost due
to OOM.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
15 years agoClean up MCA MSR virtualization and vMCE injection
Keir Fraser [Mon, 19 Apr 2010 07:54:53 +0000 (08:54 +0100)]
Clean up MCA MSR virtualization and vMCE injection

Remove all virtual MCE related work into a seperated file.
It also try to do some clean-up on the vMCE, including:
a) renmae some function name like mce_init_msr/mce_rdmsr to be
   vmce_init_msr/vmce_rdmsr to make it more straightforward,
b) make the vmca_msrs be a pointer in arch_domain,
    to decrease arch_domain's size
c) extract per-bank MCA MSR access to be seperated function
    (bank_mce_wrmsr/bank_mce_rdmsr) to make it be a bit cleaner.
d) A new file xen/include/asm-x86/mce.h  is added for vmce related
header.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
15 years agox86: Revert how we calculate 'total system RAM' after c/s 20236.
Keir Fraser [Thu, 15 Apr 2010 18:11:16 +0000 (19:11 +0100)]
x86: Revert how we calculate 'total system RAM' after c/s 20236.

This approach is more straightforward, in that it simply works the
original e820 map. It's what the user expects, and reporting a smaller
value is never appreciated. ;-)

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86_emulate: Emulate CLFLUSH instruction
Keir Fraser [Thu, 15 Apr 2010 17:47:58 +0000 (18:47 +0100)]
x86_emulate: Emulate CLFLUSH instruction

We recently found that FreeBSD 8.0 guest failed to install and boot on
Xen. The reason was that FreeBSD detected clflush feature and invoked
this instruction to flush MMIO space. This caused a page fault; but
x86_emulate.c failed to emulate this instruction (not supported). As a
result, a page fault was detected inside FreeBSD. A similar issue was
reported earlier.

http://lists.xensource.com/archives/html/xen-devel/2010-03/msg00362.html

From: Wei Huang <wei.huang2@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agopygrub: Fix Grub2 support for Ubuntu 10.04
Keir Fraser [Thu, 15 Apr 2010 16:36:55 +0000 (17:36 +0100)]
pygrub: Fix Grub2 support for Ubuntu 10.04

Due to changes in grub2, menu entry titles now have single quote
around them rather than double quotes, but the memtest entries still
are using double quotes, so we need to catch both.

Signed-off-by: David Markey <david.markey@citrix.com>
15 years agoxend: fix best NUMA node allocation
Keir Fraser [Thu, 15 Apr 2010 16:36:16 +0000 (17:36 +0100)]
xend: fix best NUMA node allocation

Since we moved several NUMA info fields from physinfo into separate
functions/structures, we must adapt the node picking algorithm, too.
Currently xm create complains about undefined hash values.
The patch uses the new Python xc binding to get the information and
create a reverse mapping for node_to_cpu, since we now only have a
cpu_to_node field.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
15 years agoxend: make NUMA in xm info optional (dependent on new -n switch)
Keir Fraser [Thu, 15 Apr 2010 12:16:17 +0000 (13:16 +0100)]
xend: make NUMA in xm info optional (dependent on new -n switch)

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
15 years agoacpi sleep: Must acquire hypercall_deadlock_mutex when a domain
Keir Fraser [Thu, 15 Apr 2010 12:06:48 +0000 (13:06 +0100)]
acpi sleep: Must acquire hypercall_deadlock_mutex when a domain
freezes its own vcpus.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoxend: Fix numainfo/topologyinfo loop iterators in Xc extension.
Keir Fraser [Thu, 15 Apr 2010 11:29:48 +0000 (12:29 +0100)]
xend: Fix numainfo/topologyinfo loop iterators in Xc extension.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
15 years agoFix changeset 21153:d2d8805868f1 (xend can't start)
Keir Fraser [Thu, 15 Apr 2010 11:28:33 +0000 (12:28 +0100)]
Fix changeset 21153:d2d8805868f1 (xend can't start)

21153 forgets to update the format string so xend can't start.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
15 years agolibfsimage: zfs build fix for NetBSD
Keir Fraser [Thu, 15 Apr 2010 11:24:16 +0000 (12:24 +0100)]
libfsimage: zfs build fix for NetBSD

uchar_t is not defined because both FSYS_ZFS and FSIMAGE
are defined at build time.
Also fix warnings with ctype.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
15 years agoacpi sleep: domain_freeze() pauses all vcpus, but does not sync the
Keir Fraser [Thu, 15 Apr 2010 11:21:00 +0000 (12:21 +0100)]
acpi sleep: domain_freeze() pauses all vcpus, but does not sync the
current vcpu (since that would obviously deadlock).

This simplifies thaw_domains() which is required now that thawing can
happen in deifferent context to freeze_domains().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoacpi sleep: Rearrange code for entering system sleep states.
Keir Fraser [Thu, 15 Apr 2010 10:36:20 +0000 (11:36 +0100)]
acpi sleep: Rearrange code for entering system sleep states.

We cannot freeze_domains in hypercall-continuation context any more,
since that is a softirq context which can interrupt an arbitrary
vcpu. Hence sleeping all vcpus in that context can easily deadlock
(against the vcpu we interrupted). So rearrange the code to
freeze_domains before calling continue_hypercall_on_cpu().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoUpdate comments around spin_trylock() usage for sysctl and xenpf locks.
Keir Fraser [Thu, 15 Apr 2010 10:33:39 +0000 (11:33 +0100)]
Update comments around spin_trylock() usage for sysctl and xenpf locks.

Since the execution of stop_machine_run() via cpu_down() is now always
deferred to a hypercall continuation context, the above locks are not
held at that time. Hence the trylock is not specifically to avoid
deadlock with stop_machine_run(), but rather a more general paranoia
about deadlocks in general.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agocontinue_hypercall_on_cpu() always defers execution of the continuation
Keir Fraser [Thu, 15 Apr 2010 10:31:58 +0000 (11:31 +0100)]
continue_hypercall_on_cpu() always defers execution of the continuation

...even when scheduled to run on the current physical cpu. This
ensures that locks get dropped correctly before executing the
continuation code, and also allows the original caller to determine
whether the continuation has/will execute based on c_h_o_c()'s
immediate return code.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoMake cpu param to continue_hypercall_on_cpu() an unsigned integer.
Keir Fraser [Thu, 15 Apr 2010 08:04:45 +0000 (09:04 +0100)]
Make cpu param to continue_hypercall_on_cpu() an unsigned integer.

Negative input makes no sense, and this makes the input range check
correct.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoFix tasklet_action() to notify correct cpu when running tasklet is rescheduled.
Keir Fraser [Thu, 15 Apr 2010 08:03:43 +0000 (09:03 +0100)]
Fix tasklet_action() to notify correct cpu when running tasklet is rescheduled.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoRemus: fix alignment bug in python rtnl library
Keir Fraser [Thu, 15 Apr 2010 07:42:40 +0000 (08:42 +0100)]
Remus: fix alignment bug in python rtnl library

Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
15 years agoRemus: make ebt_imq and sch_queue compatible with pvops
Keir Fraser [Thu, 15 Apr 2010 07:42:08 +0000 (08:42 +0100)]
Remus: make ebt_imq and sch_queue compatible with pvops

Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
15 years agoImprovements and bug fixes to continue_hypercall_on_cpu().
Keir Fraser [Wed, 14 Apr 2010 12:35:05 +0000 (13:35 +0100)]
Improvements and bug fixes to continue_hypercall_on_cpu().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agocredit2: Add toolstack options to control credit2 scheduler parameters
Keir Fraser [Wed, 14 Apr 2010 11:10:19 +0000 (12:10 +0100)]
credit2: Add toolstack options to control credit2 scheduler parameters

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agocredit2: Add credit2 scheduler to hypervisor
Keir Fraser [Wed, 14 Apr 2010 11:07:21 +0000 (12:07 +0100)]
credit2: Add credit2 scheduler to hypervisor

This is the core credit2 patch.  It adds the new credit2 scheduler to
the hypervisor, as the non-default scheduler.  It should be emphasized
that this is still in the development phase, and is probably still
unstable.  It is known to be suboptimal for multi-socket systems.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agocredit2: Add a scheduler-specific schedule trace class
Keir Fraser [Wed, 14 Apr 2010 11:06:05 +0000 (12:06 +0100)]
credit2: Add a scheduler-specific schedule trace class

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agocredit2: Flexible cpu-to-schedule-spinlock mappings
Keir Fraser [Wed, 14 Apr 2010 11:05:31 +0000 (12:05 +0100)]
credit2: Flexible cpu-to-schedule-spinlock mappings

Credit2 shares a runqueue between several cpus.  Rather than have
double locking and dealing with the cpu-to-runqueue races, allow
the scheduler to redefine the sched_lock-to-cpu mapping.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agocredit2: Add context_saved scheduler callback
Keir Fraser [Wed, 14 Apr 2010 11:03:27 +0000 (12:03 +0100)]
credit2: Add context_saved scheduler callback

Because credit2 shares a runqueue between several cpus, it needs
to know when a scheduled-out process has finally been context-switched
away so that it can be added to the runqueue again.  (Otherwise it may
be grabbed by another processor before the context has been properly
saved.)

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agoPort latest grub zfs boot code to pygrub
Keir Fraser [Wed, 14 Apr 2010 10:56:54 +0000 (11:56 +0100)]
Port latest grub zfs boot code to pygrub

Signed-off-by: Mark Johnson <mark.r.johnson@oracle.com>
Add -Werror to CFLAGS and fix numerous warnings/errors.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoArchitecture-independent, and tasklet-based, continue_hypercall_on_cpu().
Keir Fraser [Wed, 14 Apr 2010 10:29:05 +0000 (11:29 +0100)]
Architecture-independent, and tasklet-based, continue_hypercall_on_cpu().

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoPer-cpu tasklet lists.
Keir Fraser [Wed, 14 Apr 2010 09:44:29 +0000 (10:44 +0100)]
Per-cpu tasklet lists.

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoxentrace: Add missing help option
Keir Fraser [Tue, 13 Apr 2010 17:19:33 +0000 (18:19 +0100)]
xentrace: Add missing help option

Describe the --reserve-disk-space option in the xentrace help.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agoxentrace: Add an option not to enable tracing
Keir Fraser [Tue, 13 Apr 2010 17:19:10 +0000 (18:19 +0100)]
xentrace: Add an option not to enable tracing

Add an option that will set up the buffers and listen for updates,
but will not enable tracing.  This is useful if you have hacks
in Xen to enable tracing at key points (for example, debugging a
shadow bug).

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agoxentrace: Skip to low cpu when throwing away portions of the circular buffer
Keir Fraser [Tue, 13 Apr 2010 17:18:36 +0000 (18:18 +0100)]
xentrace: Skip to low cpu when throwing away portions of the circular buffer

Skip to the next "low" cpu when throwing away portions of the circular
memory buffer.  This makes subsequent analysis easier.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agoMake c/s 21089 work again with c/s 21092
Keir Fraser [Tue, 13 Apr 2010 14:38:27 +0000 (15:38 +0100)]
Make c/s 21089 work again with c/s 21092

Unfortunately the latter c/s' change to mpparse.c yielded the former
patch non-functional - Xen's serial port IRQ is not in IQR_DISABLED
state, yet must be allowed to get its trigger mode and polarity set
up in order for it to be usable.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agosysctl: Fix XEN_SYSCTL_debug_keys error path.
Keir Fraser [Tue, 13 Apr 2010 12:40:58 +0000 (13:40 +0100)]
sysctl: Fix XEN_SYSCTL_debug_keys error path.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoClean up numa-info sysctl.
Keir Fraser [Tue, 13 Apr 2010 12:27:46 +0000 (13:27 +0100)]
Clean up numa-info sysctl.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agolibxl: <sys/signal.h> -> <signal.h>
Keir Fraser [Tue, 13 Apr 2010 11:48:17 +0000 (12:48 +0100)]
libxl: <sys/signal.h> -> <signal.h>

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoUpdate QEMU_TAG to b5160622517fb2d16d0836172a2e34633c9d94bf
Keir Fraser [Tue, 13 Apr 2010 11:45:51 +0000 (12:45 +0100)]
Update QEMU_TAG to b5160622517fb2d16d0836172a2e34633c9d94bf

15 years agolibxl: build fix for netbsd
Keir Fraser [Tue, 13 Apr 2010 11:21:28 +0000 (12:21 +0100)]
libxl: build fix for netbsd

<sys/signal.h> is needed to get definition for SIGPIPE and SIG_IGN.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
15 years agop2m: merge ptp allocation
Keir Fraser [Tue, 13 Apr 2010 11:20:48 +0000 (12:20 +0100)]
p2m: merge ptp allocation

Signed-off-by: Christoph Egger <Christop.Egger@amd.com>
15 years agoTopology-info sysctl cleanups.
Keir Fraser [Tue, 13 Apr 2010 08:38:54 +0000 (09:38 +0100)]
Topology-info sysctl cleanups.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agosysctl: Remove sockets_per_node field from physinfo command.
Keir Fraser [Tue, 13 Apr 2010 07:37:16 +0000 (08:37 +0100)]
sysctl: Remove sockets_per_node field from physinfo command.

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
15 years agoxentrace: fix lost records resume
Keir Fraser [Mon, 12 Apr 2010 17:28:33 +0000 (18:28 +0100)]
xentrace: fix lost records resume

Reorder the SCHED_SWITCH trace before the runstate change trace to fix
a problem with the lost records "resume" code.

Namely: The "lost records" trace includes the currently running
process.  But during SCHED_SWITCH, it reads the wrong value, confusing
xenalyze.  Making sure there are no trace records between runstate
change trace and the actual context switch fixes it.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agoxentrace: Bounds checking and error handling
Keir Fraser [Mon, 12 Apr 2010 16:54:48 +0000 (17:54 +0100)]
xentrace: Bounds checking and error handling

Check tbuf_size to make sure that it will fit on the t_info struct
allocated at boot.   Also deal with allocation failures more
gracefully.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agox86, shadow: Fix read-to-use race condition
Keir Fraser [Mon, 12 Apr 2010 16:51:56 +0000 (17:51 +0100)]
x86, shadow: Fix read-to-use race condition

If OOS mode is enabled, after last possible resync, read the guest l1e
one last time.  If it's different than the original read, start over
again.

This fixes a race which can result in inconsistent in-sync shadow
tables, leading to corruption:

v1: take page fault, read gl1e from an out-of-sync PT.
v2: modify gl1e, lowering permissions
[v1,v3]: resync l1 which was just read.
v1: propagate change to l1 shadow using stale gl1e

Now we have an in-sync shadow with more permissions than the guest.

The resync can happen either as a result of a 3rd vcpu doing a cr3
update, or under certain conditions by v1 itself.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agoxl: Migration support
Keir Fraser [Mon, 12 Apr 2010 16:47:16 +0000 (17:47 +0100)]
xl: Migration support

Implement "xl migrate".

ssh is used as the transport by default, although this can be
overridden by specifying a different sshcommand.  This is a very
standard approach nowadays and avoids the need for daemons at the
target host in the default configuration, while providing flexibility
to admins.  (In the future it might be nice to support plain
unencrypted migration over TCP, which we do not rule out now, although
it is not currently implemented.)

Properties of the migration protocol:
  * The domain on the target machine is named "<domname>--incoming"
    while it is being transferred.
  * The domain on the source machine is renamed
  "<domain>--migratedaway"
    before we give the target permission to rename and unpause.
  * The locking in libxl_domain_rename ensures that of two
    simultaneous migration attempts no more than one will succeed.
  * We go to some considerable effort to avoid leaving the domain in
    a bad state if something goes wrong with one of the ends or the
    network, although there is still (inevitably) a possibility of a
    unresolvable state (in case of very badly timed network failure)
    which is probably best resolved by destroying the domain at both
    ends.

Incidental changes:
  create_domain now returns a libxl error code rather than exiting on
  error.
  New ERROR_BADFAIL error code for reporting unpleasant failures.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
15 years agoxl: Domain creation logging fixes
Keir Fraser [Mon, 12 Apr 2010 16:46:39 +0000 (17:46 +0100)]
xl: Domain creation logging fixes

 * Make create_domain always return to caller
 * Have create_domain set its log callback sooner
 * Actually write things to logfile, and some error checking

With some combinations of options, create_domain would never return to
the caller, since it would have called daemon and will later exit.  So
we fork an additional time, so that we can call daemon in the child
and also return to the caller in the parent.  It's a shame that
there's no version of daemon(3) that allows us to do this without the
extra code and pointless extra fork.

daemon(0,0) closes all the fds.  So we need to call daemon(0,1) and
organise detaching our stdin/out/err ourselves.  Doing this makes
messages actually appear in the xl logfile in /var/log/xen.

Finally, make create_domain call libxl_ctx_set_log sooner.  This makes
some lost messages appear.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
15 years agoxl: New savefile format. Save domain config when saving a domain.
Keir Fraser [Mon, 12 Apr 2010 16:46:10 +0000 (17:46 +0100)]
xl: New savefile format. Save domain config when saving a domain.

We introduce a new format for saved domains.  The new format, in
contrast to the old:
  * Has a magic number which can distinguish it from other kinds of
  file
  * Is extensible
  * Can contains the domain configuration file

On domain creation we remember the actual config file used (using the
toolstack data feature of libxl, just introduced), and by default save
it to the save file.

However, options are provided for the following:
  * When saving a domain, supplying an alternative config file to
    store in the savefile.
  * When restoring a domain, supplying an alternative config file.

If a domain is restored with a different config file, it is the
responsibility of the xl user to ensure that the two configs are
"compatible".  Changing the targets of virtual devices is supported;
changing other features of the domain is not recommended.  Bad changes
may lead to undefined behaviour in the domain, and are in practice
likely to cause resume failures or crashes.

Old format save files generated by old versions of xl are not
supported.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
15 years agolibxl,xl: Fix two minor bugs in domain destruction
Keir Fraser [Mon, 12 Apr 2010 16:45:26 +0000 (17:45 +0100)]
libxl,xl: Fix two minor bugs in domain destruction

* If /local/domain/<domid>/device does not exist, this is not
  necessarily an error.  It probably means the domain has been
  partially destroyed already.

* Have xl report errors from libxl_domain_destroy.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
15 years agoxl: Remove some duplicated boilerplate. (Improves logging slightly.)
Keir Fraser [Mon, 12 Apr 2010 16:44:47 +0000 (17:44 +0100)]
xl: Remove some duplicated boilerplate. (Improves logging slightly.)

We remove six lines of boilerplate from the top of each function, and
instead have a single struct libxl_ctx which is initialised once at
the top of main.

Likewise we wrap domain_qualifier_to_domid in a new function
find_domain, which does the error handling, and stores the domid and
the specified name (if applicable).

This reduces the size of xl.c by 7% (!)

As a beneficial side effect, the earlier call to libxl_ctx_set_log in
main makes some lost messages appear.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
15 years agolibxl: Per-domain data storage for the convenience of the library user
Keir Fraser [Mon, 12 Apr 2010 16:44:01 +0000 (17:44 +0100)]
libxl: Per-domain data storage for the convenience of the library user

We provide a mechanism whereby a user of the libxl library is able to
store some information alongside the domain.  The information stored
is a block of bytes.  Its lifetime is that of the domain - ie the
userdata is garbage collected alongside the domain if the domain is
destroyed.  (This is why the feature needs to be in libxl and cannot
be implemented in the user itself or in libxlutil.)

If a libxl caller does not need to use this feature it can ignore it.

The data is tagged with the (self-declared) name of the libxl user, so
that different users cannot accidentally trip over each others'
userdata.  The data is not interpreted at all by libxl.

To assist developers and people debugging, there is a registry of the
known userdata userids, and the corresponding data format as declared
by that libxl user, in libxl.h next to these declarations:

 int libxl_userdata_store(struct libxl_ctx *ctx, uint32_t domid,
                               const char *userdata_userid,
                               const uint8_t *data, int datalen);
 int libxl_userdata_retrieve(struct libxl_ctx *ctx, uint32_t domid,
                                  const char *userdata_userid,
                                  uint8_t **data_r, int *datalen_r);

The next patch will introduce the data for the userid "xl".

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
15 years agolibxl: New function libxl_domain_info
Keir Fraser [Mon, 12 Apr 2010 16:43:25 +0000 (17:43 +0100)]
libxl: New function libxl_domain_info

libxl_domain_info provides a way to get the struct libxl_dominfo
for a single domain given its domid.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
15 years agoxl, libxl: xl list -v shows the uuid too
Keir Fraser [Mon, 12 Apr 2010 16:42:57 +0000 (17:42 +0100)]
xl, libxl: xl list -v shows the uuid too

Break uuid to string conversion (including logging) out into a new
function libxl_uuid2string for reuse, and expose it for the
convenience of callers.

Provide a new -v option to xl list which shows the domain's uuid.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
15 years agolibxl: Expose libxl_report_exitstatus
Keir Fraser [Mon, 12 Apr 2010 16:42:29 +0000 (17:42 +0100)]
libxl: Expose libxl_report_exitstatus

xl would like to use libxl_report_exitstatus, so expose it in
libxl_utils.h to avoid having to write it twice.  Also, give it a
"level" argument to set the loglevel of the resulting message.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
15 years agoxenstore,libxl: cleanup of xenstore connections across fork()
Keir Fraser [Mon, 12 Apr 2010 16:41:58 +0000 (17:41 +0100)]
xenstore,libxl: cleanup of xenstore connections across fork()

Provide a new function xs_daemon_destroy_postfork which can be called
by a libxenstore user who has called fork, to close the fd for the
connection to xenstored and free the memory, without trying to do
anything to any threads which libxenstore may have created.

Use this new function in libxl_fork, to avoid accidental use of a
xenstore connection in both parent and child.

Also, fix the doc comment for libxl_spawn_spawn to have the success
return codes the right way round.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
15 years agolibxl: Expose functions for helping with subprocesses.
Keir Fraser [Mon, 12 Apr 2010 16:41:05 +0000 (17:41 +0100)]
libxl: Expose functions for helping with subprocesses.

 * Expose libxl_fork in libxl_utils.h
 * Expose libxl_pipe in libxl_utils.h
 * Make libxl_exec put SIGPIPE back (so that libxl callers may
    have SIGPIPE ignored)

xl would like to use libxl_fork (which is like fork(2) except that it
logs errors) and also a similar function libxl_pipe.  So put these in
libxl_utils.[ch] and use them in libxl.c as appropriate, to avoid
having to duplicate code between xl and libxl.

Also, make sure that subprocesses spawned by libxl have SIGPIPE set
back to SIG_DFL as they are entitled to expect.  This means that a
libxl caller which sets SIGPIPE to SIG_IGN is no longer buggy.  (This
is relevant for xl migration, because xl would like to be such a
caller.)

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
15 years agolibxl: Provide libxl_domain_rename
Keir Fraser [Mon, 12 Apr 2010 16:40:34 +0000 (17:40 +0100)]
libxl: Provide libxl_domain_rename

Provide a new function libxl_domain_rename.  It can check that the
domain being renamed has the expected name, to avoid races.

Use the new function to set the name during domain creation.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
15 years agolibxl: libxl_domain_restore: Put fd back to blocking mode
Keir Fraser [Mon, 12 Apr 2010 16:40:06 +0000 (17:40 +0100)]
libxl: libxl_domain_restore: Put fd back to blocking mode

libxl_domain_restore calls, indirectly, xc_domain_restore.  The
latter, when doing a live migration, sets the fd from blocking mode
(which it must be on entry, or things go wrong) to nonblocking mode
and leaves it this way.  Arguably this is a bug in libxc, but to avoid
disrupting any callers we fix it in libxl.

So libxl_domain_restore now puts the fd back into blocking mode
before returning.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
15 years agolibxl: New utility functions in for reading and writing files.
Keir Fraser [Mon, 12 Apr 2010 16:39:29 +0000 (17:39 +0100)]
libxl: New utility functions in for reading and writing files.

We introduce these functions in libxl_utils.h:

  int libxl_read_file_contents(struct libxl_ctx *ctx, const char
  *filename,
                               void **data_r, int *datalen_r);
  int libxl_read_exactly(struct libxl_ctx *ctx, int fd, void *data,
  ssize_t sz,
                         const char *filename, const char *what);
  int libxl_write_exactly(struct libxl_ctx *ctx, int fd, const void
  *data,
                          ssize_t sz, const char *filename, const char
  *what);

They will be needed by the following patches.  They have to be in
libxl.a rather than libxutil.a because they will be used, amongst
other places, in libxl itself.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
15 years agolibxl: Report error if logfile rotation fails
Keir Fraser [Mon, 12 Apr 2010 16:38:42 +0000 (17:38 +0100)]
libxl: Report error if logfile rotation fails

Check the return values from renames and errors from stat in
libxl_create_logfile (which, misleadingly, does not actually create
the logfile).

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
15 years agolibxl: Make logging functions preserve errno
Keir Fraser [Mon, 12 Apr 2010 16:38:17 +0000 (17:38 +0100)]
libxl: Make logging functions preserve errno

This is needed by the following patches.  It makes it much more
convenient for libxl functions to return the errno value from the
failure, when they fail.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
15 years agoFix bug in 21089:4f796e29987c
Keir Fraser [Mon, 12 Apr 2010 16:36:54 +0000 (17:36 +0100)]
Fix bug in 21089:4f796e29987c

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agoBetter gcc error message if GUEST_PAGING_LEVELS is undefined.
Keir Fraser [Mon, 12 Apr 2010 16:36:10 +0000 (17:36 +0100)]
Better gcc error message if GUEST_PAGING_LEVELS is undefined.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
15 years agocpufreq: fix racing issue for cpu hotplug
Keir Fraser [Mon, 12 Apr 2010 16:33:47 +0000 (17:33 +0100)]
cpufreq: fix racing issue for cpu hotplug

To eliminate racing between dbs timer handler and cpufreq_del_cpu,
using kill_timer instead of stop_timer to make sure timer handler
execution finished before other stuff in cpufreq_del_cpu.

BTW, fix a lost point of cpufreq_statistic_lock taking sequence.

Signed-off-by: Wei Gang <gang.wei@intel.com>