]> xenbits.xensource.com Git - xen.git/log
xen.git
12 years agox86: don't call generic_identify() redundantly
Jan Beulich [Mon, 21 May 2012 10:03:32 +0000 (12:03 +0200)]
x86: don't call generic_identify() redundantly

Right before calling struct cpu_dev's ->c_identify, if non-NULL,
identify_cpu() calls generic_identify(). Hence there's no point for
->c_identify to point to generic_identify, nor for the handler to call
that function. After removing all pointless uses, the function isn't
being used outside the file that's defininig it anymore, and hence can
become static.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agoserial: serial_irq() and descendants can be __init
Jan Beulich [Mon, 21 May 2012 10:00:54 +0000 (12:00 +0200)]
serial: serial_irq() and descendants can be __init

... as being solely called from smp_intr_init(), which itself is
marked such.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86/mem_sharing: Allow paging-in pages to be replaced by shared ones.
Andres Lagar-Cavilla [Fri, 18 May 2012 15:19:21 +0000 (16:19 +0100)]
x86/mem_sharing: Allow paging-in pages to be replaced by shared ones.

Making sure to tidy up any partially paged frames.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
12 years agolibxl: initialise ao when starting pvqemu for stubdomain
Ian Campbell [Fri, 18 May 2012 12:40:00 +0000 (13:40 +0100)]
libxl: initialise ao when starting pvqemu for stubdomain

libxl__spawn_local_dm requires the ao to be initialised.

Without this starting an HVM guest with a stub qemu hits the
    assert(ao->magic == LIBXL__AO_MAGIC);
in the STATE_AO_GC call from libxl__spawn_local_dm.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: avoid double free of b_info->u.pv.bootloader
Ian Campbell [Fri, 18 May 2012 12:39:59 +0000 (13:39 +0100)]
libxl: avoid double free of b_info->u.pv.bootloader

b_info is a user provided struct and therefore the content must come from
malloc and not gc such that libxl_domain_build_info_dispose can free it. This
was broken by 25340:373f24c87dee.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: Remus - xl remus command
Shriram Rajagopalan [Fri, 18 May 2012 10:00:45 +0000 (11:00 +0100)]
libxl: Remus - xl remus command

xl remus acts as a frontend to enable remus for a given domain.
 * At the moment, only memory checkpointing and blackhole replication is
   supported. Support for disk checkpointing and network buffering will
   be added in future.
 * Replication is done over ssh connection currently (like live migration
   with xl). Future versions will have an option to use simple tcp socket
   based replication channel (for both Remus & live migration).

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: Remus - suspend/postflush/commit callbacks
Shriram Rajagopalan [Fri, 18 May 2012 10:00:44 +0000 (11:00 +0100)]
libxl: Remus - suspend/postflush/commit callbacks

 * Add libxl callback functions for Remus checkpoint suspend, postflush
   (aka resume) and checkpoint commit callbacks.
 * suspend callback is a stub that just bounces off
   libxl__domain_suspend_common_callback - which suspends the domain and
   saves the devices model state to a file.
 * resume callback currently just resumes the domain (and the device model).
 * commit callback just writes out the saved device model state to the
   network and sleeps for the checkpoint interval.
 * Introduce a new public API, libxl_domain_remus_start (currently a stub)
   that sets up the network and disk buffer and initiates continuous
   checkpointing.

 * Future patches will augment these callbacks/functions with more functionalities
   like issuing network buffer plug/unplug commands, disk checkpoint commands, etc.

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: resume instead of unpause on xl save -c
Shriram Rajagopalan [Fri, 18 May 2012 10:00:43 +0000 (11:00 +0100)]
libxl: resume instead of unpause on xl save -c

The guest is "suspended" via libxl_domain_suspend when taking a snapshot.
So call libxl_domain_resume instead of libxl_domain_unpause, when taking
a checkpoint of the domain (using xl save -c).

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: refactor migrate_domain and generalize migrate_receive
Shriram Rajagopalan [Fri, 18 May 2012 10:00:42 +0000 (11:00 +0100)]
libxl: refactor migrate_domain and generalize migrate_receive

Refactor some tasks like establishing the migration channel,
initial migration protocol exchange into separate functions,
to facilitate re-use, when remus support is introduced. Also,
make migrate_receive generic (instead of resorting to stdin and
stdout as the file descriptors for communication).

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: support suspend_cancel in domain_resume
Shriram Rajagopalan [Fri, 18 May 2012 10:00:41 +0000 (11:00 +0100)]
libxl: support suspend_cancel in domain_resume

Add an extra parameter to libxl_domain_resume indicating
if the caller wishes to use the SUSPEND_CANCEL style
resume instead of the normal resume.

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: QMP stop/resume & refactor QEMU suspend/resume/save
Shriram Rajagopalan [Fri, 18 May 2012 10:00:41 +0000 (11:00 +0100)]
libxl: QMP stop/resume & refactor QEMU suspend/resume/save

Implement QMP stop and resume functionality and split
device model save into 3 parts:
 suspend_dm(domid)
 save_dm(domid, fd)
 resume_dm(domid)

Integrate Device model suspend into suspend_common_callback

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix build on platforms where openpty's parameters are not const.
Christoph Egger [Thu, 17 May 2012 13:45:43 +0000 (14:45 +0100)]
libxl: fix build on platforms where openpty's parameters are not const.

Such as NetBSD. Fixes this build error:

libxl_aoutils.c: In function 'libxl__openptys':
libxl_aoutils.c:281:13: error: passing argument 4 of 'openpty' discards
qualifiers from pointer target type
/usr/include/util.h:92:6: note: expected 'struct termios *' but argument
is of type 'const struct termios *'
libxl_aoutils.c:281:13: error: passing argument 5 of 'openpty' discards
qualifiers from pointer target type
/usr/include/util.h:92:6: note: expected 'struct winsize *' but argument
is of type 'const struct winsize *'

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl, xl: fix bootloader immediate console attach
Ian Jackson [Thu, 17 May 2012 13:45:42 +0000 (14:45 +0100)]
libxl, xl: fix bootloader immediate console attach

