Keir Fraser [Wed, 21 Nov 2007 11:38:51 +0000 (11:38 +0000)]
x86: Make IDT/GDT/LDT updates safe.
This involves either determining that the entry will not be
read/written while the update takes place, or atomically making the
entry 'present', or doing the entire write atomically, as appropriate.
This issue raised, and original patch provided, by Jan Beulich.
Keir Fraser [Wed, 21 Nov 2007 09:49:09 +0000 (09:49 +0000)]
hvm: Do not crash guest if it does an unaligned access to an HPET
register. Some CrashMe test apaprently does this and we don't want
that to crash the domain it runs in.
From: Dexuan Cui <dexuan.cui@intel.com> Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
Keir Fraser [Tue, 20 Nov 2007 15:34:25 +0000 (15:34 +0000)]
x86, 32-on-64: Improve checking in vcpu_destroy_pagetables(). It *is*
possible for 64-bit guest to have matching guest_table and
guest_table_user.
Original patch by John Levon <levon@movementarian.org> Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
Keir Fraser [Tue, 20 Nov 2007 15:05:36 +0000 (15:05 +0000)]
svm: Fix __update_guest_eip() to clear interrupt shadow.
Get rid of assertions about return value of get_instruction_length()
-- instead test in __update_guest_eip() and crash the domain.
Cache value of 'current' in svm_do_hlt().
The mismanagement of the interrupt shadow was found by Christoph
Egger of AMD.
Keir Fraser [Tue, 20 Nov 2007 14:35:36 +0000 (14:35 +0000)]
xen: Domain0 builder should set start_info magic string to
'xen-3.0-...' just like user-space builder for domUs. Signed-off-by: Keir Fraser <keir@xensource.com>
Keir Fraser [Fri, 16 Nov 2007 20:06:15 +0000 (20:06 +0000)]
Log dirty radix tree code cleanup. Also do not deference non-existent
pointer in paging_new_log_dirty_*() functions if allocation fails. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Fri, 16 Nov 2007 19:07:46 +0000 (19:07 +0000)]
hvm: RTC emulation - RTC_UIE/RTC_SET fix
This patch fixes a bug in the RTC code which appears to originate in
having written the emuated device following an incorrect
specification. VMware has (or had, at least, at the time we were still
testing on both VMWare and Xen) the same issue. In the current code,
when RTC_SET is set, RTC_UIE is cleared. This does not match the
behavior of real hardware, where the case is simply that no update
ended interrupts are sent as long as RTC_SET is set, but the UE ints
will resume as soon as RTC_SET is cleared and the clock update is
done. This little patch fixes this issue. In practicality, this means
OS/2 can now set the time without having the clock stop. I don't know
if any other guests have been affected by this issue.
Keir Fraser [Fri, 16 Nov 2007 18:33:24 +0000 (18:33 +0000)]
hvm: make dirty logging stop requiring physical pages of order > 0
This patch re-implements the (x86) hypervisor dirty page log with a
simple four-level radix tree whose nodes are all single pages, thus
making migration require only order-0 pages (where before it required
at least an order-5 page).
Unlike the p2m radix tree implementation, the interior nodes of this
tree are NOT page table nodes. I chose a lazy-allocation and -mapping
approach because most pages are not marked dirty while dirty-logging is
enabled. There are doubtless situations (the 'stream' benchmark, for
example) where a more complex p2m-like approach is faster, but I'm not
sure they're worth the effort.
Signed-off-by: Dave Lively <dlively@virtualiron.com>
Keir Fraser [Fri, 16 Nov 2007 17:59:34 +0000 (17:59 +0000)]
x86: Clean up some files of inline asm, and fix
__copy_{to,from}_user_ll() for gcc 3.4 (asm output constraints all
need to be '=&').
Based on a patch by Jan Beulich. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Fri, 16 Nov 2007 17:08:05 +0000 (17:08 +0000)]
xentrace: make xentrace and xenmon work on Solaris and *BSD.
- Use getopt() to get rid of argp dependency which does not exist
on Solaris and *BSD. Done by Tariq Magdon-Ismail.
- Minor modifications by me (Christoph) to make it also work on *BSD.
- Tested on Linux by me (Christoph). No functional change on Linux.
- Tariq ok'd BSD modifications for Solaris
- Tariq ok'd submission by me :)
Signed-off-by: Tariq Magdon-Ismail <tariqmi@sun.com> Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Keir Fraser [Fri, 16 Nov 2007 16:36:38 +0000 (16:36 +0000)]
vmx: wbinvd optimization for pass-through domain.
Optimise wbinvd exit emulation for pass-through domains to avoid
"always wbinvd" when a VCPU is migrated. Instead, do host wbinvd on
all host CPUs when wbinvd exit.
Keir Fraser [Fri, 16 Nov 2007 14:45:35 +0000 (14:45 +0000)]
xend, xenapi: Strip characters from logs that XMLRPC layer cannot handle.
From: Ian Jackson <ian.jackson@citrix.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Tue, 13 Nov 2007 19:05:27 +0000 (19:05 +0000)]
vmx: Restore correct host SYSENTER parameters on vmexit.
Also simplify vmx_set_host_env().
HOST_GDT_BASE does not have to change when we shift CPU. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Sun, 11 Nov 2007 18:22:33 +0000 (18:22 +0000)]
libxc: Consolidate read()/write() syscall wrappers to read/write an
exact number of bytes. The consolidated versions are more watertight
than the various versions previously distributed around the library
source code. Signed-off-by: Keir Fraser <keir@xensource.com>
Keir Fraser [Sat, 10 Nov 2007 10:54:32 +0000 (10:54 +0000)]
xend: Fix appending policy module to end of grub's config file
This patch fixes the case where a module line is supposed to be added
to the very end of the file but the file does not end in with a new
line. Also fixes a problem that in some cases the module line would
not be properly be removed.
Keir Fraser [Thu, 8 Nov 2007 14:50:01 +0000 (14:50 +0000)]
hvm: Clean up buf_ioreq handling.
Also, disable stdvga caching on hvm save/restore, as the shadow vga
state is not preserved. Signed-off-by: Keir Fraser <keir@xensource.com>
Keir Fraser [Thu, 8 Nov 2007 10:33:18 +0000 (10:33 +0000)]
x86, hvm: Clean up periodic timer code a little. This leads naturally
to a no-missed-tick-accounting mode which is a combination of ticks
delivered 'off beat' immediately upon re-scheduling when ticks are
missed, then reverting to delivering ticks 'on beat' as usual. Signed-off-by: Keir Fraser <keir@xensource.com>
Keir Fraser [Thu, 8 Nov 2007 10:21:47 +0000 (10:21 +0000)]
x86, hvm: Fix boot of HVM guests with pass-thru devices. Cache
attributes should not be propagated for Xen-heap pages. Signed-off-by: Keir Fraser <keir@xensource.com>
Keir Fraser [Thu, 8 Nov 2007 10:19:18 +0000 (10:19 +0000)]
Replace is_xen_heap_frame() with is_xen_heap_{page,mfn}(). Callers are
changed to use whichever is more convenient. Signed-off-by: Keir Fraser <keir@xensource.com>
Alex Williamson [Wed, 7 Nov 2007 22:11:44 +0000 (15:11 -0700)]
[IA64] Fix breakage from upstream and remove duplicate code
- Get rid of PAGE_SIZE usage in arch-ia64.h when building tools.
- Now that more of xen_init_fv is identical to x86 code, share the
code rather than duplicate it.
- Change a few things that came over from the ia64 tree to use the
XC_* macros as already done upstream.
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
- set_hvm_param hypercall clean up.
- The reference counts of the io pages must be incremented.
- Buffered pio wasn't SMP safe.
- Clean up get_vio() parameter.
Alex Williamson [Wed, 7 Nov 2007 17:19:21 +0000 (10:19 -0700)]
[IA64] vti save-restore: clean up arch_get/set_info_guest()
- Update comment in copy_rbs()
- Don't warn when rbs_size = 0 for cpu initialization case.
- Remove struct vcpu_guest_context_regs::rbs_nat member which isn't used.
and add num_phys_stacked to struct vcpu_guest_context_regs.
so far rbs_nat and rbs_rnat isn't, so it is allowed to change the offset
of rbs_rnat.
- Add check when setting vRR[].
- Don't set vRR[] if val is zero.
Keir Fraser [Wed, 7 Nov 2007 15:20:06 +0000 (15:20 +0000)]
vt-d: Support intra-domain shared interrupt.
Inter-domain shared interrupt has been supported by timeout method,
but it still doesn't support intra-domain shared interrupt, that is
assigning multiple devices which share a physical irq to the same
domain. This patch implements intra-domain shared interrupt
support. In addition, this patch maps link to guest device/intx
instead of directly mapping isairq in pt_irq_create_bind_vtd(),
because at this point the isairqs got from pci_link are always 0.
Note that assigning multiple devices to guests which uses PIC to
handle interrupts may be failed, because different links possibly
connect to same irq.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Keir Fraser [Wed, 7 Nov 2007 13:41:29 +0000 (13:41 +0000)]
[SHADOW] Fix up change that allowed MMIO mappings to be shadowed
so it doesn't let us map INVALID_MFN as a shadow pagetable page. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Keir Fraser [Wed, 7 Nov 2007 11:44:05 +0000 (11:44 +0000)]
x86: Change cache attributes of Xen 1:1 page mappings in response to
guest mapping requests.
Based on a patch by Jan Beulich <jbeulich@novell.com> Signed-off-by: Keir Fraser <keir@xensource.com>
Keir Fraser [Wed, 7 Nov 2007 09:22:31 +0000 (09:22 +0000)]
Enable loopback disk image files on readonly nfs filesystem.
When we losetup a file on readonly nfs filesystem, it fails with:
# losetup /dev/loop7 /data/vm/xen_el5_i386_para/system.raw
/data/vm/xen_el5_i386_para/system.raw: Permission denied
New version of losetup has add a "-r" option for readonly loop, which
Linux kernel has supported for a long time. Some distribution (EL5
update, Fedora 8, etc.) have shipped it. This patch benefit this
option while doesn't break the old versions of losetup.
Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
Keir Fraser [Tue, 6 Nov 2007 11:49:15 +0000 (11:49 +0000)]
[PV-ON-HVM] Fix evtchn of unbind_from_irqhandler()
When xm block-detach command was done on PV-ON-HVM, the response of
other disks was lost. It is because a wrong event channel was
invalidated when detaching it. Not the evtchn number but the irq
number is invalidated specifying it.
Keir Fraser [Tue, 6 Nov 2007 09:43:22 +0000 (09:43 +0000)]
vt-d: Free memory of g2m_ioport_list.
This patch frees memory of g2m_ioport_list when remove g2m_ioport or
destroy iommu domain to avoid memory leak. In addtion, does some
cleanup on domctl.c.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Keir Fraser [Tue, 6 Nov 2007 09:41:57 +0000 (09:41 +0000)]
Users manual updates:
1) PAE as 32-bit Xen default
2) IA64 and Power are supported
3) AMD Virtualization is supported
4) Add console_timestamps boot param
Keir Fraser [Tue, 6 Nov 2007 09:40:44 +0000 (09:40 +0000)]
xenstored: Recover from corrupt tdb on reboot
Xen cannot work when xenstored's tdb is corrupt. When that happens
somehow (and we've seen it happen), even reboot doesn't recover from
it. It could: there is no state in tdb that needs to be persisted
across reboots.
This patch arranges that tdb is removed before xenstored is started,
provided it doesn't already run. This is safe, because:
* xenstored cannot be restarted. If it dies, Xen's screwed until
reboot.
* /usr/sbin/xend always starts xenstored anyway.
* xenstored locks its pid-file (see write_pidfile() in
tools/xenstore/xenstored_core.c), and refuses to start when it
can't.
* My patch makes /usr/sbin/xend remove tdb iff it can lock the
pid-file. In other words, it removes tdb only when xenstored is not
running, and locks it out until it is done.
Bonus fix: it also removes stale copies of the tdb xenstored tends
to leave behind when it exits uncleanly.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Keir Fraser [Mon, 5 Nov 2007 16:38:47 +0000 (16:38 +0000)]
[SHADOW] Fix error paths in guest-pagetable walker.
Real hardware sets PFEC_page_present regardless of the access bits,
and doesn't write back _PAGE_ACCESSED except after a successful walk. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Keir Fraser [Mon, 5 Nov 2007 10:45:07 +0000 (10:45 +0000)]
cpufreq, amd: Xen support for architectural AMD pstate driver
With the third generation Opteron parts, AMD switched to an
architecturally defined interface for PowerNow! that uses
different MSRs than previous versions.
Add support in msr-index.h and traps.c for the new interface.
Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
Keir Fraser [Fri, 2 Nov 2007 16:34:54 +0000 (16:34 +0000)]
hvm: Timer fixes:
1. Do not record more than one pending interrupt in
no-missed-tick-accounting mode. We do not stack up missed interrupts
in this timer mode.
2. Always record all missed ticks when we are in a
missed-tick-accounting mode. Do not have a ceiling for this as it
simply causes guests to lose track of wall time.
3. General bits of cleanup and simplification.
From: Dave Winchell <dwinchell@virtualiron.com> Signed-off-by: Keir Fraser <keir@xensource.com>
Keir Fraser [Fri, 2 Nov 2007 16:06:06 +0000 (16:06 +0000)]
x86, svm: Add hunk I missed from Jan's debug-register handling
patch. We need to handle SVM debug-register read access intercepts. Signed-off-by: Keir Fraser <keir@xensource.com>
Tim Deegan [Fri, 2 Nov 2007 15:41:57 +0000 (15:41 +0000)]
[SHADOW] Make the guest PT walker more complete.
We now check access rights and write back the _PAGE_ACCESSED and
_PAGE_DIRTY bits into the guest entries as we walk the tables.
This makes the shadow fault handler simpler, and the various emulation
paths more correct.
This patch doesn't add checking and write-back to the HAP pagetable walker;
it just fixes up its arguments to match the new shadow one.
Signed-off-by: Tim Deegan <Tim.Deegan@eu.citrix.com>