]> xenbits.xensource.com Git - xen.git/log
xen.git
15 years agoxend: Fix wait-for-stubdom loop to avoid possible infinite loop
Keir Fraser [Thu, 14 Jan 2010 10:14:17 +0000 (10:14 +0000)]
xend: Fix wait-for-stubdom loop to avoid possible infinite loop

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoLinux: Use losetup -f where available.
Keir Fraser [Thu, 14 Jan 2010 10:12:58 +0000 (10:12 +0000)]
Linux: Use losetup -f where available.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86: Fix xen_in_range() for fragmented percpu data area.
Keir Fraser [Thu, 14 Jan 2010 10:03:44 +0000 (10:03 +0000)]
x86: Fix xen_in_range() for fragmented percpu data area.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoxend, NUMA: Fix computation of needed nodes
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>
15 years agolibxenlight: fix name to domid conversion.
Keir Fraser [Thu, 14 Jan 2010 09:42:40 +0000 (09:42 +0000)]
libxenlight: fix name to domid conversion.

also simplify massively the function that iterate over all domains to
find the corresponding domid to a name.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxenlight: add error in disk_add if phystype is not recognized
Keir Fraser [Thu, 14 Jan 2010 09:42:06 +0000 (09:42 +0000)]
libxenlight: add error in disk_add if phystype is not recognized

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxenlight: add fuse around generic_device_add related to invalid kinds
Keir Fraser [Thu, 14 Jan 2010 09:41:34 +0000 (09:41 +0000)]
libxenlight: add fuse around generic_device_add related to invalid kinds

prevent segfault in case the backend or frontend kinds have
not been set to a correct kind value (or not initilized).

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxenlight: initialize enum to 1, to prevent defaulting to the 0
Keir Fraser [Thu, 14 Jan 2010 09:40:55 +0000 (09:40 +0000)]
libxenlight: initialize enum to 1, to prevent defaulting to the 0
values when structure when not properly initialized by the client.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxenlight: add some return values testing in stubdom
Keir Fraser [Thu, 14 Jan 2010 09:40:01 +0000 (09:40 +0000)]
libxenlight: add some return values testing in stubdom

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agox86 hvm: Change default setting of guest CPUID RDTSCP bit
Keir Fraser [Wed, 13 Jan 2010 08:33:34 +0000 (08:33 +0000)]
x86 hvm: Change default setting of guest CPUID RDTSCP bit

Expose RDTSCP CPUID to guest only when tsc_mode == TSC_MODE_DEFAULT
and host_tsc_is_safe() returns 1.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
15 years agox86: fix unmaskable msi assignment issue.
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.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
15 years agox86: minor cleanup to arch_memory_op()
Keir Fraser [Wed, 13 Jan 2010 08:17:00 +0000 (08:17 +0000)]
x86: minor cleanup to arch_memory_op()

There's a function-wide variable rc, so no need to re-declare it in
individual case handling blocks.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agoUpdate Xen version to 4.0.0-rc2-pre
Keir Fraser [Wed, 13 Jan 2010 08:16:37 +0000 (08:16 +0000)]
Update Xen version to 4.0.0-rc2-pre

15 years agox86: add and use XEN_DOMCTL_getpageframeinfo3
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.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agolibxc: use new (replacement) mmap-batch ioctl
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.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agoAdded tag 4.0.0-rc1 for changeset 67b5ad8ae87e
Keir Fraser [Tue, 12 Jan 2010 07:17:40 +0000 (07:17 +0000)]
Added tag 4.0.0-rc1 for changeset 67b5ad8ae87e

15 years agoUpdate Xen version for 4.0.0-rc1 4.0.0-rc1
Keir Fraser [Tue, 12 Jan 2010 07:11:28 +0000 (07:11 +0000)]
Update Xen version for 4.0.0-rc1

15 years agolibxenlight: remove ctx dangerously passed to children
Keir Fraser [Tue, 12 Jan 2010 07:06:12 +0000 (07:06 +0000)]
libxenlight: remove ctx dangerously passed to children

apart from ctx->waitpid, it's potentially harmful to call into
logging.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxenlight: remove ctx argument to exec
Keir Fraser [Tue, 12 Jan 2010 07:05:22 +0000 (07:05 +0000)]
libxenlight: remove ctx argument to exec

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxenlight: typo in old patch, lead to waitpid forever instead of
Keir Fraser [Tue, 12 Jan 2010 07:04:46 +0000 (07:04 +0000)]
libxenlight: typo in old patch, lead to waitpid forever instead of
waitpid with WNOHANG

