Commit Graph
22724 Commits
Author SHA1 Message Date
Christoph Egger cdca3dd8ed libxl: fix missing include of <signal.h>
libxl_dm.c:713: warning: implicit declaration of function 'kill'

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-01-11 18:44:41 +00:00
Gianni Tedesco 9bdd55b787 libxl: move domain struct init functions from xl to libxl
This allows libxl users to get some sane default values for this complex
set of structures. This is purely code movement and there are no
functional changes except for a trivial error handling change in nic
device init.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-01-11 18:32:32 +00:00
Gianni Tedesco 760b359388 libxl: Introduce libxl_domain_create_new() and libxl_domain_create_restore()
These functions are introduced as the new way to create domains with libxl
they prevent the callers from need to know about low-level implementation
details such as:
 - libxl_domain_make()
 - libxl_domain_build()
 - libxl_domain_restore()
 - when to attach the console
 - how to start the device model

Above mentioned functions and all API's for the device model, which are now
redundant, have been made internal to libxl and no longer accessible.

The ocaml binding for libxl has not been properly updated to reflect the
changes, wrappers for the old functions have been removed but the code to wrap
the new functions has not been added.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-01-11 18:29:43 +00:00
Ian Campbell 64bc47d9a1 libxl: refactor code which adds per-PCI device backend nodes in xenstore
libxl_create_pci_backend and libxl_device_pci_add_xenstore contains
identical code to setup the per device xenstore nodes in the backend.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-01-11 18:16:45 +00:00
Ian Campbell f25a7171a1 libxl: log which PCI device could not be reset.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-01-11 18:16:26 +00:00
Ian Campbell 382571fcde libxl: do not leak front flexarray on error in libxl_create_pci_backend
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-01-11 18:15:38 +00:00
Ian Campbell 63f600a362 libxl: write PCI frontend xenstore nodes to the frontend directory.
They accidentally got moved to the backend directory by 22680:03718b569d97.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-01-11 18:15:18 +00:00
Tim Deegan afadd6ac31 tools: remove fs-front/fs-back
Its access controls are really not OK.  In particular, it's not good for
libxl, which stores per-VM config blobs in a directory that is exported
to all VMs.

This will break stub-qemu save/restore, which is the only user of
fs-front that I'm aware of, but:
 - It's currently broken anyway (fs-back isn't run by default and crashes
   if it is run manually); and
 - Stefano has a plan to plumb qemu save records through a dedicated
   console channel instead.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-01-11 18:13:44 +00:00
Ian Jackson 4e86bc34ad tools/xenpaging: fix return value from xc_mem_paging_flush_ioemu_cache
While using xenpaging, "Error flushing ioemu cache" message will be
shown even if the "flush-cache" command is sent to xenstore correctly.
That is because xenpaging assumes xc_mem_paging_flush_ioemu_cache()
returns non-zero value when the operation fails.  But
xc_mem_paging_flush_ioemu_cache() returns the return value from
xs_write() which is zero on error.

So, we should invert the return value from xs_write() and return -1 on
error, or 0 on success, like other xc_ functions.

Signed-off-by: Han-Lin Li <Han-Lin.Li@itri.org.tw>
Author: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-01-11 16:48:09 +00:00
John Weekes 1676d94292 stubdom: Fix stubdom-dm using "grep" improperly
stubdom-dm uses "grep" on "xm list" output to determine whether it is
already running. The existing behavior is to use "grep $domname-dm" but
this will result in a false-positive in the case of another domU running
whose name ends with the full new name; for instance, if "abctest-dm" is
running, a new "test-dm" will spin forever, waiting for it the end.

Any easy fix is to have it use "grep -w" instead of "grep", searching
for the whole word only.

It also might be worth considering a switch to "xl list" from "xm list",
here and in other places.

Signed-off-by: John Weekes <lists.xen@nuclearfallout.net>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-01-11 16:42:41 +00:00
Gianni Tedesco b3c8bef7a7 stubdom/minios: don't retrieve the address of void variable
Objects must not be declared to have type void.  Declare shared_info
to have the appropriate type instead.

Author: Ganni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-01-11 16:31:47 +00:00
Samuel Thibault 53424cba44 stubdom/minios: use correct sized types for software floating point
Replace long/int/short sizes with proper exact-size types for 64bit
architectures.  As well as making the code correct, this eliminates a
compiler warning about an uninitialised variable.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-01-11 16:30:15 +00:00
Daniel De Graaf fb97d90a51 libxl: Add gfx_passthru parameter
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-01-11 16:13:07 +00:00
Keir Fraser e23f7e77ab xentrace: build fix "array subscript has type 'char'"
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2011-01-11 15:10:21 +00:00
Keir Fraser ca20d83c4b tools: Fix flask does not build because linking fails with
missing dlopen/dlsym etc.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2011-01-11 15:09:23 +00:00
Keir Fraser a7c8838ea7 xenctx: misc adjustments
- fix off-by-one errors during symbol insertion and lookup
- don't store the symbol type, as it wasn't needed at all so far and
  is only needed now at parsing time
