Commit Graph
22188 Commits
Author SHA1 Message Date
Ian Jackson 39ae85c6ee tools, build system: Detect distro-variant directories at build-time
In b59f87f56b1e, the defaults for some of the directory config
variables implicitly changed.  In this commit we arrange for the
defaults to be auto-detected (with the same logic as the run-time
scripts use).

This will make the build more likely to produce answers which the
builder intends.  (And, in particular, it should un-break the
automated tests, which didn't set these variables explicitly and
therefore got broken by b59f87f56b1e.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-21 12:17:04 +01:00
Keir Fraser 89acd8b4d6 x86: Retry do_mmu_update() a few times when called on a pte whose type is in flux.
This can really happen -- all our PV Linux kernels have a race
between vmalloc_sync_all() and pgdir pinning/unpinning. The former is
protected by pgd_lock while the latter by mm->page_table_lock. Hence
they can happen concurrently, and vmalloc_sync_all() can attempt to
set_pmd() on a page directory which is in the process of being
pinned. This can confuse the hypervisor which may see a type change,
and hence fail do_mmu_update(). Until this patch. :-)

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-09-20 20:11:43 +01:00
Keir Fraser 4276fde7f8 x86/hvm: fix extra size passed to __trace_var()
While removing the casts on the last arguments to __trace_var() I
noticed the bogus addition of 1 here.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-09-20 18:53:18 +01:00
Keir Fraser a8a6ca9fe7 Eliminate unnecessary casts from __trace_var() invocations
This is possible now that its last parameter's type is 'const void *'.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-09-20 18:52:48 +01:00
Keir Fraser 4be742c4db ia64: fix gcc 4.5 warnings
Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-09-20 18:51:19 +01:00
Keir Fraser b5aadd4248 x86: protect MSI-X table and pending bit array from guest writes
These structures are used by Xen, and hence guests must not be able
to fiddle with them.

qemu-dm currently plays with the MSI-X table, requiring Dom0 to
still have write access. This is broken (explicitly allowing the guest
write access to the mask bit) and should be fixed in qemu-dm, at which
time Dom0 won't need any special casing anymore.

The changes are made under the assumption that p2m_mmio_direct will
only ever be used for order 0 pages.

An open question is whether dealing with pv guests (including the
IOMMU-less case) is necessary, as handling mappings a domain may
already have in place at the time the first interrupt gets set up
would require scanning all of the guest's L1 page table pages.
Currently a hole still remains allowing PV guests to map these ranges
before actually setting up any MSI-X vector for a device.

An alternative would be to determine and insert the address ranges
earlier into mmio_ro_ranges, but that would require a hook in the
PCI config space writes, which is particularly problematic in case
MMCONFIG accesses are being used.

A second alternative would be to require Dom0 to report all devices
(or at least all MSI-X capable ones) regardless of whether they would
be used by that domain, and do so after resources got determined/
assigned for them (i.e. a second notification later than the one
currently happening from the PCI bus scan would be needed).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Acked-by: Jiang, Yunhong <yunhong.jiang@intel.com>
2010-09-20 18:50:38 +01:00
Keir Fraser 94187eb55b rangesets: add function to query for overlaps
Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-09-20 18:50:06 +01:00
Keir Fraser 6d6b9b99aa sched_credit: Raise bar for inter-socket migrations on mostly-idle systems
The credit scheduler ties to keep work balanced, even on a mostly idle
system.  Unfortunately, if you have one VM burning cpu and another VM
idle, the effect is that the busy VM will flip back and forth between
sockets.

This patch addresses this, by only migrating to a different socket if
the number of idle processors is twice that of the socket the vcpu is
currently on.

This will only affect mostly-idle systems; as the system becomes more
busy, other load-balancing code will come into effect.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2010-09-20 18:49:15 +01:00
744d6961f9 tools, build system: Make changing distro-specific layout aspects easier
Introduce CONFIG_LEAF_DIR, SUBSYS_DIR, INITD_DIR variables to cope
better with variation between distributions.

See docs/misc/distro_mapping.txt for details.

Signed-off-by: Bruce Edge <bruce.edge@gmail.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-20 17:54:25 +01:00
Jan Beulich 1e7aadfdff libxl: fix Makefiles for autogenerated code (use multi-target patterns)
Building in a tree with read-only source files failed because the flex/
bison generated files are left in place.

All of the source files (instead of all of the object files) were
depending on libxl.h (in particular forcing the needless re-generation
of the flex/bison generated files).

