Commit Graph
21199 Commits
Author SHA1 Message Date
Keir Fraser f3a1f2d30e 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>
2010-04-19 11:07:14 +01:00
Keir Fraser 10d7e8ed96 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>
2010-04-19 10:12:41 +01:00
Keir Fraser 197965150c 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>
2010-04-19 10:06:42 +01:00
Keir Fraser f770264fe1 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>
2010-04-19 09:00:30 +01:00
Keir Fraser 04dffa0be9 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>
2010-04-19 08:59:14 +01:00
Keir Fraser fc9e443321 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>
2010-04-19 08:58:43 +01:00
Keir Fraser b17520fdb1 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>
2010-04-19 08:55:33 +01:00
Keir Fraser 05dd855d25 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>
2010-04-19 08:54:53 +01:00
Keir Fraser ba4608bf8c 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>
2010-04-15 19:11:16 +01:00
Keir Fraser 91b1583fbc 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>
2010-04-15 18:47:58 +01:00
Keir Fraser 757907af26 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>
2010-04-15 17:36:55 +01:00
Keir Fraser a667809cd4 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>
2010-04-15 17:36:16 +01:00
Keir Fraser 254a13846c xend: make NUMA in xm info optional (dependent on new -n switch)
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
2010-04-15 13:16:17 +01:00
Keir Fraser 37cd685b75 acpi sleep: Must acquire hypercall_deadlock_mutex when a domain
freezes its own vcpus.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-04-15 13:06:48 +01:00
Keir Fraser d8ffa3fa6b 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>
2010-04-15 12:29:48 +01:00
Keir Fraser 1844bfe6f8 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>
2010-04-15 12:28:33 +01:00
Keir Fraser a5913cc17c 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>
2010-04-15 12:24:16 +01:00
Keir Fraser 0e697bad53 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>
2010-04-15 12:21:00 +01:00
Keir Fraser b1d62eecbb 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>
2010-04-15 11:36:20 +01:00
Keir Fraser 86cd882200 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>
2010-04-15 11:33:39 +01:00
Keir Fraser dcc9060e4a 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>
2010-04-15 11:31:58 +01:00
Keir Fraser e6baf56c8c 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>
2010-04-15 09:04:45 +01:00
Keir Fraser 0b8d217214 Fix tasklet_action() to notify correct cpu when running tasklet is rescheduled.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-04-15 09:03:43 +01:00
Keir Fraser 82e84243c3 Remus: fix alignment bug in python rtnl library
Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
2010-04-15 08:42:40 +01:00
Keir Fraser 04b41ebf20 Remus: make ebt_imq and sch_queue compatible with pvops
Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
2010-04-15 08:42:08 +01:00
Keir Fraser a96f66af6d Improvements and bug fixes to continue_hypercall_on_cpu().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-04-14 13:35:05 +01:00
Keir Fraser 3ac51fc221 credit2: Add toolstack options to control credit2 scheduler parameters
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2010-04-14 12:10:19 +01:00
Keir Fraser 0dd76d3d20 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>
2010-04-14 12:07:21 +01:00
Keir Fraser 13a24225fb credit2: Add a scheduler-specific schedule trace class
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2010-04-14 12:06:05 +01:00
Keir Fraser 05d6aca7c2 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>
2010-04-14 12:05:31 +01:00
Keir Fraser be9a0806e1 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>
2010-04-14 12:03:27 +01:00
Keir Fraser f426678bf2 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>
2010-04-14 11:56:54 +01:00
Keir Fraser d68069e6cb 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>
2010-04-14 11:29:05 +01:00
Keir Fraser 58f293ed52 Per-cpu tasklet lists.
Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-04-14 10:44:29 +01:00
Keir Fraser 822cdd45d1 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>
2010-04-13 18:19:33 +01:00
Keir Fraser 70d3f227c6 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>
2010-04-13 18:19:10 +01:00
Keir Fraser 7787576014 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>
2010-04-13 18:18:36 +01:00
Keir Fraser 70121cba8f 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>
2010-04-13 15:38:27 +01:00
Keir Fraser 2bd42d61f1 sysctl: Fix XEN_SYSCTL_debug_keys error path.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-04-13 13:40:58 +01:00
Keir Fraser 66ff9844c1 Clean up numa-info sysctl.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-04-13 13:27:46 +01:00
Keir Fraser 7da1c9269c libxl: <sys/signal.h> -> <signal.h>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-04-13 12:48:17 +01:00
Keir Fraser fec5d09df4 Update QEMU_TAG to b5160622517fb2d16d0836172a2e34633c9d94bf 2010-04-13 12:45:51 +01:00
Keir Fraser 0e9cb215cf 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>
2010-04-13 12:21:28 +01:00
Keir Fraser d1673b3916 p2m: merge ptp allocation
Signed-off-by: Christoph Egger <Christop.Egger@amd.com>
2010-04-13 12:20:48 +01:00
Keir Fraser 645f5ea7cb Topology-info sysctl cleanups.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-04-13 09:38:54 +01:00
Keir Fraser 81f77532b5 sysctl: Remove sockets_per_node field from physinfo command.
Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
2010-04-13 08:37:16 +01:00
Keir Fraser 741bcc86e2 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>
2010-04-12 18:28:33 +01:00
Keir Fraser b690245b9f 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>
2010-04-12 17:54:48 +01:00
Keir Fraser 24488e9b29 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>
2010-04-12 17:51:56 +01:00
Keir Fraser 4cdb003c2d 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>
2010-04-12 17:47:16 +01:00