- don't insert certain kinds of symbols

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-01-11 11:41:39 +00:00
Keir Fraser db0fe41a14 x86: restore x2apic pre-enabled check logic
c/s 22475 removed the early checking without replacement, neglecting
the fact that x2apic_enabled must be set early for APIC register
accesses done during second stage ACPI table parsing (rooted at
acpi_boot_init()) to work correctly. Without this, particularly
determination of the boot CPU won't work, resulting in an attempt to
bring up that CPU again as a secondary one (which fails).

Restore the functionality, now calling it from generic_apic_probe().

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-01-11 11:40:50 +00:00
Keir Fraser 0c13834740 xenpaging: update machine_to_phys_mapping[] during page deallocation
The machine_to_phys_mapping[] array needs updating during page
deallocation.  If that page is allocated again, a call to
get_gpfn_from_mfn() will still return an old gfn from another guest.
This will cause trouble because this gfn number has no or different
meaning in the context of the current guest.

This happens when the entire guest ram is paged-out before
xen_vga_populate_vram() runs.  Then XENMEM_populate_physmap is called
with gfn 0xff000.  A new page is allocated with alloc_domheap_pages.
This new page does not have a gfn yet.  However, in
guest_physmap_add_entry() the passed mfn maps still to an old gfn
(perhaps from another old guest).  This old gfn is in paged-out state
in this guests context and has no mfn anymore.  As a result, the
ASSERT() triggers because p2m_is_ram() is true for p2m_ram_paging*
types.  If the machine_to_phys_mapping[] array is updated properly,
both loops in guest_physmap_add_entry() turn into no-ops for the new
page and the mfn/gfn mapping will be done at the end of the function.

If XENMEM_add_to_physmap is used with XENMAPSPACE_gmfn,
get_gpfn_from_mfn() will return an appearently valid gfn.  As a
result, guest_physmap_remove_page() is called.  The ASSERT in
p2m_remove_page triggers because the passed mfn does not match the old
mfn for the passed gfn.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2011-01-11 11:27:37 +00:00
Keir Fraser ee3c42ba5b xenpaging: drop paged pages in guest_remove_page
Simply drop paged-pages in guest_remove_page(), and notify xenpaging
to drop its reference to the gfn. If the ring is full, the page will
remain in paged-out state in xenpaging. This is not an issue, it just
means this gfn will not be nominated again.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2011-01-11 10:38:28 +00:00
Keir Fraser bc89270b8a xenpaging: update machine_to_phys_mapping[] during page-in
Update the machine_to_phys_mapping[] array during page-in. The gfn is
now at a different page and the array has still INVALID_M2P_ENTRY in
the index.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2011-01-11 10:37:45 +00:00
Keir Fraser b4b531b52e xenpaging: make three functions static
xenpaging_init(), xenpaging_teardown() and xenpaging_evict_page() are
only used in file scope, so they can be marked static.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2011-01-11 10:33:20 +00:00
Keir Fraser 58097363ef xenpaging: print page-in/page-out progress
Now that DPRINTF is triggered only when the environment variable
XENPAGING_DEBUG is found, make such a debug session actually useful by
printing the entire page-out/page-in process. The 'Got event from Xen'
message alone is not helpful.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2011-01-11 10:32:59 +00:00
Keir Fraser 86ef532d29 xenpaging: mkdir /var/lib/xen/xenpaging during make install
pagefiles go to /var/lib/xen/xenpaging directory,
create this directory during make install

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2011-01-11 10:32:32 +00:00
Keir Fraser 2dc5d916ff xenpaging: specify policy mru_size at runtime
The environment variable XENPAGING_POLICY_MRU_SIZE will change the
mru_size in the policy at runtime.  Specifying the mru_size at runtime
allows the admin to keep more pages in memory so guests can make more
progress.  Its also good for development to reduce the value to put
more pressure on the paging related code paths.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2011-01-11 10:32:05 +00:00
Keir Fraser 56f2a91b86 xenpaging: remove domain_id and mfn from struct xenpaging_victim
Remove unused member 'mfn' from struct xenpaging_victim.

xenpaging operates on a single guest, so it needs only a single
domain_id.  Remove domain_id from struct xenpaging_victim and use the
one from paging->mem_event where needed. Its not used in the policy.

