Commit Graph
21146 Commits
Author SHA1 Message Date
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
Keir Fraser c20f18fbe8 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>
2010-04-12 17:38:17 +01:00
Keir Fraser c6ddf6e062 Fix bug in 21089:4f796e29987c
Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-04-12 17:36:54 +01:00
Keir Fraser ebb05756a0 Better gcc error message if GUEST_PAGING_LEVELS is undefined.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2010-04-12 17:36:10 +01:00
Keir Fraser 7cc4840cb2 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>
2010-04-12 17:33:47 +01:00
Keir Fraser e6984111fd xen: 'make clean' really cleans unconfigured subdirs.
Previously we skipped those listed in variable $(subdir-), only
including those in the more explicit $(subdir-n).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-04-12 17:30:08 +01:00
Keir Fraser a124755be6 blktap2: a little fix to xen-hotplug-cleanup
Signed-off-by: James (Song Wei) <jsong@novell.com>
2010-04-12 07:23:21 +01:00
Keir Fraser 560f4dc7f2 libxc: Flush I/O before xc_domain_save completion
The final, flushing call to discard_file_cache also discards any
errors from fsync. Call fsync explicitly before leaving, to check if
all VM memory actually made it to the disk.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
2010-04-12 07:22:16 +01:00
Keir Fraser ed85f602c4 pygrub: fix 64b Solaris PV guest boot on 32b Linux dom0 & 64b Xen
Signed-off-by: Mark Johnson <mark.r.johnson@oracle.com>
2010-04-12 07:21:44 +01:00
Keir Fraser bf294945ed xm: Fix string index out of range in 'vcpu-pin' command
if <PCPUs> contins '' (e.g. '1,,2'), error 'string index out of range'
occurs. Fix this trivial bug.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
2010-04-09 08:54:25 +01:00
Keir Fraser 38c0598f9c Add support for AMD MPERF/APERF
Starting with Family 0x10, model 10 processors, some AMD processors
will have support for the APERF/MPERF MSRs.  This patch adds the
checks necessary to support those MSRs.

It also makes the get_measured_perf function defined inside cpufreq.c
driver independent.  max_freq is taken from the policy definition
instead of being a private argument in struct acpi_cpufreq_data.
The struct member is entirely removed from the function since it
is no longer used.

Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
2010-04-09 08:53:53 +01:00
Keir Fraser a6adb8aa62 Add Xen support for AMD Turbo/Boost
Add support for disabling AMD's Boost feature.  Boost is similar to
Intel's Turbo and uses the same high level interface.  The low
level implementation is different and encapsulated in the powernow
driver for cpufreq.

Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
2010-04-09 08:53:19 +01:00
Keir Fraser 002c5bcdbe Refactor Xen Support for Intel Turbo Boost
Refactor the existing code that supports the Intel Turbo feature to
move all the driver specific bits in the cpufreq driver.  Create
a tri-state interface for the Turbo feature that can distinguish
amongst enabled Turbo, disabled Turbo, and processors that don't
support Turbo at all.

Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
2010-04-09 08:52:43 +01:00
Keir Fraser e136054ced libxl: Fix the build by reinstating some sysctl.physinfo fields.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-04-08 16:11:17 +01:00
Keir Fraser 2293eaf330 Fix two issues for CPU online/offline.
Firstly, we should return if we fail to get spin lock in cpu_down.
Secondly, in credit scheduler, the idlers need be limited only to
online map.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2010-04-08 15:31:52 +01:00
Keir Fraser 6c87eec55a tmem: fix ia64 build
/xen/common/built_in.o: In function `tmh_get_first_byte':
  /xen/include/xen/tmem_xen.h:350: undefined reference to
  `__map_domain_page'

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
2010-04-08 15:31:21 +01:00
Keir Fraser 750b06dbd9 xen: allow guests to set caching attributes for MMIOs
This patch allows guests that have directly mapped MMIO regions to set
the caching attributes for them, and only for them.
Currently we have just an on/off check for a directly assigned device
instead of looking for directly mapped MMIO regions.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2010-04-08 15:30:52 +01:00
Keir Fraser 4d6e834ba9 Host Numa information in dom0
'xm info' command now also gives the cpu topology & host numa
information. This will be later used to build guest numa support.  The
patch basically changes physinfo sysctl, and adds topology_info &
numa_info sysctls, and also changes the python & libxc code
accordingly.

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
2010-04-07 16:22:05 +01:00
Keir Fraser 35e9666fc4 Revert 21110:d791173ca65b and 21111:986d3b1d30fb
Break automated tests.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-04-07 15:44:29 +01:00
Keir Fraser ab3575f913 x86: Fix caller of p2m_init(): cannot use paging_mode_hap() yet.
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
2010-04-07 10:17:27 +01:00
Keir Fraser cdabe14bff mini-os: Fix xenbus_switch_state's transaction retry
When xenbus_switch_state has to retry the transaction which it just
created, it needs to recreate another one.  Clearing xbt triggers it.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2010-04-07 08:17:21 +01:00
Keir Fraser 15d5739ea9 mini-os: Fix crash on frontend shutdown failures
Do not free frontend resources if some error happened, since the
backend may not have finished properly restarting in such case.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2010-04-07 08:16:15 +01:00
Keir Fraser 42e3a21b11 mini-os: Fix frontend shutdown wait loop
minios frontends must wait for backends to be shut down and
reinitialized before freeing resources.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2010-04-07 08:15:55 +01:00
Keir Fraser 449e0d3d0e Fix 32bit PAE compilation error introduced by 1GB patches
Signed-off-by: Wei Huang2 <wei.huang2@amd.com>
2010-04-07 08:15:33 +01:00
Keir Fraser 8aa77c0ef1 Update git clone command
When cloning the kernel repo:
   1. make remote called "xen" rather than the default "origin"
   2. directly checkout the desired branch in one step

