]> xenbits.xensource.com Git - xen.git/log
xen.git
12 years agoxenconsoled: clean-up after all dead domains
David Vrabel [Fri, 31 Aug 2012 09:42:04 +0000 (10:42 +0100)]
xenconsoled: clean-up after all dead domains

xenconsoled expected domains that are being shutdown to end up in the
the DYING state and would only clean-up such domains.  HVM domains
either didn't enter the DYING state or weren't in long enough for
xenconsoled to notice.

For every shutdown HVM domain, xenconsoled would leak memory, grow its
list of domains and (if guest console logging was enabled) leak the
log file descriptor.  If the file descriptors were leaked and enough
HVM domains were shutdown, no more console connections would work as
the evtchn device could not be opened.  Guests would then block
waiting to send console output.

Fix this by tagging domains that exist in enum_domains().  Afterwards,
all untagged domains are assumed to be dead and are shutdown and
cleaned up.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-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 agoREADME: Update references to PyXML to lxml
Ian Campbell [Fri, 31 Aug 2012 09:42:04 +0000 (10:42 +0100)]
README: Update references to PyXML to lxml

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 agodocs: improve documentation of Xen command line parameters
Matt Wilson [Fri, 31 Aug 2012 09:42:03 +0000 (10:42 +0100)]
docs: improve documentation of Xen command line parameters

This change improves documentation for several Xen command line
parameters. Some of the Itanium-specific options are now removed. A
more thorough check should be performed to remove any other remnants.

I've reformatted some of the entries to fit in 80 column terminals.

Options that are yet undocumented but accept standard boolean /
integer values are now annotated as such.

The size suffixes have been corrected to use the binary prefixes
instead of decimal prefixes.

Signed-off-by: Matt Wilson <msw@amazon.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agox86/i8259: Clean up _mask_and_ack_8259A_irq().
Keir Fraser [Thu, 30 Aug 2012 17:17:20 +0000 (18:17 +0100)]
x86/i8259: Clean up _mask_and_ack_8259A_irq().

Signed-off-by: Keir Fraser <keir@xen.org>
12 years agox86/i8259: Handle bogus spurious interrupts more quietly
Andrew Cooper [Thu, 30 Aug 2012 17:06:39 +0000 (18:06 +0100)]
x86/i8259: Handle bogus spurious interrupts more quietly

c/s 25336:edd7c7ad1ad2 introduced the concept of a bogus vector, for
in irqs delivered through the i8259 PIC after IO-APICs had been set
up.

However, if supurious PIC vectors are received, many "No irq handler
for vector" log messages can be seen on the console.

This patch adds to the bogus vector logic to detect spurious PIC
vectors and simply ignore them.  _mask_and_ack_8259A_irq() has been
modified to return a boolean indicating whether the irq is real or
not, and in the case of a spurious vector, the error in do_IRQ() is
not printed.

One complication is that now, _mask_and_ack_8259A_irq() can get called
whatever the ack mode is, so has been altered to work out whether it
should EOI the irq or not.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agonvmx: fix unhandled nested XSETBV VMExit
Dongxiao Xu [Thu, 30 Aug 2012 16:58:23 +0000 (17:58 +0100)]
nvmx: fix unhandled nested XSETBV VMExit

If the L2 guest issue a XSETBV instruction, we need to deliver to
L1 guest.

This could fix the Fedora 17 booting hang issue as a L2 guest.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agodocs: update xenpaging.txt
Olaf Hering [Thu, 30 Aug 2012 16:57:31 +0000 (17:57 +0100)]
docs: update xenpaging.txt

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Keir Fraser <keir@xen.org>
12 years agonvmx: fix resource relinquish for nested VMX
Dongxiao Xu [Thu, 30 Aug 2012 16:55:31 +0000 (17:55 +0100)]
nvmx: fix resource relinquish for nested VMX

The previous order of relinquish resource is:
relinquish_domain_resources() -> vcpu_destroy() ->
nvmx_vcpu_destroy().  However some L1 resources like nv_vvmcx and
io_bitmaps are free in nvmx_vcpu_destroy(), therefore the
relinquish_domain_resources() will not reduce the refcnt of the domain
to 0, therefore the latter vcpu release functions will not be called.

To fix this issue, we need to release the nv_vvmcx and io_bitmaps in
relinquish_domain_resources().

Besides, after destroy the nested vcpu, we need to switch the
vmx->vmcs back to the L1 and let the vcpu_destroy() logic to free the
L1 VMCS page.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agox86: Prefer multiboot-provided e820 over bios-provided e801 memory info.
Keir Fraser [Tue, 28 Aug 2012 21:40:45 +0000 (22:40 +0100)]
x86: Prefer multiboot-provided e820 over bios-provided e801 memory info.

Some UEFI systems do not provide e820 information. In this case we
should take the detailed memory map provided by a multiboot-capable
loader, rather than rely on very conservative values from the e801
bios call. Using the latter on any modern system really hardly makes
good sense.

[Excellent candidate for 4.1 backport]

Signed-off-by: Keir Fraser <keir@xen.org>
Tested-by: Jonathan Tripathy <jonnyt@abpni.co.uk>
12 years agotools/xl: Fix uninitialized variable error.
Andrew Cooper [Tue, 28 Aug 2012 13:46:30 +0000 (14:46 +0100)]
tools/xl: Fix uninitialized variable error.

c/s 25779:4ca40e0559c3 introduced a compilation error for any build
system using -Werror=uninitialized, such as the default CentOS 5.7
version of gcc.

And with good reason, because if the global libxl
default_output_format is neither OUTPUT_FORMAT_SXP nor
OUTPUT_FORMAT_JSON, the variable hand will be used before being
initialised.

The attached patch fixes the warning, and futher fixes the logic to
work correctly when a new OUTPUT_FORMAT is added to xl.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: Rerun bison
Ian Jackson [Fri, 24 Aug 2012 11:38:18 +0000 (12:38 +0100)]
libxl: Rerun bison

This updates libxlu_cfg_y.[ch] to code generated by bison from
Debian squeeze (1:2.4.1.dfsg-3 i386).

There should be no functional change since there is no change to the
source file, but we will inherit bugfixes and behavioural changes from
the new version of bison.  So this is more a matter of hope than
knowledge.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agolibxl: Rerun flex
Ian Jackson [Fri, 24 Aug 2012 11:38:16 +0000 (12:38 +0100)]
libxl: Rerun flex

This undoes some systematic changes which were made to
libxlu_cfg_l.[ch] along with manually-edited files (eg, whitespace
changes, emacs local variables) and returns these two files to exactly
the output of flex (Debian squeeze 2.5.35-10 i386).

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agolibxl: provide "make realclean" target
Ian Jackson [Fri, 24 Aug 2012 11:38:14 +0000 (12:38 +0100)]
libxl: provide "make realclean" target

This removes all the autogenerated files.

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 agonested vmx: Don't set bit 55 in IA32_VMX_BASIC_MSR
Zhang Xiantao [Fri, 24 Aug 2012 08:49:47 +0000 (09:49 +0100)]
nested vmx: Don't set bit 55 in IA32_VMX_BASIC_MSR

All related IA32_VMX_TRUE_*_MSR are not implemented,
so set this bit to 0, otherwise system L1VMM may
get incorrect default1 class settings.

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agonested vmx: VM_ENTRY_IA32E_MODE shouldn't be in default1 class
Zhang Xiantao [Fri, 24 Aug 2012 08:49:14 +0000 (09:49 +0100)]
nested vmx: VM_ENTRY_IA32E_MODE shouldn't be in default1 class
for IA32_VM_ENTRY_CTLS_MSR.