This saves 4MB runtime data with a 1GB pagefile.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2011-01-11 10:31:33 +00:00
Keir Fraser a3b9de49c6 x86-64: refine access permission check for wrmsr to MSR_FAM10H_MMIO_CONF_BASE
We really don't want the mmconf window to move/disappear whenever we
use is ourselves, not only when we enabled it.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-01-11 10:30:46 +00:00
Keir Fraser 95805ed0a2 vt-d: Remove unnecessary 'inline' qualifiers
Compiler knows best when to inline. Also this shows up an unused flush
function which is removed by this patch.

Signed-off-by: Keir Fraser <keir@xen.org>
2011-01-10 10:37:53 +00:00
Keir Fraser 3edc8a6f83 vtd: Remove unused 'align' local variable from iommu_flush_iotlb_psi().
Signed-off-by: Keir Fraser <keir@xen.org>
2011-01-10 10:32:04 +00:00
Keir Fraser 9d64734955 vtd: Fix up iommu_flush_iotlb_psi().
1. Change missed usage of 'align' to 'order'
2. Remove unused 'pages' parameter

Signed-off-by: Keir Fraser <keir@xen.org>
2011-01-10 10:31:09 +00:00
Keir Fraser 5dd5892da9 x86_64: don't use weak symbols on x86-64
Various gcc versions inline functions that are both weak and hidden,
without even giving a warning.

Certainly the risk exists that we'll see the problem again when
another weak function gets introduced, but I don't see a way to
protect us from that.

Signed-off-by: Jan Beulich <jbeulich@novell.com>

Just remove the weak attribute altogether. It's the only one in
non-ia64-specific code. We can get teh same effect with ifdefs which
although a bit unsightly is better than using compiler/linker features
we cannot trust.

Signed-off-by: Keir Fraser <keir@xen.org>
2011-01-10 08:45:19 +00:00
Keir Fraser a85a31246a x86-64: don't allow wrmsr to MSR_FAM10H_MMIO_CONF_BASE when Xen itself is using it
Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-01-10 08:42:32 +00:00
Keir Fraser 6cd8743754 EPT/VT-d: bug fix for EPT/VT-d table sharing
This patch makes following changes: 1) Moves EPT/VT-d sharing
initialization back to when it is actually needed to make sure
vmx_ept_vpid_cap has been initialized.  2) added page order parameter
to iommu_pte_flush() to tell VT-d what size of page to flush.  3)
added hap_2mb flag to ease performance studies between base 4KB EPT
size and when 2MB and 1GB page size support are enabled.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
2011-01-10 08:40:32 +00:00
Keir Fraser 4306e1ed46 Update hgignore list 2011-01-08 11:07:18 +00:00
Joe Epstein cc8ad39c1f mem_access test tool: xen-access
Added a test tool to let the memory access APIs be tested.  This tool
logs to stdout the memory accesses that the domain given is performing.

Signed-off-by: Joe Epstein <jepstein98@gmail.com>
Signed-off-by: Keir Fraser <keir@xen.org>
2011-01-08 11:06:18 +00:00
Keir Fraser e7803f184a tools/tests: Move x86 emulator tests into a subdir
Signed-off-by: Keir Fraser <keir@xen.org>

--HG--
rename : tools/tests/Makefile => tools/tests/x86_emulator/Makefile
rename : tools/tests/blowfish.c => tools/tests/x86_emulator/blowfish.c
rename : tools/tests/blowfish.mk => tools/tests/x86_emulator/blowfish.mk
rename : tools/tests/test_x86_emulator.c => tools/tests/x86_emulator/test_x86_emulator.c
rename : tools/tests/x86_emulate.c => tools/tests/x86_emulator/x86_emulate.c
2011-01-08 10:59:13 +00:00
Keir Fraser 120138ec11 Update AMD SVM feature flags
This patch updates AMD SVM feature flags (0x8000000A:EDX). It adds
several new feature bits, along with feature description. The feature
names are changed to be consistent with Linux kernel.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
Signed-off-by: Keir Fraser <keir@xen.org>
2011-01-08 10:52:45 +00:00
Keir Fraser 9dee048130 Update AMD CPU feature flags 0x80000001:ECX for Xen Hypervisor
This patch syncs-up AMD CPU feature flags 0x80000001:ECX with the
latest Linux kernel. Several new features are added. Some of existing
features' names are changed as well.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
2011-01-08 10:48:46 +00:00
Keir Fraser c458f45d2e libxc: Update AMD CPU feature flags 0x80000001:ECX for Xen tools
This patch syncs-up AMD CPU feature flags 0x80000001:ECX in libxc with
the latest Linux kernel.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
2011-01-08 10:48:09 +00:00
Keir Fraser f3af225db3 timer: Don't hardcode cpu0 in migrate_timers_from_cpu().
Although we don't allow cpu0 to be offlined, there's no need to
hardcode that assumption in the timer subsystem.

