Commit Graph
20206 Commits
Author SHA1 Message Date
Keir Fraser fbc4f2e894 xend: Fix VDI.get_record
We cannot get correct records of VDI by VDI.get_record.
The correct records of VDI are gotten by this patch.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-09-15 09:26:08 +01:00
Keir Fraser 7451edbf39 x86 mce: Fix panic in mcheck_mca_logout
I met the following panic message in mcheck_mca_logout().
MSR_IA32_MCi_ADDR might take the values other than the machine
address. FATAL PAGE FAULT occured when the non-existent address is
passed to maddr_get_owner().

Signed-off-by: Kazuhiro Suzuki <kaz@jp.fujitsu.com>
2009-09-15 09:25:41 +01:00
Keir Fraser 4e8febe0b8 Vt-d: queued invalidation cleanup
This patch cleans up queued invalidation, including round wrap
check, multiple polling status and other minor changes. This version
uses local variable as the polling address, which is clean.

Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
2009-09-15 09:24:59 +01:00
Keir Fraser 3217c5cc9c x86: Remove PSE flag from PV guest CR4 and CPUID.
From: Dave McCracken <dcm@mccr.org>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-15 09:23:44 +01:00
Keir Fraser ada90ce49f pygrub: Correct pygrub return value
This is the patch to correct pygrub return value for checkPassword()
function. It didn't return False at the end of the function. It
returned None so it was working fine and it's most likely just a
cosmetic issue.

Also, the missing () were added to checkPassword() function when
calling hasPassword and the unnecessary comment was removed.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
2009-09-15 09:21:34 +01:00
Keir Fraser 278db12c2b xend: Receive error message of migration from destination server
The following error message was shown by xm migrate command.
In fact, I caused the command error by intention.  I prepared a
destination server where free memory was insufficient, and then
I tried to migrate a VM to the destination server.  As I had
expected, the command error occurred.  However the error message
was different from my expectation.  I would like to show an error
message from the destination server if an error occurred on the
destination server.

# xm migrate --live vm3 bx339
Error: (107, 'Transport endpoint is not connected')
Usage: xm migrate <Domain> <Host>

Migrate a domain to another machine.

Options:

-h, --help           Print this help.
-l, --live           Use live migration.
-p=3Dportnum, --port=3Dportnum
                     Use specified port for migration.
-n=3Dnodenum, --node=3Dnodenum
                     Use specified NUMA node on target.
-s, --ssl            Use ssl connection for migration.


If a destination server sends an error message, this patch shows=20
the error message.  For example, the following error message is=20
shown if free memory of the destination server is insufficient.

# xm migrate --live vm3 bx339
Error: I need 262144 KiB, but dom0_min_mem is 716800 and shrinking
to=20
716800 KiB would leave only 50368 KiB free. (from bx339)
Usage: xm migrate <Domain> <Host>

Migrate a domain to another machine.

Options:

-h, --help           Print this help.
-l, --live           Use live migration.
-p=3Dportnum, --port=3Dportnum
                     Use specified port for migration.
-n=3Dnodenum, --node=3Dnodenum
                     Use specified NUMA node on target.
-s, --ssl            Use ssl connection for migration.


Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-09-15 09:20:47 +01:00
Keir Fraser 05a75fd45b Replace magic number for NULL (~0) with PAGE_LIST_NULL
...in the page_list_* functions.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-09-15 09:19:23 +01:00
Keir Fraser d3dbf99bb2 blktap2: Fix off-by-one error in driver lookup
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-15 09:16:52 +01:00
Keir Fraser fd17f9b66d PoD: Implement PoD for EPT
This patch implements the populate-on-demand functionality for EPT.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-09-15 09:16:19 +01:00
Keir Fraser 88a7064b74 p2m: Reorganize p2m_pod_demand_populate in preparation for EPT PoD patch
p2m_pod_demand_populate is too non-EPT-p2m-centric.  Reorganize code
to have a p2m-specific call that wraps a generic PoD call.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-09-15 09:15:14 +01:00
Keir Fraser 07a5a802d3 EPT: Clean up some code
Clean up and reorganize some code in preparation for adding
populate-on-demand functionality.

Should be no functional difference.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-09-15 09:14:36 +01:00
Keir Fraser 877d625b29 PoD: Check p2m assumption in debug builds
The PoD code assumes that if:
* A page is in a domain's p2m table
* And it's owned by the domain
* And it's not a xenheap page
then:
* It's on the domain's page list.

