Commit Graph
23041 Commits
Author SHA1 Message Date
Jan Beulich 32084d0016 _csched_cpu_pick(): don't write idle bias more than once
For the bias to be really meaningful, it should be updated only when
the CPU selected will indeed be returned (and hence used for placing
the vCPU in question).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-14 17:19:47 +00:00
Jan Beulich 58a83b75d1 _csched_cpu_pick(): don't return CPUs outside vCPU's affinity mask
This fixes a fairly blatant bug I introduced in c/s 20377:cff23354d026
- I wonder how this went unnoticed for so long.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-14 17:19:22 +00:00
Gianni Tedesco 342392ddbe Allow tools to map arbitrarily large machphys_mfn_list on 32bit dom0
This permits suspend/resume to work with 32bit dom0/tools when system
memory extends beyond 160GB (and up to 1TB).

AFAICT the limit to MACH2PHYS_COMPAT_NR_ENTRIES is redundant since
that refers to a limit in 32bit guest compat mappings under 64bit
hypervisors, not userspace where there may be gigabytes of useful
virtual space available for this.

Suggested-by: Ian Campbell <Ian.Campbell@eu.citrix.com>
Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
2011-03-14 17:13:15 +00:00
Jan Beulich 37916ccd3a x86: fix cpu_sibling_map initialization when topology CPUID leaf is present
c/s 21811:12f0618400de broke this by not properly initializing struct
cpuinfo_x86's x86_num_siblings member (other than Linux, where this is
a global variable, it is being maintained per CPU by Xen).

Hyper-threaded CPUs with CPUID leaf 0xb present had therefore all
cpu_sibling_map-s with just a single bit set, thus improperly feeding
the scheduler.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-14 17:05:21 +00:00
Wei Gang 1a048a1d9e x86: add volatile prefix for cpuid asm clauses
cpuid results are possible to be changed now. For example, changing
CR4.OSXSAVE bit or setting MSR XCR_XFEATURE_ENABLED_MASK may change
XSAVE related cpuid leave return values.

The volatile prefix is required to avoid the second cpuid calls
following some possible changing operations being optimized in
incorrect way by compiler.

The sample bug is in xsave_init while debug=3Dn. The second call to
cpuid_count() may be optimized and lead to a BUG_ON case while compare
xsave_cntxt_size with ebx.

Signed-off-by: Wei Gang <gang.wei@intel.com>
2011-03-14 17:04:42 +00:00
Jan Beulich 84c4461b7d Force out-of-line instances of inline functions into .init.text in init-only code
Some compiler versions may choose to not inline certain functions, but
the check introduced in c/s 23003:768269c43914 wants .text to be
empty.

Also make sure an eventual error gets properly propagated even on the
first section of an object (.text typically being the first one), and
cover a broader set of sections.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-14 17:02:50 +00:00
Tim Deegan d62b3c2276 x86_64: fix error checking in arch_set_info_guest()
Cannot specify user mode execution without specifying user-mode
pagetables.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
2011-03-14 16:59:49 +00:00
Jan Beulich 418df701ce x86/HPET: adjust types
'unsigned int' is better suited as an array index on x86-64.

'u32' produces better code than 'unsigned long' on x86-64, so use the
former for storing 32-bit values read from the hardware.

this_cpu() uses an implicit smp_processor_id(), and hence using
per_cpu() when the result of smp_processor_id() is already available
is more efficient.

Fold one case of cpu_isset()+cpu_clear() into cpu_test_and_clear().

Drop the unused return value of evt_do_broadcast().

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Acked-by: Wei Gang <gang.wei@intel.com>
2011-03-12 13:20:51 +00:00
Jan Beulich a03ac7d945 x86/HPET: use dynamic allocation for hpet_events[]
Typically there are far less than 32 counters available, and hence
there's no use in wasting the memory on (almost) every system.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Acked-by: Wei Gang <gang.wei@intel.com>
2011-03-12 13:20:11 +00:00
Jan Beulich b927089900 x86/HPET: cleanup
- separate init and resume code paths (so that the [larger] init parts
  can go init .init.* sections)