fixes qemu starting problem

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxenlight: misc cleanup
Keir Fraser [Tue, 12 Jan 2010 07:03:54 +0000 (07:03 +0000)]
libxenlight: misc cleanup

wait_for_device_model expect two pointer as the end not 2 integers.
remove debugging message in libxl_list

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxenlight: do not try to set memory target with a number we haven't
Keir Fraser [Tue, 12 Jan 2010 07:03:14 +0000 (07:03 +0000)]
libxenlight: do not try to set memory target with a number we haven't
verified in set-mem.

checking that memory string conversion what done properly instead of
sending a request to balloon a domain to 0 memory.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxenlight: tests a lots more of xl return value inside the library
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>
15 years agoblktap: make memshr optional
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>
15 years agoxend, pciquirk: fix uninitialized variable
Keir Fraser [Tue, 12 Jan 2010 06:56:56 +0000 (06:56 +0000)]
xend, pciquirk: fix uninitialized variable

Fixes uninitialized variable when there's no
PERMISSIVE_CONFIG_FILE

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
15 years agotools: build fixes for NetBSD
Keir Fraser [Tue, 12 Jan 2010 06:55:24 +0000 (06:55 +0000)]
tools: build fixes for NetBSD

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
15 years agox86_32: Fix the build.
Keir Fraser [Sat, 9 Jan 2010 08:14:44 +0000 (08:14 +0000)]
x86_32: Fix the build.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agolibxenlight: initialize domid to -1 in domain_create
Keir Fraser [Fri, 8 Jan 2010 11:48:36 +0000 (11:48 +0000)]
libxenlight: initialize domid to -1 in domain_create

prevent call site that doesn't check return values to try to do
operation on domain 0.
instead they use domid -1, which is unlikely to exist.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxenlight: don't try to delete path when they doesn't exists.
Keir Fraser [Fri, 8 Jan 2010 11:48:02 +0000 (11:48 +0000)]
libxenlight: don't try to delete path when they doesn't exists.

fix segfault in destroy when creation hasn't been done properly.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxenlight: simplify the logic of domain_list to just return 1024 domains maximum
Keir Fraser [Fri, 8 Jan 2010 11:47:28 +0000 (11:47 +0000)]
libxenlight: simplify the logic of domain_list to just return 1024 domains maximum

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxenlight: remove all cloning logic.
Keir Fraser [Fri, 8 Jan 2010 11:46:52 +0000 (11:46 +0000)]
libxenlight: remove all cloning logic.

replace by simpler xl ctx init/free calls.
also don't segfault if there's no callback for log.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxenlight: don't use the cloning logic in dm_xenstore_record_pid.
Keir Fraser [Fri, 8 Jan 2010 11:46:17 +0000 (11:46 +0000)]
libxenlight: don't use the cloning logic in dm_xenstore_record_pid.

use call to lowlevel functions to do the same things.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxenlight: returns errors if xc and/or xs has not been initialized properly.
Keir Fraser [Fri, 8 Jan 2010 11:45:34 +0000 (11:45 +0000)]
libxenlight: returns errors if xc and/or xs has not been initialized properly.

fixed segfault when xenstore or xc are not available.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxenlight: don't free ifname, can lead to double free
Keir Fraser [Fri, 8 Jan 2010 11:44:58 +0000 (11:44 +0000)]
libxenlight: don't free ifname, can lead to double free

ifname is mostly handled directly in xl now, do not attempts to free
this.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxenlight: don't ignore ctx_init errors if there is one.
Keir Fraser [Fri, 8 Jan 2010 11:44:15 +0000 (11:44 +0000)]
libxenlight: don't ignore ctx_init errors if there is one.

ctx_init can return error, and ignoring the errors, would lead to
segfault later. fix all call sites to check return values.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agoVT-d: get rid of trailing whitespace
Keir Fraser [Fri, 8 Jan 2010 11:39:33 +0000 (11:39 +0000)]
VT-d: get rid of trailing whitespace

Signed-off-by: Weidong Han <weidong.han@intel.com>
15 years agoxend: fix options for assigned pci
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>
15 years ago[IA64] support XEN_DOMCTL_mem_sharing_op
Keir Fraser [Fri, 8 Jan 2010 11:37:44 +0000 (11:37 +0000)]
[IA64] support XEN_DOMCTL_mem_sharing_op