Signed-off-by: Keir Fraser <keir@xen.org>
2011-01-08 10:43:01 +00:00
Keir Fraser d8ec7a2381 timer: Ensure that CPU field of a timer is read safely when lock-free.
Firstly, all updates must use atomic_write16(), and lock-free reads
must use atomic_read16(). Secondly, we ensure ->cpu is the only field
accessed without a lock. This requires us to place a special sentinel
value in that field when a timer is killed, to avoid needing to read
->status outside a locked critical section.

Signed-off-by: Keir Fraser <keir@xen.org>
2011-01-08 10:09:44 +00:00
Keir Fraser 44260b1a73 x86: Fix atomic_write*() macros to correctly inform GCC that memory
it knows about is being written to.

The bug is a copy-and-paste error from inline asm that writes to I/O
memory. In that case, as with asm for accessign guest memory,
specifying memory as a read-only parameter is acceptable because the
memory cannot alias with anything that GCC reads directly.

Signed-off-by: Keir Fraser <keir@xen.org>
2011-01-08 10:05:55 +00:00
Keir Fraser fd01e26c97 timer: Fix up timer-state teardown on CPU offline / online-failure.
The lock-free access to timer->cpu in timer_lock() is problematic, as
the per-cpu data that is then dereferenced could disappear under our
feet. Now that per-cpu data is freed via RCU, we simply add a RCU
read-side critical section to timer_lock(). It is then also
unnecessary to migrate timers on CPU_DYING (we can defer it to the
nicer CPU_DEAD state) and we can also safely migrate timers on
CPU_UP_CANCELED.

Signed-off-by: Keir Fraser <keir@xen.org>
2011-01-08 09:29:11 +00:00
Keir Fraser 1be584b57a x86: Free per-cpu area for offline cpu via RCU.
This allows other CPUs to reference per-cpu areas with less strict
locking. In particular, timer.c access a per-cpu lock with reference
to a per-timer cpu field which it accesses with no synchronisation.

One subtlety is that this prevents us bringing a cpu back online until
the RCU work is completed. In this case we return EBUSY and the
tool stack can report the (unlikely) error, or retry, as it sees fit.

Signed-off-by: Keir Fraser <keir@xen.org>
2011-01-08 09:14:23 +00:00
Gianni Tedesco c65422a6c4 xl: Implement flexarray_append() and flexarray_vappend()
Makes a lot of code simpler and nicer and saves a fair amount of screen
real-estate

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-01-07 18:53:50 +00:00
Gianni Tedesco 984599eab7 xl: Move device model functions in to a separate file
No functional changes.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
2011-01-07 18:24:54 +00:00
Gianni Tedesco c761b54d7c minios: use constant expression to size arrays
Fixes a compile error in gcc-4.5 which is the reason __CONST_RING_SIZE()
was introduced. Let's just use it in minios netfront.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-01-07 18:01:18 +00:00
Keir Fraser 2f5d40aab9 x86 asid: Do not check for per-cpu asid state being already initialised.
It cannot be, since per-cpu data is re-allocated and zeroed across CPU
hotplug. Th ecomment about resetting teh per-cpu generation counter is
incorrect, since all vcpus must have been migrated to other cpus while
this cpu was offline, and that resets the per-vcpu generation stamp.

Signed-off-by: Keir Fraser <keir@xen.org>
2011-01-07 16:59:53 +00:00
Keir Fraser e8dea77d35 ASID: Optimize hvm_flush_guest_tlbs
In our testing, we found that function hvm_flush_guest_tlbs() is used
very frequently and it will always force asid recycling and will
result a whole tlb flush immediately no matter there are still free
asids or not.  Actually, in this case, just increasing core generation
might be enough and the remaining asids can still be used until
next_asid > max_asid.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Reviewed-by: Wei Huang <wei.huang2@amd.com>

Simplify the logic and also fix a very minor bug in
hvm_asid_handle_vmenter(), in the case that hvm_asid_flush_core() sets
data->disabled.

Signed-off-by: Keir Fraser <keir@xen.org>
2011-01-07 14:13:15 +00:00
Keir Fraser 94feecc881 Update my email address to long-term stable address.
Signed-off-by: Keir Fraser <keir@xen.org>
2011-01-07 13:30:04 +00:00
Tim Deegan be51cca5a4 Fix 32-bit build after the latest mem-event series
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-01-07 11:55:35 +00:00