If set to 1, L2 guest's paging mode maybe mis-judged
and mis-set.

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agoxl: make "xl list -l" proper JSON
Ian Campbell [Thu, 23 Aug 2012 18:12:28 +0000 (19:12 +0100)]
xl: make "xl list -l" proper JSON

Bastian Blank reports that the output of this command is just multiple
JSON objects concatenated and is not a single properly formed JSON
object.

Fix this by wrapping in an array. This turned out to be a bit more
intrusive than I was expecting due to the requirement to keep
supporting the SXP output mode.

Python's json module is happy to parse the result...

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agolibxl: make domain resume API asynchronous
Ian Campbell [Thu, 23 Aug 2012 18:00:09 +0000 (19:00 +0100)]
libxl: make domain resume API asynchronous

Although the current implementation has no asynchromous parts I can
envisage it needing to do bits of create/destroy like functionality
which may need async support in the future.

To do this make the meat into an internal libxl__domain_resume
function in order to satisfy the no-internal-callers rule for the
async function.

Since I needed to touch the logging to s/ctx/CTX/ anyway switch to the
LOG* helper macros.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-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 agoUpdate Xen version to 4.2.0-rc4-pre
Keir Fraser [Thu, 23 Aug 2012 14:06:11 +0000 (15:06 +0100)]
Update Xen version to 4.2.0-rc4-pre

12 years agoAdded signature for changeset d44f290e81df
Keir Fraser [Thu, 23 Aug 2012 14:05:48 +0000 (15:05 +0100)]
Added signature for changeset d44f290e81df

12 years agoAdded tag 4.2.0-rc3 for changeset d44f290e81df
Keir Fraser [Thu, 23 Aug 2012 14:05:36 +0000 (15:05 +0100)]
Added tag 4.2.0-rc3 for changeset d44f290e81df

12 years agoUpdate Xen version to 4.2.0-rc3 4.2.0-rc3
Keir Fraser [Thu, 23 Aug 2012 14:05:30 +0000 (15:05 +0100)]
Update Xen version to 4.2.0-rc3

12 years agox86,cmdline: Fix setting skip_realmode boolean on no-real-mode and tboot options
Keir Fraser [Thu, 23 Aug 2012 14:02:04 +0000 (15:02 +0100)]
x86,cmdline: Fix setting skip_realmode boolean on no-real-mode and tboot options
...effect should be cumulative.

Signed-off-by: Keir Fraser <keir@xen.org>
12 years agoDump IOMMU p2m table
Santosh Jodh [Wed, 22 Aug 2012 21:29:06 +0000 (22:29 +0100)]
Dump IOMMU p2m table

New key handler 'o' to dump the IOMMU p2m table for each domain.
Skips dumping table for domain 0.
Intel and AMD specific iommu_ops handler for dumping p2m table.

Incorporated feedback from Jan Beulich and Wei Wang.
Fixed indent printing with %*s.
Removed superflous superpage and other attribute prints.
Make next_level use consistent for AMD IOMMU dumps. Warn if found
inconsistent.
AMD IOMMU does not skip levels. Handle 2mb and 1gb IOMMU page size for
AMD.

Signed-off-by: Santosh Jodh <santosh.jodh@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agoFix shared entry status for grant copy operation on paged-out gfn
Andres Lagar-Cavilla [Wed, 22 Aug 2012 21:27:50 +0000 (22:27 +0100)]
Fix shared entry status for grant copy operation on paged-out gfn

The unwind path was not clearing the shared entry status bits. This
was BSOD-ing guests on network activity under certain configurations.

Also:
 * sed the fixup method name to signal it's related to grant copy.
 * use atomic clear flag ops during fixup.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Committed-by: Keir Fraser <keir@xen.org>
12 years agohvm: Remove VM genearation ID device and incr_generationid from build_info.
Paul Durrant [Wed, 22 Aug 2012 21:26:27 +0000 (22:26 +0100)]
hvm: Remove VM genearation ID device and incr_generationid from build_info.

Microsoft have now published their VM generation ID specification at
https://www.microsoft.com/en-us/download/details.aspx?id=30707.
It differs from the original specification upon which I based my
implementation in several key areas. Particularly, it is no longer
an incrementing 64-bit counter and so this patch is to remove
the incr_generationid field from the build_info and also disable the
ACPI device before 4.2 is released.

I will follow up with further patches to implement the VM generation
ID to the new specification.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
12 years agolibxc: Support save/restore of up to 4096 VCPUs (increase from 64 VCPUs).
Keir Fraser [Wed, 22 Aug 2012 21:20:42 +0000 (22:20 +0100)]
libxc: Support save/restore of up to 4096 VCPUs (increase from 64 VCPUs).

Signed-off-by: Keir Fraser <keir@xen.org>
12 years agoflask/policy: add accesses used by newer dom0s
Daniel De Graaf [Wed, 22 Aug 2012 21:15:36 +0000 (22:15 +0100)]
flask/policy: add accesses used by newer dom0s

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
12 years agoxsm/flask: remove page-to-domain lookups from XSM hooks
Daniel De Graaf [Wed, 22 Aug 2012 21:14:52 +0000 (22:14 +0100)]
xsm/flask: remove page-to-domain lookups from XSM hooks

Doing a reverse lookup from MFN to its owning domain is redundant with
the internal checks Xen does on pages. Change the checks to operate
directly on the domain owning the pages for normal memory; MMIO areas
are still checked with security_iomem_sid.

This fixes a hypervisor crash when a domU attempts to map an MFN that
is free in Xen's heap: the XSM hook is called before the validity
check, and page_get_owner returns garbage when called on these
pages. While explicitly checking for such pages using
page_get_owner_and_reference is a possible solution, this ends up
duplicating parts of get_page_from_l1e.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
12 years agoxsm: Add missing dummy hooks
Daniel De Graaf [Wed, 22 Aug 2012 21:13:32 +0000 (22:13 +0100)]
xsm: Add missing dummy hooks

A few XSM hooks have been defined without implementation in dummy.c;
these will cause a null function pointer deference if called. Also
implement the efi_call hook, which was incorrectly added without any
implementations.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
12 years agox86-64: refine the XSA-9 fix
Jan Beulich [Mon, 20 Aug 2012 06:46:47 +0000 (08:46 +0200)]
x86-64: refine the XSA-9 fix

Our product management wasn't happy with the "solution" for XSA-9, and
demanded that customer systems must continue to boot. Rather than
having our and perhaps other distros carry non-trivial patches, allow
for more fine grained control (panic on boot, deny guest creation, or
merely warn) by means of a single line change.

Also, as this was found to be a problem with remotely managed systems,
don't default to boot denial (just deny guest creation).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86: don't expose SYSENTER on unknown CPUs
Jan Beulich [Mon, 20 Aug 2012 06:40:01 +0000 (08:40 +0200)]
x86: don't expose SYSENTER on unknown CPUs

So far we only ever set up the respective MSRs on Intel CPUs, yet we
hide the feature only on a 32-bit hypervisor. That prevents booting of
PV guests on top of a 64-bit hypervisor making use of the instruction
on unknown CPUs (VIA in this case).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agodocs: console: correct example console type definition
Ian Campbell [Fri, 17 Aug 2012 13:57:29 +0000 (14:57 +0100)]
docs: console: correct example console type definition

I think this is intended to be under the specific console's directory.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agotools/python: Clean python correctly
Andrew Cooper [Fri, 17 Aug 2012 13:46:49 +0000 (14:46 +0100)]
tools/python: Clean python correctly

