Commit Graph
21185 Commits
Author SHA1 Message Date
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
Keir Fraser c31aaf24cd 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>
2010-04-12 17:46:39 +01:00
Keir Fraser 01745ae6b5 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>
2010-04-12 17:46:10 +01:00
Keir Fraser b175259586 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>
2010-04-12 17:45:26 +01:00
Keir Fraser e5f63f2ca9 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>
2010-04-12 17:44:47 +01:00
Keir Fraser 0ac8d8f169 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>
2010-04-12 17:44:01 +01:00
Keir Fraser 83a2d58bd6 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>
2010-04-12 17:43:25 +01:00
Keir Fraser a7bd5ff41e 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>
2010-04-12 17:42:57 +01:00
Keir Fraser 1d95423e86 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>
2010-04-12 17:42:29 +01:00
Keir Fraser aa8978e2d9 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>
2010-04-12 17:41:58 +01:00
Keir Fraser 25887df0de 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>
2010-04-12 17:41:05 +01:00
Keir Fraser 567326149c 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>
2010-04-12 17:40:34 +01:00
Keir Fraser e82f13b13d 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>
2010-04-12 17:40:06 +01:00
Keir Fraser eb67817b17 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>
2010-04-12 17:39:29 +01:00
Keir Fraser 4f7fb69661 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>
2010-04-12 17:38:42 +01:00