- drop the separate legacy_hpet_event object, as we can easily re-use
  the first slot of hpet_events[] for that purpose (the whole array is
  otherwise unused when the legacy code is being used)
- use section placement attributes where reasonable

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Acked-by: Wei Gang <gang.wei@intel.com>
2011-03-12 13:19:34 +00:00
Jan Beulich 8fb9870830 x86/HPET: fix initialization order
At least the legacy path can enter its interrupt handler callout while
initialization is still in progress - that handler checks whether
->event_handler is non-NULL, and hence all other initialization must
happen before setting this field.

Do the same to the MSI initialization just in case (and to keep the
code in sync).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-12 13:19:02 +00:00
Stefano Stabellini 8d5a53c1fa libxl: do not try to use blktap with qdisk
libxl_device_disk_add tries to use blktap when available even for qdisk
devices, this patch fixes it.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-11 18:22:23 +00:00
Ian Jackson 45096ce635 Merge 2011-03-11 18:21:17 +00:00
Ian Campbell 96a312ead2 libxc: move error checking next to the function which returned the error.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-11 18:20:53 +00:00
Ian Campbell 44baceec2d libxc: osdep: convert hypercall buffer allocation
This will allow us to use OS specific interfaces to ensure that the
allocated memory is safe for use as a hypercall buffer in the future.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2011-03-11 18:18:18 +00:00
Keir Fraser baabb96f5c x86: Clean up wbinvd usage in cpu offline paths.
No need to wbinvd before HLT (entering C1) as the processor continues
to participate in the full cache coherency protocol in this sleep
state.

Signed-off-by: Keir Fraser <keir@xen.org>
2011-03-11 17:27:25 +00:00
Liu, Jinsong cbd8fa3005 x86: Fix cpu offline bug: add clflush inside dead loop
At some platform (like Xen 7400), when hyperthreading, an offlined
thread may waked spuriously up by its brother, and returning around
the loop.  This patch explicitly clflush the cache line in a light
weight way to workaround potential issue.  Unlike wbinvd, clflush is
not serializing instruction, hence memory fence is necessary to make
sure all load/store operation visible before flush cache line.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
2011-03-11 17:18:53 +00:00
Liu, Jinsong 61799a138a x86: Fix cache flush bug of cpu offline
Current xen cpu offline logic flush cache too early, which potentially
break cache coherency.  wbinvd should be the last ops before cpu going
into dead, otherwise cache may be dirty, i.e, something like setting
an A bit on page tables. Pointed out by Arjan van de Ven.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
2011-03-11 17:18:01 +00:00
Liu, Jinsong 79eae2548b x86: Fix cpu offline bug: cancel SYSIO method when play dead
Play dead is a fragile and tricky point of cpu offline logic.  For how
to play cpu dead, linux kernel changed several times: Very old kernel
support 3 ways to play cpu dead: mwait, SYSIO, and halt, just like
what cpuidle did when enter C3; Later, it cancel mwait and SYSIO
support, only use halt to play dead; Latest linux 2.6.38 add mwait
support when cpu dead.

This patch cancel SYSIO method when cpu dead, keep same with latest
kernel.