Cleaning the python directory should completely remove the build/
directory, otherwise subsequent builds may be short-circuited and a
stale build installed.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxc/Linux: Add VM_DONTCOPY flag of the VMA of the hypercall buffer
Wangzhenguo [Fri, 17 Aug 2012 13:46:48 +0000 (14:46 +0100)]
libxc/Linux: Add VM_DONTCOPY flag of the VMA of the hypercall buffer

This avoids the hypercall buffer becoming CoW on fork.

In multi-threads and multi-processes environment, e.g. the process has two
threads, thread A may call hypercall, thread B may call fork() to create child
process. After forking, all pages of the process including hypercall buffers
are cow. It will cause a write protection and return EFAULT error if hypervisor
calls copy_to_user in hypercall in thread A context,

Fix:
1. Before hypercall: use MADV_DONTFORK of madvise syscall to make the hypercall
   buffer not to be copied to child process after fork.
2. After hypercall: undo the effect of MADV_DONTFORK for the hypercall buffer
   by using MADV_DOFORK of madvise syscall.
3. Use mmap/nunmap for memory alloc/free instead of malloc/free to bypass libc.

Note:
Child processes must not use the opened xc_{interface,evtchn,gnttab,gntshr}
handle that inherits from parents. They should reopen the handle if they want
to interact with xc. Otherwise, it may cause segment fault to access hypercall
buffer caches of the handle.

Signed-off-by: Zhenguo Wang <wangzhenguo@huawei.com>
Signed-off-by: Xiaowei Yang <xiaowei.yang@huawei.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- s/ptr/p/ to fix build & tweaked the wording of the comments
         slightly. ]
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxend: Replace the use of XMLPrettyPrint from PyXML with stdlib functionality.
M A Young [Fri, 17 Aug 2012 13:10:26 +0000 (14:10 +0100)]
xend: Replace the use of XMLPrettyPrint from PyXML with stdlib functionality.

This appears to have been missed by changeset 22235:b8cc53d22545
"Replace pyxml/xmlproc-based XML validator with lxml based one"

This was reported by Toshio Ernie Kuratomi at
https://bugzilla.redhat.com/show_bug.cgi?id=842843

Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agofix typos in xen/arch/x86/hvm/vmx/vmcs.c
Yongjie Ren [Fri, 17 Aug 2012 10:36:38 +0000 (12:36 +0200)]
fix typos in xen/arch/x86/hvm/vmx/vmcs.c

Signed-off-by: Yongjie Ren <yongjie.ren@intel.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
12 years agox86/ucode: don't crash during AP bringup on non-Intel, non-AMD CPUs
Jan Beulich [Fri, 17 Aug 2012 09:36:08 +0000 (11:36 +0200)]
x86/ucode: don't crash during AP bringup on non-Intel, non-AMD CPUs

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agoEPT/PoD: fix interaction with 1Gb pages
Jan Beulich [Thu, 16 Aug 2012 16:38:05 +0000 (17:38 +0100)]
EPT/PoD: fix interaction with 1Gb pages

When PoD got enabled to support 1Gb pages, ept_get_entry() didn't get
updated to match - the assertion in there triggered, indicating that
the call to p2m_pod_demand_populate() needed adjustment.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
12 years agox86/mm: update max_mapped_pfn on MMIO mappings too.
Tim Deegan [Thu, 16 Aug 2012 13:31:09 +0000 (14:31 +0100)]
x86/mm: update max_mapped_pfn on MMIO mappings too.

max_mapped_pfn should reflect the highest mapping we've ever seen of
any type, or the tests in the lookup functions will be wrong.  As it
happens, the highest mapping has always been a RAM one, but this is no
longer the case when we allow 64-bit BARs.

Reported-by: Xudong Hao <xudong.hao@intel.com>
Signed-off-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
12 years agox86/PoD: clean up types
Jan Beulich [Thu, 16 Aug 2012 08:16:19 +0000 (10:16 +0200)]
x86/PoD: clean up types

GMFN values must undoubtedly be "unsigned long". "count" and
"entry_count", since they are signed types, should also be "long" as
otherwise they can't fit all values that can fit into "d->tot_pages"
(which currently is "uint32_t").

Beyond that, the patch doesn't convert everything to "long" as in many
places it is clear that "int" suffices. In places where "long" is being
used partially already, the change is however being done.

Furthermore, page order values have no use of being "long".

Finally, in the course of updating a few printk messages anyway, some
also get slightly shortened (to focus on the relevant information).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
12 years agox86/PoD: prevent guest from being destroyed upon early access to its memory
Jan Beulich [Thu, 16 Aug 2012 08:14:11 +0000 (10:14 +0200)]
x86/PoD: prevent guest from being destroyed upon early access to its memory

When an external agent (e.g. a monitoring daemon) happens to access the
memory of a PoD guest prior to setting the PoD target, that access must
fail for there not being any page in the PoD cache, and only the space
above the low 2Mb gets scanned for victim pages (while only the low 2Mb
got real pages populated so far).

To accomodate for this
- set the PoD target first
- do all physmap population in PoD mode (i.e. not just large [2Mb or
  1Gb] pages)
- slightly lift the restrictions enforced by p2m_pod_set_mem_target()
  to accomodate for the changed tools behavior

Tested-by: Jürgen Groß <juergen.gross@ts.fujitsu.com>
           (in a 4.0.x based incarnation)
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
12 years agoetherboot: Build fixes for gcc 4.7.
Keir Fraser [Wed, 15 Aug 2012 08:41:21 +0000 (09:41 +0100)]
etherboot: Build fixes for gcc 4.7.

Signed-off-by: Keir Fraser <keir@xen.org>
12 years agoacpi: Make sure valid CPU is passed to do_pm_op()
Boris Ostrovsky [Wed, 15 Aug 2012 07:43:25 +0000 (09:43 +0200)]
acpi: Make sure valid CPU is passed to do_pm_op()

Passing invalid CPU value to do_pm_op() will cause assertion
in cpu_online().

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
Such checks would, at a first glance, then also be missing at the top
of various helper functions, but these check really were already
redundant with the check in do_pm_op(). Remove the redundant checks
for clarity and brevity.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
12 years agox86-64/EFI: add CFLAGS to check compile
Daniel De Graaf [Wed, 15 Aug 2012 07:42:14 +0000 (09:42 +0200)]
x86-64/EFI: add CFLAGS to check compile

Without this, the compilation of check.c could fail due to compiler
features such as -fstack-protector being enabled, which causes a
missing __stack_chk_fail symbol error.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Rather than using plain CFLAGS here, remove CFLAGS-y from them to
particularly get rid of the -MF argument referencing (the undefined
here) $(@F).

The use of CFLAGS at once allows dropping the explicit use of -Werror.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
12 years agoQEMU_TAG update
Ian Jackson [Tue, 14 Aug 2012 14:59:38 +0000 (15:59 +0100)]
QEMU_TAG update

12 years agox86/PoD: fix (un)locking after 24772:28edc2b31a9b
Jan Beulich [Tue, 14 Aug 2012 08:28:14 +0000 (10:28 +0200)]
x86/PoD: fix (un)locking after 24772:28edc2b31a9b

That c/s introduced a double unlock on the out-of-memory error path of
p2m_pod_demand_populate().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
12 years agoconfig: Split debug build from debug symbols
Andrew Cooper [Mon, 13 Aug 2012 17:09:33 +0000 (18:09 +0100)]
config: Split debug build from debug symbols