This patch adds a check for this assumption when debug=y.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-09-15 09:13:38 +01:00
Keir Fraser cc6b589060 PoD: Fix debug build.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-15 09:13:01 +01:00
Keir Fraser 3fc5b3282f PoD: Don't reclaim xenheap pages in zero-sweep
Don't reclaim xenheap-allocated pages in the zero-sweep.  This avoids
grabbing things like grant tables mapped in the p2m.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-09-15 09:09:18 +01:00
Keir Fraser 9650bb1b94 PoD: Scrub pages before adding to the cache
Neither memory from the allocator nor memory from
the balloon driver is guaranteed to be zero.  Scrub it
before adding to the cache.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-09-15 09:08:36 +01:00
Keir Fraser c331a144c0 passthrough: remove pointless error checks
map_domain_page() cannot return NULL. And if it could, both instances
changed here would leak memory in such a case.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-09-15 09:06:46 +01:00
Keir Fraser daf7926d53 x86: add an extra check when validating a huge pv L2 entry
While get_page_and_type_from_pagenr() (through get_page_from_pagenr())
does the needed mfn_valid() check, get_data_page() doesn't and, it
being passed a struct page_info pointer, really expects it's caller(s)
to do.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-09 16:39:41 +01:00
Keir Fraser e94d4918b5 Fix an obviously inverted check in offline_page()
Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-09-09 16:32:25 +01:00
Keir Fraser d51e292331 Fix typo in c/s 20158:f9ce5858.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-09 15:34:37 +01:00
Keir Fraser 463d75af78 xm,xend: Make cpus parameter available
When I started a VM by using xm create command, cpus parameter in VM
configuration files was ignored.  The problem occurred only when I
used XenAPI. This patch makes the parameter available.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-09-09 15:33:30 +01:00
Keir Fraser 7c211e2350 mount /proc/xen in init.d/xen
pvops dom0 kernels have a separate xenfs which has to be mounted on
/proc/xen.  Systems with older configurations don't have xenfs listed
in fstab, and it can sometimes make sense to keep it that way (for
example, if the dom0 wants to boot a native-only kernel too).

The attached patch to the script which ends up in /etc/init.t/xend
mounts /proc/xen if it appears to be necessary.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2009-09-09 15:32:30 +01:00
Keir Fraser a0eb214b31 x86: Fix typo in p2m_pod_set_cache_target
Fix typo in p2m_pod_set_cache_target by defining (1<<9) as
SUPERPAGE_PAGES

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-09-08 15:11:52 +01:00
Keir Fraser a447e3e88b Update QEMU_TAG to 2836e73adcd994de071f4eec1aa538a5ca849118 2009-09-08 15:11:18 +01:00
Keir Fraser 23c3a595fe xend: Fix syntax error
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-09-08 15:10:59 +01:00
Keir Fraser 83904107a3 VT-d: prevent dom0 to use VT-d HW
pv-ops dom0 contains Linux upstream VT-d driver, and will go to enable
it when VT-d is set in kernel config file. It should not enable VT-d
in dom0.

Currently it already zaps ACPI DMAR signature to prevents dom0 using
VT-d HW when VT-d is enabled for Xen. But when VT-d is not enabled for
Xen, and VT-d is set in pv-ops kernel config file, pv-ops dom0 will go
to enable it. This will results in pv-ops dom0 booting failure. This
patch prevents dom0 to use VT-d HW whether VT-d is enabled or disabled
for Xen.

Signed-off-by: Weidong Han <weidong.han@intel.com>
2009-09-08 15:10:31 +01:00
Keir Fraser 7c49bea080 Fix etags invocation
Don't fail in the case where 'etags' isn't Exuberant Ctags

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2009-09-07 14:26:06 +01:00
Keir Fraser f703973da4 xend: passthrough: add an option pci-passthrough-strict-check
Currently when assigning device to HVM guest, we use the strict check
for HVM guest by default.(For PV guest we use loose check
automatically if necessary.)

When we assign device to HVM guest, if we meet with the co-assignment
issues or the ACS issue (see changeset 20081: 4a517458406f), we could
try changing the option to 'no' -- however, we have to realize this
may incur security issue and we can't make sure the device assignment
could really work properly even after we do this.

The option is located in /etc/xen/xend-config.sxp:
(pci-passthrough-strict-check yes)

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-09-07 13:52:48 +01:00
Keir Fraser 8b4225a532 vt-d: don't treat IOAPIC RTE of dest_SMI type specially.
We also need to create IRTE for it since we enable EIM and clear CFI,
or else, the IOAPIC RTE's interrupt message would be blocked by IR unit.

