Keir Fraser [Thu, 21 Jan 2010 09:12:01 +0000 (09:12 +0000)]
VT-d: improve RMRR validity checking
Currently, Xen checks RMRR range and disables VT-d if RMRR range is
set incorrectly in BIOS rigorously. But, actually we can ignore the
RMRR if the device under its scope are not pci discoverable, because
the RMRR won't be used by non-existed or disabled devices.
This patch ignores the RMRR if the device under its scope are not pci
discoverable, and only checks the validity of RMRRs that are actually
used. In order to avoid duplicate pci device detection code, this
patch defines a function pci_device_detect for it.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Keir Fraser [Thu, 21 Jan 2010 09:11:06 +0000 (09:11 +0000)]
VT-d: handle return value of deassign_device
deassign_device may fail, so need to capture its failure for
appropriate handling. This patch captures return values of
deassign_device, and prints error messages if it fails.
In addition, this patch also fixes some code style issues.
Signed-off-by: Weidong Han <Weidong.han@intel.com>
Keir Fraser [Thu, 21 Jan 2010 09:03:20 +0000 (09:03 +0000)]
libxc: Unbreak HVM live migration after 0b138a019292.
0b138a019292 was a little too ambitious replacing xc_map_foreign_batch
with xc_map_foreign_pages in xc_domain_restore. With HVM, some of the
mappings are expected to fail (as "XTAB" pages).
Keir Fraser [Thu, 21 Jan 2010 09:03:00 +0000 (09:03 +0000)]
xend: Unbreak live migration with tapdisk2 after 20691:054042ba73b6
vm.image does not exist at this point in the restore process.
I haven't looked at the memory_sharing code. It's likely something
better is needed to make that work across relocation.
Keir Fraser [Wed, 20 Jan 2010 20:33:35 +0000 (20:33 +0000)]
xentrace: Per-cpu xentrace buffers
In the current xentrace configuration, xentrace buffers are all
allocated in a single contiguous chunk, and then divided among logical
cpus, one buffer per cpu. The size of an allocatable chunk is fairly
limited, in my experience about 128 pages (512KiB). As the number of
logical cores increase, this means a much smaller maximum per-cpu
trace buffer per cpu; on my dual-socket quad-core nehalem box with
hyperthreading (16 logical cpus), that comes to 8 pages per logical
cpu.
This patch addresses this issue by allocating per-cpu buffers
separately.
Keir Fraser [Tue, 19 Jan 2010 15:44:54 +0000 (15:44 +0000)]
Enable IOMMU by default.
Can be disabled with 'iommu=0' boot parameter.
Note that iommu_inclusive_mapping is now also enabled by default, to
deal with systems with broken BIOS tables specifying bad RMRRs. Old
behaviour can be specified via 'iommu_inclusive_mapping=0'.
Keir Fraser [Tue, 19 Jan 2010 10:56:59 +0000 (10:56 +0000)]
x86: Clean up TSC_RELIABLE handling after 20705:a74aca4b9386
Set the feature by default and disable it if we can detect TSC warp,
rather than leaving the feature cleared and setting it if we happen
not to detect TSC warp.
This way round fixes dom0 kernel boot for Masaki Kanno.
Keir Fraser [Mon, 18 Jan 2010 10:35:36 +0000 (10:35 +0000)]
x86 hvm: Pre-allocate per-cpu HVM memory before bringing CPUs online
after boot. Avoids doing the allocations on the CPU itself, while in a
not-fully-online state and with irqs disabled. This way we avoid
assertions about irqs being disabled in e.g., tlb flush logic.
Keir Fraser [Sun, 17 Jan 2010 18:07:10 +0000 (18:07 +0000)]
Change default cpufreq governor to ondemand
Back in c/s 18950 the default cpufreq governor was set to userspace
(it had previously been performance). However, since there is no
supplied userspace program or script that will change the frequency
this is at best a no-op. Worse, on some hardware with some BIOS
revisions, this actually sets the CPUs running at their lowest
frequency rather than their highest and there is a corresponding (and
initially puzzling) drop in performance.
This patch changes the default governor to "ondemand" which should
make it the same as the Linux default and will provide power savings
for the majority without needing to write a userspace governor. For
those that want to install their own governor, that is still possible.
Keir Fraser [Sun, 17 Jan 2010 18:05:03 +0000 (18:05 +0000)]
libxenlight: separate logically list_vm and list_domain
previously list_domain was something between listing VM and domains.
provide 2 separates API calls to list domains and list vms. the list
vms API filters utility domains like stubdomains, and domain 0
change is_stubdom to properly check the integer and also return a
boolean value.
Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
Keir Fraser [Sun, 17 Jan 2010 18:01:08 +0000 (18:01 +0000)]
xend: NUMA: fix division by zero on unpopulated nodes
nodes without memory will currently be disabled by also moving the
physical cores connected to them to other nodes. This leads to nodes
without CPUs and thus to a division by zero in the node allocation
algorithm. Attached patch fixes this by checking for 0 before the
division. This fixes domain creation on boxes with memory-less nodes.
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Keir Fraser [Thu, 14 Jan 2010 09:44:08 +0000 (09:44 +0000)]
xend, NUMA: Fix computation of needed nodes
Enumerate the best nodes and add CPU affinity until all VCPUs can be
backed by at least one physical core. This should fix problems with
asymmetric NUMA configurations and cropped number of CPUs in Xen.
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Keir Fraser [Wed, 13 Jan 2010 08:18:38 +0000 (08:18 +0000)]
x86: fix unmaskable msi assignment issue.
Currently, unmasked msi irq's EOI write is deferred untile guest
writes EOI, so needs to keep eoi_vector unchanged before guest writes
EOI. However, irq migration breaks the assumption and changs
eoi_vector when interrupts are generated through new vector.
The patch removes the dependency for eoi_vector and directly recoreds
the irq info in the EOI stack, and when guest writes EOI, just do the
physical EOI for the specific irq(recorded in EOI stack)on the cpus
according to the cpu_eoi_map.
Keir Fraser [Wed, 13 Jan 2010 08:14:01 +0000 (08:14 +0000)]
x86: add and use XEN_DOMCTL_getpageframeinfo3
To support wider than 28-bit MFNs, add XEN_DOMCTL_getpageframeinfo3
(with the type replacing the passed in MFN rather than getting or-ed
into it) to properly back xc_get_pfn_type_batch().
With xc_get_pfn_type_batch() only used internally to libxc, move its
prototype from xenctrl.h to xc_private.h.
This also fixes a couple of bugs in pre-existing code:
- the failure path for init_mem_info() leaked minfo->pfn_type,
- one error path of the XEN_DOMCTL_getpageframeinfo2 handler used
put_domain() where rcu_unlock_domain() was meant, and
- the XEN_DOMCTL_getpageframeinfo2 handler could call
xsm_getpageframeinfo() with an invalid struct page_info pointer.
Keir Fraser [Wed, 13 Jan 2010 08:12:56 +0000 (08:12 +0000)]
libxc: use new (replacement) mmap-batch ioctl
Replace all calls to xc_map_foreign_batch() where the caller doesn't
look at the passed in array to check for errors by calls to
xc_map_foreign_pages(). Replace all remaining calls by such to the
newly introduced xc_map_foreign_bulk().
As a sideband modification (needed while writing the patch to ensure
they're unused) eliminate unused parameters to
uncanonicalize_pagetable() and xc_map_foreign_batch_single(). Also
unmap live_p2m_frame_list earlier in map_and_save_p2m_table(),
reducing the peak amount of virtual address space required.
All supported OSes other than Linux continue to use the old ioctl for
the time being.
Also change libxc's MAJOR to 4.0 to reflect the API change.
Keir Fraser [Tue, 12 Jan 2010 07:02:29 +0000 (07:02 +0000)]
libxenlight: tests a lots more of xl return value inside the library
and in xl.
introducing a domain where the xenguest build function has fail, lead
to having xenstored receiving SIGBUS, since it's trying to access some
of the domain's memory, which haven't been properly allocated. (it
doesn't seems to be a way to make xenstored more robust to this though
since xc_map_foreign_range just succeed).
make xl a lot more robust regarding all those random errors possible.
Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
Keir Fraser [Tue, 12 Jan 2010 07:01:21 +0000 (07:01 +0000)]
blktap: make memshr optional
Attached patch makes memshr optional for blktap/blktap2.
This fixes build for platforms where memshr isn't build on.
While there, make indentation consistent.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Keir Fraser [Fri, 8 Jan 2010 11:39:06 +0000 (11:39 +0000)]
xend: fix options for assigned pci
pci global options and per-device options for HVM device model have
been broken for some time, the patch tries to fix the problem. It:
* maintains global options in xend, and merge it into
per-device option when creating the backend
* merge the global options also into the parameter of pci-ins
dm-command
The second one is there because the backend is effectively skipped
in ioemu at present, ioemu solely relies on the parameter string to
create the device.
Cc: Simon Horman <horms@verge.net.au> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Qing He <qing.he@intel.com>
Keir Fraser [Fri, 8 Jan 2010 11:25:22 +0000 (11:25 +0000)]
tmem: Reduce verbosity on failed memory allocations.
Reduce tmem complaints per Jan's concerns in this thread
http://lists.xensource.com/archives/html/xen-devel/2010-01/msg00155.html
Now complains only if tmem HAS memory to relinquish and
memory request has order>0.
Signed-off by: Dan Magenheimer <dan.magenheimer@oracle.com>
Comined with the static size of the memnodemap[] array, NUMA got
therefore disabled on such systems. The backport from Linux was really
incomplete, as Linux much earlier had already introduced a dynamcially
allocated memnodemap[].
Further, doing to/from pdx translations on addresses just past a valid
range is not correct, as it may strip/fail to insert non-zero bits in
this case.
Finally, using 63 as the cover-it-all shift value is invalid on 32bit,
since pdx values are unsigned long.
Keir Fraser [Wed, 6 Jan 2010 12:45:23 +0000 (12:45 +0000)]
Handle PoD case in hvm_hap_nested_page_fault()
The new combined nested page fault handling doesn't consider the case
where the gfn_to_mfn() translation caused the page to be transparently
populated.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Wed, 6 Jan 2010 08:25:07 +0000 (08:25 +0000)]
libxl: apply CPUID policy for all types of VMs in all situations
Apply CPUID policy to all types of VMs in all situations. Otherwise PV
VMs get no cpuid flags. It would be interesting if someone tested
libxl on PV before pushing dozens of patches.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.com>
Keir Fraser [Wed, 6 Jan 2010 08:18:04 +0000 (08:18 +0000)]
tmem: Only enable by default for x86_64
While tmem has gotten limited testing with a 32-bit Xen, it
has severe limitations due to 32-bit heap restrictions.
So, turn it off by default for 32-bit so nobody accidentally
runs into this.
Signed-off by: Dan Magenheimer <dan.magenheimer@oracle.com>
Keir Fraser [Wed, 6 Jan 2010 08:17:20 +0000 (08:17 +0000)]
xend: passthrough: also do_FLR when a device is assigned.
To workaround a race condition about guest hotplug, c/s
18338:7c10be016e4 disabled do_FLR when we create guest or 'xm
pci-attach' device into guest, so now we actually only do_FLR when a
guest is destroyed or 'xm pci-detach'.
By moving the FLR-related checking/do_FLR logic a little earlier, this
patch re-enables do_FLR in these 2 cases disabled by 18338.
Keir Fraser [Tue, 5 Jan 2010 08:39:40 +0000 (08:39 +0000)]
libxenlight: remove any uuid dependancies from xl
uuid handles in create and now create_device_model need to fill the
uuid field by client. the uuid field happens to be the exact same size
as the standard uuid (sixteen 8 bits values).
stubdom need to have a uuid when created, so using the one in
create_device_model.
this permits the client library to generate the uuid in any way it see
fits (even if it's not compliant to any standard), and simplify
installation of the libxenlight header.
xl converted from libuuid generated uuid to generated through random()
C call. need to be fixed if anyone plan to use xl for anything
seriously apart from developing libxl.
Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
Keir Fraser [Tue, 5 Jan 2010 08:38:23 +0000 (08:38 +0000)]
numa: Correct handling node with CPU populated but no memory populated
In changeset 20599, the node that has no memory populated is marked
parsed, but not online. However, if there are CPU populated in this
node, the corresponding CPU mapping (i.e. the cpu_to_node) is still
setup to the offline node, this will cause trouble for memory
allocation.
This patch changes the init_cpu_to_node() and srant_detect_node(), to
considering the node is offlined situation.
Now the apicid_to_node is only used to keep the mapping between
cpu/node provided by BIOS, and should not be used for memory
allocation anymore.
One thing left is to update the cpu_to_node mapping after memory
populated by memory hot-add.
Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
This is a reintroduction of 20726:ddb8c5e798f9, which I incorrectly
reverted in 20745:d3215a968db9
Keir Fraser [Mon, 4 Jan 2010 09:07:28 +0000 (09:07 +0000)]
VT-d: fix iommu_domid for PCI/PCIx devices assignment
Currently, it clears iommu_domid and domid_map at the end of
domain_context_unmap_one() if no other devices under the same iommu
owned by this domain. But, when assign a PCI/PCIx device to a guest,
it also assigns its upstream bridge to the guest, and they use the
same iommu_domid. In the deassignment, the iommu_domid and domid_map
are cleared in domain_context_unmap_one() for the assigned PCI/PCIx
device, therefore it cannot get valid iommu_domid in followed
domain_context_unmap_one for its upstream bridge. It causes PCI/PCIx
device re-assignment failure.
This patch moves the iommu_domid and domid_map clearing code to the
end of domain_context_unmap, where all dependent
domain_context_unmap_one()s are completed, thus fix above issue.
Signed-off-by: Weidong Han <Weidong.han@intel.com>
Keir Fraser [Mon, 4 Jan 2010 09:06:36 +0000 (09:06 +0000)]
VT-d: fix iommu_domain_destroy
Currently, g2m_ioport list and mapped_rmrrs always won't be released
in iommu_domain_destroy, because the function returns before those
code. It causes potential leak. This patch releases them, and thus
avoid the potential leak.
Signed-off-by: Weidong Han <Weidong.han@intel.com>
Keir Fraser [Mon, 4 Jan 2010 09:06:02 +0000 (09:06 +0000)]
VT-d: clean up dynamic page mapping
Before dynamic VT-d page table for hvm guest (changeset 20152),
need_iommu is only used for PV guest. And it maps pages into VT-d for
PV guest in get_page_type and grant table. Now need_iommu is used
both hvm and pv guests, this patch makes those code still only for PV
guest, because it needn't to map pages there for hvm domain.
Signed-off-by: Weidong Han <Weidong.han@intel.com>
Keir Fraser [Wed, 30 Dec 2009 12:47:09 +0000 (12:47 +0000)]
libxl: add a versioning number to ctx_init that permit to detect
incompatible client.
at the moment if the versioning of the library is not exactly the same
used in the client then the ctx_init return an ERROR_VERSION. however
the same mechanism can be use in the future to be able to support
older version and offer a compatibility layer.
Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
Keir Fraser [Wed, 30 Dec 2009 12:45:13 +0000 (12:45 +0000)]
libxl: remove API for dominfolist and list that returns xc_dominfo.
fixup xl and part of libxl that use those API, to use simpler, faster
and less wasteful API (doesn't need to get the info about all domains
when looking for one specific domain).
Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>