RPM based packaging systems expect binaries to have debug symbols which get
placed in a separate debuginfo RPM.

Split the concept of a debug build up so that binaries can be built with
debugging symbols without having the other gubbins which $(debug) implies, most
notibly frame pointers.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Tested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agolibxl: fix build for gcc prior to 4.3
Jan Beulich [Mon, 13 Aug 2012 17:08:37 +0000 (18:08 +0100)]
libxl: fix build for gcc prior to 4.3

So far all we (explicitly) require is gcc 3.4 or better, so we
shouldn't be unconditionally using features supported only by much
newer versions.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agotools: init.d/Linux/xencommons: load all known backend drivers
Olaf Hering [Mon, 13 Aug 2012 13:11:22 +0000 (14:11 +0100)]
tools: init.d/Linux/xencommons: load all known backend drivers

Load all known backend drivers fron xenlinux and pvops based dom0
kernels.  There is currently no code in xend or libxl to load these
drivers on demand.  Currently libxl has also no helpful error message if
a backend driver is missing.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agox86/cpuidle: clean up statistics reporting to user mode
Jan Beulich [Fri, 10 Aug 2012 12:41:17 +0000 (14:41 +0200)]
x86/cpuidle: clean up statistics reporting to user mode

First of all, when no ACPI Cx data was reported, make sure the usage
count passed back to user mode is not random.

Besides that, fold a lot of redundant code.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agomake all (native) hypercalls consistently have "long" return type
Jan Beulich [Fri, 10 Aug 2012 07:51:01 +0000 (09:51 +0200)]
make all (native) hypercalls consistently have "long" return type

for common and x86 ones at least, to address the problem of storing
zero-extended values into the multicall result field otherwise.

Reported-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agoUpdate Xen version to 4.2.0-rc3-pre
Keir Fraser [Wed, 8 Aug 2012 17:02:57 +0000 (18:02 +0100)]
Update Xen version to 4.2.0-rc3-pre

12 years agoAdded signature for changeset f4c47bcc01e1
Keir Fraser [Wed, 8 Aug 2012 17:02:35 +0000 (18:02 +0100)]
Added signature for changeset f4c47bcc01e1

12 years agoAdded tag 4.2.0-rc2 for changeset f4c47bcc01e1
Keir Fraser [Wed, 8 Aug 2012 17:02:27 +0000 (18:02 +0100)]
Added tag 4.2.0-rc2 for changeset f4c47bcc01e1

12 years agoUpdate Xen version to 4.2.0-rc2 4.2.0-rc2
Keir Fraser [Wed, 8 Aug 2012 17:02:21 +0000 (18:02 +0100)]
Update Xen version to 4.2.0-rc2

12 years agoQEMU_TAG update
Ian Jackson [Tue, 7 Aug 2012 17:37:31 +0000 (18:37 +0100)]
QEMU_TAG update

12 years agolibxl: write physical-device node if user did not supply a block script
Ian Campbell [Tue, 7 Aug 2012 13:26:29 +0000 (14:26 +0100)]
libxl: write physical-device node if user did not supply a block script

This reverts one of the intentional changes from 25733:353bc0801b11.
That change exposed an issue with the xl migration protocol, which
although safe triggers the hotplug scripts device sharing logic.

For 4.2 we disable this logic by writing the physical-device xenstore
node ourselves if a user did not supply a script. If the user did
supply a script then we continue to rely on it to write the
physical-device node (not least because the script may create the
device and therefore it is not available before we run the script).

This means that to support localhost migration a block hotplug script
needs to be robust against adding a device twice and should not
deactivate the device until it has been removed twice.

This should be revisited for 4.3.

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 agoeliminate lock profile pointer from spinlock structure when !LOCK_PROFILE
Jan Beulich [Tue, 7 Aug 2012 13:09:17 +0000 (15:09 +0200)]
eliminate lock profile pointer from spinlock structure when !LOCK_PROFILE

This pointer is never used for anything, and needlessly increases the
memory footprint of various pieces of data.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agomark 8x14 font data const
Jan Beulich [Tue, 7 Aug 2012 11:42:32 +0000 (13:42 +0200)]
mark 8x14 font data const

Signed-off-by: Jan Beulich <jbeulich@suse.com>
12 years agoAlthough the "Intel Virtualization Technology FlexMigration
Matt Wilson [Tue, 7 Aug 2012 06:49:53 +0000 (08:49 +0200)]
Although the "Intel Virtualization Technology FlexMigration
Application Note" (http://www.intel.com/Assets/PDF/manual/323850.pdf)
does not document support for extended model 2H model DH (Intel Xeon
Processor E5 Family), empirical evidence shows that the same MSR
addresses can be used for cpuid masking as exdended model 2H model AH
(Intel Xen Processor E3-1200 Family).

Signed-off-by: Matt Wilson <msw@amazon.com>
Acked-by: Nakajima, Jun <jun.nakajima@intel.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
12 years agox86/MCE: remove mcg_ctl and other adjustment for future vMCE
Liu, Jinsong [Tue, 7 Aug 2012 06:16:37 +0000 (08:16 +0200)]
x86/MCE: remove mcg_ctl and other adjustment for future vMCE

This is a middle-work patch, preparing for the future new vMCE model.
It removes mcg_ctl, disables MCG_CTL_P, and sets bank count to 2.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
12 years agolibxl: support custom block hotplug scripts
Ian Campbell [Mon, 6 Aug 2012 11:28:03 +0000 (12:28 +0100)]
libxl: support custom block hotplug scripts

These are provided using the "script=" syntax described in
docs/misc/xl-disk-configuration.txt.

The existing hotplug scripts currently conflate two different
concepts, namely that of making a datapath available in the backend
domain (logging into iSCSI LUNs and the like) and that of actually
connecting that datapath to a Xen backend path (e.g. writing
"physical-device" node in xenstore to bring up blkback).

For this reason the script support implemented here is only supported
in conjunction with backendtype=phy.

Eventually we hope to rework the hotplug scripts to separate the to
concepts, but that is not 4.2 material.