SYSIO is an obsoleted method to enter deep C, with some tricky
hardware behavior, and seldom supported in new platform.  Xen
experiment indicate that when cpu dead, SYSIO method would trigger
unknown issue which would bring strange error.  We now cancel SYSIO
method when cpu dead, after all, correctness is more important than
power save, and btw new platform use mwait.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
2011-03-11 16:27:33 +00:00
Ian Campbell 921bb910be libxc: move error checking next to the function which returned the error.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2011-03-11 16:20:34 +00:00
Liu, Jinsong 493e2b80aa x86: Fix cpuidle bug
Before invoking C3, bus master disable / flush cache should be the
last step; After resume from C3, bus master enable should be the first
step;

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Acked-by: Wei Gang <gang.wei@intel.com>
2011-03-10 18:35:32 +00:00
Ian Campbell 8627dcc084 libxl: do not rely on guest to respond when forcing pci device removal
This is consistent with the expected semantics of a forced device
removal and also avoids a delay when destroying an HVM domain which
either does not support hot unplug (does not respond to SCI) or has
crashed.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-10 18:21:42 +00:00
Jim Fehlig bea472a7e1 libxl: Call setsid(2) before exec'ing device model
While doing development on libvirt libxenlight driver I noticed
that terminating a libxenlight client causes any qemu-dm
processes that were indirectly created by the client to also
terminate.  Calling setsid(2) before exec'ing qemu-dm resolves
the issue.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-10 18:17:16 +00:00
Stefano Stabellini 44a953192a update README
update README: we are missing few compile time dependencies and a link
to the pvops kernel page on the wiki.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-10 18:11:31 +00:00
Jan Beulich b398a438b0 x86: remove pre-686 CPU support bits
... as Xen doesn't run on such CPUs anyway. Clearly these bits were
particularly odd to have on x86-64.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 17:25:44 +00:00
Ian Campbell 4c8c24a088 xl/xm: make pci-list use same BDF format as all other commands
In particular using the same syntax as pci-{attach,detach} uses is
very helpful.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-09 17:05:43 +00:00
Stefano Stabellini 8f53c184ea libxl: introduce flexarray_append_pair
Introduce flexarray_append_pair: a simple syntactic sugar to add a pair
of pointers to a flexarray, very useful when adding pairs of strings to
xenstore.

Replace flexarray_vappend calls (and one pair of flexarray_append)
with flexarray_append_pair calls when dealing with flexarrays that are
going to be used with libxl__xs_kvs_of_flexarray:

NULL is a valid pointer value in these cases while flexarray_vappend
uses NULL as vargs terminator, so the old code is buggy.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-09 17:03:34 +00:00
Jan Beulich 54f4cfa3d8 ACPI: large cleanup
In some cases, entire files turned out unnecessary. Of what remains,
move whatever possible into .init.*, and some data items into
.data.read_mostly.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 16:32:04 +00:00
Jan Beulich 67d84b65a1 x86: MCE cleanup
Move some MCE data items into .data.read_mostly. Adjust some types,
and make some symbols static.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 16:31:28 +00:00
Jan Beulich cba76631d1 move various bits into .init.* sections
This also includes the removal of some entirely unused functions.

The patch builds upon the makefile adjustments done in the earlier
sent patch titled "move more kernel decompression bits to .init.*
sections".

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 16:31:00 +00:00
Jan Beulich 007f425ac5 x86: MTRR cleanup
Remove unused and pointless bits from MTRR handling code. Move some
data items into .data.read_mostly. Adjust some types.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 16:30:19 +00:00
Jan Beulich 345ff09cee VT-d: cleanup ATS code
Rather than having per-architecture stubs when ATS support is not
implemented, simply provide inline functions in the common header for
that case.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 16:29:52 +00:00
Jan Beulich 7b491593ff x86: IO-APIC cleanup
Remove unused and pointless bits from IO-APIC handling code. Move
whatever possible into .init.*, and some data items into
.data.read_mostly. Adjust some types.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 16:28:58 +00:00
Jan Beulich 490a08a9f7 x86: APIC cleanup
Remove unused and pointless bits from APIC handling code. Move some
data items into .data.read_mostly. Adjust some types.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 16:23:41 +00:00
Jan Beulich 601d06e2fb x86: cleanup mpparse.c
Remove unused and pointless bits from mpparse.c (and other files where
they are related to it). Of what remains, move whatever possible into
.init.*, and some data items into .data.read_mostly.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 16:23:09 +00:00
Jan Beulich 086c24e10f VT-d: section adjustments to DMAR parsing code
Move whatever possible into .init.*, and some data items into
.data.read_mostly.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 16:22:40 +00:00
Jan Beulich 55c7eccc98 VT-d: section adjustments to quirks code
Move whatever possible into .init.*, and some data items into
.data.read_mostly.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 16:22:16 +00:00
Jan Beulich 48115d1474 Move more kernel decompression bits to .init.* sections
Based on how c/s 22986:076b63b74cf6 changed xen/libelf/Makefile I
suppose this is compatibile with those clang/llvm changes, but I
didn't actually test it.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 16:20:13 +00:00
Jan Beulich 4afea3d653 Add DomU xz kernel decompression
Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 16:19:36 +00:00
Jan Beulich a1630abae5 Add Dom0 xz kernel decompression
Largely taken from Linux 2.6.38 and made build/work for Xen.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 16:18:58 +00:00
Jan Beulich 7f107ea5c0 x86: make mod_l2_entry() return a proper error code
... so that finally all mod_lN_entry() functions behave identically,
allowing some cleanup in do_mmu_update() (which no longer needs to
track both an okay status and an error code).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 16:17:26 +00:00
Jan Beulich 541ce4766e x86: make mod_l1_entry() return a proper error code
... again is so that the guest can actually know the reason for the
(hypercall) failure.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 16:16:49 +00:00
Keir Fraser be640b1800 x86: make get_page_from_l1e() return a proper error code
... so that the guest can actually know the reason for the (hypercall)
failure.