In io_apic_read_remap_rte(), we now use
"apic_pin_2_ir_idx[apic][ioapic_pin]"
rather than "(remap_rte->index_15 << 15) | remap_rte->index_0_14" to
avoid the "interrupt remapping table out of bound error".

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-09-07 13:52:17 +01:00
Keir Fraser 71a311b28e vt-d: some small fixes to apic_pin_2_ir_idx
1) apic_pin_2_ir_idx should be int** rahter than unsigned int**,
because we use the int -1 to indicate that the related IRTE index is
not allocated.
2) shouldn't re-init apic_pin_2_ir_idx when resuming from S3.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-09-07 13:51:55 +01:00
Keir Fraser 611d7859a0 x86: Some cleanups for apic_write, apic_read, apic_wrmsr, apic_rdmsr
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-09-07 13:51:37 +01:00
Keir Fraser 2e0626fb1c vt-d: replace the gdprintk with dprintk since it isn't in guest context.
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-09-07 13:51:19 +01:00
Keir Fraser fdb26f82e7 pygrub: trap exception when python module import fails
Fix the issue when importing 'crypt' module or crypt.crypt fails in
pygrub. The exception is written on the same line like "Failed!"
message but only if there is an exception. If there is no exception,
we don't bother users with details (probably the password they entered
was wrong) so we just display "Failed!" message. Also, the code for
hasPassword() was rewritten not to have try/except block here.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
2009-09-07 13:50:55 +01:00
Keir Fraser 4fe3160cbc vt-d: avoid obtaining iommu->register_lock too early in
dma_msi_set_affinity()

If set_desc_affinity() fails, the current code doesn't release the
spinlock. We should obtain the lock at a later place.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-09-07 13:49:35 +01:00
Keir Fraser ad46d7a628 xend: Enable to set config variables in /etc/sysconfig/xend
The attached patch enables to set the environment variables for xend
in /etc/sysconfig/xend.

There are four variables.

XENCONSOLED_TRACE=3D[none|guest|hv|all]
XENSTORED_ROOTDIR=3D/var/lib/xenstored
XENSTORED_TRACE=3D[yes|on|1]
XENBACKENDD_DEBUG=3D[yes|on|1]

The XENCONSOLED_TRACE and XENSTORED_ROOTDIR take strings for each
command's options. And if thease variables have non-zero strings, then
export them.
If the XENSTORED_TRACE and XENBACKENDD_DEBUG take either "yes", "on"
or "1" then export them.

From: Kazuhiro SUZUKI <kaz@jp.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-07 09:00:21 +01:00
Keir Fraser a358be0b0f xend: Revert c/s 17536 which breaks PV passthru of MSI-X devices.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-07 08:48:12 +01:00
Keir Fraser b8fae2f777 Add the support of x2apic logical cluster mode.
Add a xen boolean parameter 'x2apic'.
Add a xen boolean parameter 'x2apic_phys'(by default, we use logical
cluster mode).

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-09-07 08:46:46 +01:00
Keir Fraser 5c53154b61 vt-d: use 32-bit Destination ID when Interrupt Remapping with EIM is
enabled

When x2APIC and Interrupt Remapping(IR) with EIM are enabled, we
should use 32-bit Destination ID for IOAPIC and MSI.

We implemented the IR support in xen by hooking the functions like
io_apic_write(),io_apic_modify(), write_msi_message(), and as a
result, in the hook functions in intremap.c, we can only see the 8-bit
dest id rather the 32-bit id, so we can't set IR table Entry that
requires a 32-bit dest id.

To solve the issue throughly, we need find every place in io_apic.c
and msi.c that could write ioapic RTE and and device's msi message and
explicitly handle the 32-bit dest id carefully (namely, when genapic
is x2apic, cpu_mask_to_apic could return a 32-bit value); and we have
to change the iommu_ops->{.update_ire_from_apic, .update_ire_from_msi}
interfaces. We may have to write an over-1000-LOC patch for this.

Instead, we could use a workround:
1) for ioapic, in the struct IO_APIC_route_entry, we could use a new
"dest32" to refer to the dest field;
2) for msi, in the struct msi_msg, we could add a new "u32 dest".
And in intremap.c, if x2apic_enabled, we use the new names to refer to
the dest fields.

We can improve this in future.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-09-07 08:46:03 +01:00
Keir Fraser cda2f6c761 vt-d: enhance the support of Interrupt Remapping EIM and x2APIC
1) Clear Interrupt Remapping(IR) unit's CFI (Compatibility Format
Interrupt) to enhance security;
2) Move the iommu_setup() ahead and put it before we begin to use
IOAPIC so we can make sure after we enable Interrupt Remapping, the
later IOAPIC (and MSI) initialization would setup IOAPIC RTEs (and
MSI) with remappable format;
3) Enable x2APIC only when all VT-d engines support IR with EIM
(Extended Interrupt Mode). EIM enables external devices to deliver
interrupts to logical processor with >8-bit APIC ID.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-09-07 08:44:50 +01:00
Keir Fraser 1589882b8b x86/mmcfg: misc adjustments
- fix the mapping range (end_bus_number is inclusive)
- fix the mapping base address (shifting segment by 22 was set for
  overlapping mappings; assuming the goal was to reduce the virtual
  space used when less than 256 busses are present on all segments,
  adding logic to determine the smallest possible shift value)
