]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/xen.git/log
people/liuw/libxenctrl-split/xen.git
14 years agoDefine new <pfn.h> header for PFN_{DOWN,UP} macros.
Keir Fraser [Wed, 23 Mar 2011 13:34:55 +0000 (13:34 +0000)]
Define new <pfn.h> header for PFN_{DOWN,UP} macros.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agotools: consistently use $({CFLAGS,LDLIBS}_libxenlight) instead of open coding.
Ian Campbell [Mon, 21 Mar 2011 18:07:06 +0000 (18:07 +0000)]
tools: consistently use $({CFLAGS,LDLIBS}_libxenlight) instead of open coding.

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>
14 years agotools: consistently use $({CFLAGS,LDLIBS}_libxenstore) instead of open coding.
Ian Campbell [Mon, 21 Mar 2011 18:06:27 +0000 (18:06 +0000)]
tools: consistently use $({CFLAGS,LDLIBS}_libxenstore) instead of open coding.

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>
14 years agotools: consistently use $({CFLAGS,LDLIBS}_libxenctrl) instead of open coding.
Ian Campbell [Mon, 21 Mar 2011 18:05:49 +0000 (18:05 +0000)]
tools: consistently use $({CFLAGS,LDLIBS}_libxenctrl) instead of open coding.

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>
14 years agotools: consistently use $(CFLAGS_xeninclude) instead of open coding.
Ian Campbell [Mon, 21 Mar 2011 18:04:59 +0000 (18:04 +0000)]
tools: consistently use $(CFLAGS_xeninclude) instead of open coding.

Renamed from the slightly ambiguous CFLAGS_include.

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>
14 years agotools: Drop XEN_XC variable
Ian Campbell [Mon, 21 Mar 2011 18:00:17 +0000 (18:00 +0000)]
tools: Drop XEN_XC variable

There is nothing to include in the python bindings source directory
and likely never was/will be ...

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>
14 years agotools: remove unnecessary uses of -I.
Ian Campbell [Mon, 21 Mar 2011 17:58:52 +0000 (17:58 +0000)]
tools: remove unnecessary uses of -I.

It's not needed unless you are including headers in the current
directory _and_ you can't use "" instead of <> because the headers are
to be installed.

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>
14 years agotools: remove unnecessary uses of -L.
Ian Campbell [Mon, 21 Mar 2011 17:58:23 +0000 (17:58 +0000)]
tools: remove unnecessary uses of -L.

It's not needed unless you are linking against a library in the
current directory.

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>
14 years agotools: vtpm: Use $(BINDIR) rather than a privately defined variable
Ian Campbell [Mon, 21 Mar 2011 17:46:28 +0000 (17:46 +0000)]
tools: vtpm: Use $(BINDIR) rather than a privately defined variable

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>
14 years agotools: Drop use of $(INCLUDES)
Ian Campbell [Mon, 21 Mar 2011 17:45:50 +0000 (17:45 +0000)]
tools: Drop use of $(INCLUDES)

Several places include it in CFLAGS even though it is never defined. A
few others use it as nothing more than a gathering point for
CFLAGS. Get rid of it.

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>
14 years agotools: libxc: drop rpm.spec
Ian Campbell [Mon, 21 Mar 2011 17:40:18 +0000 (17:40 +0000)]
tools: libxc: drop rpm.spec

Last updated in 2004, doesn't even use the right library names.

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>
14 years agolibxc: remove dependency on xenstore headers.
Ian Campbell [Mon, 21 Mar 2011 17:39:41 +0000 (17:39 +0000)]
libxc: remove dependency on xenstore headers.

xc_offline_page doesn't really need xs.h.

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>
14 years agoxl: link against libxenctrl
Ian Campbell [Mon, 21 Mar 2011 14:52:27 +0000 (14:52 +0000)]
xl: link against libxenctrl

As well as the indirect dependency (via libxl) the xl binary also uses
libxenctrl directory (for xtl_createlogger_stdiostream etc) and
therefore must link against the library directly too.

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>
14 years agoamd-iommu: remove a stray __init
Jan Beulich [Fri, 18 Mar 2011 17:15:52 +0000 (17:15 +0000)]
amd-iommu: remove a stray __init

This function is being called on the resume path.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86/mce: CPU notifiers must not be registered a second time during resume
Jan Beulich [Fri, 18 Mar 2011 17:15:19 +0000 (17:15 +0000)]
x86/mce: CPU notifiers must not be registered a second time during resume