For _libxl_types.[ch] a single non-pattern rule was used. For non-
pattern rules with multiple targets, other than for pattern ones, the
body gets executed once for each target, causing problems when building
with -j<n>, <n> >= 2. Convert this rule to a pattern one.

The flex/bison generated headers pointlessly depended on the
corresponding source files. Use multiple-target pattern rules instead.

It would also have been nice if the minimal flex/bison versions needed
to successfully build libxl were documented: neither flex 2.5.31 nor
bison 2.1 (as found e.g. on SLE10) is sufficient.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-20 16:57:08 +01:00
Keir Fraser a11b6c53f6 x86_32: [un]map_domain_page() is now IRQ safe.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-09-18 08:57:15 +01:00
Keir Fraser df57b09eb6 x86: Fix indentation in irq.c.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-09-18 08:34:15 +01:00
Keir Fraser ef7a899470 x86: irq_enter()/irq_exit() covers all of do_IRQ().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-09-18 08:31:55 +01:00
Keir Fraser a541d50bff hvm pmtimer: correct pmtimer accuracy
Several seconds of backward time drift per minute can be seen on a
RHEL6 HVM guest by switching the clocksource to 'acpi_pm' and then
running gettimeofday() in a loop. This is due to the accumulation
of small inaccuracies that are caused by shifting out the lower 32
bits when pmt_update_time() computes 'tmr_val'.

The patch makes sure that the lower 32 bits of the computed value
are not lost. They are saved in a new field 'not_accounted' in the
PMTState structure and are accounted the next time pmt_update_time()
is called.

From: Ulrich Obergfell <uobergfe@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-09-17 16:59:21 +01:00
Keir Fraser 453bfd468f x86_32: Fix build by fixing prototype of hvmemul_do_pio().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-09-17 16:44:00 +01:00
Ian Campbell 67e27bba02 python: xl: stub out libxl_cpuid_policy_list accessors
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-17 16:12:13 +01:00
Juergen Gross 33c3ef4f76 xl: correct vcpu-pin and vcpu-list parameter checking
attached patch corrects parameter checking of vcpu-pin and vcpu-list
sub-commands.

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-16 18:29:26 +01:00
Andre Przywara d3c4df5c7e libxl: introduce cpuid interface to domain build
Add a cpuid parameter into libxl_domain_build_info and use
it's content while setting up the domain. This is a only paving the way,
the real functionality is implemented in the later patches.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-16 18:02:40 +01:00
Jun Zhu 497515e500 libxl: Clear device-model info when destroying an HVM domain with stubdom.
Signed-off-by: Jun Zhu <Jun.Zhu@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-16 17:49:43 +01:00
Andre Przywara 68c2232d04 libxl: fix compiler warning with fork_exec_bootloader
At least one of my compilers complains about the broken const
qualifier in the fork_exec_bootloader() call (despite the cast).
Fix this properly by propagating the const attribute down the
call stack.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-16 17:39:33 +01:00
Gianni Tedesco 6d4ba52d49 libxl, tools/python: Add libxl python binding
Introduce python binding for libxl. The binding is not yet complete but
serveral methods are implemented and tested. Those which are implemented
provide examples of the two or three basic patterns that most future
methods should follow.

Over 5,000 lines of boilerplate is automatically generated to wrap and
export all relevant libxl structure definitions. There are a few places
where such code cannot be fully auto-generated and special hooks are
declared and stubbed where, for example, conversion between
libxl_file_reference and a python file object is required.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-16 17:20:22 +01:00
Gianni Tedesco 7c12b60534 libxl: change IDL to export a saner interface for upcoming language bindings
Firstly remove an anonymous union in libxl_device_pci structure which
was making auto-generating language bindings more complicated than
necessary and exporting random bits of low level ABI that libxl that
would rather hide anyway. There is a corresponding (untested) change to
the ocaml binding which maintains previous ml API.

Secondly make the libxl_file_reference type a Builtin. This is a
'semantic
correctness' issue in that libxl ABI/API won't change. But it makes it
so that when the IDL is used to generate language bindings that a
file_reference type is not exported.

