Keir Fraser [Tue, 9 Mar 2010 09:57:25 +0000 (09:57 +0000)]
hvm: correct time offset update in RTC write emulation
mktime takes a month in 1..12 form while tm->tm_mon contains 0..11 so
we need to add 1. Without this fix setting the month back or forward a
month inside the guest would lead to the wrong number of days being
added/subtracted.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Keir Fraser [Tue, 9 Mar 2010 09:54:39 +0000 (09:54 +0000)]
x86: Increase the default NR_CPUS to 128.
We have newer systems which have more than 64 CPUs, and users
often complain some cpus can't be waken up when play with Xen.
Certainly, MAX_PHYS_CPUS option also can support more CPUs, but
it is still inconvenient for them, so change the default value to
128.
Keir Fraser [Fri, 5 Mar 2010 14:40:19 +0000 (14:40 +0000)]
Fix Makefile targets that generate several files at once
In a few places in the tree the Makefiles have constructs like this:
one_file another_file:
$(COMMAND_WHICH_GENERATES_BOTH_AT_ONCE)
This is wrong, because make will run _two copies_ of the same command
at once. This generally causes races and hard-to-reproduce build
failures.
Notably, `make -j4' at the top level will build stubdom libxc twice
simultaneously!
In this patch we replace the occurrences of this construct with the
correct idiom:
one_file: another_file
another_file:
$(COMMAND_WHICH_GENERATES_BOTH_AT_ONCE)
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Wed, 3 Mar 2010 17:40:22 +0000 (17:40 +0000)]
Fix domain exit actions that contain hyphen
Domain exit actions that contain a hyphen (e.g. rename-restart) were
not being detected properly when xm is configured to use xenapi.
Domain config containing on_crash=3D"rename-restart" results in
xen53:~ # xm new /tmp/domU.config
Using config file "/tmp/domU.config".
Unexpected error: <type 'exceptions.TypeError'>
This patch fixes the raised exception and at the same time
handles the replacement of hyphen with underscore properly.
Keir Fraser [Wed, 3 Mar 2010 17:39:22 +0000 (17:39 +0000)]
Replace config file parser for "xl"
This provides a replacement config file parser for "xl" based on bison
and flex.
Benefits:
* proper error reporting with line numbers
* parser can understand nearly all "xm" configuration files directly
(doesn't understand Python code but should do everything else)
* parser also understands the ;-infested "xl" style files
* removes the dependency on libconfig
* better checking for certain kinds of mistakes
* eliminates the strange "massage file and try again" code
This is intended to support all config files currently supported by
"xl" and almost all files supported by "xm". (NB that whether a
feature works depends on the implementation of that feature in
xl/libxl of course.)
This patch also introduces a new library "libxlutil" which is mainly
for the benefit of "xl". Users of libxl do not need to use libxlutil,
but they can do so if they want to parse "xl" files without being
"xl".
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
Keir Fraser [Fri, 26 Feb 2010 17:09:50 +0000 (17:09 +0000)]
Revert 20954:b4041e7bbe1b "paging_domctl: Add missing breaks in switch stmt"
This fixed a fairly innocuous bug (OP_ENABLE/OP_OFF both don't work
properly) but unmasked a much nastier one (turning off shadow mode on
a PV guest crashes the hypervisor).
So, for now, we pick the less of two evils. We don't really much rely
on OP_ENABLE/OP_OFF anyway, as it happens.
Keir Fraser [Thu, 25 Feb 2010 20:56:43 +0000 (20:56 +0000)]
ACPI: workaround for S3 fail in two facs tables case
Some legacy BIOS which support ACPI2.0+ may expose two FACS tables via
both FADT->FIRMWARE_CTRL and FADT->X_FIRMWARE_CTRL, but only lookup S3
waking_vector in the first one.
Signed-off-by: Wei Gang <gang.wei@intel.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
This patch fixes the following error on ia64:
iommu.c: In function 'init_vtd_hw':
iommu.c:1831: error: 'nr_ioapics' undeclared (first use in this
function)
Keir Fraser [Wed, 24 Feb 2010 10:59:37 +0000 (10:59 +0000)]
vtd: interrupt remapping: be more defensive
1) A buggy BIOS may not report IOAPIC in DRHD. Currently we still try
to enable IR while the IOAPIC RTEs are still in non-remappable format
and the host would hang. The patch detects this case and will not try
to enable IR.
2) Currently HPET's MSI mode doesn't work if IR is enabled because we
have no code to allocate IRTE for it. Luckily this HW configuration is
rather rarely at present, we can just work it around by only using
HPET's IOAPIC mode for now.
Keir Fraser [Wed, 24 Feb 2010 10:47:34 +0000 (10:47 +0000)]
[IA64] Support preemption in multicall
After 19946:91407452cdb6, preemption in multicall may happen while HVM
domains are running. It cause hypervisor's panic on ia64.
This patch implements it in the same way to x86.
Keir Fraser [Wed, 24 Feb 2010 09:38:35 +0000 (09:38 +0000)]
xend: notify xenpv device model that console info is ready
Sometimes PV domain with vfb doesn't boot up. /sbin/kudzu is stuck.
After investigation, I've found that the evtchn for console is not
bound at all.
Normal sequence of evtchn initialization in qemu-dm for xenpv is:
1) watch xenstore backpath (/local/domain/0/backend/console/<domid>/0)
2) read console info (/local/domain/<domid>/console/{type, ring-ref,
port..=
})
3) bind the evtchn to the port.
But in some case, xend writes to the backpath before the console info
is prepared, and never write to the backpath again. So the qemu-dm
fails at 2) and never reach to 3).
When this happens, manually xenstore-write command on Domain-0
resumes the guest.
Keir Fraser [Mon, 22 Feb 2010 10:07:27 +0000 (10:07 +0000)]
Fix blktap2 test in xen-hotplug-cleanup
The blktap2 test in xen-hotplug-cleanup was not quite right, causing
orphaned /vm/<uuid>/device node in xenstore. Attempt to reattach the
device failed:
Keir Fraser [Mon, 22 Feb 2010 10:04:22 +0000 (10:04 +0000)]
hvmloader: fix vgatype detecting issue
When graphics card is assigned to a guest as a secondary VGA,
without gfx_passthru and emulated VGA is the primary VGA,
hvmloader misreads gfx_passthru is specified if VGA device is
found after the emulated VGA.
This patch fix this issue. If emulated VGA is found, hvmloader
preserves it and loads vgabios of the emulated VGA.
Keir Fraser [Wed, 17 Feb 2010 12:05:45 +0000 (12:05 +0000)]
Mask AMD CPUID masks in software before writing them to the MSRs
Mask AMD CPUID masks in software before writing them to the MSRs.
Setting bits in the CPUID mask MSR that are not set in the unmasked
CPUID response can cause those bits to be set in the masked response.
Avoid that by explicitly masking in software.
Keir Fraser [Wed, 17 Feb 2010 12:04:50 +0000 (12:04 +0000)]
x86/mcheck: do not blindly de-reference dom0 et al
Since machine checks and CMCIs can happen before Dom0 even gets
constructed, the handlers of these events have to avoid de-referencing
respective pointers without checking.
Keir Fraser [Tue, 16 Feb 2010 09:28:39 +0000 (09:28 +0000)]
hotplug: ignore xenstore-read error
The failure to read "backend/tap/<domid>/*" in the xenstore is a usual
case since the domain is gone after xenstore-ls command is executed.
The error should be ignored.
Keir Fraser [Tue, 16 Feb 2010 09:27:45 +0000 (09:27 +0000)]
cpuidle: do not enter deep C state if there is urgent VCPU
when VCPU is polling on event channel, it usually has urgent task
running, e.g. spin_lock, in this case, it is better for cpuidle driver
not to enter deep C state.
This patch fix the issue that SLES 11 SP1 domain0 hangs in the box of
large number of CPUs (>= 64 CPUs).
Signed-off-by: Yu Ke <ke.yu@intel.com> Signed-off-by: Tian Kevin <kevin.tian@intel.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Mon, 15 Feb 2010 08:14:21 +0000 (08:14 +0000)]
hvmloader: Fix an ACPI asl bug.
Fix an ACPI asl bug by explicitly convert PRS to buffer, otherwise PRS
would be parsed as integer if less than 32/64 bits (according to ACPI
1.0 or 2.0).
Keir Fraser [Mon, 15 Feb 2010 08:13:26 +0000 (08:13 +0000)]
Vcpu hotplug: Move ACPI processor from \_PR to \_SB
Move processor from \_PR to \_SB. ACPI processor can be defined
under \_PR or \_SB. However, recently os like linux 2.6.30/32 support
cpu hotplug better for \_SB processor object.
Keir Fraser [Fri, 12 Feb 2010 09:24:18 +0000 (09:24 +0000)]
x86_64: widen bit width usable for struct domain allocation
With it being a PDX (instead of a PFN) that gets stored when a 32-bit
quantity is needed, we should also account for the bits removed during
PFN-to-PDX conversion when doing the allocation.
Keir Fraser [Fri, 12 Feb 2010 09:23:10 +0000 (09:23 +0000)]
Remus: increase failover timeout from 500ms to 1s
500ms is aggressive enough to trigger split-brain under fairly
ordinary workloads, particularly for HVM. The long-term fix is to
integrate with a real HA monitor like linux HA.
Keir Fraser [Fri, 12 Feb 2010 09:21:57 +0000 (09:21 +0000)]
keyhandler: Do not serialise keyhandlers; increase scratch array size.
Although serialising keyhandlers is safer, and in particular
protects access to shared heyhandler_scratch[], in debug scenarios it
is probably better to 'have a go' when requested - and assume the user
knows what they are doing.
Meanwhile, increase scratch array size to 1024. That's enough for more
than a dozen lines of 80-column text, and should be plenty in any
practical situation.
Keir Fraser [Fri, 12 Feb 2010 09:16:10 +0000 (09:16 +0000)]
hvmloader: Fix parallel build of ACPI tables.
Make build.c dependency on ssdt_{pm,tpm}.h explicit, else they can be
built in the wrong order.
Also, improve naming of target DSDT structures, and specify -p option
to iasl so that all generated files for a given target have
target-unique names, hence build can proceed safely in parallel.
Keir Fraser [Thu, 11 Feb 2010 22:42:18 +0000 (22:42 +0000)]
hvmloader: Build a compatibility DSDT with only 15 processor objects.
Deploy this smaller DSDT where possible: this is required to boot
Windows 2000, which only supports up to 15 processors and will blue
screen if it sees more processor objects than that (even inactive
ones).
Keir Fraser [Thu, 11 Feb 2010 19:51:15 +0000 (19:51 +0000)]
VT-d: get rid of duplicated definition
free_pgtable_maddr was implemented the same for x86 and IA64, so it's
not necessary to define it separately for x86 and IA64. This patch
moves free_pgtable_maddr definition to iommu.c to avoid duplicated
definition.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Keir Fraser [Thu, 11 Feb 2010 19:48:58 +0000 (19:48 +0000)]
VT-d: ensure zapping ACPI DMAR signature in acpi_parse_dmar
VT-d is owned by Xen hypervisor. Xen zaps ACPI DMAR signature to
prevent dom0 to use VT-d. This patch changes the direct return when
DMAR width is zero, instead zaps ACPI DMAR signature before return.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Keir Fraser [Wed, 10 Feb 2010 09:20:56 +0000 (09:20 +0000)]
x86: move trampoline location
A partner of ours is reporting boot failures (Xen not even emitting a
single message) over iSCSI on new (UEFI based) systems. After
pointing at their BIOS initially I finally remembered to take a look
at the memory map a native kernel booted this way see - and voila, the
BIOS reports memory starting at 0x8d000 as reserved. Xen, however,
places about 12k of (trampoline) data at 0x8c000.
For now, move the trampolien down by 4kB to 0x88000. Later we may
choose the location dynamically based on E820 information, if this
proves to be an ongoing problem.
One thing this patch enforces in any case is a single point of
definition for the hard coded location, so that at least adjusting it
won't require more than a single line change in the future.
Keir Fraser [Wed, 10 Feb 2010 09:18:43 +0000 (09:18 +0000)]
Fix domain reference leaks
Besides two unlikely/rarely hit ones in x86 code, the main offender
was tmh_client_from_cli_id(), which didn't even have a counterpart
(albeit it had a comment correctly saying that it causes d->refcnt to
get incremented). Unfortunately(?) this required a bit of code
restructuring (as I needed to change the code anyway, I also fixed
a couple os missing bounds checks which would sooner or later be
reported as security vulnerabilities), so I would hope Dan could give
it his blessing before it gets applied.
Keir Fraser [Wed, 10 Feb 2010 09:18:11 +0000 (09:18 +0000)]
x86: MCE fixes
- fill_vmsr_data() leaked a domain reference; since the caller already
obtained one, there's no need to obtain another one here
- intel_UCR_handler() could call put_domain() with a NULL pointer
- mcheck_mca_logout() updated a local data structure that wasn't used
after the update