While c/s 22964:f71212f712fd and 23051:93c864c16ab1 fixed issues with
CPU onlining, they introduced a problem with resume: mcheck_init() is
also being called on that path, and hence checking whether it's
running on CPU 0, which is generally not a really good thing, is
particularly inappropriate here.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agoRules.mk: adjustments to the .o -> .init.o build rule
Jan Beulich [Fri, 18 Mar 2011 16:31:11 +0000 (16:31 +0000)]
Rules.mk: adjustments to the .o -> .init.o build rule

First, $(shell ...) getting executed before the containing command gets
invoked doesn't have the intended effect when the inner command wants
variables of the outer command expanded. This needs to be done by the
shell executing the entire command.

Second, pattern rules for intermediate files with their targets not
mentioned explicitly result in them getting deleted. Since the .*.o.d
files get generated on the first make run and included for the second,
the second run sees them mentioned explicitly and re-builds them (and
the final *.init.o files), which is particularly annoying if the second
build is actually an install (as root) while normal builds get run as
ordinary user: Some of the output files will suddenly be root owned,
possibly causing permission issues on a later rebuild.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoUpdate Xen version to 4.2-unstable
Keir Fraser [Thu, 17 Mar 2011 23:30:35 +0000 (23:30 +0000)]
Update Xen version to 4.2-unstable

14 years agotools: do not link against unused libraries.
Ian Campbell [Thu, 17 Mar 2011 19:38:05 +0000 (19:38 +0000)]
tools: do not link against unused libraries.

A fair few things under tools link against libraries which they don't
even use.

Most of this appears to come from copy-and-pasting previous Makefile
snippets and cargo-culting plus the tendency to define global $(LIBS)
even for Makefiles which build multiple separate utilities or
libraries.

Identified by comparing a build with --as-needed to one without by
looking at the NEEDED header of all ELF objects.

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>
14 years agotools: support building with --as-needed
Ian Campbell [Thu, 17 Mar 2011 19:15:42 +0000 (19:15 +0000)]
tools: support building with --as-needed

Tested by forcing --as-needed via tools/Rules.mk but this is included
since the intention is simply to support diustros which default to
--as-needed, not to enable it everywhere.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agotools: link each shared library or binary only against the libraries it uses
Ian Campbell [Thu, 17 Mar 2011 19:15:18 +0000 (19:15 +0000)]
tools: link each shared library or binary only against the libraries it uses

In particular if binary A uses libB and libB uses libC entirely
internally then A does not need to link against libC only libB.

However when linking binary A the linker does need to have visibility
of the libraries which libB links against (libC in this example). For
out of tree uses this is achieved without fuss due because the
libraries are installed in a standard path. However in the case of
in-tree users the linker needs a hint in the form of the -rpath-link
option.  Therefore a new class of build variable, $(SHLIB_FOO), is
introduced which includes the linker options needed to link against a
library which uses libFOO. The intention is that $(LDLIBS_bar) will
include the $(SHLIB_foo)s which it uses where necessary rather
requiring that users are aware of this.

For the python extensions this change appears particularly large since
previously each of python bindings were linked against the union of
all possible libraries used by all bindings instead of just what they
individually needed.

This change removes a dependency on libdl.so from nearly everything
in the system, only libxenctrl actually uses it.

In the context of xl/libxl the intention of libxl is to remove any
need for a user of libxl to know about libxenstore or libxenctrl,
however in the current build it is xl which links against those
libraries rather than libxl (which only links against libc). After
this change libxl correctly depends on the libraries it uses and xl
does not depend on libraries which it is not support to be required to
know about. Note that xl does depend on libxenctrl.so since it uses
xtl_* directly.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agotools/blktap2/libvhd: move uuid wrapper functions out of line.
Ian Campbell [Thu, 17 Mar 2011 19:14:57 +0000 (19:14 +0000)]
tools/blktap2/libvhd: move uuid wrapper functions out of line.

This isolates users of libvhd from the need to know about the
different OS schemes for UUIDs.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Daniel Stodden <daniel.stodden@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agotools/blktap2: push uuid wrapper functions down into libvhd.
Ian Campbell [Thu, 17 Mar 2011 19:13:53 +0000 (19:13 +0000)]
tools/blktap2: push uuid wrapper functions down into libvhd.