ptwr_do_page_fault() could propagate the error indicator received from
get_page_from_l1e() back to the guest in the high half of the error
code (entry_vector), provided we're sure all existing guests can deal
with that (or indicate so by means of a to-be-added guest feature
flag). Alternatively, a second virtual status register (like CR2)
could be introduced.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 16:16:11 +00:00
Jan Beulich 0778492204 x86: run-time callers of map_pages_to_xen() must check for errors
Again, (out-of-memory) errors must not cause hypervisor crashes, and
hence ought to be propagated.

This also adjusts the cache attribute changing loop in
get_page_from_l1e() to not go through an unnecessary iteration. While
this could be considered mere cleanup, it is actually a requirement
for the subsequent now necessary error recovery path.

Also make a few functions static, easing the check for potential
callers needing adjustment.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 16:15:36 +00:00
Jan Beulich be68c24351 x86: don't BUG() post-boot in alloc_xen_pagetable()
Instead, propagate the condition to the caller, all of which also get
adjusted to check for that situation.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 16:14:59 +00:00
Jan Beulich 28d6207bfc Fix make 3.80 incompatibility in 22985:d8ea33e7af7e
make 3.80 complains about a missing endif if the invocation of
cc-ver-check is itself wrapped in a conditional. Steal how the tools
deal with that.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-03-09 10:49:19 +00:00
Keir Fraser f544bf377e Fix rcu domain locking for transitive grants
When acquiring a transitive grant for copy then the owning domain
needs to be locked down as well as the granting domain. This was being
done, but the unlocking was not. The acquire code now stores the
struct domain * of the owning domain (rather than the domid) in the
active entry in the granting domain. The release code then does the
unlock on the owning domain.  Note that I believe I also fixed a bug
where, for non-transitive grants the active entry contained a
reference to the acquiring domain rather than the granting
domain. From my reading of the code this would stop the release code
for transitive grants from terminating its recursion correctly.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
2011-03-08 16:30:30 +00:00
Keir Fraser 076eae8bef x86_emulate: FPU 0xda instructions have a 32-bit memory operand, not 64-bit.
Signed-off-by: Keir Fraser <keir@xen.org>
2011-03-08 16:14:55 +00:00
Keir Fraser cc18b6ba43 x86_emulate: Fix emulation of FIMUL m32i.
Need to emit assembler instruction fimull not fimul/fimuls.

Signed-off-by: Keir Fraser <keir@xen.org>
2011-03-08 16:10:13 +00:00
Tim Deegan 87c604dae4 Tidy makefiles to use CFLAGS-$(foo) idiom instead of ifeq.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
2011-03-08 10:23:52 +00:00