Because memory sharing is not implemented on ia64, only
XEN_DOMCTL_MEM_SHARING_OP_CONTROL is supported.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
15 years agoxend: Fix xc.physinfo() Py_BuildValue format string.
Keir Fraser [Fri, 8 Jan 2010 11:33:37 +0000 (11:33 +0000)]
xend: Fix xc.physinfo() Py_BuildValue format string.

Fix for 20762:a1d0a575b4ba

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
15 years agotmem: Reduce verbosity on failed memory allocations.
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>

15 years agoEPT: Walk and print EPT tables on an unexpected EPT violation
Keir Fraser [Fri, 8 Jan 2010 11:24:18 +0000 (11:24 +0000)]
EPT: Walk and print EPT tables on an unexpected EPT violation

Wrote this when I was tracking down the HAP-PoD problem, figured it
might come in handy sometime.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agox86: fix NUMA handling (c/s 20599:e5a757ce7845)
Keir Fraser [Fri, 8 Jan 2010 11:22:41 +0000 (11:22 +0000)]
x86: fix NUMA handling (c/s 20599:e5a757ce7845)

c/s 20599 caused the hash shift to become significantly smaller on
systems with an SRAT like this

(XEN) SRAT: Node 0 PXM 0 0-a0000
(XEN) SRAT: Node 0 PXM 0 100000-80000000
(XEN) SRAT: Node 1 PXM 1 80000000-d0000000
(XEN) SRAT: Node 1 PXM 1 100000000-130000000

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.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agoHandle PoD case in hvm_hap_nested_page_fault()
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>
15 years agosysctl: Return max_node_id rather than nr_nodes from physinfo command.
Keir Fraser [Wed, 6 Jan 2010 10:13:55 +0000 (10:13 +0000)]
sysctl: Return max_node_id rather than nr_nodes from physinfo command.

Python extension continues to synthesise a nr_nodes value.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86: XEN_DOMCTL_MEM_SHARING_OP_CONTROL should not depend on HAP.
Keir Fraser [Wed, 6 Jan 2010 09:39:01 +0000 (09:39 +0000)]
x86: XEN_DOMCTL_MEM_SHARING_OP_CONTROL should not depend on HAP.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agolibxl: apply CPUID policy for all types of VMs in all situations
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>
15 years ago[IA64] Fix ia64 build
Keir Fraser [Wed, 6 Jan 2010 08:20:11 +0000 (08:20 +0000)]
[IA64] Fix ia64 build

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
15 years agotmem: Only enable by default for x86_64
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>

15 years agoxend: passthrough: also do_FLR when a device is assigned.
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.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
15 years agolibxenlight: install libxl.h
Keir Fraser [Tue, 5 Jan 2010 08:40:18 +0000 (08:40 +0000)]
libxenlight: install libxl.h

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxenlight: remove any uuid dependancies from xl
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>
15 years agonuma: Correct handling node with CPU populated but no memory populated
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

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoxend: Pass -vcpu-avail option to QEMU now it is supported.
Keir Fraser [Tue, 5 Jan 2010 08:36:54 +0000 (08:36 +0000)]
xend: Pass -vcpu-avail option to QEMU now it is supported.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoUpdate QEMU_TAG to 2621a102cd74cd6691bed30f638581639fcb141d
Keir Fraser [Tue, 5 Jan 2010 08:35:31 +0000 (08:35 +0000)]
Update QEMU_TAG to 2621a102cd74cd6691bed30f638581639fcb141d

15 years agoRevert incorrect comment change introduced by 20720:ddb3646ad681
Keir Fraser [Tue, 5 Jan 2010 08:34:55 +0000 (08:34 +0000)]
Revert incorrect comment change introduced by 20720:ddb3646ad681

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agodomctl: Fix command-number clashes and place all #defines together to
Keir Fraser [Mon, 4 Jan 2010 10:35:16 +0000 (10:35 +0000)]
domctl: Fix command-number clashes and place all #defines together to
avoid the problem in future.

From: Juergen Gross <juergen.gross@ts.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoVT-d: fix iommu_domid for PCI/PCIx devices assignment
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>
15 years agoVT-d: fix iommu_domain_destroy
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>
15 years agoVT-d: clean up dynamic page mapping
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>
15 years agoxend: Allow disable QEMU monitor by settinbg option to 0 in config file.
Keir Fraser [Mon, 4 Jan 2010 09:04:53 +0000 (09:04 +0000)]
xend: Allow disable QEMU monitor by settinbg option to 0 in config file.