Signed-off-by: Jeremy Fitzhardinge<jeremy.fitzhardinge@citrix.com>
2010-04-07 08:14:34 +01:00
Keir Fraser 715dd40aed Switch default kernel branch to xen/stable-2.6.31.x
This is functionally identical to xen/master at the moment, but more
meaningful.

Signed-off-by: Jeremy Fitzhardinge<jeremy.fitzhardinge@citrix.com>
2010-04-07 08:13:20 +01:00
Keir Fraser f2dcefdc7b x86, cpu hotplug: Synchronise vcpu state earlier during cpu offline.
Needs to happen before non-idle VCPU is fully descheduled after CPU is
removed from cpu_online_map. Else sync_vcpu_execstate() doesn't work
properly.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-04-07 08:09:00 +01:00
Keir Fraser 0273e627ed Enable debug=y by default in the build.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-04-06 07:16:47 +01:00
Keir Fraser 2dcbce9769 EPT: 1GB large page support.
Alloc 1GB large page for EPT if possible. It also contains the logic
to split large page into small ones (2M or 4K).

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Signed-off-by: Xiaohui Xin <xiaohui.xin@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
2010-04-06 07:14:56 +01:00
Keir Fraser 453c7b6442 mini-os: Fix xenbus initialisation
This fixes xenbus initialization of blkfront, netfront and pcifront
by uniformizing with fbfront: after writing parameters, set state to
initialised, then wait for backend to switch to connect state, and
then only read its parameter and switch to the connect state.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2010-04-06 07:13:19 +01:00
Keir Fraser efdf57d613 pv-grub: fix boot crash when no fb is available
When no fb is available, init_fbfront will return, so the local
semaphore for synchronization with the kbd thread would get dropped.
Using a global static semaphore instead fixes this.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2010-04-06 07:13:01 +01:00
Keir Fraser d98d3c5208 mini-os: Do not use the same wait element twice
To enqueue the kbdfront thread on two separate wait queues, we need
two different wait elements.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2010-04-06 07:12:39 +01:00
Keir Fraser 38c433d0c7 tmem: add page deduplication with optional compression or trailing-zero-elimination
Add "page deduplication" capability (with optional compression
and trailing-zero elimination) to Xen's tmem.

(Transparent to tmem-enabled guests.)  Ephemeral pages
that have the exact same content are "combined" so that only
one page frame is needed.  Since ephemeral pages are essentially
read-only, no C-O-W (and thus no equivalent of swapping) is
necessary.  Deduplication can be combined with compression
or "trailing zero elimination" for even more space savings.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2010-04-06 07:11:48 +01:00
Keir Fraser 6a9ee8cf21 1GB Page Table Support for HVM Guest 3/3
This patch adds a new field in hvm to indicate 1gb is supported by
CPU.  In addition, users can turn 1GB feature on/off using a Xen
option ("hap_1gb", default is off). Per Tim's suggestion, I also add
an assertion check in shadow/common.c file to prevent affecting shadow
code.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
Acked-by: Dongxiao Xu <dongxiao.xu@intel.com>
Acked-by: Tim Deegan <tim.deegan@citrix.com>
2010-04-06 07:09:35 +01:00
Keir Fraser 270ed5c14a 1GB Page Table Support for HVM Guest 2/3
This patch changes P2M code to works with 1GB page now.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
Acked-by: Dongxiao Xu <dongxiao.xu@intel.com>
Acked-by: Tim Deegan <tim.deegan@citrix.com>
2010-04-06 07:07:37 +01:00
Keir Fraser ff61ed41ee 1GB Page Table Support for HVM Guest 1/3
This patch changes Xen tools to allocate 1GB first. If such requests
fail, it will fall back to 2MB and then 4KB. We skip 1GB allocation
for the MMIO space between 3GB and 4GB.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Acked-by: Tim Deegan <tim.deegan@citrix.com>
2010-04-06 07:02:17 +01:00
Keir Fraser e4434634c4 CSCHED: Optimize __runq_tickle to reduce IPIs
Limiting the number of idle cpus tickled for vcpu migration purpose
to ONLY ONE to get rid of a lot of IPI events which may impact the
average cpu idle residency time.

The default on option 'tickle_one_idle_cpu=0' can be used to disable
this optimization if needed.

Signed-off-by: Wei Gang <gang.wei@intel.com>
2010-04-06 06:59:32 +01:00
Keir Fraser b97d94b4ef xl: tsc_mode parameter in guest configuration file
Signed-off-by: Eric Chanudet <eric.chanudet@citrix.com>
Acked-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2010-04-06 06:56:20 +01:00
Keir Fraser 56a5e4b778 xl: vcpu-set command
Signed-off-by: Eric Chanudet <eric.chanudet@citrix.com>
Acked-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2010-04-06 06:55:37 +01:00
Keir Fraser aa2fb6ae52 xl: vcpu-pin command
Signed-off-by: Eric Chanudet <eric.chanudet@citrix.com>
Acked-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2010-04-06 06:54:51 +01:00