Isaku Yamahata [Fri, 13 Feb 2009 02:23:16 +0000 (11:23 +0900)]
[IA64] shrink ia64 struct page_info.
This patch is the ia64 counter part of 19107:0858f961c77a,
19132:5848b49b74fc and 19136:162cdb596b9a.
This patch shrink ia64 struct page_info and rearrange its members.
The shrinking is made compile time option in config.h with default off
becuase physical address size is architected to 50bit by ia64
and mfn isn't always addressed by 32bits with 16KB page size.
Isaku Yamahata [Fri, 13 Feb 2009 01:56:01 +0000 (10:56 +0900)]
[IA64] MCA: Avoid calling xmcalloc from interrupt handler
This patch fixes to avoid calling xmalloc() from the interrupt handler.
Calling xmalloc() with interrupt disabled triggers the following
BUG_ON().
> (XEN) Xen BUG at xmalloc_tlsf.c:548
Keir Fraser [Thu, 12 Feb 2009 10:48:55 +0000 (10:48 +0000)]
Cleanup naming for ia64 and x86 interrupt handling functions
- Append '_IRQ' to AUTO_ASSIGN, NEVER_ASSIGN, and FREE_TO_ASSIGN
- Rename {request,setup}_irq to {request,setup}_irq_vector
- Rename free_irq to release_irq_vector
- Add {request,setup,release}_irq wrappers for their
{request,setup,release}_irq_vector counterparts
- Added generic irq_to_vector inline for ia64
- Changed ia64 to use the new naming scheme
Keir Fraser [Wed, 11 Feb 2009 13:07:45 +0000 (13:07 +0000)]
x86: cpufreq get_cur_val adjustment
c/s 19149 update cpufreq get_cur_val logic to avoid cross processor
call. However, to avoid null drv_data pointer, we adjust some logic in
this patch to keep advantage of c/s 19149 and at same time to avoid
null drv_data pointer.
Keir Fraser [Wed, 11 Feb 2009 10:47:24 +0000 (10:47 +0000)]
cpufreq cmdline handling
c/s 19147 adjust cpufreq cmdline handling, this patch is a complement
to c/s 19147.
In this patch:
1. add common para (governor independent para) handling;
2. change governor dependent para handling method, governor dependent
para will only be handled by the handler of that governor (not by all
governors);
3. add userspace governor dependent para handling;
4. change para name 'threshold' of ondemand governor to 'up_threshold'
since ondemand has only 'up_threshold', and conservative governor (will be
implemented later) has both 'up_threshold' and 'down_threshold';
5. change some coding style (c/s 19147, drivers/cpufreq/cpufreq.c) to
keep coordination with original drivers/cpufreq/cpufreq.c coding style;
(originally this file is ported from linux, we partly use linux coding style)
Keir Fraser [Tue, 10 Feb 2009 05:51:00 +0000 (05:51 +0000)]
x86: mce: Provide extended physical CPU info.
Provide extended physial CPU info for the sake of dom0 MCE handling.
This information includes <cpu,core,thread> info for all logical CPUs,
cpuid information from all of them, and initial MSR values for a few
MSRs that are important to MCE handling.
Signed-off-by: Frank van der Linden <Frank.Vanderlinden@Sun.COM>
Keir Fraser [Fri, 6 Feb 2009 10:42:26 +0000 (10:42 +0000)]
Better separate IOAPIC management from interrupt vector management
Don't automatically update ioapic_irq array when allocating vectors.
Only do so when actually allocating IOAPIC irqs. Also move some
IOAPIC specific defines to io_apic.c.
Keir Fraser [Fri, 6 Feb 2009 10:36:23 +0000 (10:36 +0000)]
Cleanup IOMMU interrupt setup
- Check for errors when allocating interrupt vectors
- Clean up if interrupt allocation failed
- Make sure that the allocated vector is not reused
Keir Fraser [Thu, 5 Feb 2009 12:17:08 +0000 (12:17 +0000)]
libxc support for the new partial-HVM-save domctl.
This includes making the pagetable walker in xc_pagetab.c behave
correctly for 32-bit and 64-bit HVM guests.
Keir Fraser [Thu, 5 Feb 2009 12:16:53 +0000 (12:16 +0000)]
Remove uses of DECLARE_BITMAP in the public HVM save format headers
and replace them with open-coded equivalents. DECLARE_BITMAP is
not exported to user-space consumers of the Xen headers.
Keir Fraser [Thu, 5 Feb 2009 12:14:09 +0000 (12:14 +0000)]
x86: recover pat value for bsp after S3 resume.
host pat is set to cover all memory types by Xen, which is
necessary to support guest mtrr/pat, especially when device
is passthroughed with VT-d. However pat on bsp is not=20
recovered which could make assigned device defunct after S3
resume
Keir Fraser [Thu, 5 Feb 2009 12:09:10 +0000 (12:09 +0000)]
Add a page_info flag to indicate whether free pages need a TLB flush
on next use.
Apart from teh small performance gain of this, my primary motivation
is to avoid TLB flushes very early in boot, when the system is not yet
properly set up for cross-TLB shootdowns.
Keir Fraser [Wed, 4 Feb 2009 15:29:51 +0000 (15:29 +0000)]
Remove cpumask for page_info struct.
This makes TLB flushing on page allocation more conservative, but the
flush clock should still save us most of the time (page freeing and
alloc'ing tends to happen in batches, and not necesasrily close
together). We could add some optimisations to the flush filter if this
does turn out to be a significant overhead for some (useful)
workloads.
Keir Fraser [Wed, 4 Feb 2009 15:08:46 +0000 (15:08 +0000)]
x86: Clean up PV guest LDT handling.
1. Do not touch deferred_ops in invalidate_shadow_ldt(), as we may
not always be in a context where deferred_ops is valid.
2. Protected the shadow LDT with a lock, now that mmu updates are not
protected by the per-domain lock.
Keir Fraser [Wed, 4 Feb 2009 12:01:47 +0000 (12:01 +0000)]
Eliminate some special page list accessors
Since page_list_move_tail(), page_list_splice_init(), and
page_list_is_eol() are only used by relinquish_memory(), and that
function can easily be changed to use more generic accessors, just
eliminate them altogether.
Keir Fraser [Tue, 3 Feb 2009 18:13:55 +0000 (18:13 +0000)]
x86: misc adjustments to acpi-cpufreq
Avoid the call to check_freq() by default, since that function may
spin up to 1ms on certain systems without indicating any kind of severe
failure. This matches similar behavior in Linux.
Avoid doing a cross processor call in get_cur_val() if the current CPU
has its bit set in the mask passed in. Also use the local variable
'cpu' consistently, allowing to remove another local variable.
Keir Fraser [Tue, 3 Feb 2009 18:13:22 +0000 (18:13 +0000)]
cpufreq: attach __exit to the (unused) cpufreq governor exit handlers
... in order to make them disappear from the final image. Of course
they could as well be removed altogether, but I assumed that whoever
added them had a reason to do so.
Keir Fraser [Tue, 3 Feb 2009 18:12:51 +0000 (18:12 +0000)]
Consolidate cpufreq cmdline handling
... by moving as much of the option processing into cpufreq code as is
possible, by folding the cpufreq_governor option into the cpufreq one
(the governor name, if any, must be specified as the first thing after
the separator following "cpufreq=xen"), and by allowing each
governor to have an option processing routine.
Keir Fraser [Tue, 3 Feb 2009 18:11:03 +0000 (18:11 +0000)]
x86: Relocate Multiboot structures where we know they will be
accessible. GRUB2 seems to like to stick them really high sometimes
(just below 4GB).
The 32-bit C code framework that this sets up can also be used for
other stuff in future:
* early cmdline parsing
* relocating multiboot modules so they too are guaranteed accessible
Its interaction with normal Xen start-of-day, and with the 16-bit
assembly trampoline, needs a bit of thought.
Keir Fraser [Tue, 3 Feb 2009 14:06:51 +0000 (14:06 +0000)]
ia64: fix compilation error
This patch fixes the following compilation error.
Since struct page_list_head is defined in mm.h, sched.h needs mm.h.
Other circular inclusions are sorted out.
> In file included from xen/include/asm-ia64/linux-xen/asm/smp.h:50,
> from xen/include/linux/smp.h:5,
> from xen/include/asm-ia64/linux/topology.h:33,
> from xen/include/asm-ia64/linux-xen/linux/gfp.h:6,
> from xen/include/asm/mm.h:11,
> from xen/include/xen/mm.h:90,
> from viosapic.c:35:
> xen/include/xen/sched.h:174: error: field page_list has incomplete
> type
> xen/include/xen/sched.h:175: error: field xenpage_list has
> incomplete type
Isaku Yamahata [Mon, 2 Feb 2009 02:11:36 +0000 (11:11 +0900)]
[IA64] Fix populate-on-demand stub.
A return value of 1 is meant to inform decrease_reservation() that
everything has been taken care of by the PoD code and it doesn't need
to call guest_remove_page().
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Keir Fraser [Fri, 30 Jan 2009 11:16:52 +0000 (11:16 +0000)]
page_alloc: try to put heap control structures on the target node
This also neatly eliminates (in certain cases) the need to reserve a
page between nodes, as the heap control structures will never be freed
and thus can serve as the needed separator.
It also adds an additonal fallback attempting to make use of the
wasted tail of a (group of) page(s) used for the _heap array by putting the
avail array there if it fits.
Keir Fraser [Fri, 30 Jan 2009 11:14:23 +0000 (11:14 +0000)]
page_alloc: properly honor MAX_ORDER in init_heap_pages()
The previous check was flawed in that it checked
- for a single bit to be set instead of a range of bits to be clear
- a machine address against a mask supposed to be used on MFNs.
Keir Fraser [Fri, 30 Jan 2009 11:10:43 +0000 (11:10 +0000)]
x86: re-arrange struct page_info members
By combining the overlay fields that are 8 bytes long (on x86-64) into
a union separate from the one used for the 4 byte wide fields, no
unnecessary padding will be inserted while at the same time avoiding
to use __attribute__((__packed__)) on any of the sub-structures (which
risks misaligning structure members without immediately noticing).
Keir Fraser [Fri, 30 Jan 2009 11:08:06 +0000 (11:08 +0000)]
x86-64: fold shadow_page_info fields into page_info
... combining the list entry members of both structures and removing
the artificial 'mbz' member (shadow code must keep the real underlying
member 'count_info' at zero for the lifetime of pages use as shadows).
This also fixes a latent issue with u.inuse._domain not getting
explicitly cleared before returning shadow pages to the domain heap -
it just so happened that this member turned out to be zero in all
(normal?) cases when a shadow page ends its life (but there were
neither build nor run-time assertions that this would actually be the
case). The bug got exposed by a subsequent patch changing the order of
fields in struct page_info.
Keir Fraser [Fri, 30 Jan 2009 11:03:28 +0000 (11:03 +0000)]
x86-64: use MFNs for linking together pages on lists
Unless more than 16Tb are going to ever be supported in Xen, this will
allow reducing the linked list entries in struct page_info from 16 to
8 bytes.
This doesn't modify struct shadow_page_info, yet, so in order to meet
the constraints of that 'mirror' structure the list entry gets
artificially forced to be 16 bytes in size. That workaround will be
removed in a subsequent patch.
Isaku Yamahata [Fri, 30 Jan 2009 02:04:51 +0000 (11:04 +0900)]
[IA64] remove warning
This patch remove the following warning.
> memory.c:116: warning: implicit declaration of function 'guest_physmap_mark_populate_on_demand'
> memory.c:206: warning: implicit declaration of function 'p2m_pod_decrease_reservation'
Keir Fraser [Thu, 29 Jan 2009 16:41:48 +0000 (16:41 +0000)]
stubdom: add videoram to stubdom initial memory reservation
This patch adds a videoram parameter (4MB is the default) to pv guests
too: if the pv guest is actually a stubdomain then the videoram size
is added to the initial required available memory.
This way there is no risk that a stubdom fails to populate the
videoram because the RAM freed for the videoram by dom0 has already
been used to create the stubdom.
Keir Fraser [Thu, 29 Jan 2009 16:39:56 +0000 (16:39 +0000)]
xend: Fix block device type check
Since changeset 17617 the block device protocols are checked to be
either file or phy. This has later been fixed to also include
tap. This is still not a correct check as there can be arbitrary
additional protocols. Before this check was added you could have a
block-xyz hotplug script and xyz would work as a protocol, now it is
refused. An example for this mechanism is the block-nbd script which
is included in the tree.
This patch changes the check to allow file, phy, tap and all protocol
names for which a block-$protocol hotplug script exists. This should
fix the last regressions introduced by the check.
Keir Fraser [Thu, 29 Jan 2009 11:35:19 +0000 (11:35 +0000)]
tboot: ACPI Generic Address Structure for tboot shutdown
New versions of tboot support ACPI GAS (Generic Address Structure) for
handling sleep states. This required a change to the tboot_shared_t
data structure that is not backwards compatible. This patch requires
that new version makes use of GAS when invoking tboot on shutdown.
Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>