Signed-off-by: Daniel Kiper <dkiper@net-space.pl>
15 years agoRevert 20726:ddb8c5e798f9
Keir Fraser [Mon, 4 Jan 2010 09:03:42 +0000 (09:03 +0000)]
Revert 20726:ddb8c5e798f9

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
15 years agox86: In mmuext_op(), MMUEXT_[UN]PIN_* must respect 'foreigndom'...
Keir Fraser [Wed, 30 Dec 2009 13:10:03 +0000 (13:10 +0000)]
x86: In mmuext_op(), MMUEXT_[UN]PIN_* must respect 'foreigndom'...

... and *only* those subcommands respect 'foreigndom', according to
documentation in public header xen.h.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agohvmloader: mp table fix
Keir Fraser [Wed, 30 Dec 2009 12:49:10 +0000 (12:49 +0000)]
hvmloader: mp table fix

The bug causes noapic PAE Windows 2k3 boot failure.

Signed-off-by: Yang Xiaowei <xiaowei.yang@intel.com>
15 years agolibxl: add a versioning number to ctx_init that permit to detect
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>
15 years agolibxl: define errors as an enum instead of define random values.
Keir Fraser [Wed, 30 Dec 2009 12:46:16 +0000 (12:46 +0000)]
libxl: define errors as an enum instead of define random values.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxl: add a get_shutdown_reason
Keir Fraser [Wed, 30 Dec 2009 12:45:41 +0000 (12:45 +0000)]
libxl: add a get_shutdown_reason

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxl: remove API for dominfolist and list that returns xc_dominfo.
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>
15 years agolibxl: add useful xc flags in the xl_dominfo structure
Keir Fraser [Wed, 30 Dec 2009 12:44:37 +0000 (12:44 +0000)]
libxl: add useful xc flags in the xl_dominfo structure

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxl: remove waitpid wrapper that's doesn't do anything
Keir Fraser [Wed, 30 Dec 2009 12:43:57 +0000 (12:43 +0000)]
libxl: remove waitpid wrapper that's doesn't do anything

if the waitpid callback isn't defined just call normal waitpid

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxl: hide internal logging from client
Keir Fraser [Wed, 30 Dec 2009 12:43:19 +0000 (12:43 +0000)]
libxl: hide internal logging from client

reimplement simple logging in xl, the XL_LOG facilities are a
means for the library to communicate back to the client, not
for a logging library that may be redundant with what the client
use.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxl: remove structure init from the library and structure domid
Keir Fraser [Wed, 30 Dec 2009 12:42:41 +0000 (12:42 +0000)]
libxl: remove structure init from the library and structure domid
fixup completly

structure init are more accurately done in the client of the library.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxl: remove useless smac in the nic_info structure
Keir Fraser [Wed, 30 Dec 2009 12:42:01 +0000 (12:42 +0000)]
libxl: remove useless smac in the nic_info structure

the string representing the mac is easily recomputed from the mac
array

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxl: coding styles cleanup
Keir Fraser [Wed, 30 Dec 2009 12:41:22 +0000 (12:41 +0000)]
libxl: coding styles cleanup

simplify some lines, and keep the xl style consistant with itself.
use libxl_sprintf instead of snprintf/sprintf

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agolibxl: change semantics of ctx_free and remove ctx_close
Keir Fraser [Wed, 30 Dec 2009 12:40:44 +0000 (12:40 +0000)]
libxl: change semantics of ctx_free and remove ctx_close

ctx_close isn't use anywhere, and free reallocate the GC array, which
is quite surprising and lead to memory leaking in xl.c

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agox86: Initialise percpu areas as early as possible during bootstrap.
Keir Fraser [Tue, 29 Dec 2009 15:11:47 +0000 (15:11 +0000)]
x86: Initialise percpu areas as early as possible during bootstrap.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoXendAPI: After VBD_destroy and VIF_destroy the managed config must be saved
Keir Fraser [Tue, 29 Dec 2009 15:04:17 +0000 (15:04 +0000)]
XendAPI: After VBD_destroy and VIF_destroy the managed config must be saved

...otherwise already deleted devices appear again in configuration
after a xend restart.