Nothing else uses them.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agox86/HPET: fix oversight in 23033:84bacd800bf8 (2nd try)
Jan Beulich [Thu, 17 Mar 2011 13:32:41 +0000 (13:32 +0000)]
x86/HPET: fix oversight in 23033:84bacd800bf8 (2nd try)

Clearly for the adjusted BUG_ON()s to not yield false positives
num_hpets_used (rather than num_chs_used, as done mistakenly in
23042:599ceb5b0a9b) must be incremented before setting up an IRQ (and
decremented back when the setup failed). To avoid further confusion,
just eliminate the local variable altogether.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86: mce cleanup for both Intel and AMD mce logic
Liu, Jinsong [Thu, 17 Mar 2011 13:31:43 +0000 (13:31 +0000)]
x86: mce cleanup for both Intel and AMD mce logic

c/s 22964 fixed a mce memory leaks bug which may trigger xen crash
when cpu online.  However, there are 2 mce memory leaks: 1 at mce
level (arch independent), 1 at mce_intel level (arch dependent).  At
c/s 22964, it free both leaks at mce_intel level, which would has
problem under AMD arch.

This patch fix this issue.

It alloc/free poll_bankmask (arch independent) at mce level,=20 and
add a notifier block at mce level to avoid xmalloc risk when irq
disable.

With this patch, both Intel and AMD mce works OK in a clean way.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
14 years agoxentrace: dynamic tracebuffer allocation
Olaf Hering [Thu, 17 Mar 2011 13:29:01 +0000 (13:29 +0000)]
xentrace: dynamic tracebuffer allocation

Allocate tracebuffers dynamically, based on the requested buffer size.
Calculate t_info_size from requested t_buf size.
Fix allocation failure path, free pages outside the spinlock.
Remove casts for rawbuf, it can be a void pointer since no math is
done.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
14 years agobuild: Make XEN_ROOT an absolute path.
Keir Fraser [Thu, 17 Mar 2011 10:36:25 +0000 (10:36 +0000)]
build: Make XEN_ROOT an absolute path.

Otherwise make can search the path relative to certain standard paths
such as /usr/include (e.g., the line '-include $(XEN_ROOT)/.config' in
Config.mk suffers from this).

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agoDo not re-define XEN_ROOT in hypervisor sub-Makefiles.
Keir Fraser [Thu, 17 Mar 2011 08:04:10 +0000 (08:04 +0000)]
Do not re-define XEN_ROOT in hypervisor sub-Makefiles.

We can globally export it from xen/Makefile instead, as all hypervisor
builds have this Makefile at their root.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agolibxl: provide full path to vif hotplug script script
Ian Jackson [Wed, 16 Mar 2011 16:44:25 +0000 (16:44 +0000)]
libxl: provide full path to vif hotplug script script

This improves compatibility with xm style config files since xend does
this (see NetifController.getDeviceDetails() in
tools/python/xen/xend/server/netif.py) and
tools/hotplug/Linux/vif-setup expects an absolute path to the script.

This patch supports both absolute and relative paths in the
configuration.  Also, if somehow nic->script==NULL, don't add write
the entry to xenstore at all (rather than crashing due to the new
check for absolute vs relative path).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoThis fixes a bug in changeset 22526:7a5ee3800417, where the wrong
Tim Deegan [Wed, 16 Mar 2011 09:35:32 +0000 (09:35 +0000)]
This fixes a bug in changeset 22526:7a5ee3800417, where the wrong
value is read when deciding whether to flush the VTd tables.  The
effect is minor: in situations where the p2m entry is changed but the
mfn is the same, the VTd tables will be unnecessarily flushed.

old_entry is left untouched in the second case, since having a present
old_entry will cause the an unnecessary check to be taken at the end
of the function.

Spotted-by: Zhang, Peng Fei <zpfalpc23@gmail.com>
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agolibxl: Make all hidden/static functions take a gc not a ctx
Ian Campbell [Tue, 15 Mar 2011 18:20:46 +0000 (18:20 +0000)]
libxl: Make all hidden/static functions take a gc not a ctx

Also ensure that static and hidden functions use the libxl__ prefix
not just libxl_ (in the case of static functions only when they use a
libxl prefix to start with).

This follows the policy described in libxl.h "libxl memory
management".

