Commit Graph
20681 Commits
Author SHA1 Message Date
Keir Fraser af909e7e16 M2P translation cannot be handled through flat table with only one slot per MFN
when an MFN is shared. However, all existing calls can either infer the GFN (for
example p2m table destructor) or will not need to know GFN for shared pages.
This patch identifies and fixes all the M2P accessors, either by removing the
translation altogether or by making the relevant modifications. Shared MFNs have
a special value of SHARED_M2P_ENTRY stored in their M2P table slot.

Signed-off-by: Grzegorz Milos <Grzegorz.Milos@citrix.com>
2009-12-17 06:27:56 +00:00
Keir Fraser e8a90e0ab1 Sharable/shared pages need to be unshared in responce to a write attempt. This
is handled through custom gfn_to_mfn transation functions called from generic
host page table page fault handler. This should handle both SVM and VTX alike.

Signed-off-by: Grzegorz Milos <Grzegorz.Milos@citrix.com>
2009-12-17 06:27:56 +00:00
Keir Fraser 2bde77654a This patch defines a new P2M type used for sharable/shared pages. It also
implements the basic functions to nominate GFNs for sharing, and to break
sharing (either by making page 'private' or creating private copy),
mem_sharing_nominate_page() and mem_sharing_unshare_page() respectively. Note
pages cannot be shared yet, because there is no efficient way to find all GFNs
mapping to the two MFNs scheduled for sharing.

Signed-off-by: Grzegorz Milos <Grzegorz.Milos@citrix.com>
2009-12-17 06:27:56 +00:00
Keir Fraser 38edca187d This patch defines a new PGT type called PGT_shared_page and a new synthetic
domain called 'dom_cow'. In order to share a page, the type needs to be changed
to PGT_shared_page and the owner to dom_dow. Only pages with PGT_none, and no
type count are allowed to become sharable. Conversly, sharable pages can only be
made 'private' if type count equals one. page_make_sharable() and
page_make_private() handle these transitions.

Signed-off-by: Grzegorz Milos <Grzegorz.Milos@citrix.com>
2009-12-17 06:27:56 +00:00
Keir Fraser 287d07f6a7 User-land tool for memory paging.
This tool will page out the specified number of pages from the specified
domain. When a paged out page is accessed, Xen will issue a request and
notify the tool over an event channel. The tool will process ther request,
page the page in, and notify Xen.

The current (default) policy tracks the 1024 most recently paged in pages
and will not choose to evict any of those. This is done with the assumption
that if a page is accessed, it is likely to be accessed again soon.

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-12-17 06:27:55 +00:00
Keir Fraser c0c8c01d67 libxc interface support for memory paging domctls.
Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-12-17 06:27:55 +00:00
Keir Fraser 0645e0177f libxc support of memory paging.
libxc accepts the new return code from privcmd mmap, which indicates a page
being mapped is actually paged out. Spin until the page is paged in and return
as normal to the caller. This allows memory paging to work transparently with
existing tools.