In addition there are some other subtleties:

 - Previously in the blktap case we would add "script = .../blktap" to
   the backend flex array, but then jumped to the PHY case which added
   "script = .../block" too. The block one takes precendence since it
   comes second.

   This was, accidentally, correct. The blktap script is for blktap1
   devices and not blktap2 devices. libxl completely manages the
   blktap2 side of things without resorting to hotplug scripts and
   creates a blkback device directly.  Therefore the "block" script is
   always the correct one to call. Custom script are not supported in
   this context.

 - libxl should not write the "physical-device" node. This is the
   responsibility of the block script. Writing the "physical-device"
   node in libxl basically completely short-cuts the standard block
   hotplug script which uses "physical-device" to know if it has run
   already or not.

   In the case of more complex scripts libxl cannot know the right
   value to write here anyway, in particular the device may not exist
   until after the script is called.

   This change has the side effect of re-enabling the checks for
   device sharing aspect of the default block script, which I have tested
   and which now cause libxl to properly abort now that libxl properly
   checks for hotplug script errors.

   There is no sharing check for blktap2 since even if you reuse the
   same vhd the resulting tap device is different. I would have preferred
   to simply write the "physical-device" node for the blktap2 case but
   the hotplug script infrastructure is not currently setup to handle
   LIBXL__DEVICE_KIND_VBD
   devices without a hotplug script (backendtype phy and tap both end
   up as KIND_VBD). Changing this was more surgery than I was happy doing
   for 4.2 and therefore I have simply hardcoded to the block script for
   the LIBXL_DISK_BACKEND_TAP case.

 - libxl__device_disk_set_backend running against a phy device with a
   script cannot stat the device to check its properties since it may
   not exist until the script is run. Therefore I have special cased
   this in disk_try_backend to simply assume that backend == phy is
   always ok if a script was
   configured.  Similarly the other backend types are always rejected
   if a script was configured.

   Note that the reason for implementing the default script behaviour
   in device_disk_add instead of libxl__device_disk_setdefault is
   because we need to be able to tell when the script was
   user-supplied rather than defaulted by libxl in order to correctly
   implement the above. The setdefault function must be idempotent so
   we cannot simply update disk->script.

   I suspect that for 4.3 a script member should be added to
   libxl__device, this would also help in the case above of handling
   devices with no script in a consistent manner. This is not 4.2
   material.

 - When the block script falls through and shells out to a block-$type
   script it used to pass "$node" however the only place this was
   assigned was in the remove+phy case (in which case it contains the
   file:// derived /dev/loopN device), and in that case the script
   exits without falling through to the block-$type case.

   Since libxl never creates a type other than phy this never happens
   in practice anyway and we now call the correct block-$type script
   directly.  But fix it up anyway since it is confusing.

 - The block-nbd and block-enbd scripts which we supply appear to be
   broken WRT the hotplug calling convention, in that they seem to
   expect a command line parameter (perhaps the $node described above)
   rather than reading the appropriate node from xenstore.

   I rather suspect this was broken by 7774:e2e7f47e6f79 in November
   2005. I think it is safe to say no one is using these scripts! I
   haven't fixed this here. It would be good to track down some working
   scripts and either incorproate them or defer to them in their existing
   home (e.g. if they live somewhere useful like the nbd tools
   package).

 - Added a few block script related entries to check-xl-disk-parse
   from http://backdrift.org/xen-block-iscsi-script-with-multipath-support
   and http://lists.linbit.com/pipermail/drbd-user/2008-September/010221.html /
   http://www.drbd.org/users-guide-emb/s-xen-configure-domu.html (and
   snuck in another interesting empty CDROM case)

   This highlighted two bugs in the libxlu disk parser handling of the
   deprecated "<script>:" prefix:

   - It was failing to prefix with "block-" to construct the actual
     script name

   - The regex for matching iscsi or drdb or e?nbd was incorrect

 - Use libxl__abs_path for the nic script too. Just because the
   existing code nearly tricked me into repeating the mistake

I have tested with a custom block script which uses "lvchange -a" to
dynamically add remove the referenced device (simulates iSCSI
login/logout without requiring me to faff around setting up an iSCSI
target). I also tested on a blktap2 system.

I haven't directly tested anything more complex like iscsi: or nbd:
other than what check-xl-disk-parse exercises.

[ Recommit of correct version of 25727:a8d708fcb347, which was mangled
  during commit.  Sorry. -iwj ]

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 agoMerge backout of 25727:a8d708fcb347
Ian Jackson [Mon, 6 Aug 2012 11:25:06 +0000 (12:25 +0100)]
Merge backout of 25727:a8d708fcb347

12 years agoBacked out changeset a8d708fcb347
Ian Jackson [Mon, 6 Aug 2012 11:24:46 +0000 (12:24 +0100)]
Backed out changeset a8d708fcb347

25727:a8d708fcb347 was mangled during commit.  Back it out so that we
can commit it properly.

Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agox86: fix wait code asm() constraints
Jan Beulich [Mon, 6 Aug 2012 09:18:43 +0000 (11:18 +0200)]
x86: fix wait code asm() constraints

This fixes theoretical issues with those constraints - operands that
get clobbered before consuming all input operands must be marked so
according the the gcc documentation. Beyond that, the change is merely
code improvement, not a bug fix.

In __prepare_to_wait(), properly mark early clobbered registers. By
doing so, we at once eliminate the need to save/restore rCX and rDI.

In check_wakeup_from_wait(), make the current constraints match by
removing the code that actuall alters registers. By adjusting the
resume address in __prepare_to_wait(), we can simply re-use the copying
operation there (rather than doing a second pointless copy in the
opposite direction after branching to the resume point), which at once
eliminates the need for re-loading rCX and rDI inside the asm().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agolibxl: fix cleanup of tap devices in libxl__device_destroy
Ian Campbell [Fri, 3 Aug 2012 11:25:29 +0000 (12:25 +0100)]
libxl: fix cleanup of tap devices in libxl__device_destroy

We pass be_path to tapdisk_destroy but we've already deleted it so it
fails to read tapdisk-params. However it appears that we need to
destroy the tap device after tearing down xenstore, to avoid the leak
reported by Greg Wettstein in
<201207312141.q6VLfJje012656@wind.enjellic.com>.

So read the tapdisk-params in the cleanup transaction, before the
remove, and pass that down to destroy_tapdisk instead. tapdisk-params
may of course be NULL if the device isn't a tap device.

There is no need to tear down the tap device from
libxl__initiate_device_remove since this ultimately calls
libxl__device_destroy.

Propagate and log errors from libxl__device_destroy_tapdisk.

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 agotools/hotplug/Linux/init.d/: load other xen kernel modules on xencommons start
Fabio Fantoni [Fri, 3 Aug 2012 11:07:34 +0000 (12:07 +0100)]
tools/hotplug/Linux/init.d/: load other xen kernel modules on xencommons start

Signed-off-by: Fabio Fantoni <fabio.fantoni@heliman.it>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agolibxl: support custom block hotplug scripts
Ian Campbell [Fri, 3 Aug 2012 10:59:12 +0000 (11:59 +0100)]
libxl: support custom block hotplug scripts

These are provided using the "script=" syntax described in
docs/misc/xl-disk-configuration.txt.

The existing hotplug scripts currently conflate two different
concepts, namely that of making a datapath available in the backend
domain (logging into iSCSI LUNs and the like) and that of actually
connecting that datapath to a Xen backend path (e.g. writing
"physical-device" node in xenstore to bring up blkback).

For this reason the script support implemented here is only supported
in conjunction with backendtype=phy.

Eventually we hope to rework the hotplug scripts to separate the to
concepts, but that is not 4.2 material.