- fix PCI_MCFG_VIRT_END, and actually use it to avoid creating
- mappings
  outside the designated range
- fix address calculations (segment numbers must be converted to long
  to avoid truncation)
- add a way (command line option) to suppress the use of mmconfig as
  well as to actually use the AMD Fam10 special code
- correct __init annotations
- use xmalloc()/xmalloc_array() in favor of xmalloc_bytes()
- eliminate dead code and data

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-09-07 08:44:00 +01:00
Keir Fraser 8a4bbcadab amd iommu: Remove a useless flag and fix I/O page fault for hvm
passthru devices.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
2009-09-07 08:43:14 +01:00
Keir Fraser 22398f88b7 amd iommu: Cleanup initialization functions and fix a fatal page fault
caused by out-of-bounds access to irq_to_iommu array.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
2009-09-07 08:42:50 +01:00
Keir Fraser afd639fcfe x86-64/mmcfg: add explicit support for nVidia MCP55
This is a simple port from Linux 2.6.31-rc8.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-09-07 08:41:45 +01:00
Keir Fraser 494adf9a5b x86: convert frame_table to a #define
Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-09-07 08:41:00 +01:00
Keir Fraser e1c60c7545 Tidy evtchn keyhandler a little
Get rid of all the -1s and label the pending and masked columns.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2009-09-07 08:40:33 +01:00
Keir Fraser 345fbe6cb4 xend: passthrough: fix physdev_map_pirq invocation
For those devices not having INTx (like VFs), avoid calling map_pirq,
otherwise the guest cannot be started successfully.

Also avoid calling this hypercall for hvm guest, this is done in the
device model.

Signed-off-by: Qing He <qing.he@intel.com>
2009-09-07 08:38:39 +01:00
Keir Fraser 0c98ffd10a Fix some issues for HVM log dirty:
* Add necessary logging dirty in qemu to avoid guest error with
intensive disk access when live migration
* Take place of shared memory between qemu and migration tools by new
added hypercall, which is clean and simple

Signed-Off-By: Zhai, Edwin <edwin.zhai@intel.com>
2009-09-07 08:37:58 +01:00
Keir Fraser 3f394a6b33 x86: Fix PoD cache size when decreasing memory
Certain paths through p2m_pod_decrease_reservation() fail to reduce
the size of the PoD cache if the number of outstanding entries is less
than the size of the cache.  Rearrange so this doesn't happen.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-09-04 08:43:05 +01:00
Keir Fraser e4e14402c1 xend: Support "bootloader" mode for "drbd:" devices
To be able to use "bootloader" on drbd devices the following changes
need to be made:

*) Translation of devicename

_parse_uname which is used by blkdev_uname_to_file which is again used
by _configureBootloader in XendDomainInfo needs to be able to resolve
drbd resources to the corresponding blockdevice to feed to the
configured bootloader.

*) Activation of drbd device

If the drbd device isn't in Primary mode when the bootloader tries to
fetch the kernel and initrd, the start of the DomU will fail. To
prevent this the given drbd device will be made Primary before the
bootloader gets executed.

A note on the naming of drbd resouces: drbd uses mostly resource names
in it's userland tools. Because of that drbd VBDs, if configured with
the "drbd:" type, should always use the drbd resource name as
suggested by the drbd documentation at
http://www.drbd.org/users-guide-emb/s-xen-configure-domu.html. My
patches assume that the VBDs are named accordingly.

Signed-off-by: Michael Renner <michael.renner@geizhals.at>
2009-09-04 08:42:10 +01:00
Keir Fraser 35c865110a xend: fix domain_migrate
When the guest(pv-on-hvm guest that cannot suspend) reboot in
LiveMigration, the disconnecting of src-side is not transmitted to
dist-side. As a result, the error processing on the dist side is not
executed.

Signed-off-by: Tomonari Horikoshi <t.horikoshi@jp.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-04 08:34:45 +01:00
Keir Fraser 4bda558243 vt-d: fix Dom0 S3 resume.
When resuming from Dom0 S3, here 'irq' is -1, so we can't use it at
all. We should always use iommu->irq.

With the patch applied on the current tip 20153 and using the 2.6.18
Dom0, Dom0 S3 works fine (at least on my DQ35).

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-09-03 09:51:37 +01:00