Also implement a Numeric type which all integers are derived from. Make
sure a boolean signed/unsigned attribute is set accordingly. This is
required to allow language bindings to correctly handle the sign bit in
environments with arbitrarily long integers.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-16 17:12:21 +01:00
Keir Fraser 8fa2c1212d Remove unused function console_force_lock().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-09-16 10:02:14 +01:00
Keir Fraser 817d550023 vmx: Annotate update_guest_eip() callers with safety analysis
for access to VM_EXIT_INSTRUCTION_LEN

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-09-15 16:52:31 +01:00
Keir Fraser a6b6b7976b vmx: __update_guest_eip(__guest_instruction_length()) -> update_guest_eip()
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
2010-09-15 16:05:50 +01:00
Keir Fraser 03980f610a mem_event: Clean up and remove over-sized paused_vcpus[] array.
This cuts the size of the domain structure by around 30kB! It is now a
little over a page in size.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-09-15 15:45:42 +01:00
Keir Fraser 65f6837480 x86 hvm: Clean up PIO fast path emulation.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-09-15 14:03:26 +01:00
Keir Fraser 95807bcae4 C6 state with EOI issue fix for some Intel processors
There is an errata in some of Intel processors.

AAJ72. EOI Transaction May Not be Sent if Software Enters Core C6
During an Interrupt Service Routine

If core C6 is entered after the start of an interrupt service routine
but before a write to the APIC EOI register, the core may not send an
EOI transaction (if needed) and further interrupts from the same
priority level or lower may be blocked.

This patch fix this issue, by checking if ISR is pending before enter
deep Cx state. If so, it would use power->safe_state instead of deep
Cx state to prevent the above issue happen.

Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-09-15 09:00:35 +01:00
Keir Fraser c87dafbd40 notify_via_xen_event_channel() should check for dying domain.
Else we can fail on either ASSERTion in that function.