In addition there are some other subtleties:

 - Previously in the blktap case we would add "script = .../blktap" to
   the backend flex array, but then jumped to the PHY case which added
   "script = .../block" too. The block one takes precendence since it
   comes second.

   This was, accidentally, correct. The blktap script is for blktap1
   devices and not blktap2 devices. libxl completely manages the
   blktap2 side of things without resorting to hotplug scripts and
   creates a blkback device directly.  Therefore the "block" script is
   always the correct one to call. Custom script are not supported in
   this context.

 - libxl should not write the "physical-device" node. This is the
   responsibility of the block script. Writing the "physical-device"
   node in libxl basically completely short-cuts the standard block
   hotplug script which uses "physical-device" to know if it has run
   already or not.

   In the case of more complex scripts libxl cannot know the right
   value to write here anyway, in particular the device may not exist
   until after the script is called.

   This change has the side effect of re-enabling the checks for
   device sharing aspect of the default block script, which I have tested
   and which now cause libxl to properly abort now that libxl properly
   checks for hotplug script errors.

   There is no sharing check for blktap2 since even if you reuse the
   same vhd the resulting tap device is different. I would have preferred
   to simply write the "physical-device" node for the blktap2 case but
   the hotplug script infrastructure is not currently setup to handle
   LIBXL__DEVICE_KIND_VBD
   devices without a hotplug script (backendtype phy and tap both end
   up as KIND_VBD). Changing this was more surgery than I was happy doing
   for 4.2 and therefore I have simply hardcoded to the block script for
   the LIBXL_DISK_BACKEND_TAP case.

 - libxl__device_disk_set_backend running against a phy device with a
   script cannot stat the device to check its properties since it may
   not exist until the script is run. Therefore I have special cased
   this in disk_try_backend to simply assume that backend == phy is
   always ok if a script was
   configured.  Similarly the other backend types are always rejected
   if a script was configured.

   Note that the reason for implementing the default script behaviour
   in device_disk_add instead of libxl__device_disk_setdefault is
   because we need to be able to tell when the script was
   user-supplied rather than defaulted by libxl in order to correctly
   implement the above. The setdefault function must be idempotent so
   we cannot simply update disk->script.

   I suspect that for 4.3 a script member should be added to
   libxl__device, this would also help in the case above of handling
   devices with no script in a consistent manner. This is not 4.2
   material.

 - When the block script falls through and shells out to a block-$type
   script it used to pass "$node" however the only place this was
   assigned was in the remove+phy case (in which case it contains the
   file:// derived /dev/loopN device), and in that case the script
   exits without falling through to the block-$type case.

   Since libxl never creates a type other than phy this never happens
   in practice anyway and we now call the correct block-$type script
   directly.  But fix it up anyway since it is confusing.

 - The block-nbd and block-enbd scripts which we supply appear to be
   broken WRT the hotplug calling convention, in that they seem to
   expect a command line parameter (perhaps the $node described above)
   rather than reading the appropriate node from xenstore.

   I rather suspect this was broken by 7774:e2e7f47e6f79 in November
   2005. I think it is safe to say no one is using these scripts! I
   haven't fixed this here. It would be good to track down some working
   scripts and either incorproate them or defer to them in their existing
   home (e.g. if they live somewhere useful like the nbd tools
   package).

 - Added a few block script related entries to check-xl-disk-parse
   from http://backdrift.org/xen-block-iscsi-script-with-multipath-support
   and http://lists.linbit.com/pipermail/drbd-user/2008-September/010221.html /
   http://www.drbd.org/users-guide-emb/s-xen-configure-domu.html (and
   snuck in another interesting empty CDROM case)

   This highlighted two bugs in the libxlu disk parser handling of the
   deprecated "<script>:" prefix:

   - It was failing to prefix with "block-" to construct the actual
     script name

   - The regex for matching iscsi or drdb or e?nbd was incorrect

 - Use libxl__abs_path for the nic script too. Just because the
   existing code nearly tricked me into repeating the mistake

I have tested with a custom block script which uses "lvchange -a" to
dynamically add remove the referenced device (simulates iSCSI
login/logout without requiring me to faff around setting up an iSCSI
target). I also tested on a blktap2 system.

I haven't directly tested anything more complex like iscsi: or nbd:
other than what check-xl-disk-parse exercises.

[ reran flex/bison -iwj ]

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agolibxl: correct some comments regarding event API and fds
Ian Jackson [Fri, 3 Aug 2012 10:57:10 +0000 (11:57 +0100)]
libxl: correct some comments regarding event API and fds

* libxl may indeed register more than one callback for the same fd,
  with some restrictions.  The allowable range of responses to this by
  the application means that this should pose no problems for users.
  But the documentation comment should be fixed.

* Document the relaxed synchronicity semantics of the fd_modify
  registration callback.

* A couple of comments referred to old names for functions.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoIntel VT-d: Dump IOMMU supported page sizes
Santosh Jodh [Fri, 3 Aug 2012 09:38:04 +0000 (10:38 +0100)]
Intel VT-d: Dump IOMMU supported page sizes

Signed-off-by: Santosh Jodh <santosh.jodh@citrix.com>
12 years agonestedhvm: fix nested page fault build error on 32-bit
Ian Campbell [Fri, 3 Aug 2012 08:54:17 +0000 (09:54 +0100)]
nestedhvm: fix nested page fault build error on 32-bit

    cc1: warnings being treated as errors
    hvm.c: In function ‘hvm_hap_nested_page_fault’:
    hvm.c:1282: error: passing argument 2 of ‘nestedhvm_hap_nested_page_fault’ from incompatible pointer type /local/scratch/ianc/devel/xen-unstable.hg/xen/include/asm/hvm/nestedhvm.h:55: note: expected ‘paddr_t *’ but argument is of type ‘long unsigned int *’

hvm_hap_nested_page_fault takes an unsigned long gpa and passes &gpa
to nestedhvm_hap_nested_page_fault which takes a paddr_t *. Since both
of the callers of hvm_hap_nested_page_fault (svm_do_nested_pgfault and
ept_handle_violation) actually have the gpa which they pass to
hvm_hap_nested_page_fault as a paddr_t I think it makes sense to
change the argument to hvm_hap_nested_page_fault.

The other user of gpa in hvm_hap_nested_page_fault is a call to
p2m_mem_access_check, which currently also takes a paddr_t gpa but I
think a paddr_t is appropriate there too.

Jan points out that this is also an issue for >4GB guests on the 32
bit hypervisor.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: const correctness for libxl__xs_path_cleanup
Ian Campbell [Fri, 3 Aug 2012 08:54:16 +0000 (09:54 +0100)]
libxl: const correctness for libxl__xs_path_cleanup

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: add a comment re the memory management API instability
Ian Jackson [Fri, 3 Aug 2012 08:54:15 +0000 (09:54 +0100)]
libxl: add a comment re the memory management API instability

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: idl: always initialise the KeyedEnum keyvar in the member init function
Ian Campbell [Fri, 3 Aug 2012 08:54:14 +0000 (09:54 +0100)]
libxl: idl: always initialise the KeyedEnum keyvar in the member init function

Previously we only initialised it if an explicit keyvar_init_val was
given but not if the default was implicitly 0.