Based on a manual audit of:
grep ^static tools/libxl/libxl*.[ch]| grep libxl_ctx
grep libxl__ tools/libxl/*.h| grep libxl_ctx

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agolibxl: do not start a xenpv qemu solely for tap devices if blktap is available
Ian Campbell [Tue, 15 Mar 2011 18:19:47 +0000 (18:19 +0000)]
libxl: do not start a xenpv qemu solely for tap devices if blktap is available

qemu is used as a fallback for DISK_BACKEND_TAP if no blktap is
available but if blktap is available, or for DISK_BACKEND_PHY, we
don't need a qemu process.

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>
14 years agoAvoid endless loop for vcpu migration.
Juergen Gross [Tue, 15 Mar 2011 10:14:27 +0000 (10:14 +0000)]
Avoid endless loop for vcpu migration.

Only call SCHED_OP(pick_cpu) if a previously picked cpu is not
suitable on the current iteration of the retry loop.

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Signed-off-by: Keir Fraser <keir@xen.org>
14 years agox86/HPET: fix oversight in 23033:84bacd800bf8
Jan Beulich [Tue, 15 Mar 2011 10:02:36 +0000 (10:02 +0000)]
x86/HPET: fix oversight in 23033:84bacd800bf8

Clearly for the adjusted BUG_ON()s to not yield false positives
num_chs_used must be incremented before setting up an IRQ (and
decremented back when the setup failed).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years ago_csched_cpu_pick(): simplify sched_smt_power_savings dependent condition
Jan Beulich [Mon, 14 Mar 2011 17:20:11 +0000 (17:20 +0000)]
_csched_cpu_pick(): simplify sched_smt_power_savings dependent condition

At least to me, using ?: instead of the (a && ...) || (!a && ...)
construct is far easier to grok with a single look.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years ago_csched_cpu_pick(): don't write idle bias more than once
Jan Beulich [Mon, 14 Mar 2011 17:19:47 +0000 (17:19 +0000)]
_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>
14 years ago_csched_cpu_pick(): don't return CPUs outside vCPU's affinity mask
Jan Beulich [Mon, 14 Mar 2011 17:19:22 +0000 (17:19 +0000)]
_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>
14 years agoAllow tools to map arbitrarily large machphys_mfn_list on 32bit dom0
Gianni Tedesco [Mon, 14 Mar 2011 17:13:15 +0000 (17:13 +0000)]
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>
14 years agox86: fix cpu_sibling_map initialization when topology CPUID leaf is present
Jan Beulich [Mon, 14 Mar 2011 17:05:21 +0000 (17:05 +0000)]
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>
14 years agox86: add volatile prefix for cpuid asm clauses
Wei Gang [Mon, 14 Mar 2011 17:04:42 +0000 (17:04 +0000)]
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>
14 years agoForce out-of-line instances of inline functions into .init.text in init-only code
Jan Beulich [Mon, 14 Mar 2011 17:02:50 +0000 (17:02 +0000)]
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>
14 years agox86_64: fix error checking in arch_set_info_guest()
Tim Deegan [Mon, 14 Mar 2011 16:59:49 +0000 (16:59 +0000)]
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>
14 years agox86/HPET: adjust types
Jan Beulich [Sat, 12 Mar 2011 13:20:51 +0000 (13:20 +0000)]
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>
14 years agox86/HPET: use dynamic allocation for hpet_events[]
Jan Beulich [Sat, 12 Mar 2011 13:20:11 +0000 (13:20 +0000)]
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>
14 years agox86/HPET: cleanup
Jan Beulich [Sat, 12 Mar 2011 13:19:34 +0000 (13:19 +0000)]
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>
14 years agox86/HPET: fix initialization order
Jan Beulich [Sat, 12 Mar 2011 13:19:02 +0000 (13:19 +0000)]
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>
14 years agolibxl: do not try to use blktap with qdisk
Stefano Stabellini [Fri, 11 Mar 2011 18:22:23 +0000 (18:22 +0000)]
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>
14 years agoMerge
Ian Jackson [Fri, 11 Mar 2011 18:21:17 +0000 (18:21 +0000)]
Merge

14 years agolibxc: move error checking next to the function which returned the error.
Ian Campbell [Fri, 11 Mar 2011 18:20:53 +0000 (18:20 +0000)]
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>
14 years agolibxc: osdep: convert hypercall buffer allocation
Ian Campbell [Fri, 11 Mar 2011 18:18:18 +0000 (18:18 +0000)]
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>
14 years agox86: Clean up wbinvd usage in cpu offline paths.
Keir Fraser [Fri, 11 Mar 2011 17:27:25 +0000 (17:27 +0000)]
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>
14 years agox86: Fix cpu offline bug: add clflush inside dead loop
Liu, Jinsong [Fri, 11 Mar 2011 17:18:53 +0000 (17:18 +0000)]
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>
14 years agox86: Fix cache flush bug of cpu offline
Liu, Jinsong [Fri, 11 Mar 2011 17:18:01 +0000 (17:18 +0000)]
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>
14 years agox86: Fix cpu offline bug: cancel SYSIO method when play dead
Liu, Jinsong [Fri, 11 Mar 2011 16:27:33 +0000 (16:27 +0000)]
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>
14 years agolibxc: move error checking next to the function which returned the error.
Ian Campbell [Fri, 11 Mar 2011 16:20:34 +0000 (16:20 +0000)]
libxc: move error checking next to the function which returned the error.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
14 years agox86: Fix cpuidle bug
Liu, Jinsong [Thu, 10 Mar 2011 18:35:32 +0000 (18:35 +0000)]
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>
14 years agolibxl: do not rely on guest to respond when forcing pci device removal
Ian Campbell [Thu, 10 Mar 2011 18:21:42 +0000 (18:21 +0000)]
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>
14 years agolibxl: Call setsid(2) before exec'ing device model
Jim Fehlig [Thu, 10 Mar 2011 18:17:16 +0000 (18:17 +0000)]
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>
14 years agoupdate README
Stefano Stabellini [Thu, 10 Mar 2011 18:11:31 +0000 (18:11 +0000)]
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>
14 years agox86: remove pre-686 CPU support bits
Jan Beulich [Wed, 9 Mar 2011 17:25:44 +0000 (17:25 +0000)]
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>
14 years agoxl/xm: make pci-list use same BDF format as all other commands
Ian Campbell [Wed, 9 Mar 2011 17:05:43 +0000 (17:05 +0000)]
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>
14 years agolibxl: introduce flexarray_append_pair
Stefano Stabellini [Wed, 9 Mar 2011 17:03:34 +0000 (17:03 +0000)]
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>
14 years agoACPI: large cleanup
Jan Beulich [Wed, 9 Mar 2011 16:32:04 +0000 (16:32 +0000)]
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>
14 years agox86: MCE cleanup
Jan Beulich [Wed, 9 Mar 2011 16:31:28 +0000 (16:31 +0000)]
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>
14 years agomove various bits into .init.* sections
Jan Beulich [Wed, 9 Mar 2011 16:31:00 +0000 (16:31 +0000)]
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>
14 years agox86: MTRR cleanup
Jan Beulich [Wed, 9 Mar 2011 16:30:19 +0000 (16:30 +0000)]
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>
14 years agoVT-d: cleanup ATS code
Jan Beulich [Wed, 9 Mar 2011 16:29:52 +0000 (16:29 +0000)]
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>
14 years agox86: IO-APIC cleanup
Jan Beulich [Wed, 9 Mar 2011 16:28:58 +0000 (16:28 +0000)]
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>
14 years agox86: APIC cleanup
Jan Beulich [Wed, 9 Mar 2011 16:23:41 +0000 (16:23 +0000)]
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>
14 years agox86: cleanup mpparse.c
Jan Beulich [Wed, 9 Mar 2011 16:23:09 +0000 (16:23 +0000)]
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>
14 years agoVT-d: section adjustments to DMAR parsing code
Jan Beulich [Wed, 9 Mar 2011 16:22:40 +0000 (16:22 +0000)]
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>
14 years agoVT-d: section adjustments to quirks code
Jan Beulich [Wed, 9 Mar 2011 16:22:16 +0000 (16:22 +0000)]
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>
14 years agoMove more kernel decompression bits to .init.* sections
Jan Beulich [Wed, 9 Mar 2011 16:20:13 +0000 (16:20 +0000)]
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>
14 years agoAdd DomU xz kernel decompression
Jan Beulich [Wed, 9 Mar 2011 16:19:36 +0000 (16:19 +0000)]
Add DomU xz kernel decompression

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agoAdd Dom0 xz kernel decompression
Jan Beulich [Wed, 9 Mar 2011 16:18:58 +0000 (16:18 +0000)]
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>
14 years agox86: make mod_l2_entry() return a proper error code
Jan Beulich [Wed, 9 Mar 2011 16:17:26 +0000 (16:17 +0000)]
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>
14 years agox86: make mod_l1_entry() return a proper error code
Jan Beulich [Wed, 9 Mar 2011 16:16:49 +0000 (16:16 +0000)]
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>
14 years agox86: make get_page_from_l1e() return a proper error code
Keir Fraser [Wed, 9 Mar 2011 16:16:11 +0000 (16:16 +0000)]
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>
14 years agox86: run-time callers of map_pages_to_xen() must check for errors
Jan Beulich [Wed, 9 Mar 2011 16:15:36 +0000 (16:15 +0000)]
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>
14 years agox86: don't BUG() post-boot in alloc_xen_pagetable()
Jan Beulich [Wed, 9 Mar 2011 16:14:59 +0000 (16:14 +0000)]
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>
14 years agoFix make 3.80 incompatibility in 22985:d8ea33e7af7e
Jan Beulich [Wed, 9 Mar 2011 10:49:19 +0000 (10:49 +0000)]
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>
14 years agoFix rcu domain locking for transitive grants
Keir Fraser [Tue, 8 Mar 2011 16:30:30 +0000 (16:30 +0000)]
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>
14 years agox86_emulate: FPU 0xda instructions have a 32-bit memory operand, not 64-bit.
Keir Fraser [Tue, 8 Mar 2011 16:14:55 +0000 (16:14 +0000)]
x86_emulate: FPU 0xda instructions have a 32-bit memory operand, not 64-bit.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agox86_emulate: Fix emulation of FIMUL m32i.
Keir Fraser [Tue, 8 Mar 2011 16:10:13 +0000 (16:10 +0000)]
x86_emulate: Fix emulation of FIMUL m32i.

Need to emit assembler instruction fimull not fimul/fimuls.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agoTidy makefiles to use CFLAGS-$(foo) idiom instead of ifeq.
Tim Deegan [Tue, 8 Mar 2011 10:23:52 +0000 (10:23 +0000)]
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>
14 years agomerge
Tim Deegan [Mon, 7 Mar 2011 16:35:49 +0000 (16:35 +0000)]
merge

14 years agoblktap2: fix gap in tapdisk2 disk_type numbering
Shriram Rajagopalan [Mon, 7 Mar 2011 16:15:15 +0000 (16:15 +0000)]
blktap2: fix gap in tapdisk2 disk_type numbering

Make the DISK_TYPE_* id numbering in tapdisk-disktypes.h contiguous.
Currently, id 8 is unallocated causing a null disk type entry in
tapdisk_disk_drivers array in tapdisk-disktypes.c. This causes the
function tapdisk_disktype_find() to return an error on encountering
disk types >7 (remus:, log:, etc.).

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Daniel Stodden <daniel.stodden@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agox86: Add another '&' to the function arg of run_in_exception_handler.
Tim Deegan [Mon, 7 Mar 2011 16:07:06 +0000 (16:07 +0000)]
x86: Add another '&' to the function arg of run_in_exception_handler.
This is needed to compile xen with clang.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agox86: revert 22983:0edb666c8300
Tim Deegan [Mon, 7 Mar 2011 15:58:19 +0000 (15:58 +0000)]
x86: revert 22983:0edb666c8300
run_in_exception_handler _does_ have other users.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agoxen: add "lto=y" option to build Xen with link-time optimizations.
Tim Deegan [Mon, 7 Mar 2011 11:34:09 +0000 (11:34 +0000)]
xen: add "lto=y" option to build Xen with link-time optimizations.

This involves gathering object files from .asm (which will be binary)
and object files from .c (which will be in LTO format) separately
until the final link.

Only tested for x86_64 Xen builds using Clang/LLVM bitcode; it should be
possible to do the same with newer GCCs and GIMPLE.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agoxen: add "clang=y" option to build Xen with clang/llvm instead of gcc.
Tim Deegan [Mon, 7 Mar 2011 11:21:11 +0000 (11:21 +0000)]
xen: add "clang=y" option to build Xen with clang/llvm instead of gcc.

Tested with svn snapshot of clang and llvm from 17 February 2011.
Only x86_64 hypervisor builds (make dist-xen clang=y) are supported
and I haven't even begun to look at cross-compiling.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agox86: redefine REX64_PREFIX for clang, which doesn't like 'rex64/'.
Tim Deegan [Mon, 7 Mar 2011 11:21:11 +0000 (11:21 +0000)]
x86: redefine REX64_PREFIX for clang, which doesn't like 'rex64/'.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agoXen: remove run_in_exception_handler() and recode its only caller
Tim Deegan [Mon, 7 Mar 2011 11:21:11 +0000 (11:21 +0000)]
Xen: remove run_in_exception_handler() and recode its only caller
(dump_execution_state()) as its own bug-trap.

This is needed to compile xen with clang, which can't handle using a
function name in an asm immediate.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agocredit2: remove two nested functions, replacing them with static ones
Tim Deegan [Mon, 7 Mar 2011 11:21:11 +0000 (11:21 +0000)]
credit2: remove two nested functions, replacing them with static ones
and passing the outer scope's variables in explicitly.
This is needed to compile xen with clang.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agoxen: adjust cpumask initializers to suit clang's incomplete gccisms.
Tim Deegan [Mon, 7 Mar 2011 11:21:11 +0000 (11:21 +0000)]
xen: adjust cpumask initializers to suit clang's incomplete gccisms.
This is needed to compile xen with clang.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agox86: redefine a few empty macros as explicit nops.
Tim Deegan [Mon, 7 Mar 2011 11:21:11 +0000 (11:21 +0000)]
x86: redefine a few empty macros as explicit nops.
This is needed to compile xen with clang.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agox86: add explicit size suffixes to some assembly instructions.
Tim Deegan [Mon, 7 Mar 2011 11:21:11 +0000 (11:21 +0000)]
x86: add explicit size suffixes to some assembly instructions.
This is needed to compile xen with clang.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agox86: make spinlock's 16-bit asm operand explicitly 16-bit.
Tim Deegan [Mon, 7 Mar 2011 11:21:11 +0000 (11:21 +0000)]
x86: make spinlock's 16-bit asm operand explicitly 16-bit.
This is needed to compile xen with clang.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
14 years agox86: Cache read of cpu_state in __cpu_die() for subsequent BUG_ON check.
Keir Fraser [Sat, 5 Mar 2011 16:02:33 +0000 (16:02 +0000)]
x86: Cache read of cpu_state in __cpu_die() for subsequent BUG_ON check.

Otherwise compiler may re-read cpu_state for the BUG_ON and see a
modified value causing erroneous BUG.

Signed-off-by: Keir Fraser <keir@xen.org>
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
14 years agosched_credit: Hold lock while dump scheduler info
Keir Fraser [Sat, 5 Mar 2011 11:36:21 +0000 (11:36 +0000)]
sched_credit: Hold lock while dump scheduler info

Dump runq with debug key 'r' may cause dead loop like below:

(XEN) active vcpus:
(XEN)     1: [1.0] pri=0 flags=0 cpu=0 credit=263 [w=256]
(XEN)     2: [0.2] pri=0 flags=0 cpu=5 credit=284 [w=256]
(XEN)     3: [0.2] pri=0 flags=0 cpu=5 credit=282 [w=256]
...
(XEN)  xxxxx: [0.2] pri=0 flags=0 cpu=2 credit=54 [w=256]
...
(XEN)  xxxxx: [0.2] pri=0 flags=0 cpu=3 credit=-48 [w=256]
...

This means the active vcpu 0.2 became non-active with the active list
element empty just after it was accessed in the loop '2:'.

We should always hold a lock before access scheduler related list,
even in the debug purpose dump code.

Signed-off-by: Wei Gang <gang.wei@intel.com>
14 years agox86: On CPU offline, fix master waiting for slave to be fully dead.
Keir Fraser [Sat, 5 Mar 2011 11:34:41 +0000 (11:34 +0000)]
x86: On CPU offline, fix master waiting for slave to be fully dead.

On two back-to-back CPU offline operations, on second offline the
cpu_state var will be CPU_STATE_DEAD from the first offline. Hence
__cpu_die() will incorrectly not wait for the second slave to fully
die and set cpu_state itself.

The fix is to set cpu_state to a new value, CPU_STATE_DYING, earlier
during CPU offline, before __cpu_die() starts to execute.

Original diagnosis and patch by Liu, Jinsong <jinsong.liu@intel.com>

Signed-off-by: Keir Fraser <keir@xen.org>