Fix bugs related to console handling:

 * In libxl_primary_console_exec, if libxl__domain_type fails, do
   not abort, but instead log and return an error.  This can occur
   if the domid is invalid.

 * In xl's autoconnect_console, rename the ctx formal parameter so
   that when postfork creates a new ctx and puts it in the global ctx,
   we don't end up using the old one (via the formal parameter which
   has shadowed the global).

 * In xl's autoconnect_console, pass the domid from the event
   to libxl_primary_console_exec, rather than using the global domid
   (which has not yet been set, since it is only set at completion
   of the ao).

This causes xl create -c to once more work with pygrub.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: Do not use-after-free on ao progress reporting
Ian Jackson [Thu, 17 May 2012 13:45:41 +0000 (14:45 +0100)]
libxl: Do not use-after-free on ao progress reporting

We need to call libxl__free_all after egc_run_callbacks since some of
the callbacks might be ao progress reports allocated from the egc's
gc.

Fixes a segfault in egc_run_callbacks.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: events: STATE_AO_GC checks ao is still valid
Ian Jackson [Thu, 17 May 2012 13:45:40 +0000 (14:45 +0100)]
libxl: events: STATE_AO_GC checks ao is still valid

This will catch earlier the mistake where an ao is completed while it
still has events registered: when the event callback happens for the
long-gone ao, we will crash before attempting to execute any of the
operation-specific code.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agox86/mem_sharing: Fix test for "empty" physmap entry in sharing_add_to_physmap
Tim Deegan [Thu, 17 May 2012 09:37:09 +0000 (10:37 +0100)]
x86/mem_sharing: Fix test for "empty" physmap entry in sharing_add_to_physmap

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
12 years agox86/p2m, arm/p2m: remove get_gfn_untyped().
Tim Deegan [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
x86/p2m, arm/p2m: remove get_gfn_untyped().

Adjust its only user to use get_gfn.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agox86/hvm/svm: used unlocked p2m lookups in trace and error paths.
Andres Lagar-Cavilla [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
x86/hvm/svm: used unlocked p2m lookups in trace and error paths.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
12 years agox86/hvm: use unlocked p2m lookups in hvmemul_rep_movs()
Tim Deegan [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
x86/hvm: use unlocked p2m lookups in hvmemul_rep_movs()

The eventual hvm_copy or IO emulations will re-check the p2m and DTRT.

Signed-off-by: Tim Deegan <tim@xen.org>
12 years agogrant-tables: Use get_page_from_gfn() instead of get_gfn()/put_gfn.
Andres Lagar-Cavilla [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
grant-tables: Use get_page_from_gfn() instead of get_gfn()/put_gfn.

This requires some careful re-engineering of __get_paged_frame and its callers.
Functions that previously returned gfn's to be put now return pages to be put.

Tested with Win7 + Citrix PV drivers guest, using speedtest for networking
(yes!) plus the loginVSI framework to constantly hit disk.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
12 years agocommon: Use get_page_from_gfn() instead of get_gfn()/put_gfn.
Tim Deegan [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
common: Use get_page_from_gfn() instead of get_gfn()/put_gfn.

Signed-off-by: Tim Deegan <tim@xen.org>
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
12 years agox86: Use get_page_from_gfn() instead of get_gfn()/put_gfn.
Tim Deegan [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
x86: Use get_page_from_gfn() instead of get_gfn()/put_gfn.

Signed-off-by: Tim Deegan <tim@xen.org>
12 years agox86/mm: Use get_page_from_gfn() instead of get_gfn()/put_gfn.
Tim Deegan [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
x86/mm: Use get_page_from_gfn() instead of get_gfn()/put_gfn.

Signed-off-by: Tim Deegan <tim@xen.org>
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
12 years agox86/hvm: Use get_page_from_gfn() instead of get_gfn()/put_gfn.
Tim Deegan [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
x86/hvm: Use get_page_from_gfn() instead of get_gfn()/put_gfn.

Signed-off-by: Tim Deegan <tim@xen.org>
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
12 years agoarm: Implement get_page_from_gfn()
Tim Deegan [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
arm: Implement get_page_from_gfn()

We will be calling this from common code, so add a basic
implementation to arch/arm.

After 4.2 we should reshuffle some of the p2m interface out of
arch/x86 into common headers; for now duplicate a little bit of it.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agox86/mm: Introduce get_page_from_gfn().
Tim Deegan [Thu, 17 May 2012 09:24:54 +0000 (10:24 +0100)]
x86/mm: Introduce get_page_from_gfn().

This new function does a p2m lookup under the read lock, falling back
to the write lock only if it needs to make a change.  If the GFN is
backed by RAM, it takes a refcount on the underlying page.

The following patches will convert many paths that currently use
get_gfn/put_gfn to use the new interface.  That will avoid serializing
p2m accesses in the common case where no updates are needed (i.e. no
page-sharing, VM paging or other p2m trickery).

Signed-off-by: Tim Deegan <tim@xen.org>
12 years agox86/mm: make p2m lock into an rwlock
Tim Deegan [Thu, 17 May 2012 09:24:53 +0000 (10:24 +0100)]
x86/mm: make p2m lock into an rwlock

Because the p2m lock was already recursive, we need to add a new
mm-lock class of recursive rwlocks.

Signed-off-by: Tim Deegan <tim@xen.org>
12 years agoxl: Fixup filename->source after 25344:0f3b1e13d6af
George Dunlap [Tue, 15 May 2012 16:01:54 +0000 (17:01 +0100)]
xl: Fixup filename->source after 25344:0f3b1e13d6af

Because of conflicts with another patch, changeset 25344:0f3b1e13d6af missed
one change.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl: Add pci_assignable_add and remove commands
George Dunlap [Tue, 15 May 2012 15:28:16 +0000 (16:28 +0100)]
xl: Add pci_assignable_add and remove commands

pci-assignable-add will always store the driver rebind path, but
pci-assignable-remove will only actually rebind if asked to do so.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: Introduce pci_assignable_add and pci_assignable_remove
George Dunlap [Tue, 15 May 2012 15:28:15 +0000 (16:28 +0100)]
libxl: Introduce pci_assignable_add and pci_assignable_remove

Introduce libxl helper functions to prepare devices to be passed
through to guests.  This is meant to replace of all the manual sysfs
commands which are currently required.

pci_assignable_add accepts a BDF for a device and will:
* Unbind a device from its current driver, if any
* If "rebind" is set, it will store the path of the driver from which we
  unplugged it in /libxl/pciback/$BDF/driver_path
* If create a slot for it in pciback if one doesn't yet exist
* Bind the device to pciback

At this point it will show up in pci_assignable_list, and is ready to
be passed through to a guest.

pci_assignable_remove accepts a BDF for a device and will:
* Unbind the device from pciback
* Remove the slot from pciback
* If "rebind" is set, and /libx/pciback/$BDF/driver_path exists, it
  will attempt to rebind the device to its original driver.

Both functions are idempotent: if the desired end state has already
been reached, they return SUCCESS.

NB that "$BDF" in this case uses '-' instead of ':' and '.', because
':' and '.' are illegal characters in xenstore paths.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: Rename pci_list_assignable to pci_assignable_list
George Dunlap [Tue, 15 May 2012 15:28:15 +0000 (16:28 +0100)]
libxl: Rename pci_list_assignable to pci_assignable_list

...to prepare for a consistent "pci_assignable_*" naming scheme.

Also move the man page entry into the PCI PASS-THROUGH section, rather
than the XEN HOST section.

No functional changes.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: Make a helper function write a BDF to a sysfs path
George Dunlap [Tue, 15 May 2012 15:28:14 +0000 (16:28 +0100)]
libxl: Make a helper function write a BDF to a sysfs path

This functionality will be used several times in subsequent patches.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl: Make clear distinction between "filename" and "data source"
George Dunlap [Tue, 15 May 2012 15:28:13 +0000 (16:28 +0100)]
xl: Make clear distinction between "filename" and "data source"

Many places in xl there's a variable or element named "filename" which
does not contain a filename, but the source of the data for reporting
purposes.  Worse, there are variables which are sometimes actually
used or interpreted as a filename depending on what other variables
are set.  This makes it difficult to tell when a string is purely
cosmetic, and when another bit of code may actually attempt to call
"open" with the string.

This patch makes a consistent distinction between "filename" (which
always refers to the name of an actual file, and may be interpreted as
such at some point) and "source" (which may be a filename, or may be
another data source such as a migration stream or saved data).

This does add some variables and reshuffle where assignments happen;
most notably, the "restore_filename" element of struct domain_create
is now only set when restoring from a file.

But at a high level, there should be no funcitonal changes.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxlu: Rename filename to config_source
George Dunlap [Tue, 15 May 2012 15:28:12 +0000 (16:28 +0100)]
libxlu: Rename filename to config_source

The "filename" is a bit of a misnomer, as it's only used during error
messages, and in most instances cases is actually set to "command
line".

Rename it to "config_source" to make it clear that it's not used to
actually open any files.

No functional changes.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: Warn that /usr/bin/pygrub is deprecated
George Dunlap [Tue, 15 May 2012 15:28:11 +0000 (16:28 +0100)]
libxl: Warn that /usr/bin/pygrub is deprecated

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agotools: Install pv bootloaders in libexec rather than /usr/bin
George Dunlap [Tue, 15 May 2012 15:28:11 +0000 (16:28 +0100)]
tools: Install pv bootloaders in libexec rather than /usr/bin

pygrub and xenpvnetboot are meant to be run by tools, and not by the user,
and thus should be in /usr/lib/xen/bin rather than /usr/bin.

Because most config files will still have an absolute path pointing to
/usr/bin/pygrub, make a symbolic link that we will deprecate.

Signed-off-by: George Dunlap <george.dunlap@eu.ctirix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: Look for bootloader in libexec path
George Dunlap [Tue, 15 May 2012 15:28:10 +0000 (16:28 +0100)]
libxl: Look for bootloader in libexec path

If the full path for a bootloader (such as pygrub or xenpvnetboot) is not
given, check for it first in the libexec path before falling back to the
PATH variable.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl: Introduce vncviewer xm compatibility options
Goncalo Gomes [Tue, 15 May 2012 14:41:53 +0000 (15:41 +0100)]
xl: Introduce vncviewer xm compatibility options

Signed-off-by: Goncalo Gomes <Goncalo.Gomes@EU.CITRIX.COM>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl: code motion of vncviewer() and `struct domain_create`
Goncalo Gomes [Tue, 15 May 2012 14:41:52 +0000 (15:41 +0100)]
xl: code motion of vncviewer() and `struct domain_create`

Signed-off-by: Goncalo Gomes <Goncalo.Gomes@EU.CITRIX.COM>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxl: introduce specific VCPU to PCPU mapping in config file
Dario Faggioli [Tue, 15 May 2012 14:41:52 +0000 (15:41 +0100)]
xl: introduce specific VCPU to PCPU mapping in config file

xm supports the following syntax (in the config file) for
specific VCPU to PCPU mapping:

cpus = "0-3,5,^1" # all vcpus run on cpus 0,2,3,5
cpus = ["2", "3"] # VCPU0 runs on CPU2, VCPU1 runs on CPU3

Allow for the same in xl.

This fixes what happened in changeset 54000bca7a6a, which
introduced suppot for the `cpus=` option within xl, but used
both the list (cpus=[2, 3]) and the string (cpus="2,3") syntax
for achieving the same behaviour (pin all guest's vcpus to the
pcpus in the list/string).

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agox86: adjust handling of interrupts coming in via legacy vectors
Jan Beulich [Tue, 15 May 2012 07:18:33 +0000 (09:18 +0200)]
x86: adjust handling of interrupts coming in via legacy vectors

The debugging code added in c/s 24707:96987c324a4f was hit a (small)
number of times (one report being
http://lists.xen.org/archives/html/xen-devel/2012-05/msg00332.html),
apparently always with a vector within the legacy range. Obviously,
besides legacy vectors not normally expected to be in use on systems
with IO-APIC(s), they should never make it to the IRQ migration logic.

This wasn't being prevented so far: Since we don't have a one-to-one
mapping between vectors and IRQs - legacy IRQs may have two vectors
associated with them (one used in either 8259A, the other used in one
of the IO-APICs) -, vector-to-IRQ translations for legacy vectors (as
used in do_IRQ()) would yield a valid IRQ number despite the IRQ
really being handled via an IO-APIC.

This gets changed here - disable_8259A_irq() zaps the legacy vector-to-
IRQ mapping, and enable_8259A_irq(), should it ever be called for a
particular interrupts, restores it.

The spurious interrupt logic in do_IRQ() gets adjusted too: Interrupts
coming in via legacy vectors presumably didn't get reported through the
IO-APIC/LAPIC pair (as we never program these vectors into any RTE or
LVT). Call ack_APIC_irq() only when the LAPIC's ISR bit says an
interrupt is pending at the given vector. Plus, a new function (pointer)
bogus_8259A_irq() gets used to have the 8259A driver take care of the
bogus interrupt (as outside of automatic EOI mode it may need an EOI to
be issued for it to prevent other interrupts legitimately going through
the 8259As from getting masked out).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
12 years agox86: fix i8259A_resume()
Jan Beulich [Tue, 15 May 2012 07:18:02 +0000 (09:18 +0200)]
x86: fix i8259A_resume()

On systems that have an IO-APIC, we generally run the PIC in AEOI
mode, yet i8259A_resume() so far failed to put it back into that mode.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agonstore: rename public xenstore headers
Ian Campbell [Mon, 14 May 2012 16:15:36 +0000 (17:15 +0100)]
nstore: rename public xenstore headers

The xenstore header xs.h is producing conflicts with other software[1].

xs is a too short identifier and does not matche the library. Renaming
the headers to xenstore.h and xenstore_lib.h is the easiest way to make
them easy recognizable and prevent furthe problems.

[1]: http://bugs.debian.org/668550

[ Also update QEMU_TAG, to bring in corresponding change to
qemu-xen-traditional. -iwj ]

Signed-off-by: Bastian Blank <waldi@debian.org>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
--HG--
rename : tools/xenstore/xs.h => tools/xenstore/xenstore.h
rename : tools/xenstore/xs_lib.h => tools/xenstore/xenstore_lib.h

12 years agox86/hvm: put value of emulated register reads into trace records
David Vrabel [Mon, 14 May 2012 15:54:52 +0000 (16:54 +0100)]
x86/hvm: put value of emulated register reads into trace records

The tracepoint for emulated MMIO and I/O port reads was always before
the emulated read or write was done.  This means that for reads the
register value in the trace record was always 0.

So for reads, move the tracepoint until the register value is
available.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agotools: xen-lowmemd is x86 specific, only install for x86
Ian Campbell [Mon, 14 May 2012 15:34:29 +0000 (16:34 +0100)]
tools: xen-lowmemd is x86 specific, only install for x86

It is TARGETS-$(CONFIG_X86) so it should be INSTALL_SBIN-$(CONFIG_X86) too

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agoautoconf: check for dev86 and iasl on x86* only
Roger Pau Monne [Mon, 14 May 2012 15:22:39 +0000 (16:22 +0100)]
autoconf: check for dev86 and iasl on x86* only

Check for this tools on x86 systems only.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agolibxc: implement gnttab.set_max_grants for Linux
Jan Beulich [Mon, 14 May 2012 15:20:33 +0000 (16:20 +0100)]
libxc: implement gnttab.set_max_grants for Linux

Legacy (non-pvops) gntdev drivers may require this operation to be
performed when the number of grants intended to be used simultaneously
exceeds a certain driver specific default limit, and qemu's qdisk
driver is an example of needing to do so.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agolibxl: prevent xl from doing operations on domains if xend is running
Roger Pau Monne [Mon, 14 May 2012 15:17:46 +0000 (16:17 +0100)]
libxl: prevent xl from doing operations on domains if xend is running

Prevent xl from doing any operation if xend daemon is running. That
prevents bugs that happened when xl and xend raced to close a domain.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agox86/irq: fix locking for c/s 24707:96987c324a4f debugging code
Jan Beulich [Mon, 14 May 2012 10:06:09 +0000 (12:06 +0200)]
x86/irq: fix locking for c/s 24707:96987c324a4f debugging code

Without this, dump_irqs() may try to acquire the lock the caller is
currently holding.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
12 years agounmodified_drivers: remove inclusion of asm/system.h
Olaf Hering [Mon, 14 May 2012 10:04:27 +0000 (12:04 +0200)]
unmodified_drivers: remove inclusion of asm/system.h

Allow compilation of PVonHVM drivers with forward-ported xenlinux
sources in openSuSE 12.2. Since Linux 3.4 asm/system.h is not present
anymore. Remove inclusion of this header, its not needed.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Jan Beulich <jbeulich@suse.com>
12 years agolibxl: abort bootloader invocation when domain dies
Ian Jackson [Fri, 11 May 2012 17:59:07 +0000 (18:59 +0100)]
libxl: abort bootloader invocation when domain dies

Cancel the bootloader (specifically, by sending it a signal) if the
domain is seen to disappear from xenstore.

We use a new utility event source libxl__domaindeathcheck which
provides a convenient wrapper for the xenstore watch.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Changes since v8:
 * Fixed the commit message summary line.

Changes since v7:
 * Add a comment explaining why we use a watch on the domain's
   xenstore path rather than @releaseDomain.
 * Fix typo in error message.
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: child processes cleanups
Ian Jackson [Fri, 11 May 2012 17:59:06 +0000 (18:59 +0100)]
libxl: child processes cleanups

Abolish libxl_fork.  Its only callers were in xl.  Its functionality
is now moved elsewhere, as follows:

* The "logging version of fork", which is what it was billed as, is now
  xl_fork, which also dies on failure.

* Closing the xenstore handle in the child is now done in
  libxl__ev_child_fork, which is the only remaining place where fork
  is called in libxl.

* We provide a new function libxl__ev_child_xenstore_reopen for
  in-libxl children to make the ctx useable for xenstore again.

* Consequently libxl__spawn_record_pid now no longer needs to mess
  about with its own xenstore handle.  As a bonus it can now just use
  libxl__xs_write.

Also, since we have now converted all the forkers in libxl, we can
always honour the fork_replacement childproc hook - so do so.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: clarify definition of "slow" operation
Ian Jackson [Fri, 11 May 2012 17:59:06 +0000 (18:59 +0100)]
libxl: clarify definition of "slow" operation

Update the comment in libxl_internal.h to be clearer about which
application-facing libxl operations need to take an ao_how.

Reported-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: convert console callback to libxl_asyncprogress_how
Ian Jackson [Fri, 11 May 2012 17:59:06 +0000 (18:59 +0100)]
libxl: convert console callback to libxl_asyncprogress_how

Remove the old console callback.  (Its reentrancy properties were
troublesome: in principle, the event loop might be reentered during
the callback, and the libxl__domain_create_state swept out from under
the feet of the domain creation.)

As a side effect of the new code arrangements, the console callback
for non-bootloader-using PV guests now occurs near the end of domain
creation, in the same place as for HVM guests, rather than near the
start.

The new arrangements should in principle mean that by the time the
console is described as ready by the callback, the xenstore key is
indeed ready.  So in the future the timeout might be removed from
the console client.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: remove malloc failure handling from NEW_EVENT
Ian Jackson [Fri, 11 May 2012 17:59:05 +0000 (18:59 +0100)]
libxl: remove malloc failure handling from NEW_EVENT

Change to use libxl__zalloc, where allocation failure is fatal.

Also remove a spurious semicolon from the helper macro.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: provide progress reporting for long-running operations
Ian Jackson [Fri, 11 May 2012 17:59:05 +0000 (18:59 +0100)]
libxl: provide progress reporting for long-running operations

This will be used for reporting, during domain creation, that the
console is ready.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Changes since v7:
 * If aop->how.callback, actually add the aop to the for_callback list (!)
 * Document the threadsafety of aop's, and make appropriate cross-references.
 * Allocate the actual aop from its thread's egc; do not free it.
 * Remove pointless code motion of libxl__ao_create.
 * Minor formatting fixes.
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: Fix an ao completion bug; document locking policy
Ian Jackson [Fri, 11 May 2012 17:59:04 +0000 (18:59 +0100)]
libxl: Fix an ao completion bug; document locking policy

Document the concurrent access policies for libxl__ao and libxl__egc,
and their corresponding gcs.

Fix a violation of the policy:

If an ao was submitted and a callback requested, and while the
initiating function was still running on the original thread, the ao
is completed on another thread, the completing thread would improperly
concurrently access the ao with the initiating thread.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: make libxl_create run bootloader via callback
Ian Jackson [Fri, 11 May 2012 17:59:04 +0000 (18:59 +0100)]
libxl: make libxl_create run bootloader via callback

Change initiate_domain_create to properly use libxl__bootloader_run
rather than improperly calling libxl_run_bootloader with NULL ao_how.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Changes since v7:
 * constify convenience aliases.

Changes since v6:
 * Bugfixes from testing.
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: set guest_domid even if libxl__domain_make fails
Roger Pau Monne [Fri, 11 May 2012 17:59:03 +0000 (18:59 +0100)]
libxl: set guest_domid even if libxl__domain_make fails

This is needed in order to perform the domain destruction if
libxl__domain_make fails.

Also move doc comment about error behaviour of libxl__domain_make from
implementation to declaration.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: ao: convert libxl__spawn_*
Ian Jackson [Fri, 11 May 2012 17:59:03 +0000 (18:59 +0100)]
libxl: ao: convert libxl__spawn_*

libxl__spawn_spawn becomes a callback-style asynchronous function.
The implementation is now in terms of libxl__ev_* including
libxl_ev_child.

All the callers need to be updated.  This includes the device model
spawning functions libxl__create_device_model and
libxl__create_stubdom; these are replaced with libxl__spawn_local_dm
and libxl__spawn_stubdom.  libxl__confirm_device_model_startup is
abolished; instead the dm spawner calls back.

(The choice of which kind of device model to create is lifted out of
what used to be libxl__create_device_model, because that function was
indirectly recursive.  Recursive callback-style operations are clumsy
because they require a pointer indirection for the nested states.)

Waiting for proper device model startup it is no longer notionally
optional.  Previously the code appeared to tolerate this by passing
NULL for various libxl__spawner_starting* parameters to device model
spawners.  However, this was not used anywhere.

Conversely, the "for_spawn" parameter to libxl__wait_for_offspring is
no longer supported.  It remains as an unused formal parameter to
avoid updating, in this patch, all the call sites which pass NULL.
libxl__wait_for_offspring is in any case itself an obsolete function,
so this wrinkle will go away when its callers are updated to use the
event system.  Consequently libxl__spawn_check is also abolished.

The "console ready" callback also remains unchanged in this patch.
The API for this needs to be reviewed in the context of the event
series and its reentrancy restrictions documented.

Thus their callers need to be updated.  These are the domain creation
functions libxl_domain_create_new and _restore.  These functions now
take ao_hows, and have a private state structure.

However domain creation remains not completely converted to the event
mechanism; in particular it runs the outward-facing function
libxl_run_bootloader with a NULL ao_how, which is quite wrong.  As it
happens in the current code this is not a bug because none of the rest
of the functionality surrounding the bootloader call will mind if the
event loop is reentered in the middle of its execution.

The file-scope function libxl__set_fd_flag which was used by the
previous spawn arrangements becomes unused and is removed; other
places in libxl can use libxl_fd_set_nonblock and
libxl_fd_set_cloexec, which of course remain.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Changes since v8:
 * Make midproc_cb callback with correct pid (that of the grandchild,
   not "middle" which is zero).  Reported by Roger Pau Monne.

Changes since v7:
 * Rename libxl__spawn_stubdom to libxl__spawn_stub_dm (and ..._state);
   rename the state's stubdom_* members to dm_*.
 * Eliminate the union between the two dm creation states in
   libxl__domain_create_state.  Instead, the domain creation code
   simply uses libxl__stub_dm_spawn_state.dm directly, if we're
   taking the local dm path.
 * Remove a spurious "break".
 * In domain creation, move the PV non-qemu case into the switch.
 * Code style fixes.
 * Constify some convenience aliases.
 * Improve comments (including typo fixes).
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: change some structures to unit arrays
Ian Jackson [Fri, 11 May 2012 17:59:02 +0000 (18:59 +0100)]
libxl: change some structures to unit arrays

In the next patch these variables will turn into actual pointers.

To clarify that patch, prepare the ground by changing these variables
from "struct foo var" to "struct foo var[1]".  This enables accesses
to them and their members to be made as if they were pointers.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: remove ctx->waitpid_instead
Ian Jackson [Fri, 11 May 2012 17:59:02 +0000 (18:59 +0100)]
libxl: remove ctx->waitpid_instead

Remove this obsolete hook.  Callers inside libxl which create and reap
children should use the mechanisms provided by the event system.

(This has no functional difference since there is no way for
ctx->waitpid_instead ever to become set.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: add a dummy ao_how to libxl_domain_core_dump
Ian Campbell [Fri, 11 May 2012 17:59:02 +0000 (18:59 +0100)]
libxl: add a dummy ao_how to libxl_domain_core_dump

Although this function is not currently slow it may become so in the
future (this also depends somewhat on the size of the guest).
Therefore arrange for it to take an ao_how which it completes
immediately.  This will allow us to make it asynchronous in the future
without breaking API compatibility.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: Allow AO_GC and EGC_GC even if not used
Ian Jackson [Fri, 11 May 2012 17:59:01 +0000 (18:59 +0100)]
libxl: Allow AO_GC and EGC_GC even if not used

Mark the gc produced by AO_GC and EGC_GC with the gcc feature
__attribute__((unused)).  This allows the use of EGC_INIT and
STATE_AO_GC by functions which do actually use the gc.

This is convenient because those functions might want to use the ao or
egc, rather than the gc; and also because it means that functions
which morally ought to be fishing any gc they use out of an egc or
state structure can be written do so regardless of whether the gc is
actually used right then.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: log bootloader output
Ian Jackson [Fri, 11 May 2012 17:59:01 +0000 (18:59 +0100)]
libxl: log bootloader output

This involves adding a new log feature to libxl__datacopier, and then
using it.

If the bootloader exits nonzero we print the log filename in a log
message from libxl.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: make libxl_create_logfile const-correct
Ian Jackson [Fri, 11 May 2012 17:59:00 +0000 (18:59 +0100)]
libxl: make libxl_create_logfile const-correct

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: ao: Convert libxl_run_bootloader
Ian Jackson [Fri, 11 May 2012 17:59:00 +0000 (18:59 +0100)]
libxl: ao: Convert libxl_run_bootloader

Convert libxl_run_bootloader to an ao_how-taking function.

It's implemented in terms of libxl__bootloader_run, which can be used
internally.  The resulting code is pretty much a rewrite.

Significant changes include:

- We direct the bootloader's results to a file, not a pipe.  This
  makes it simpler to deal with as we don't have to read it
  concurrently along with everything else.

- We now issue a warning if we find unexpected statements in the
  bootloader results.

- The arrangements for buffering of bootloader input and output
  are completely changed.  Now we have a fixed limit of 64k
  on output, and 4k on input, and discard the oldest data when
  this overflows (which it shouldn't).  There is no timeout
  any more.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Changes since v6:
 * Use libxl__ev_child_inuse rather than testing pid directly.
 * Fix a code style error.
 * Properly initialise the sub-operations' aos in _init.
 * Bugfixes.
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: provide libxl__openpty_*
Ian Jackson [Fri, 11 May 2012 17:58:59 +0000 (18:58 +0100)]
libxl: provide libxl__openpty_*

General facility for ao operations to open ptys.

This will be used by the bootloader machinery.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: provide libxl__datacopier_*
Ian Jackson [Fri, 11 May 2012 17:58:59 +0000 (18:58 +0100)]
libxl: provide libxl__datacopier_*

General facility for ao operations to shovel data between fds.

This will be used by the bootloader machinery.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Changes in v7:
 * assert that the ao is non-null on _init.
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: Clean up setdefault in do_domain_create
Ian Jackson [Fri, 11 May 2012 17:58:58 +0000 (18:58 +0100)]
libxl: Clean up setdefault in do_domain_create

do_domain_create called libxl__domain_create_info_setdefault twice.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: Introduce libxl__sendmsg_fds and libxl__recvmsg_fds
Ian Jackson [Fri, 11 May 2012 17:58:58 +0000 (18:58 +0100)]
libxl: Introduce libxl__sendmsg_fds and libxl__recvmsg_fds

Provide functions for sending and receiving fds.

There used to be fd-sending functionality in libxl_qmp.c before
25298:84ae90427c54, which this implementation is partially derived
from.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: provide libxl__remove_file et al.
Ian Jackson [Fri, 11 May 2012 17:58:58 +0000 (18:58 +0100)]
libxl: provide libxl__remove_file et al.

These utility functions cope with EINTR AND ENOENT, do error logging,
and we provide a recursive version to delete whole directory trees.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agoautoconf: New test for openpty et al.
Ian Jackson [Fri, 11 May 2012 17:58:57 +0000 (18:58 +0100)]
autoconf: New test for openpty et al.

We may need to #include <libutil.h>, and/or link with -lutil, to use
openpty, login_tty, and the like.  Provide INCLUDE_LIBUTIL_H
(preprocessor constant, not always defined) and PTYFUNCS_LIBS
(makefile variable).

We link libxl against PTYFUNCS_LIBS (which comes from autoconf) rather
than UTIL_LIBS, and #include <libutil.h> where appropriate.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Changes since v7:
 * Actually include the call to AX_CHECK_PTYFUNCS in this patch,
   not the previous one, and regenerate configure accordingly.

Changes since v6:
 * Put failure macro call in correct place so it might actually happen.
 * Try both with -lutil and without.
 * Patch now contains update for config.h.in.
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agoautoconf: trim the configure script; use autoheader
Ian Jackson [Fri, 11 May 2012 17:58:57 +0000 (18:58 +0100)]
autoconf: trim the configure script; use autoheader

Remove a lot of unnecessary tests.  Specifically, we no longer test
for standard POSIX facilities which we expect to be provided
everywhere and which we don't in any case have any alternative for.

Switch to generating config.h.in with autoheader.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Roger Pau Monne <roger.pau@entel.upc.edu>
Changes since v7:
 * Removed AX_CHECK_PTYFUNCS (snuck in from previous patch)
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agoof SIGCHLD. The application can tell us whether it wants to own
Ian Jackson [Fri, 11 May 2012 17:58:56 +0000 (18:58 +0100)]
of SIGCHLD.  The application can tell us whether it wants to own
SIGCHLD or not; if it does, it has to tell us about deaths of our
children.

Currently there are no callers in libxl which use these facilities.
All code in libxl which forks needs to be converted and libxl_fork
needse to be be abolished.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: support multiple libxl__ev_fds for the same fd
Ian Jackson [Fri, 11 May 2012 17:58:55 +0000 (18:58 +0100)]
libxl: support multiple libxl__ev_fds for the same fd

We need a slightly more sophisticated data structure to allow this,
where we record the slot not just for each fd but also for each
(fd,eventbit) where eventbit is POLLIN, POLLPRI, POLLOUT.

Document the new relaxed restriction.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Changes since v6:
 * Fix typo
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agolibxl: handle POLLERR, POLLHUP, POLLNVAL properly
Ian Jackson [Fri, 11 May 2012 17:58:55 +0000 (18:58 +0100)]
libxl: handle POLLERR, POLLHUP, POLLNVAL properly

Pass POLLERR and POLLHUP to fd callbacks, as is necessary.
Crash on POLLNVAL since that means our fds are messed up.

Document the behaviour (including the fact that poll sometimes sets
POLLHUP or POLLERR even if only POLLIN was requested.

Fix the one current fd callback to do something with POLLERR|POLLHUP.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agoblktap2: Fix naked unchecked uses of read/write/chdir.
Keir Fraser [Fri, 11 May 2012 17:30:29 +0000 (18:30 +0100)]
blktap2: Fix naked unchecked uses of read/write/chdir.

These cause warnings under warn_unused_result, and for read/write we
ought to deal with partial io results.

Signed-off-by: Keir Fraser <keir@xen.org>
12 years agolibxl_qmp: remove libxl__qmp_migrate, introduce libxl__qmp_save
Stefano Stabellini [Fri, 11 May 2012 16:46:16 +0000 (17:46 +0100)]
libxl_qmp: remove libxl__qmp_migrate, introduce libxl__qmp_save

Following the recent changes to upstream Qemu, the best monitor command
to suit or needs is "xen-save-devices-state" rather than "migrate".
This patch removes libxl__qmp_migrate and introduces libxl__qmp_save
instead, that uses "xen-save-devices-state".

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
12 years agolibxl: save/restore qemu's physmap
Stefano Stabellini [Fri, 11 May 2012 16:46:15 +0000 (17:46 +0100)]
libxl: save/restore qemu's physmap

Read Qemu's physmap from xenstore and save it using toolstack_save.
Restore Qemu's physmap using toolstack_restore.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
12 years agolibxc: introduce XC_SAVE_ID_TOOLSTACK
Stefano Stabellini [Fri, 11 May 2012 16:46:15 +0000 (17:46 +0100)]
libxc: introduce XC_SAVE_ID_TOOLSTACK

Introduce a new save_id to save/restore toolstack specific extra
information.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
12 years agoxl: Call xlu_cfg_destroy in main_cpupoolcreate
George Dunlap [Fri, 11 May 2012 16:34:24 +0000 (17:34 +0100)]
xl: Call xlu_cfg_destroy in main_cpupoolcreate

This involves making a goto clean-up path, rather than calling
return directly.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
12 years agoxl: Call xlu_cfg_destroy in the pciattach and pcidetach
George Dunlap [Fri, 11 May 2012 16:34:23 +0000 (17:34 +0100)]
xl: Call xlu_cfg_destroy in the pciattach and pcidetach

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
12 years agoxl: Replace memset with libxl_device_pci_init
George Dunlap [Fri, 11 May 2012 16:34:23 +0000 (17:34 +0100)]
xl: Replace memset with libxl_device_pci_init

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
12 years agoxl: use libxl_cpumap_set_none not memset
Ian Campbell [Fri, 11 May 2012 11:20:43 +0000 (12:20 +0100)]
xl: use libxl_cpumap_set_none not memset

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
12 years agolibxl: default to xenconsoled for pv guests
Ian Campbell [Fri, 11 May 2012 14:52:52 +0000 (15:52 +0100)]
libxl: default to xenconsoled for pv guests

Default to xenconsoled for pv guests, even if qemu is running.

Currently we prefer to use qemu for the disk backend if we are starting qemu
anyway (e.g. to service a disk).

Unfortunately qemu doesn't log the console, which xenconsoled can do via
XENCONSOLED_TRACE=guest. Since xenconsoled is also running anyway it seems like
there is no particular reason to prefer qemu just because it happens to be
running.

However we must use qemu if thereis more than one console (xenconsoled only
supports a single console).

Therefore push the logic to change the console backend down into
libxl__need_xenpv_qemu so that it can do the right thing.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl/xend: name tap devices vifX.Y-emu
Ian Campbell [Wed, 25 Apr 2012 11:55:57 +0000 (12:55 +0100)]
libxl/xend: name tap devices vifX.Y-emu

This prevents the udev scripts from operating on other tap devices (e.g.
openvpn etc)

Correct the documentation for the "vifname" option which suggested it applied
to HVM tap devices only, which is not the case.

Reported by Michael Young.

Also fix the use of vifname with emulated devices. This is slightly complex.
The current hotplug scripts rely on being able to parse the "tapX.Y" (now
"vifX.Y-emu") name in order to locate the xenstore backend dir relating to the
corresponding vif. This is because we cannot inject our own environment vars
into the tap hotplug events. However this means that if the tap is initially
named with a user specified name (which will not match the expected scheme) we
fail to do anything useful with the device. So now we create the initial tap
device with the standard "vifX.Y-emu" name and the hotplug script will handle
the rename to the desired name. This is also how PV vif devices work -- they
are always created by netback with the name vifX.Y and renamed in the script.

Lastly also move libxl__device_* to a better place in the header, otherwise the
comment about evgen stuff isn't next to the associated functions (noticed jsut
because I was going to add nic_devname near to the setdefault functions)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
12 years agoQEMU_TAG update
Ian Jackson [Fri, 11 May 2012 11:42:57 +0000 (12:42 +0100)]
QEMU_TAG update

12 years agolibxl: use xc_topologyinfo to figure out how many CPUs we actually have
Darrio Faggioli [Fri, 11 May 2012 11:39:43 +0000 (12:39 +0100)]
libxl: use xc_topologyinfo to figure out how many CPUs we actually have

Within libxl_get_cpu_topology(), considering all the CPUs the hypervisor
supports to be valid topology entries might lead to misleading and incorrect
behaviours, e.g., the output of `xl info -n' below on a 16 cores machine:
...
cpu_topology           :
cpu:    core    socket     node
  0:       0        1        0
  1:       0        1        0
  2:       1        1        0
  3:       1        1        0
  4:       9        1        0
  5:       9        1        0
  6:      10        1        0
  7:      10        1        0
  8:       0        0        1
  9:       0        0        1
 10:       1        0        1
 11:       1        0        1
 12:       9        0        1
 13:       9        0        1
 14:      10        0        1
 15:      10        0        1
 16:       0        0        0
 17:       0        0        0
 18:       0        0        0
 19:       0        0        0
 20:       0        0        0
 ...
 ...
 62:       0        0        0
 63:       0        0        0

However, xc_topologyinfo() tells us (in max_cpu_index) how many entries
arrays it returns corresponds to actually valid CPUs, so let's use that
information.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agodocs: add vpmu description to xen-command-line.markdown
Dietmar Hahn [Fri, 27 Apr 2012 09:09:26 +0000 (11:09 +0200)]
docs: add vpmu description to xen-command-line.markdown

Add a short description to the vpmu boot option in the
xen-command-line.markdown

Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix indentation in libxl_dm.c for qemu
Roger Pau Monne [Thu, 10 May 2012 16:33:59 +0000 (17:33 +0100)]
libxl: fix indentation in libxl_dm.c for qemu

Fixed indentation on Qemu argument construction for network devices.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agolibxl: add "downscript=no" to Qemu call
Roger Pau Monne [Thu, 10 May 2012 16:33:58 +0000 (17:33 +0100)]
libxl: add "downscript=no" to Qemu call

Currently we only pass script=no to Qemu, to avoid calling any scripts when
attaching a tap interface, but we should also pass downscript=no to avoid Qemu
trying to execute a script when disconnecting the interface. This prevents the
following harmless error message:

/etc/qemu-ifdown: could not launch network script

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agotools/vtpm: use LDLIBS to pass -lgmp
Olaf Hering [Fri, 4 May 2012 17:43:25 +0000 (19:43 +0200)]
tools/vtpm: use LDLIBS to pass -lgmp

Linking tpmd will fail with recent toolchains because -lgmp is passed
via LDFLAGS instead of LDLIBS. With this change -lgpm is placed at the
end of the gcc cmdline and linking tpmd succeeds again.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agotools/hotplug: remove 4 from default runlevel in init scripts
Olaf Hering [Fri, 4 May 2012 17:38:02 +0000 (19:38 +0200)]
tools/hotplug: remove 4 from default runlevel in init scripts

Remove 4 from default runlevel in xen-watchdog, xend and xendomains.

Similar to what changeset 24847:0900b1c905f1 does in xencommons, remove
runlevel 4 from the other runlevel scripts. LSB defines runlevel 4 as
reserved for local use, the local sysadmin is responsible for symlink
creation in rc4.d.

Runlevel 4 was specified in Default-Start since a very long time. Then
it was copied also to the new xen-watchdog in 21861:fb3649141e19. Until
now this was not an issue since only xencommons is automatically enabled
during package install, and a custom xend and xendomains script is
included in the SuSE packages. Since some time a rpmlint check complains
about the wrong Default-Start entry in xen-watchdog.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agotools/vtpm_manager: add missing DESTDIR to install rule
Olaf Hering [Fri, 4 May 2012 15:40:40 +0000 (17:40 +0200)]
tools/vtpm_manager: add missing DESTDIR to install rule

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agoblktap2: Fix another uninitialised value error
Ian Jackson [Thu, 10 May 2012 13:26:14 +0000 (14:26 +0100)]
blktap2: Fix another uninitialised value error

gcc  -O1 -fno-omit-frame-pointer -m32 -march=i686 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement   -D__XEN_TOOLS__ -MMD -MF .block-remus.o.d -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -mno-tls-direct-seg-refs -Werror -g -Wno-unused -fno-strict-aliasing -I../include -I../drivers -I/home/osstest/build.12828.build-i386/xen-unstable/tools/blktap2/drivers/../../../tools/libxc -I/home/osstest/build.12828.build-i386/xen-unstable/tools/blktap2/drivers/../../../tools/include -D_GNU_SOURCE -DUSE_NFS_LOCKS  -c -o block-remus.o block-remus.c

block-remus.c: In function 'ramdisk_flush':
block-remus.c:508: error: 'buf' may be used uninitialized in this function
make[5]: *** [block-remus.o] Error 1

This is because gcc can see that merge_requests doesn't always set
*mergedbuf but gcc isn't able to prove that it always does so if
merge_requests returns 0 and that in that case the value of
ramdisk_flush::buf isn't used.

This is too useful a warning to disable, despite the occasional false
positive of this form.  The conventional approach is to suppress the
warning by explicitly initialising the variable to 0.

This has just come to light because 25275:27d63b9f111a reenabled
optimisation for this area of code, and gcc's data flow analysis
(which is required to trigger the uninitialised variable warning) only
occurs when optimisation is turned on.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agoMAINTAINERS: add Ian Campbell as a tools maintainer
Ian Campbell [Thu, 10 May 2012 11:19:16 +0000 (12:19 +0100)]
MAINTAINERS: add Ian Campbell as a tools maintainer

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl: log failure from libxl__blktap_devpath in libxl_device_disk_add
Ian Campbell [Tue, 8 May 2012 13:24:31 +0000 (14:24 +0100)]
libxl: log failure from libxl__blktap_devpath in libxl_device_disk_add

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agolibxl: Fix incorrect return of OSEVENT_HOOK macro
Daniel De Graaf [Thu, 10 May 2012 11:19:15 +0000 (12:19 +0100)]
libxl: Fix incorrect return of OSEVENT_HOOK macro

The OSEVENT_HOOK_INTERN macro incorrectly returned the value of the
expression CTX->osevent_in_hook-- (usually 1) instead of the value of
the function call it made. Fix the macro to return the proper value.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxl/libxl_event.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

13 years agoxl: xl.cfg: fix typo in opengl section
Olaf Hering [Mon, 7 May 2012 15:54:08 +0000 (17:54 +0200)]
xl: xl.cfg: fix typo in opengl section

Add missing i to qemu-xen-traditonal

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>