Since libxc runs in user-space, as does the pager, both processes will be
scheduled and run. This enables the page to be paged in without needing to
spin in kernel mode (which would cause a dead-lock).

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-12-17 06:27:55 +00:00
Keir Fraser 35b1c10cb4 Memory paging domctl support, which is a sub-operation of the generic memory
event domctl support.

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-12-17 06:27:55 +00:00
Keir Fraser b41ecc03e9 Add memory paging support for MMU updates (mapping a domain's memory).
If Domain-0 tries to map a page that has been paged out, then propagate an
error so that it knows to try again. If the page is paged out, request that
it be paged back in. If the page is in the process of being paged in, then
just keeping returning the error until it is paged back in.

This requires the co-operation of the Domain-0 kernel's privcmd mmap
functions. The kernel can't simply spin waiting for the page, as this will
cause a dead-lock (since the paging tool lives in Domain-0 user-space and if
it's spinning in kernel space, it will never return to user-space to allow the
page to be paged back in). There is a complimentary Linux patch which sees
ENOENT, which is not returned by any other part of this code, and marks the
PFN of that paged specially to indicate it was paged out (much like what it
does with PFNs that are within the range of a domain's memory but are not
presently mapped).

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-12-17 06:27:55 +00:00
Keir Fraser f2a7d5963e Support for Memory paging in grant table mappings.
Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-12-17 06:27:55 +00:00
Keir Fraser 507c9e76fb Memory paging support for HVM guest emulation.
A new HVMCOPY return value, HVMCOPY_gfn_paged_out is defined to indicate that
a gfn was paged out. This value and PFEC_page_paged, as appropriate, are
caught and passed up as X86EMUL_RETRY to the emulator. This will cause the
emulator to keep retrying the operation until is succeeds (once the page has
been paged in).

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-12-17 06:27:55 +00:00
Keir Fraser 8992ab0adf hap_gva_to_gfn paging support. Return PFEC_page_paged when a paged
out page is found. Ensure top-level page table page and l1 entry
are paged in. If an intermediary page table page is paged out,
propogate error to caller.

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-12-17 06:27:55 +00:00
Keir Fraser 35387f6582 Base paging support for HVM guests.
This includes paging support for HVMOPs, HAP nested paging, and HVM map entry.
In all cases, the page is paged in automatically and an error returned,
indicating that the failed operation should be retried.

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-12-17 06:27:55 +00:00
Keir Fraser 1554c2b836 Paging support for guest walk tables to page in l1-l3 page table pages.
A new page flag has been added to indicate that a paged out page was found
while walking the page tables. The paging in code is automatically called,
so the flag is only an indicator that the operation should be retried, not
that the page should be paged in.

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-12-17 06:27:55 +00:00
Keir Fraser d5d6ec4751 EPT specific P2M support for new paging types.
Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-12-17 06:27:55 +00:00
Keir Fraser 5ad3a7d545 New P2M types for memory paging and supporting functions.
Several new types need to be added to represent the various different stages
a page can be in while being paged out/in. Xen will sometimes make different
decisions based on these types.

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-12-17 06:27:55 +00:00
Keir Fraser 5c0a90da40 imported patch mem_event_tools_domctls.patch 2009-12-17 06:27:55 +00:00
Keir Fraser bd8fd8c198 domctl support for generic memory event handling.
Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-12-17 06:27:55 +00:00
Keir Fraser 7fed9658c3 Core support for memory events.
This includes enable/disable, ring functions, and vcpu pause/unpause.

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-12-17 06:27:55 +00:00
Keir Fraser db587a25fa Base domain structure and public interface to support memory events.
Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-12-17 06:27:55 +00:00
Keir Fraser 322c096f9c General code clean-up of xc_linux.c.
Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-12-17 06:27:55 +00:00
Keir Fraser 537cf0c1dc Change the naming scheme of hap_gva_to_gfn to match that of guest_walk_tables
(i.e. hap_gva_to_gfn_n_levels instead of hap_gva_to_gfn_nlevel)

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-12-17 06:27:55 +00:00
Keir Fraser a3b207eb70 Fix a reference to X86EMUL_OKAY which was hardcoded as a 0 instead.
Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
2009-12-17 06:27:55 +00:00
Keir Fraser 3b6b6f566b hvm: handle PVRDTSCP mode
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-12-17 06:22:02 +00:00
Keir Fraser 5160866ad9 hvm: Clean up RDTSCP/TSC_AUX handling.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-12-16 22:26:38 +00:00
Keir Fraser f7a1cb1c2f Turn tmem (transcendent memory) support on by default.
Tmem has been in-tree for about seven months, but disabled
by default.  Enabling it should be entirely harmless
unless a running PV domain has been tmem-modified.
I'd like to confirm that by enabling it now, so that
it can be enabled by default for the 4.0.0 release.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-12-16 22:26:15 +00:00
Keir Fraser 0509aa7935 AMD IOMMU: Fix a xen crash on amd iommu systems
Changeset 20514 implemented deallocation for msi interrupt remapping
entries. This patch adds the same support for amd iommu to fix a xen
crash on amd iommu systems.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
2009-12-16 16:48:17 +00:00
Keir Fraser c03680b64d AMD IOMMU: Reset event logging when event overflows
Restart iommu event logging if EventOverFlow bit is set to prevent
event logging from being disabled after event overflows.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
2009-12-16 16:47:31 +00:00
Keir Fraser 79ba534b4d pygrub: add ext4 support
This is a port of the following two patches:
  http://patches.ubuntulinux.org/g/grub/extracted/ext4_support.diff
  http://patches.ubuntulinux.org/g/grub/extracted/ext4_fix_variable_sized_inodes.diff

Signed-off-by: Mark Johnson <mark.johnson@sun.com>
2009-12-16 16:42:44 +00:00
Keir Fraser ea817bcbf5 x86_emulate: Emulate RDTSCP instruction.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-12-16 12:45:18 +00:00
Keir Fraser 142a10c6c8 iommu: Actually clear IO-APIC pins on boot and shutdown when used with an IOMMU
When booted with iommu=on, io_apic_read/write functions call into the
interrupt remapping code to update the IRTEs.  Unfortunately, on boot
and shutdown, we really want clear_IO_APIC() to sanitize the actual
IOAPIC RTE, and not just the bits that are active when interrupt
remapping is enabled.  This is particularly a problem on older
versions of Xen which used the IOAPIC RTE as the canonical source for
the IRTE index.  In that case, clear_IO_APIC() actually causes
whatever happens to be stored in the RTEs to be used as an IRTE index,
which can come back and bite us in ioapic_guest_write() if we attempt
to remove an interrupt that didn't actually exist.  Current upstream
appears less susceptible to errors since the IRTE index is stored in
an array, but it's still a good idea to sanitize the IOAPIC state.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-12-16 12:32:35 +00:00
Keir Fraser 5a396b13fd HVM RDTSCP fixes
- Put the guest rdtscp cpuid logic in xc_cpuid_x86.c.
 - MSR_TSC_AUX's high 32bit is reserved, so only write the low 32bit.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
2009-12-16 12:23:21 +00:00
Keir Fraser ec164cc29f XSM: Restore policy backwards compatibility
This restores backwards compatibility with older XSM policy. Policies
built with older versions of checkpolicy will once again work in Xen.

Signed-off-by : Paul Nuzzi <pjnuzzi@tycho.ncsc.mil>
2009-12-16 12:21:43 +00:00
Keir Fraser 7cafc0777f pygrub: fix attribute error when not found parser
Signed-off-by: Wei Kong <weikong.cn@gmail.com>
2009-12-16 12:20:57 +00:00
Keir Fraser 3cc29c0f26 xenoprof: Fix support for active domains
If a user tries to use opcontrol with option --active-domains in dom0
and then run opcontrol in a guest, no samples are generated. When the
guest calls the xenoprof interface it resets the internal Xenoprof
state machine and profiling does not start

Signed-off-by: Jose Renato Santos <jsantos@hpl.hp.com>
2009-12-16 12:20:08 +00:00
Keir Fraser 420820e830 xen-detect: Avoid dumping core
F12 introduces a tool to automatically report bugs when there are core
dumps.  Since xen-detect relies on fork+waitpid in order to trap a
SIGILL from a child, every time someone runs xen-detect on a bare
metal kernel a bug is reported into Red Hat's Bugzilla. :-)

However, even without this contingent need, leaving core dumps around
is not nice.  So this patch just traps SIGILL using
signal/sentjmp/longjmp, without the need to fork.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-12-14 11:58:45 +00:00
Keir Fraser bda0da7f26 mini-os: Fix a compilation error in xencons_ring when !HAVE_LIBC
Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
2009-12-14 11:38:15 +00:00
Keir Fraser 453414b284 mini-os: Fix memory leaks in blkfront, netfront, pcifront, etc.
The return value of Xenbus routines xenbus_transaction_start(),
xenbus_printf(), xenbus_transaction_end(), etc.  is a pointer of error
message.  This pointer should be passed to free() to release the
allocated memory when it is no longer needed.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
2009-12-14 09:51:07 +00:00
Keir Fraser 82b68fcd0a x86_32: Fix build after RDTSCP and memory hotplug changes.
Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
2009-12-14 09:48:47 +00:00
Keir Fraser 37f8a59c7c Fix bug in c/s 20332 "Add commands to hotplug usb devices to hvm guests"
Signed-off-by: James Song Wei <jsong@novell.com>
2009-12-14 09:36:26 +00:00
Keir Fraser b8a087fb41 HVM vcpu add/remove: parse vcpu_avail to Qemu
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>

Disable qemu cmdline option until our qemu supports it.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-12-14 09:31:00 +00:00
Keir Fraser cf75018188 HVM vcpu add/remove: parse 'vcpu_avail' to firmware and set up madt
accordingly

-- currently firmware has got 'vcpus' from xend, this patch add parse
   'vcpu_avail' to firmware;
-- setup madt 'lapic' subitems of processors accoring to vcpus and
   vcpu_avail which finally come from config;

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-12-14 09:25:47 +00:00
Keir Fraser c70ad37a1f HVM vcpu add/remove: setup dsdt infrastructure by mk_dsdt.c for vcpu add/remove
In order to support HVM vcpu add/remove, we need set dsdt
infrastructure.
-- By using mk_dsdt.c, it auto-produce related asl code when
compiling.
-- It define processor related objects and control methods (_MAT,
_EJ0, _STA, etc).
-- It also define GPE _L02 and Notify control method for SCI
interrupt, which will trigger HVM acpi driver to add/remove cpu.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-12-14 09:14:26 +00:00
Keir Fraser 551fae6cac PoD: correct assertion and remove noisy messages
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2009-12-14 08:00:26 +00:00
Keir Fraser ec35d23a92 docs: add a document about guest cpuid configuration
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-12-14 07:59:40 +00:00
Keir Fraser a4a7c638f7 xend: fix empty 'cpus' parsing
/etc/xen/xmexample.hvm says "" means "leave to Xen to pick", but we
get a "Error: string index out of range" currently.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-12-14 07:59:12 +00:00
Keir Fraser 51dfdb01ad xend: fix a typo introduced by changeset 20621:f9392f6eda79
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-12-14 07:58:47 +00:00
Keir Fraser 30acac4606 Fix bug in c/s 20332 "Add commands to hotplug usb devices to hvm guests"
Signed-off-by: James Song Wei <jsong@novell.com>
2009-12-14 07:58:15 +00:00
Keir Fraser beba190a01 Disable watchdog in dump_registers
Avoids triggering watchdog if serial port output is slow.

Signed-off-by: Andrew Lyon <andrew.lyon@gmail.com>
2009-12-14 07:57:23 +00:00
Keir Fraser bbe624405f Fix losetup -f not working on SLES10
Signed-off-by: Gary Grebus <gary.grebus@oracle.com>
2009-12-14 07:56:21 +00:00