Signed-off-by: Lutz Dube <Lutz.Dube@ts.fujitsu.com>
15 years agomemshr: Must be built on ia64 as well as x86, as blktap depends on it.
Keir Fraser [Mon, 28 Dec 2009 10:55:50 +0000 (10:55 +0000)]
memshr: Must be built on ia64 as well as x86, as blktap depends on it.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86, passthrough: Enhance guest's interrupt affinity setting.
Keir Fraser [Mon, 28 Dec 2009 09:39:23 +0000 (09:39 +0000)]
x86, passthrough: Enhance guest's interrupt affinity setting.

When guest uses logical flat destionation mode for interrupt delivery,
vector doesn't change but destionation also can change, so should
enhance the check condition.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
15 years agohvmloader: Fix Windows XP standby with cirrus VGA
Keir Fraser [Mon, 28 Dec 2009 09:38:34 +0000 (09:38 +0000)]
hvmloader: Fix Windows XP standby with cirrus VGA

Fix it by telling OSPM don't power down vga card on entering S3
state. The trick works for XP and Windows2003, but Vista still refuse
to allow S3.

It is picked from kvm-userdapce.git commit 60e85d, author "Gleb
Natapov".

Signed-off-by: Yu Ke <ke.yu@intel.com>
15 years agonuma: Correct handling node with CPU populated but no memory populated
Keir Fraser [Mon, 28 Dec 2009 09:36:51 +0000 (09:36 +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>
15 years agogrant_table: Build fixes for IA64.
Keir Fraser [Mon, 28 Dec 2009 09:32:39 +0000 (09:32 +0000)]
grant_table: Build fixes for IA64.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agomemshr: Build fixes
Keir Fraser [Mon, 28 Dec 2009 09:14:16 +0000 (09:14 +0000)]
memshr: Build fixes

 * Build memshr/xenpaging on x86/Linux only
 * Remove dependency on GCC 4.1+ __sync_*() intrinsics.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
15 years agox86: Fix mfn/page handling in do_mmuext_op().
Keir Fraser [Thu, 24 Dec 2009 15:59:44 +0000 (15:59 +0000)]
x86: Fix mfn/page handling in do_mmuext_op().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoevtchn: Do not free d->poll_mask until domain is being deallocated.
Keir Fraser [Thu, 24 Dec 2009 12:14:09 +0000 (12:14 +0000)]
evtchn: Do not free d->poll_mask until domain is being deallocated.

Avoids crash on dereference of poll_mask after domain_kill().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agohvmloader: Only mark LTP1 present in ACPI DSDT if parport really is there.
Keir Fraser [Thu, 24 Dec 2009 09:10:25 +0000 (09:10 +0000)]
hvmloader: Only mark LTP1 present in ACPI DSDT if parport really is there.

Signed-off-by: Daniel Kiper <dkiper@net-space.pl>
15 years agox86/mm: early put_page when XENMEM_add_to_physmap(XENMAPSPACE_gmfn)
Keir Fraser [Thu, 24 Dec 2009 09:06:12 +0000 (09:06 +0000)]
x86/mm: early put_page when XENMEM_add_to_physmap(XENMAPSPACE_gmfn)

When using a stub domain, xen massively complains as follows:

(XEN) sh error: sh_remove_all_mappings(): can't find all mappings of
mfn be=
3c5: c=3D8000000000000004 t=3D00000000
(XEN) sh error: sh_remove_all_mappings(): can't find all mappings of
mfn be=
3c4: c=3D8000000000000004 t=3D00000000
...

This comes from the XENMEM_add_to_physmap hypercall from hvmloader.

The guest_physmap_remove_page function calls sh_remove_all_mappings()
which checks reference count of the page. Then, calling
guest_physmap_remove_page after temporarily get_page is obviously
wrong. And early put_page is harmless here since domain_lock is
acquired.

Also, the restore program seems not to complain extra mappings
long before. Instead, the stub domain does. Thus the comment in
sh_remove_all_mappings() is rewritten.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
15 years agoxend: Fix 'monitor' domain config parameter.
Keir Fraser [Thu, 24 Dec 2009 08:59:47 +0000 (08:59 +0000)]
xend: Fix 'monitor' domain config parameter.

Introduce new 'monitor_path' parameter, so that 'monitor' can revert
to its old type and meaning.

Fixes domain reboot and save/restore.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoxen-detect: Add command-line arguments.
Keir Fraser [Wed, 23 Dec 2009 08:22:13 +0000 (08:22 +0000)]
xen-detect: Add command-line arguments.

 - Usage info
 - Quiesce normal output
 - Affect exit status if running in unexpected context

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoxend: Extra qemu options: parallel,serial,monitor
Keir Fraser [Wed, 23 Dec 2009 07:36:33 +0000 (07:36 +0000)]
xend: Extra qemu options: parallel,serial,monitor

Allows par/ser ports to be configured with a path to backing device.
Allows qemu monitor to be disabled or redirected.

Signed-off-by: Daniel Kiper <dkiper@net-space.pl>
15 years agopygrub, reiserfs: Fix on-disk structure definition.
Keir Fraser [Wed, 23 Dec 2009 07:27:21 +0000 (07:27 +0000)]
pygrub, reiserfs: Fix on-disk structure definition.

Without this patch pyGRUB could not read ReiserFS.

Signed-off-by: Daniel Kiper <dkiper@net-space.pl>
15 years agoRemove videoram option from vfb config.
Keir Fraser [Wed, 23 Dec 2009 07:26:31 +0000 (07:26 +0000)]
Remove videoram option from vfb config.
This option is only valid in main config.

Signed-off-by: Daniel Kiper <dkiper@net-space.pl>
15 years agoReplace process_pending_timers() with process_pending_softirqs().
Keir Fraser [Tue, 22 Dec 2009 18:35:34 +0000 (18:35 +0000)]
Replace process_pending_timers() with process_pending_softirqs().

This ensures that any critical softirqs are handled in a timely manner
(e.g., TIME_CALIBRATE_SOFTIRQ) while still avoiding being preempted by
the scheduler (by SCHEDULE_SOFTIRQ), which is the reason for avoiding
use of do_softirq() directly.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agopaging: Updates to public grant table header file.
Keir Fraser [Tue, 22 Dec 2009 18:18:07 +0000 (18:18 +0000)]
paging: Updates to public grant table header file.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoVT-d: improve RMRR region handling
Keir Fraser [Tue, 22 Dec 2009 13:39:12 +0000 (13:39 +0000)]
VT-d: improve RMRR region handling

This patch improves RMRR regions handling as follows:

1) Get rid of duplicated RMRR mapping: different devices may share the
same RMRR regions, when they are assigned to the same guest, it only
need to map the same RMRR region once because RMRR region must be
identity mapped. Add an array of mapped RMRRs to achieve this.

2) Needn't call domain_context_mapping to map the device again in
iommu_prepare_rmrr_dev, and change iommu_prepare_rmrr_dev to
rmrr_identity_mapping which is more suitable.