In the generated code this only changes the unused libxl_event_init_type
function:

 void libxl_event_init_type(libxl_event *p, libxl_event_type type)
 {
+    assert(!p->type);
+    p->type = type;
     switch (p->type) {
     case LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN:
         break;

However I think it is wrong that this function is unused, this and
libxl_event_init should be used by libxl__event_new. As it happens
both are just memset to zero but for correctness we should use the
init functions (in case the IDL changes).

In the generator we also need to properly handle init_var == 0 which
the current if statements incorrectly treat as False. This doesn't
actually have any impact on the generated code.

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: remove an unused numainfo parameter
Ian Jackson [Fri, 3 Aug 2012 08:54:14 +0000 (09:54 +0100)]
libxl: remove an unused numainfo parameter

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: remus: mark TODOs more clearly
Ian Jackson [Fri, 3 Aug 2012 08:54:13 +0000 (09:54 +0100)]
libxl: remus: mark TODOs more clearly

Change the TODOs in the remus code to "REMUS TODO" which will make
them easier to grep for later.  AIUI all of these are essential for
use of remus in production.

Also add a new TODO and a new assert, to check rc on entry to
remus_checkpoint_dm_saved.

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 blunder on if bootloader fails (again)
Ian Jackson [Fri, 3 Aug 2012 08:54:12 +0000 (09:54 +0100)]
libxl: do not blunder on if bootloader fails (again)

Do not lose the rc value passed to bootloader_callback.  Do not lose
the rc value from the bl when the local disk detach succeeds.

While we're here rationalise the use of bl->rc to make things clearer.
Set it to zero at the start and always update it conditionally; copy
it into bootloader_callback's argument each time.

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: rename aodevs to multidev
Ian Jackson [Fri, 3 Aug 2012 08:54:11 +0000 (09:54 +0100)]
libxl: rename aodevs to multidev

To be consistent with the new function naming, rename
libxl__ao_devices to libxl__multidev and all variables aodevs to
multidev.

No functional change.

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: abolish useless `start' parameter to libxl__add_*
Ian Jackson [Fri, 3 Aug 2012 08:54:11 +0000 (09:54 +0100)]
libxl: abolish useless `start' parameter to libxl__add_*

0 is always passed for this parameter and the code doesn't, actually,
use it, now.

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: fix formatting of DEFINE_DEVICES_ADD
Ian Jackson [Fri, 3 Aug 2012 08:54:10 +0000 (09:54 +0100)]
libxl: fix formatting of DEFINE_DEVICES_ADD

These lines were exactly 80 columns wide, which produces hideous wrap
damage in an 80 column emacs.  Reformat using emacs's C-c \,
which puts the \ in column 72 (by default) where possible.

Whitespace change only.

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: fix device counting race in libxl__devices_destroy
Ian Jackson [Fri, 3 Aug 2012 08:54:09 +0000 (09:54 +0100)]
libxl: fix device counting race in libxl__devices_destroy

Don't have a fixed number of devices in the aodevs array, and instead
size it depending on the devices present in xenstore.  Somewhat
formalise the multiple device addition/removal machinery to make this
clearer and easier to do.

As a side-effect we fix a few "lost thread of control" bug which would
occur if there were no devices of a particular kind.  (Various if
statements which checked for there being no devices have become
redundant, but are retained to avoid making the patch bigger.)

Specifically:

 * Users of libxl__ao_devices are no longer expected to know in
   advance how many device operations they are going to do.  Instead
   they can initiate them one at a time, between bracketing calls to
   "begin" and "prepared".

 * The array of aodevs used for this is dynamically sized; to support
   this it's an array of pointers rather than of structs.

 * Users of libxl__ao_devices are presented with a more opaque interface.
   They are are no longer expected to, themselves,
      - look into the array of aodevs (this is now private)
      - know that the individual addition/removal completions are
        handled by libxl__ao_devices_callback (this callback function
        is now a private function for the multidev machinery)
      - ever deal with populating the contents of an aodevs

 * The doc comments relating to some of the members of
   libxl__ao_device are clarified.  (And the member `aodevs' is moved
   to put it with the other members with the same status.)

 * The multidev machinery allocates an aodev to represent the
   operation of preparing all of the other operations.  See
   the comment in libxl__multidev_begin.

A wrinkle is that the functions are called "multidev" but the structs
are called "libxl__ao_devices" and "aodevs".  I have given these
functions this name to distinguish them from "libxl__ao_device" and
"aodev" and so forth by more than just the use of the plural "s"
suffix.

In the next patch we will rename the structs.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: react correctly to bootloader pty master POLLHUP
Ian Jackson [Fri, 3 Aug 2012 08:54:08 +0000 (09:54 +0100)]
libxl: react correctly to bootloader pty master POLLHUP

Receive POLLHUP on the bootloader master pty is not an error.
Hopefully it means that the bootloader has exited and therefore the
pty slave side has no process group any more.  (At least NetBSD
indicates POLLHUP on the master in this case.)

So send the bootloader SIGTERM; if it has already exited then this has
no effect (except that on some versions of NetBSD it erroneously
returns ESRCH and we print a harmless warning) and we will then
collect the bootloader's exit status and be satisfied.

However, we remember that we have done this so that if we got POLLHUP
for some other reason than that the bootloader exited we report
something resembling a useful message.

In order to implement this we need to provide a way for users of
datacopier to handle POLLHUP rather than treating it as fatal.

We rename bootloader_abort to bootloader_stop since it now no longer
only applies to error situations.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
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: unify libxl__device_destroy and device_hotplug_done
Ian Jackson [Fri, 3 Aug 2012 08:54:07 +0000 (09:54 +0100)]
libxl: unify libxl__device_destroy and device_hotplug_done

device_hotplug_done contains an open-coded but improved version of
libxl__device_destroy.  So move the contents of device_hotplug_done
into libxl__device_destroy, deleting the old code, and replace it at
its old location with a function call.

Add the missing call to libxl__xs_transaction_abort (which was present
in neither version and technically speaking is always a no-op with
this code as it stands at the moment because no-one does "goto out"
other than after libxl__xs_transaction_start or _commit).

Also fix the error handling: the rc from the destroy should be
propagated into the aodev.

Reported-by: Ian Campbell <Ian.Campbell@citrix.com>
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 agotools/vtpm: fix tpm_version.h error during parallel build
Olaf Hering [Fri, 3 Aug 2012 08:54:07 +0000 (09:54 +0100)]
tools/vtpm: fix tpm_version.h error during parallel build

Generating the tpm_version.h is not make -j safe:

In file included from ../tpm/tpm_emulator.h:25:0,
                 from ../tpm/tpm_startup.c:18:
../tpm/tpm_version.h:1:0: error: unterminated #ifndef
make[5]: *** [tpm_startup.o] Error 1

This happens because make can not know that 'all-recursive' depends on
'version'. Fix this by calling the individual make targets. Doing it
this way avoids adding yet another patch to the downloaded source.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: only read script once in libxl__hotplug_*
Ian Campbell [Fri, 3 Aug 2012 08:54:06 +0000 (09:54 +0100)]
libxl: only read script once in libxl__hotplug_*

instead of duplicating the error handling etc in get_hotplug_env just pass the
script already read by the caller down.

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: prefix *.for-check with _ to mark it as a generated file.
Ian Campbell [Fri, 3 Aug 2012 08:54:05 +0000 (09:54 +0100)]
libxl: prefix *.for-check with _ to mark it as a generated file.

Keeps it out of my greps etc.

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 agoarm: fix gic_init_secondary_cpu.
Ian Campbell [Fri, 3 Aug 2012 08:54:04 +0000 (09:54 +0100)]
arm: fix gic_init_secondary_cpu.

Using spin_lock_irq here is unnecessary (interrupts are not yet enabled) and
wrong (since they will get unexpectedly renabled by spin_unlock_irq).

We can just use spin_lock/spin_unlock.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: make libxl_device_pci_{add,remove,destroy} interfaces asynchronous
Ian Campbell [Fri, 3 Aug 2012 08:54:03 +0000 (09:54 +0100)]
libxl: make libxl_device_pci_{add,remove,destroy} interfaces asynchronous

This does not make the implementation fully asynchronous but just
updates the API to support asynchrony in the future.

Currently although these functions do not call hotplug scripts etc and
therefore are not "slow" (per the comment about ao machinery in
libxl_internal.h) they do interact with the device model and so are
not quite "fast" either. We can live with this for now.

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 agocpufreq: P state stats aren't available if there is no cpufreq driver
David Vrabel [Fri, 3 Aug 2012 07:50:28 +0000 (09:50 +0200)]
cpufreq: P state stats aren't available if there is no cpufreq driver

If there is no cpufreq driver (e.g., with an AMD Opteron 8212) then
reading the P state statistics causes a deadlock as an uninitialized
spinlock is locked in do_get_pm_info(). The spinlock is initialized in
cpufreq_statistic_init() which is not called if cpufreq_driver == NULL.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
12 years agonestedhvm: return the pfec from the pagetable walk.
Tim Deegan [Thu, 2 Aug 2012 13:44:53 +0000 (14:44 +0100)]
nestedhvm: return the pfec from the pagetable walk.

Don't clobber it with the pfec from teh p2m walk behind it; the guest
will not expect (or be able to handle) error codes that come from the
p2m table, which it can't see or control.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Tim Deegan <tim@xen.org>
12 years agonestedhvm: fix write access fault on ro mapping
Christoph Egger [Thu, 2 Aug 2012 13:38:09 +0000 (14:38 +0100)]
nestedhvm: fix write access fault on ro mapping

Fix write access fault when host npt is mapped read-only.
In this case let the host handle the #NPF.
Apply host p2mt to hap-on-hap pagetable entry.
This fixes the l2 guest graphic display refresh problem.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
12 years agoxen: detect compiler version with '--version' rather than '-v'
Tim Deegan [Thu, 2 Aug 2012 11:04:31 +0000 (12:04 +0100)]
xen: detect compiler version with '--version' rather than '-v'

This allows us to get rid of the 'grep version', which doesn't
work with localized compilers.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
12 years agox86: also allow disabling LAPIC NMI watchdog on newer CPUs
Jan Beulich [Thu, 2 Aug 2012 09:49:37 +0000 (11:49 +0200)]
x86: also allow disabling LAPIC NMI watchdog on newer CPUs

This complements c/s 9146:941897e98591, and also replaces a literal
zero with a proper manifest constant.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agopygrub: add quoting to install receipe
Olaf Hering [Thu, 2 Aug 2012 09:46:02 +0000 (10:46 +0100)]
pygrub: add quoting to install receipe

The changeset 25694:e20085770cb5 causes a syntax error if readline
returns nothing due to non-existant path:

[  148s] set -e; if [ `readlink -f /home/abuild/rpmbuild/BUILD/xen-4.2.25700/non-dbg/dist/install//usr/bin` != \
[  148s]              `readlink -f /usr/lib64/xen/bin` ]; then \
[  148s]     ln -sf /usr/lib64/xen/bin/pygrub /home/abuild/rpmbuild/BUILD/xen-4.2.25700/non-dbg/dist/install//usr/bin; \
[  148s] fi
[  148s] /bin/sh: line 0: [: /home/abuild/rpmbuild/BUILD/xen-4.2.25700/non-dbg/dist/install/usr/bin: unary operator expected

Add quoting to fix the error.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: enforce prohibitions of internal callers
Ian Jackson [Wed, 1 Aug 2012 11:46:52 +0000 (12:46 +0100)]
libxl: enforce prohibitions of internal callers

libxl_internal.h says:

 * Functions using LIBXL__INIT_EGC may *not* generally be called from
 * within libxl, because libxl__egc_cleanup may call back into the
 * application. ...

and

 *                    ...  [Functions which take an ao_how] MAY NOT
 * be called from inside libxl, because they can cause reentrancy
 * callbacks.

However, this was not enforced.  Particularly the latter restriction
is easy to overlook, especially since during the transition period to
the new event system we have bent this rule a couple of times, and the
bad pattern simply involves passing 0 or NULL for the ao_how.

So use the compiler to enforce this property, as follows:

 - Mark all functions which take a libxl_asyncop_how, or which
   use EGC_INIT or LIBXL__INIT_EGC, with a new annotation
   LIBXL_EXTERNAL_CALLERS_ONLY in the public header.

 - Change the documentation comment for asynch operations and egcs to
   say that this should always be done.

 - Arrange that if libxl.h is included via libxl_internal.h,
   LIBXL_EXTERNAL_CALLERS_ONLY expands to __attribute__((warning(...))),
   which generates a message like this:
      libxl.c:1772: warning: call to 'libxl_device_disk_remove'
             declared with attribute warning:
             may not be called from within libxl
   Otherwise, the annotation expands to nothing, so external
   callers are unaffected.

 - Forbid inclusion of both libxl.h and libxl_internal.h unless
   libxl_internal.h came first, so that the above check doesn't have
   any loopholes.  Files which include libxl_internal.h should not
   include libxl.h as well.

   This is enforced explicitly using #error.  However, in practice
   with the current tree it just changes the error message when this
   mistake is made; otherwise we would carry on to immediately
   following #define which would cause the compiler to complain that
   LIBXL_EXTERNAL_CALLERS_ONLY was redefined.  Then the developer
   might be tempted to add a #ifndef which would be wrong - it would
   leave the affected translation unit unprotected by the new
   enforcement regime.  So let's be explicit.

 - Fix the one source of files which violate the above principle, the
   output from the idl compiler, by removing the redundant inclusion
   of libxl.h from the output.

Also introduce a new script "check-libxl-api-rules" which contains
some ad-hoc regexps to spot and complain when libxl.h contains
functions which mention libxl_asyncop_how but not
LIBXL_EXTERNAL_CALLERS_ONLY.  This isn't a full C parser but is likely
to get the common cases right and err on the side of complaining.

While we are here, the invocation of perl for the bsd queue.h seddery
to $(PERL).

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: 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 agotools/config: Allow building of components to be controlled from .config
Andrew Cooper [Wed, 1 Aug 2012 11:46:51 +0000 (12:46 +0100)]
tools/config: Allow building of components to be controlled from .config

For build systems which build certain Xen components separately, allow certain
components to be conditionally built based on .config, rather than always
building them.

This patch allows qemu and blktap to be configured in this manner.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agotools/ocaml: ignore and clean .spot and .spit files
Andrew Cooper [Wed, 1 Aug 2012 11:46:50 +0000 (12:46 +0100)]
tools/ocaml: ignore and clean .spot and .spit files

Newer ocaml toolchains generate .spot and .spit files which are ocaml metadata
about their respective source files.

Add them to the clean rules as well as the .{hg,git}ignore files.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix unitialized variables in libxl__primary_console_find
Olaf Hering [Wed, 1 Aug 2012 11:46:49 +0000 (12:46 +0100)]
libxl: fix unitialized variables in libxl__primary_console_find

gcc 4.5 as shipped with openSuSE 11.4 does not recognize the case of
LIBXL_DOMAIN_TYPE_INVALID properly:

cc1: warnings being treated as errors
libxl.c: In function 'libxl_primary_console_exec':
libxl.c:1408:14: error: 'domid' may be used uninitialized in this function
libxl.c:1409:9: error: 'cons_num' may be used uninitialized in this function
libxl.c:1410:24: error: 'type' may be used uninitialized in this function
libxl.c: In function 'libxl_primary_console_get_tty':
libxl.c:1421:14: error: 'domid' may be used uninitialized in this function
libxl.c:1422:9: error: 'cons_num' may be used uninitialized in this function
libxl.c:1423:24: error: 'type' may be used uninitialized in this function
make[3]: *** [libxl.o] Error 1

Fix this by adding a default case.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoinit/NetBSD: move xenbackendd to xend init script
Roger Pau Monne [Wed, 1 Aug 2012 11:46:48 +0000 (12:46 +0100)]
init/NetBSD: move xenbackendd to xend init script

xenbackendd is not needed by the xl toolstack, so move it's launch to
the xend script.

We have to iterate until we are sure there are no xend processes left,
since doing a single pkill usually leaves xend processes running.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tested-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: call hotplug scripts from xl for NetBSD
Roger Pau Monne [Wed, 1 Aug 2012 11:46:47 +0000 (12:46 +0100)]
libxl: call hotplug scripts from xl for NetBSD

Add the missing NetBSD functions to call hotplug scripts, and disable
xenbackendd if libxl/disable_udev is not set.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>