From: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-09-15 08:18:53 +01:00
Keir Fraser d193f667ea x86: restore handling of "reboot=no"
Somewhere between 3.2 and 3.3 this got dropped (as I noticed on a
[rarely used] box that didn't crash on me since then).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-09-15 07:48:27 +01:00
Keir Fraser 4f1262e66a x86: fix debug key 'i' handling with no IO-APICs
Signed-off-by: Jan Beulich <jbeulich@novell.com>
2010-09-15 07:47:54 +01:00
Keir Fraser b24e5d3d0f svm: simplify MSR handling
Machine check MSRs are not special to long mode.  Thus move them into
svm_msr_write_intercept().  Remove empty long mode msr function and
simplify the logic.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2010-09-15 07:45:25 +01:00
Ian Jackson 5eab9f4628 QEMU_TAG update 2010-09-14 18:26:10 +01:00
Ian Jackson 341388ff90 xl: fix memory management of migration_domname_r
During migration, the domain name from the config file is swapped out
and replaced with a different name (with the "--incoming" suffix),
which we return to the caller.  The memory management arrangements
here were broken.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-14 18:25:15 +01:00
Matthias Klose a502f04ad6 tools/python: Replace python string exceptions with ValueError exceptions
There are at least some syntax errors when trying to use the xen utils with
python2.6.  The attached patch changes these string exception into
ValueErrors:

   - tools/python/xen/util/bugtool.py (getBugTitle)
   - tools/python/xen/xend (class XendBase): not catched
   - tools/python/xen/xm/xenapi_create.py (sxp2xmlconvert_sxp_to_xml):
     the method already raises a ValueError for similiar condition.
   - tools/python/xen/xm/main.py (xm_network_attach): not catched.

For all but maybe the first one, the replacement of the string
exceptions into ValueErrors seems to be safe.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-14 17:46:21 +01:00
Keir Fraser 39b089b258 x86 mca: unmap broken memory in EPT guest in MCA delayed handler
When a memory owned by EPT guest is broken, we change the P2M type to
be broken memory type, so that later access from the guest to the
broken memory will be trapped as EPT violation.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
2010-09-13 17:48:19 +01:00
Keir Fraser 4d94df82fb x86: Add broken memory type in p2m table
In some platform, whole system will crash if a broken memory is
accessed, no matter this access is from guest, or hypervisor. This may
cause issue if mallicious guest access this memory. To avoid this, we
need to guard the access from the guest. Morever, we need make sure
host will not access the memory for guest, like when do instruction
emulation.

This patch is to guard EPT guest's access. A new broken memory type is
added. Because the ept_p2m_type_to_flags() will mark default type as
r/w/x bit as zero, a broken memory type will have non-present EPT
entry, thus guest's access will cause EPT violation VM Exit.

In Xen hypervisor's vmexit ept violation handler, when it try to
translate the gpfn to mfn through p2m_guest query type, this patch
will cause domain to be crashed.

The changes to __gfn_to_mfn_type will return INVALID_MFN for broken
memory type, to avoid the crash caused by hypervisor access if caller
check the return value. It is complex to test this scenerior in EPT
situation, since mostly EPT violation will happen before hypervisor
will access the broken memory, but to be helpful for other memory
type.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
2010-09-13 17:47:40 +01:00
Keir Fraser 2e701b1f87 Allow easier overriding of LIBLEAFDIR_x86_64 on GNU systems
Some GNU systems (including Debian) do not use /usr/lib64. This change
makes it easier to have the Xen build system on amd64 put its 64-bit
libraries files in /usr/lib.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-13 17:45:59 +01:00
Keir Fraser 5e886b3484 Fix an IO-APIC error message
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-09-13 17:44:19 +01:00
Keir Fraser 4436e67fd1 Fix serial interrupt's destination
Lowest Priority can't use with invalid cpu_mask, and the default value
of CPU_MASK_ALL may cover CPU which wasn't online.

From: "Yang, Sheng" <sheng.yang@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-09-13 17:37:25 +01:00
Keir Fraser ad8a2e7642 hvm: Merge MSR_EFER handling.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2010-09-13 17:35:03 +01:00
Keir Fraser c6b30186cd Disable kernel build in Xen build system.
Cloning and building a kernel as part of the Xen distribution
implicitly advises that this kernel is the best kernel for all users
and many users appear to be under this impression, even though there
is no fundamental coupling between the Xen distribution and a
particular domain 0 kernel.

There are several choices available for domain 0 kernel, as well as
other user specific variations in requirements e.g. for kernel
configurations. It's not clear that whatever the xen build system
happens to produce (which is really tailored to the needs of the
automated build system) is best for anybody.

Coupling the kernel build with the Xen build has proved problematic
for stable Xen releases as it implicitly blesses the particular kernel
(at a particular point in time) as a constituent part of the Xen
release, while in reality the OS kernels are separate entities with
their own release cycles which may or may not coincide with the
maintenance of Xen stable branches.

Therefore disable the building of a kernel as part of the Xen
distribution by default and instead direct users to use an OS
distribution provided kernel (properly packaged with security updates
via the normal distribution mechanisms etc) where possible and give
pointers to suitable resources providing guidance for cases where it
is not.

This decouples the implicit advice as to the best kernel at any moment
from Xen's own release cycle and removes the implicit suggestion that
only particular domain 0 kernel will do.

The actual infrastructure is left in place since the automated test
system (currently) relies on it (but always asks for the specific
kernel variant it wants for a particular test).

(I also tried to remove Linux-isms from the README's Quick start
guide. In particular I'm not sure what was supposedly Linux specific
about steps 3 and 4 therefore I have removed the suggestion that they
are.)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-09-13 17:31:19 +01:00
Keir Fraser 987c1f6080 xen: define raw version of set_xen_guest_handle
allows users to define more complex (e.g. type-safer) variations on
set_xen_guest_handle if they wish.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2010-09-13 17:29:53 +01:00
Keir Fraser bdc9bc5f48 xsm: Avoid null dereference in flask get_page_sid
From: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2010-09-13 17:27:22 +01:00
Keir Fraser 4e1d7bcd4d The sysctl hypercall should be callable from HVM guests.
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2010-09-13 17:26:49 +01:00
Keir Fraser 5d21edd56c vmx: Unifying the CPU_BASED_VM_EXEC_CONTROL VMCS field write into a
single place for additional control that is required in nested VMX.

Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
2010-09-13 17:25:42 +01:00
Keir Fraser aed42d0f06 vmx: Unifying the SECONDARY_VM_EXEC_CONTROL VMCS field write into a
single place for additional control that is required in nested VMX.

Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
2010-09-13 17:25:11 +01:00
Keir Fraser f2af2d95f0 vmx: Caching the VMCS field EXCEPTION_BITMAP and cleanup some unused function.
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
2010-09-13 17:24:44 +01:00
Keir Fraser dbc2b88ca2 vmx: Rename host_vmcs to vmxon_region
For some reason, the memory region used for vmxon is named as
host_vmcs, which is somewhat misleading, rename it to vmxon_region as
SDM does.

Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
2010-09-13 17:24:10 +01:00
Keir Fraser 66d799b9d9 libxc, tmem: Fix build after fd2e5008c2e0
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-09-13 17:17:01 +01:00