3) A device may have more than one RMRR regions, remove "break" in
intel_iommu_add_device to let it map all RMRR regions of the device.

Signed-off-by: Weidong Han <Weidong.han@intel.com>
15 years agodomctl/sysctl: Clean up definitions
Keir Fraser [Tue, 22 Dec 2009 11:33:15 +0000 (11:33 +0000)]
domctl/sysctl: Clean up definitions
 - Use fixed-width types only
 - Use named unions only
 - Bump domctl version number

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoRevert 20709:085627544270
Keir Fraser [Mon, 21 Dec 2009 16:51:40 +0000 (16:51 +0000)]
Revert 20709:085627544270

15 years agoxend: Enable vHPET in HVM guests by default.
Keir Fraser [Mon, 21 Dec 2009 10:50:28 +0000 (10:50 +0000)]
xend: Enable vHPET in HVM guests by default.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoCheck m2p/compat m2p table for new added memory.
Keir Fraser [Mon, 21 Dec 2009 10:48:01 +0000 (10:48 +0000)]
Check m2p/compat m2p table for new added memory.

As we allocate m2p/compat m2p/frametable page tables from new added
memory, we want to make sure the new range can hold up the new page
tables, this is because m2p/frametable need be aligned and cover more
than the new-added range.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
15 years agoFix bugs in frame table setup function when memory hot-add.
Keir Fraser [Mon, 21 Dec 2009 10:47:34 +0000 (10:47 +0000)]
Fix bugs in frame table setup function when memory hot-add.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
15 years agoClean up memory hotplug functions.
Keir Fraser [Mon, 21 Dec 2009 10:47:21 +0000 (10:47 +0000)]
Clean up memory hotplug functions.

Move the range checking to mem_hotadd_check.
Add more error handling, to restore the node information, unmap iommu
page tables, destroy xen mapping when error happens.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>