ia64/xen-unstable

changeset 2762:7266d3bd3b1f

bitkeeper revision 1.1159.137.1 (41811b328SwfN4BTxZsoMM-iGa8evQ)

Delete some unused tools, lots of docs updates.
author mwilli2@equilibrium.research
date Thu Oct 28 16:15:46 2004 +0000 (2004-10-28)
parents 23eb17be7a14
children ad13896e776c
files .rootkeys README README.CD TODO docs/src/user.tex tools/misc/Makefile tools/misc/p4perf.h tools/misc/setdomainmaxmem tools/misc/xen_cpuperf.c tools/misc/xensymoops tools/misc/xensymoops.py
line diff
     1.1 --- a/.rootkeys	Tue Oct 26 17:08:38 2004 +0000
     1.2 +++ b/.rootkeys	Thu Oct 28 16:15:46 2004 +0000
     1.3 @@ -5,7 +5,6 @@ 3ddb79c9_hgSp-gsQm8HqWM_9W3B_A BitKeeper
     1.4  4177dbbfqsi01p2zgZa0geUOgScONw COPYING
     1.5  3eb788d6Kleck_Cut0ouGneviGzliQ Makefile
     1.6  3f5ef5a24IaQasQE2tyMxrfxskMmvw README
     1.7 -3f5ef5a2l4kfBYSQTUaOyyD76WROZQ README.CD
     1.8  3f69d8abYB1vMyD_QVDvzxy5Zscf1A TODO
     1.9  3f9e7d53iC47UnlfORp9iC1vai6kWw docs/Makefile
    1.10  3f9e7d60PWZJeVh5xdnk0nLUdxlqEA docs/figs/xenlogo.eps
    1.11 @@ -354,15 +353,12 @@ 3f6dc142IHaf6XIcAYGmhV9nNSIHFQ tools/mis
    1.12  40c9c469kT0H9COWzA4XzPBjWK0WsA tools/misc/netfix
    1.13  4022a73cEKvrYe_DVZW2JlAxobg9wg tools/misc/nsplitd/Makefile
    1.14  4022a73cKms4Oq030x2JBzUB426lAQ tools/misc/nsplitd/nsplitd.c
    1.15 -3f870808_8aFBAcZbWiWGdgrGQyIEw tools/misc/p4perf.h
    1.16 -4113d1afyPjO8m8-9E1pVBDHzGe1jQ tools/misc/setdomainmaxmem
    1.17  3f5ef5a2ir1kVAthS14Dc5QIRCEFWg tools/misc/xen-clone
    1.18  3f5ef5a2dTZP0nnsFoeq2jRf3mWDDg tools/misc/xen-clone.README
    1.19 -3f870808zS6T6iFhqYPGelroZlVfGQ tools/misc/xen_cpuperf.c
    1.20  405eedf6_nnNhFQ1I85lhCkLK6jFGA tools/misc/xencons
    1.21  40c9c4697z76HDfkCLdMhmaEwzFoNQ tools/misc/xend
    1.22  4107986eMWVdBoz4tXYoOscpN_BCYg tools/misc/xensv
    1.23 -4056f5155QYZdsk-1fLdjsZPFTnlhg tools/misc/xensymoops.py
    1.24 +4056f5155QYZdsk-1fLdjsZPFTnlhg tools/misc/xensymoops
    1.25  40cf2937dqM1jWW87O5OoOYND8leuA tools/misc/xm
    1.26  40c9c468icGyC5RAF1bRKsCXPDCvsA tools/python/Makefile
    1.27  40ffc44dOwe1CcYXGCkYHdG_NxcccA tools/python/logging/logging-0.4.9.2/PKG-INFO
     2.1 --- a/README	Tue Oct 26 17:08:38 2004 +0000
     2.2 +++ b/README	Thu Oct 28 16:15:46 2004 +0000
     2.3 @@ -8,9 +8,9 @@
     2.4  ###############################
     2.5  
     2.6  University of Cambridge Computer Laboratory
     2.7 -28 Aug 2004
     2.8 +28 Oct 2004
     2.9  
    2.10 -http://www.cl.cam.ac.uk/netos/xen
    2.11 +http://www.cl.cam.ac.uk/netos/xen/
    2.12  
    2.13  About the Xen Virtual Machine Monitor
    2.14  =====================================
    2.15 @@ -19,201 +19,13 @@ About the Xen Virtual Machine Monitor
    2.16  Systems Research Group of the University of Cambridge Computer
    2.17  Laboratory, as part of the UK-EPSRC funded XenoServers project. 
    2.18  
    2.19 -The XenoServers project aims to provide a "public infrastructure for
    2.20 -global distributed computing", and Xen plays a key part in that,
    2.21 -allowing us to efficiently partition a single machine to enable
    2.22 -multiple independent clients to run their operating systems and
    2.23 -applications in an environment providing protection, resource
    2.24 -isolation and accounting.  The project web page contains further
    2.25 -information along with pointers to papers and technical reports:
    2.26 -http://www.cl.cam.ac.uk/xeno
    2.27 -
    2.28 -Xen has since grown into a project in its own right, enabling us to
    2.29 -investigate interesting research issues regarding the best techniques
    2.30 -for virtualizing resources such as the CPU, memory, disk and network.
    2.31 -The project has been bolstered by support from Intel Research
    2.32 -Cambridge, and HP Labs, who are now working closely with us. We're
    2.33 -also in receipt of support from Microsoft Research Cambridge to port
    2.34 -Windows XP to run on Xen.
    2.35 -
    2.36 -Xen enables multiple operating system images to execute concurrently 
    2.37 -on the same hardware with very low performance overhead --- much lower
    2.38 -than commercial offerings for the same x86 platform.
    2.39 -
    2.40 -This is achieved by requiring OSs to be specifically ported to run on
    2.41 -Xen, rather than allowing unmodified OS images to be used. Crucially,
    2.42 -only the OS needs to be changed -- all of the user-level application
    2.43 -binaries, libraries etc can run unmodified. Hence the modified OS
    2.44 -kernel can typically just be dropped into any existing OS distribution
    2.45 -or installation.
    2.46 -
    2.47 -Xen currently runs on the x86 architecture, but could in principle be
    2.48 -ported to others. In fact, it would have been rather easier to write
    2.49 -Xen for pretty much any other architecture as x86 is particularly 
    2.50 -tricky to handle. A good description of Xen's design, implementation 
    2.51 -and performance is contained in our October 2003 SOSP paper, available
    2.52 -at http://www.cl.cam.ac.uk/netos/papers/2003-xensosp.pdf
    2.53 -[update: work to port Xen to x86_64 and IA64 is underway]
    2.54 -
    2.55 -Five different operating systems have been ported to run on Xen: 
    2.56 -Linux 2.4/2.6, Windows XP, NetBSD, FreeBSD and Plan 9.
    2.57 -
    2.58 -The Linux 2.4 port (currently Linux 2.4.26) works very well -- we
    2.59 -regularly use it to host complex applications such as PostgreSQL,
    2.60 -Apache, BK servers etc. It runs every user-space applications we've
    2.61 -tried.  We refer to our version of Linux ported to run on Xen as
    2.62 -"XenLinux", although really it's just standard Linux ported to a new
    2.63 -virtual CPU architecture that we call xen-x86.
    2.64 -
    2.65 -NetBSD has been ported to Xen by Christian Limpach, and will hopefully
    2.66 -soon become part of the standard release. Work on a FreeBSD port has
    2.67 -been started by Kip Macy, and we hope to see this complete for the 2.0
    2.68 -release. Ron Minnich has been working on Plan 9.
    2.69 -
    2.70 -The Windows XP port is nearly finished. It's running user space
    2.71 -applications and is generally in pretty good shape thanks to some hard
    2.72 -work by a team over the summer.  Of course, there are issues with
    2.73 -releasing this code to others.  We should be able to release the
    2.74 -source and binaries to anyone that has signed the Microsoft academic
    2.75 -source license, which these days has very reasonable terms. We are in
    2.76 -discussions with Microsoft about the possibility of being able to make
    2.77 -binary releases to a larger user community. Obviously, there are
    2.78 -issues with product activation in this environment which need to be 
    2.79 -thought through.
    2.80 -
    2.81 -So, for the moment, you only get to run Linux 2.4/2.6 and NetBSD on
    2.82 -Xen, but we hope this will change before too long.  Even running
    2.83 -multiple copies of the same OS can be very useful, as it provides a
    2.84 -means of containing faults to one OS image, and also for providing
    2.85 -performance isolation between the various OS, enabling you to either
    2.86 -restrict, or reserve resources for, particular VM instances.
    2.87 -
    2.88 -It's also useful for development -- each version of Linux can have
    2.89 -different patches applied, enabling different kernels to be tried
    2.90 -out. For example, the "vservers" patch used by PlanetLab applies
    2.91 -cleanly to our ported version of Linux.
    2.92 -
    2.93 -We've successfully booted over 128 copies of Linux on the same machine
    2.94 -(a dual CPU hyperthreaded Xeon box) but we imagine that it would be
    2.95 -more normal to use some smaller number, perhaps 10-20.
    2.96 -
    2.97 -A common question is "how many virtual machines can I run on hardware
    2.98 -xyz?". The answer is very application dependent, but the rule of thumb
    2.99 -is that you should expect to be able to run the same workload under
   2.100 -multiple guest OSes that you could run under a single Linux instance,
   2.101 -with an additional overhead of a few MB per OS instance.
   2.102 -
   2.103 -One key feature in this new release of Xen is `live migration'. This
   2.104 -enables virtual machines instances to be dynamically moved between
   2.105 -physical Xen machines, with typical downtimes of just a few tens of
   2.106 -milliseconds. This is really useful for admins that want to take a
   2.107 -node down for maintenance, or to load balance a large number of
   2.108 -virtual machines across a cluster.
   2.109 -
   2.110 -
   2.111 -
   2.112 -Hardware support
   2.113 -================
   2.114 +Xen 2.0 offers excellent performance, hardware support and enterprise
   2.115 +grade features such as live migration.  Linux 2.6, 2.4 and NetBSD 2.0
   2.116 +are already available for Xen, with more operating system ports on the
   2.117 +way.
   2.118  
   2.119 -Xen is intended to be run on server-class machines, and the current
   2.120 -list of supported hardware very much reflects this, avoiding the need
   2.121 -for us to write drivers for "legacy" hardware. It is likely that some
   2.122 -desktop chipsets will fail to work properly with the default Xen
   2.123 -configuration: specifying 'noacpi' or 'ignorebiostables' when booting
   2.124 -Xen may help in these cases.
   2.125 -
   2.126 -Xen requires a "P6" or newer processor (e.g. Pentium Pro, Celeron,
   2.127 -Pentium II, Pentium III, Pentium IV, Xeon, AMD Athlon, AMD Duron).
   2.128 -Multiprocessor machines are supported, and we also have basic support
   2.129 -for HyperThreading (SMT), although this remains a topic for ongoing
   2.130 -research. We're also working on an AMD x86_64 port (though Xen should
   2.131 -run on Opterons in 32-bit mode just fine).
   2.132 -
   2.133 -Xen can currently use up to 4GB of memory. It's possible for x86
   2.134 -machines to address more than that (64GB), but it requires using a
   2.135 -different page table format (3-level rather than 2-level) that we
   2.136 -currently don't support. Adding 3-level PAE support wouldn't be
   2.137 -difficult, but we'd also need to add support to all the guest
   2.138 -OSs. Volunteers welcome!
   2.139 -
   2.140 -In contrast to previous Xen versions, in Xen 2.0 device drivers run
   2.141 -within a privileged guest OS rather than within Xen itself. This means
   2.142 -that we should be compatible with the full set of device hardware
   2.143 -supported by Linux.  The default XenLinux build contains support for
   2.144 -relatively modern server-class network and disk hardware, but you can
   2.145 -add suppport for other hardware by configuring your XenLinux kernel in
   2.146 -the normal way (e.g. "make xconfig").
   2.147 -
   2.148 -
   2.149 -Building Xen and XenLinux
   2.150 -=========================
   2.151 -
   2.152 -The public master BK repository for the 2.0 release lives at: 
   2.153 -bk://xen.bkbits.net/xen-2.0.bk
   2.154 -
   2.155 -To fetch a local copy, install the BitKeeper tools, then run: 
   2.156 -'bk clone bk://xen.bkbits.net/xen-2.0.bk'
   2.157 -
   2.158 -You can do a complete build of Xen, the control tools, and the
   2.159 -XenLinux kernel images with "make world". This can take 10 minutes
   2.160 -even on a fast machine. If you're on an SMP machine you may wish to
   2.161 -give the '-j4' argument to make to get a parallel build.  All of the
   2.162 -files that are built are placed under the ./install directory.  You
   2.163 -can then install everything to the standard system directories
   2.164 -(e.g. /boot, /usr/bin, /usr/lib/python/ etc) by typing "make install".
   2.165 +Xen is Free Open Source Software, released under the GNU GPL.
   2.166  
   2.167 -Take a look in install/boot/:
   2.168 - install/boot/xen.gz               The Xen 'kernel' (formerly image.gz)
   2.169 - install/boot/vmlinuz-2.4.27-xen0  Domain 0 XenLinux kernel (xenolinux.gz)
   2.170 - install/boot/vmlinuz-2.4.27-xenU  Unprivileged XenLinux kernel
   2.171 -
   2.172 -The difference between the two Linux kernels that are built is
   2.173 -due to the configuration file used for each. The "U" suffixed
   2.174 -unprivileged version doesn't contain any of the physical hardware
   2.175 -device drivers, so is 30% smaller and hence may be preferred for
   2.176 -your non-privileged domains.
   2.177 -
   2.178 -The install/boot directory will also contain the config files
   2.179 -used for building the XenLinux kernels, and also versions of Xen
   2.180 -and XenLinux kernels that contain debug symbols (xen-syms and
   2.181 -vmlinux-syms-2.4.27-xen0) which are essential for interpreting crash
   2.182 -dumps.
   2.183 -
   2.184 -Inspect the Makefile if you want to see what goes on during a
   2.185 -build. Building Xen and the tools is straightforward, but XenLinux is
   2.186 -more complicated. The makefile needs a 'pristine' linux kernel tree
   2.187 -which it will then add the Xen architecture files to. You can tell the
   2.188 -makefile the location of the appropriate linux compressed tar file by
   2.189 -setting the LINUX_SRC environment variable
   2.190 -(e.g. "LINUX_SRC=/tmp/linux-2.4.27.tar.gz make world") or by placing
   2.191 -the tar file somewhere in the search path of LINUX_SRC_PATH which
   2.192 -defaults to ".:..". If the makefile can't find a suitable kernel tar
   2.193 -file it attempts to download it from kernel.org, but this won't work
   2.194 -if you're behind a firewall.
   2.195 -
   2.196 -After untaring the pristine kernel tree, the makefile uses the
   2.197 -'mkbuildtree' script to add the Xen patches the kernel. "make world"
   2.198 -then build two different XenLinux images, one with a "-xen0" extension
   2.199 -which contains hardware device drivers and is intended to be used in
   2.200 -the first virtual machine ("domain 0"), and one with a "-xenU"
   2.201 -extension that just contains virtual-device drivers. The latter can be
   2.202 -used for all non hardware privileged domains, and is substantially
   2.203 -smaller than the other kernel with its selection of hardware drivers.
   2.204 -
   2.205 -If you don't want to use bitkeeper to download the source, you can
   2.206 -download prebuilt binaries and src tar balls from the project
   2.207 -downloads page:  http://www.cl.cam.ac.uk/netos/xen/downloads/
   2.208 -
   2.209 -Using the domain control tools
   2.210 -==============================
   2.211 -
   2.212 -Before starting domains you'll need to start the node management
   2.213 -daemon: "xend start". 
   2.214 -The primary tool for starting and controlling domains is "xm". 
   2.215 -"xm help <cmd>" will tell you how to use it.
   2.216 -
   2.217 -README.CD contains some example invocations.
   2.218 -
   2.219 -Further documentation is in docs/ (e.g., docs/Xen-HOWTO), and also in
   2.220 -
   2.221 -
   2.222 +For full documentation, see the Xen User Manual in docs/user.pdf
   2.223 +(after running make -C docs) or the Documentation page on the Xen
   2.224 +website.
     3.1 --- a/README.CD	Tue Oct 26 17:08:38 2004 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,737 +0,0 @@
     3.4 -###############################
     3.5 -__  __            ____    ___
     3.6 -\ \/ /___ _ __   |___ \  / _ \
     3.7 - \  // _ \ '_ \    __) || | | |
     3.8 - /  \  __/ | | |  / __/ | |_| |
     3.9 -/_/\_\___|_| |_| |_____(_)___/
    3.10 -
    3.11 -###############################
    3.12 -
    3.13 - XenDemoCD 2.0
    3.14 - University of Cambridge Computer Laboratory
    3.15 - 28 Aug 2004
    3.16 -
    3.17 - http://www.cl.cam.ac.uk/netos/xen
    3.18 -
    3.19 -Welcome to the Xen Demo CD! 
    3.20 -
    3.21 -Executive Summary
    3.22 -=================
    3.23 -
    3.24 -This CD is a standalone demo of the Xen Virtual Machine Monitor (VMM),
    3.25 - Linux-2.4 and Linux-2.6 OS port (Xenlinux). It runs entirely off the
    3.26 -CD, without requiring hard disk installation. This is achieved using a
    3.27 -RAM disk to store mutable file system data while using the CD for
    3.28 -everything else. The CD can also be used for installing Xen/Xenlinux
    3.29 -to disk, and includes a source code snapshot along with all of the
    3.30 -tools required to build it.
    3.31 -
    3.32 -Booting the CD
    3.33 -==============
    3.34 -
    3.35 -It should be possible to get Xen working with any relatively modern
    3.36 -hardware supported by standard Linux. However, the version of XenLinux
    3.37 -built for the DemoCD is fairly h/w specific. If you need other
    3.38 -hardware, you'll have to configure and build your own xenlinux kernel.
    3.39 -Xen does require an 'i686'-class CPU or newer, so won't work on 486's
    3.40 -or plain Pentiums.
    3.41 -
    3.42 -We have compiled in drivers for the following hardware:
    3.43 -
    3.44 -CPU:  Pentium Pro/II/III/IV/Xeon, Athlon (i.e. P6 or newer) SMP supported
    3.45 -IDE:  Intel PIIX chipset, others will be PIO only (slow)
    3.46 -SCSI: Adaptec / Dell PERC Raid (aacraid), fusion MPT, megaraid, Adaptec aic7xxx
    3.47 -Net:  Recommended: Intel e1000, Broadcom BCM57xx (tg3), 3c905 (3c59x)
    3.48 -      Also supported: pcnet32, Intel e100, tulip
    3.49 -
    3.50 -Because of the demo CD's use of RAM disks, make sure you have plenty
    3.51 -of RAM (256MB+).
    3.52 -
    3.53 -To try out the Demo, boot from CD (you may need to change your BIOS
    3.54 -configuration to do this), then select one of the four boot options 
    3.55 -from the Grub menu:
    3.56 -
    3.57 - Xen / linux-2.4.27
    3.58 - Xen / linux-2.4.27 using cmdline IP configuration
    3.59 - Xen / linux-2.4.27 in "safe mode"
    3.60 - linux-2.4.22
    3.61 -
    3.62 -The last option is a plain linux kernel that runs on the bare machine,
    3.63 -and is included simply to help diagnose driver compatibility
    3.64 -problems. The "safe mode" boot option might be useful if you're having
    3.65 -problems getting Xen to work with your hardware, as it disables various
    3.66 -features such as SMP, and enables some debugging.
    3.67 -
    3.68 -If you are going for a command line IP config, hit "e" at
    3.69 -the grub menu, then edit the "ip=" parameters to reflect your setup
    3.70 -e.g. "ip=<ipaddr>::<gateway>:<netmask>::eth0:off". It shouldn't be
    3.71 -necessary to set either the nfs server or hostname
    3.72 -parameters. Alternatively, once Xenlinux has booted you can login and
    3.73 -setup networking with 'dhclient' or 'ifconfig' and 'route' in the
    3.74 -normal way. 
    3.75 -
    3.76 -To make things easier for yourself, it's worth trying to arrange for an
    3.77 -IP address which is the first in a sequential range of free IP
    3.78 -addresses.  It's useful to give each VM instance its own public IP
    3.79 -address (though it is possible to do NAT or use private addresses), 
    3.80 -and the configuration files on the CD allocate IP addresses
    3.81 -sequentially for subsequent domains unless told otherwise.
    3.82 -
    3.83 -After selecting the kernel to boot, stand back and watch Xen boot,
    3.84 -closely followed by "domain 0" running the Xenlinux kernel. The boot
    3.85 -messages can also sent to the serial line by specifying the baud rate
    3.86 -on the Xen cmdline (e.g., 'com1=9600,8n1'); this can be very useful
    3.87 -for debugging should anything important scroll off the screen. Xen's
    3.88 -startup messages will look quite familiar as much of the hardware
    3.89 -initialisation (SMP boot, apic setup) and device drivers are derived
    3.90 -from Linux.
    3.91 -
    3.92 -If everything is well, you should see the linux rc scripts start a
    3.93 -bunch of standard services including sshd.  Login on the console or
    3.94 -via ssh::
    3.95 - username: user         root
    3.96 - password: xendemo      xendemo
    3.97 -
    3.98 -Once logged in, it should look just like any regular linux box. All
    3.99 -the usual tools and commands should work as per usual.  However,
   3.100 -because of the poor random access performance of CD drives, the
   3.101 -machine will feel very slugish, and you may run out of memory if you
   3.102 -make significant modifications to the ramfs filesystem -- for the full
   3.103 -experience, install a Xen and Xenlinux image on you hard drive :-)
   3.104 -
   3.105 -You can configure networking, either with 'dhclient' or manually via
   3.106 -'ifconfig' and 'route', remembering to edit /etc/resolv.conf if you
   3.107 -want DNS to work.
   3.108 -
   3.109 -You can start an X server with 'startx'. It defaults to a conservative
   3.110 -1024x768, but you can edit the script for higher resoloutions.  The CD
   3.111 -contains a load of standard software. You should be able to start
   3.112 -Apache, PostgreSQL, Mozilla etc in the normal way, but because
   3.113 -everything is running off CD the performance will be very sluggish and
   3.114 -you may run out of memory for the 'tmpfs' file system.  You may wish
   3.115 -to go ahead and install Xen/Xenlinux on your hard drive, either
   3.116 -dropping Xen and the Xenlinux kernel down onto a pre-existing Linux
   3.117 -distribution, or using the file systems from the CD (which are based
   3.118 -on RH9). See the installation instructions later in this document.
   3.119 -
   3.120 -If your video card requires 'agpgart' then it unfortunately won't yet
   3.121 -work with Xen, and you'll only be able to configure a VGA X
   3.122 -server. We're working on a fix for this for the next release.
   3.123 -
   3.124 -If you want to browse the Xen / Xenlinux source, it's all located
   3.125 -under /usr/local/src/xen-2.0.bk, complete with BitKeeper
   3.126 -repository. We've also included source code and configuration
   3.127 -information for the various benchmarks we used in the SOSP paper.
   3.128 -
   3.129 -
   3.130 -Starting other domains
   3.131 -======================
   3.132 -
   3.133 -The first thing you need to do is to start the "xend" control daemon
   3.134 -with "xend start". You may wish to add an appropriate link to xend in
   3.135 -you /etc/rcX.d directory e.g. "ln -sf ../init.d/xend S97xend"
   3.136 -
   3.137 -If you're not intending to configure the new domain with an IP address
   3.138 -on your LAN, then you'll probably want to use NAT. The
   3.139 -'xen_nat_enable' installs a few useful iptables rules into domain0 to
   3.140 -enable NAT. [NB: We plan to support RSIP in future]
   3.141 -
   3.142 -Xen has a management interface that can be manipulated from domain0 to
   3.143 -create new domains, control their CPU, network and memory resource
   3.144 -allocations, allocate IP addresses, grant access to disk partitions,
   3.145 -and suspend/resume domains to files, etc.  The management interface is
   3.146 -implemented as a set of library functions (implemented in C) for which
   3.147 -there are Python language bindings. 
   3.148 -
   3.149 -We have developed a simple set of example python tools for
   3.150 -manipulating the interface, with the intention that more sophisticated
   3.151 -high-level management tools will be developed in due course. Within
   3.152 -the source repository the tools live in tools/examples/ but are
   3.153 -installed in /usr/local/bin/ on the CD.
   3.154 -
   3.155 -Starting a new domain is achieved using the command 'xm create' which
   3.156 -allocates resources to a new domain, populates it with a kernel image
   3.157 -(and optionally a ramdisk) and then starts it.
   3.158 -
   3.159 -It parses a configuration file written in the Python language, the
   3.160 -default location of which is "/etc/xc/defaults", but this may be
   3.161 -overridden with the "-f" option. For the Demo CD, the defaults file
   3.162 -will cause domains to be created with ram-based root file systems, and
   3.163 -mount their /usr partition from the CD, just like domain0. (If you are
   3.164 -writing your own config file, the "example" script may be a better
   3.165 -starting point)
   3.166 -
   3.167 -Variables can be initialised and passed into configuration files. Some
   3.168 -of these may be compulsory, others optional.
   3.169 -
   3.170 -The 'defaults' file on the CD requires the 'ip' variable to be set to
   3.171 -tell Xen what IP address(es) should be routed to this domain.  Xen
   3.172 -will route packets to the domain if they bear one of these addresses
   3.173 -as a destination address, and will also ensure that packets sent from
   3.174 -the domain contain one of the addresses as a source address (to
   3.175 -prevent spoofing).  If multiple IP addresses are to be assigned to a
   3.176 -domain they can be listed in a comma separated list (with no
   3.177 -whitespace).
   3.178 -
   3.179 -The 'mem' variable can be used to change the default memory allocation
   3.180 -of 64MB. For example to start a domain with two IP addresses and
   3.181 -72MB:
   3.182 -
   3.183 -  xm create ip=128.23.45.34,169.254.1.1mem=72
   3.184 -
   3.185 -When invoked with the '-n' option 'xm create' will do a dry run
   3.186 -and just print out what resources and configuration the domain will
   3.187 -have e.g.:
   3.188 -
   3.189 -  [root@xendemo]# xm create -n ip=commando-1.xeno,169.254.2.3 mem=100
   3.190 -  Parsing config file 'defaults'
   3.191 -
   3.192 -  VM image           : "/boot/xenlinux.gz"
   3.193 -  VM ramdisk         : "/boot/initrd.gz"
   3.194 -  VM memory (MB)     : "100"
   3.195 -  VM IP address(es)  : "128.232.38.51:169.254.2.3"
   3.196 -  VM block device(s) : "phy:cdrom,hdd,r"
   3.197 -  VM cmdline         : "ip=128.232.38.51:169.254.1.0:128.232.32.1:255.255.240.0::eth0:off root=/dev/ram0 rw init=/linuxrc 4 LOCALIP=169.254.2.3"
   3.198 -
   3.199 -xm create will print the local TCP port to which you should
   3.200 -connect to perform console I/O. A suitable console client is provided
   3.201 -by the Python module xenctl.console_client: running this module from
   3.202 -the command line with <host> and <port> parameters will start a
   3.203 -terminal session. This module is also installed as /usr/bin/xencons,
   3.204 -from a copy in tools/misc/xencons.  An alternative to manually running
   3.205 -a terminal client is to specify '-c' to xm create, or add
   3.206 -'auto_console=True' to the defaults file. This will cause
   3.207 -'xm create' to automatically become the console terminal after
   3.208 -starting the domain.
   3.209 -
   3.210 -The 169.254.x.x network is special in that it is the 'link local'
   3.211 -subnet, and is isolated from the external network and hence can only
   3.212 -be used for communication between virtual machines. By convention, we
   3.213 -usually give each domain a link local address. The startup scripts on
   3.214 -the CD have been modified to accept a LINKLOCAL= parameter on the
   3.215 -kernel command line and initialise an IP alias accordingly (see
   3.216 -/etc/sysinit/network-scripts/ifcfg-eth0).
   3.217 -
   3.218 -Linux only allows one IP address to be specified on the kernel command
   3.219 -line, so if you specify multiple IP addresses you'll need to configure
   3.220 -the new Linux VM with the other addresses manually (using ifconfig)
   3.221 -having logged in.
   3.222 -
   3.223 -If you inspect the 'defaults' config script you'll see that the new
   3.224 -domain was started with a '4' on the kernel command line to tell
   3.225 -'init' to go to runlevel 4 rather than the default of 3 used by
   3.226 -domain0. This is done simply to suppress a bunch of harmless error
   3.227 -messages that would otherwise occur when the new (unprivileged) domain
   3.228 -tried to access physical hardware resources to try setting the
   3.229 -hwclock, system font, run gpm etc.
   3.230 -
   3.231 -After it's booted, you should be able to ssh into your new domain from
   3.232 -domain0 using the link local 19.254.x.x address you assigned. If you
   3.233 -assigned a further IP address you should be able to ssh in using that
   3.234 -address too. If you ran the xen_enable_nat script, a bunch of port
   3.235 -redirects have been installed to enable you to ssh in to other domains
   3.236 -remotely even if you didn't assign an externally routeable address.
   3.237 -To access the new virtual machine remotely, use:
   3.238 -
   3.239 - ssh -p2201 root@IP.address.Of.Domain0  # use 2202 for domain 2 etc.
   3.240 -
   3.241 -You can manipulate running domains using the xm tool.
   3.242 -Invoking it without arguments prints some usage information.
   3.243 -
   3.244 -To see what domains are running, run 'xm list'.  Using the
   3.245 -tool you can change scheduling parameters, pause a domain, send it a
   3.246 -shutdown request, or blow it away with the 'destroy' command. You can
   3.247 -even suspend it to disk (but you probably won't have enough memory to
   3.248 -do the latter if you're running off the demo CD).
   3.249 -
   3.250 -To find usage information for xm, run the script with no arguments or
   3.251 -with the 'help' argument.  To get help on a particular xm command, use
   3.252 -'xm cmdname help'.
   3.253 -
   3.254 -
   3.255 -Troubleshooting Problems
   3.256 -========================
   3.257 -
   3.258 -If you have problems booting Xen, there are a number of boot parameters 
   3.259 -that may be able to help diagnose problems:
   3.260 -
   3.261 - ignorebiostables Disable parsing of BIOS-supplied tables. This may
   3.262 -                  help with some chipsets that aren't fully supported
   3.263 -                  by Xen. If you specify this option then ACPI tables are
   3.264 -                  also ignored, and SMP support is disabled.
   3.265 -
   3.266 - noreboot         Don't reboot the machine automatically on errors.
   3.267 -                  This is useful to catch debug output if you aren't
   3.268 -                  catching console messages via the serial line.
   3.269 -
   3.270 - nosmp		  Disable SMP support.
   3.271 -                  This option is implied by 'ignorebiostables'.
   3.272 -
   3.273 - noacpi   	  Disable ACPI tables, which confuse Xen on some chipsets.
   3.274 -                  This option is implied by 'ignorebiostables'.
   3.275 -
   3.276 - watchdog	  Enable NMI watchdog which can report certain failures.
   3.277 -
   3.278 - noht		  Disable Hyperthreading.
   3.279 -
   3.280 - badpage=<page number>[,<page number>]*
   3.281 -                  Specify a list of pages not to be allocated for use 
   3.282 -                  because they contain bad bytes. For example, if your
   3.283 -                  memory tester says that byte 0x12345678 is bad, you would
   3.284 -                  place 'badpage=0x12345' on Xen's command line (i.e., the
   3.285 -                  last three digits of the byte address are not included!).
   3.286 -
   3.287 - com1=<baud>,DPS[,<io_base>,<irq>]
   3.288 - com2=<baud>,DPS[,<io_base>,<irq>]
   3.289 -                  Xen supports up to two 16550-compatible serial ports.
   3.290 -                  For example: 'com1=9600,8n1,0x408,5' maps COM1 to a
   3.291 -                  9600-baud port, 8 data bits, no parity, 1 stop bit,
   3.292 -                  I/O port base 0x408, IRQ 5.
   3.293 -                  If the I/O base and IRQ are standard (com1:0x3f8,4;
   3.294 -                  com2:0x2f8,3) then they need not be specified.
   3.295 -
   3.296 - console=<specifier list>
   3.297 -                  Specify the destination for Xen console I/O.
   3.298 -                  This is a comma-separated list of, for example:
   3.299 -                   vga:  use VGA console and allow keyboard input
   3.300 -                   com1: use serial port com1
   3.301 -                   com2H: use serial port com2. Transmitted chars will
   3.302 -                          have the MSB set. Received chars must have
   3.303 -                          MSB set.
   3.304 -                   com2L: use serial port com2. Transmitted chars will
   3.305 -                          have the MSB cleared. Received chars must
   3.306 -                          have MSB cleared.
   3.307 -                  The latter two examples allow a single port to be
   3.308 -                  shared by two subsystems (eg. console and
   3.309 -                  debugger). Sharing is controlled by MSB of each
   3.310 -                  transmitted/received character.
   3.311 - [NB. Default for this option is 'com1,vga']
   3.312 -
   3.313 - conswitch=<switch-char><auto-switch-char>
   3.314 -                  Specify how to switch serial-console input between
   3.315 -                  Xen and DOM0. The required sequence is CTRL-<switch_char>
   3.316 -                  pressed three times. Specifying '`' disables switching.
   3.317 -                  The <auto-switch-char> specifies whether Xen should
   3.318 -                  auto-switch input to DOM0 when it boots -- if it is 'x'
   3.319 -                  then auto-switching is disabled. Any other value, or
   3.320 -                  omitting the character, enables auto-switching.
   3.321 - [NB. Default for this option is 'a']
   3.322 -
   3.323 - nmi=<nmi-error-behaviour>
   3.324 -                  Specify what to do with an NMI parity or I/O error.
   3.325 -                  'nmi=fatal':  Xen prints a diagnostic and then hangs.
   3.326 -                  'nmi=dom0':   Inform DOM0 of the NMI.
   3.327 -                  'nmi=ignore': Ignore the NMI.
   3.328 - [NB. Default is 'dom0' ('fatal' for debug builds).]
   3.329 -
   3.330 - dom0_mem=xxx 	  Set the initial amount of memory for domain0.
   3.331 -
   3.332 - pdb=xxx          Enable the pervasive debugger.  See docs/pdb.txt
   3.333 -                  xxx defines how the gdb stub will communicate:
   3.334 -                     com1    use com1
   3.335 -                     com1H   use com1 (with high bit set)
   3.336 -                     com2    use on com2
   3.337 -                     com2H   use com2 (with high bit set)
   3.338 -
   3.339 -It's probably a good idea to join the Xen developer's mailing list on
   3.340 -Sourceforge:    http://lists.sourceforge.net/lists/listinfo/xen-devel   
   3.341 -
   3.342 -
   3.343 -About The Xen Demo CD
   3.344 -=====================
   3.345 -
   3.346 -The purpose of the Demo CD is to distribute a snapshot of Xen's
   3.347 -source, and simultaneously provide a convenient means for enabling
   3.348 -people to get experience playing with Xen without needing to install
   3.349 -it on their hard drive. If you decide to install Xen/Xenlinux you can
   3.350 -do so simply by following the installation instructions below -- which
   3.351 -essentially involves copying the contents of the CD on to a suitably
   3.352 -formated disk partition, and then installing or updating the Grub
   3.353 -bootloader.
   3.354 -
   3.355 -This is a bootable CD that loads Xen, and then a Linux 2.4.27 OS image
   3.356 -ported to run on Xen. The CD contains a copy of a file system based on
   3.357 -the RedHat 9 distribution that is able to run directly off the CD
   3.358 -("live ISO"), using a "tmpfs" RAM-based file system for root (/etc
   3.359 -/var etc). Changes you make to the tmpfs will obviously not be
   3.360 -persistent across reboots!
   3.361 -
   3.362 -Because of the use of a RAM-based file system for root, you'll need
   3.363 -plenty of memory to run this CD -- something like 96MB per VM. This is
   3.364 -not a restriction of Xen : once you've installed Xen, Xenlinux and
   3.365 -the file system images on your hard drive you'll find you can boot VMs
   3.366 -in just a few MBs.
   3.367 -
   3.368 -The CD contains a snapshot of the Xen and Xenlinux code base that we
   3.369 -believe to be pretty stable, but lacks some of the features that are
   3.370 -currently still work in progress e.g. OS suspend/resume to disk, and
   3.371 -various memory management enhancements to provide fast inter-OS
   3.372 -communication and sharing of memory pages between OSs. We'll release
   3.373 -newer snapshots as required, making use of a BitKeeper repository
   3.374 -hosted on http://xen.bkbits.net (follow instructions from the project
   3.375 -home page).  We're obviously grateful to receive any bug fixes or
   3.376 -other code you can contribute. We suggest you join the
   3.377 -xen-devel@lists.sourceforge.net mailing list.
   3.378 -
   3.379 -
   3.380 -Installing from the CD
   3.381 -======================
   3.382 -
   3.383 -If you're installing Xen/Xenlinux onto an existing linux file system
   3.384 -distribution, just copy the Xen VMM (/boot/image.gz) and Xenlinux
   3.385 -kernels (/boot/xenlinux.gz), then modify the Grub config
   3.386 -(/boot/grub/menu.lst or /boot/grub/grub.conf) on the target system.
   3.387 -It should work on pretty much any distribution.
   3.388 -
   3.389 -Xen is a "multiboot" standard boot image. Despite being a 'standard',
   3.390 -few boot loaders actually support it. The only two we know of are
   3.391 -Grub, and our modified version of linux kexec (for booting off a
   3.392 -XenoBoot CD -- PlanetLab have adopted the same boot CD approach).
   3.393 -
   3.394 -If you need to install grub on your system, you can do so either by
   3.395 -building the Grub source tree
   3.396 -/usr/local/src/grub-0.93-iso9660-splashimage or by copying over all
   3.397 -the files in /boot/grub and then running /sbin/grub and following the
   3.398 -usual grub documentation. You'll then need to edit the Grub
   3.399 -config file.
   3.400 -
   3.401 -A typical Grub menu option might look like:
   3.402 -
   3.403 -title Xen 2.0 / Xenlinux 2.4.27
   3.404 -        kernel /boot/xen.gz dom0_mem=131072 com1=115200 noht watchdog
   3.405 -        module /boot/vmlinuz-2.4.27-xen0 root=/dev/sda4 ro
   3.406 -
   3.407 -The first line specifies which Xen image to use, and what command line
   3.408 -arguments to pass to Xen. In this case we set the maximum amount of
   3.409 -memory to allocate to domain0, and enable serial I/O on COM1 at 115200
   3.410 -baud.  We could also disable smp support (nosmp) or disable
   3.411 -hyper-threading support (noht). 
   3.412 -
   3.413 -The second line specifies which xenlinux image to use, and the
   3.414 -standard linux command line arguments to pass to the kernel. In this
   3.415 -case, we're configuring the root partition and stating that it should
   3.416 -initially be mounted read-only (normal practice).
   3.417 -
   3.418 -If we were booting with an initial ram disk (initrd), then this would
   3.419 -require a second "module" line.
   3.420 -
   3.421 -Installing the Xen tools and source
   3.422 -===================================
   3.423 -
   3.424 -The tools and source live in the /usr/local/src/xen-2.0.bk directory on
   3.425 -the CD (and may also be downloaded from the project downloads
   3.426 -page). You'll need to copy them to some mutable storage before using
   3.427 -them.
   3.428 -
   3.429 -If you have the BitKeeper BK tools installed you can check the
   3.430 -repository is up to date by cd'ing into the xeno-2.0.bk directory and
   3.431 -typing 'bk pull' (assuming you have an Internet connection). 
   3.432 -
   3.433 -You can rebuild Xen, the tools and XenLinux by typing 'make
   3.434 -world'. You can install them to the standard directories with 'make
   3.435 -install', or into the ./install subtree with 'make dist'.
   3.436 -
   3.437 -
   3.438 -Modifying xc_mycreatelinuxdom1.py
   3.439 -=================================
   3.440 -
   3.441 -xc_mycreatelinuxdom1.py.py can be used to set the new kernel's command line,
   3.442 -and hence determine what it uses as a root file system, etc. Although
   3.443 -the default is to boot in the same manner that domain0 did (using the
   3.444 -RAM-based file system for root and the CD for /usr) it's possible to
   3.445 -configure any of the following possibilities, for example:
   3.446 -
   3.447 - * initrd=/boot/initrd init=/linuxrc
   3.448 -     boot using an initial ram disk, executing /linuxrc (as per this CD)     
   3.449 -
   3.450 - * root=/dev/hda3 ro
   3.451 -     boot using a standard hard disk partition as root
   3.452 -     !!! remember to grant access in createlinuxdom.py.
   3.453 -
   3.454 - * root=/dev/xvda1 ro
   3.455 -     boot using a pre-configured 'virtual block device' that will be
   3.456 -     attached to a virtual disk that previously has had a file system
   3.457 -     installed on it.
   3.458 -
   3.459 - * root=/dev/nfs nfsroot=/path/on/server ip=<blah_including server_IP>
   3.460 -     Boot using an NFS mounted root file system. This could be from a
   3.461 -     remote NFS server, or from an NFS server running in another
   3.462 -     domain. The latter is rather a useful option.
   3.463 -
   3.464 -A typical setup might be to allocate a standard disk partition for
   3.465 -each domain and populate it with files. To save space, having a shared
   3.466 -read-only usr partition might make sense.
   3.467 -
   3.468 -Block devices should only be shared between domains in a read-only
   3.469 -fashion otherwise the linux kernels will obviously get very confused
   3.470 -as the file system structure may change underneath them (having the
   3.471 -same partition mounted rw twice is a sure fire way to cause
   3.472 -irreparable damage)!  If you want read-write sharing, export the
   3.473 -directory to other domains via NFS from domain0.
   3.474 -
   3.475 -
   3.476 -
   3.477 -
   3.478 -Installing the file systems from the CD
   3.479 -=======================================
   3.480 -
   3.481 -If you haven't got an existing Linux installation onto which you can
   3.482 -just drop down the Xen and Xenlinux images, then the file systems on
   3.483 -the CD provide a quick way of doing an install. However, you would be
   3.484 -better off in the long run doing a proper install of your preferred
   3.485 -distro and installing Xen onto that, rather than just doing the hack
   3.486 -described below:
   3.487 -
   3.488 -Choose one or two partitions, depending on whether you want a separate
   3.489 -/usr or not. Make file systems on it/them e.g.: 
   3.490 -  mkfs -t ext3 /dev/hda3
   3.491 -  [or mkfs -t ext2 /dev/hda3 && tune2fs -j /dev/hda3 if using an old
   3.492 -version of mkfs]
   3.493 -
   3.494 -Next, mount the file system(s) e.g.:
   3.495 -  mkdir /mnt/root && mount /dev/hda3 /mnt/root
   3.496 -  [mkdir /mnt/usr && mount /dev/hda4 /mnt/usr]
   3.497 -  
   3.498 -To install the root file system, simply untar /usr/XenDemoCD/root.tar.gz:
   3.499 -  cd /mnt/root && tar -zxpf /usr/XenDemoCD/root.tar.gz
   3.500 -
   3.501 -You'll need to edit /mnt/root/etc/fstab to reflect your file system
   3.502 -configuration. Changing the password file (etc/shadow) is probably a
   3.503 -good idea too.
   3.504 -
   3.505 -To install the usr file system, copy the file system from CD on /usr,
   3.506 -though leaving out the "XenDemoCD" and "boot" directories:
   3.507 -  cd /usr && cp -a X11R6 etc java libexec root src bin dict kerberos local sbin tmp doc include lib man share /mnt/usr
   3.508 -
   3.509 -If you intend to boot off these file systems (i.e. use them for
   3.510 -domain 0), then you probably want to copy the /usr/boot directory on
   3.511 -the cd over the top of the current symlink to /boot on your root
   3.512 -filesystem (after deleting the current symlink) i.e.:
   3.513 -  cd /mnt/root ; rm boot ; cp -a /usr/boot .
   3.514 -
   3.515 -The XenDemoCD directory is only useful if you want to build your own
   3.516 -version of the XenDemoCD (see below).
   3.517 -
   3.518 -
   3.519 -Debugging
   3.520 -=========
   3.521 -
   3.522 -Xen has a set of debugging features that can be useful to try and
   3.523 -figure out what's going on. Hit 'h' on the serial line (if you
   3.524 -specified a baud rate on the Xen command line) or ScrollLock-h on the
   3.525 -keyboard to get a list of supported commands.
   3.526 -
   3.527 -If you have a crash you'll likely get a crash dump containing an EIP
   3.528 -(PC) which, along with an 'objdump -d image', can be useful in
   3.529 -figuring out what's happened.  Debug a Xenlinux image just as you
   3.530 -would any other Linux kernel.
   3.531 -
   3.532 -We supply a handy debug terminal program which you can find in
   3.533 -/usr/local/src/xen-2.0.bk/tools/misc/miniterm/
   3.534 -This should be built and executed on another machine that is connected
   3.535 -via a null modem cable. Documentation is included.
   3.536 -Alternatively, if the Xen machine is connected to a serial-port server
   3.537 -then we supply a dumb TCP terminal client:
   3.538 - 'tools/xenctl/lib/console_client.py <server host> <server port>'
   3.539 -
   3.540 -
   3.541 -Installing Xen / Xenlinux on a RedHat distribution
   3.542 -===================================================
   3.543 -
   3.544 -When using Xen / Xenlinux on a standard Linux distribution there are
   3.545 -a couple of things to watch out for:
   3.546 -
   3.547 -The first Linux VM that is started when Xen boots start (Domain 0) is
   3.548 -given direct access to the graphics card, so it may use it as a
   3.549 -console. Other domains don't have ttyN consoles, so attempts to run a
   3.550 -'mingetty' against them will fail, generating periodic warning
   3.551 -messages from 'init' about services respawning too fast. They should
   3.552 -work for domain0 just fine.  
   3.553 -IMPORTANT: To prevent warning messages when running RH9 you'll need to
   3.554 -remove ttyN from /etc/inittab for domains>0.  Due to a bug in the RH9
   3.555 -/etc/rc.sysinit script #'ing the lines out of /etc/inittab won't work
   3.556 -as it ignores the '#' and tries to access them anyway.
   3.557 -
   3.558 -Every Xenlinux instance owns a bidirectional 'virtual console'.
   3.559 -The device node to which this console is attached can be configured
   3.560 -by specifying 'xencons=' on the OS command line:
   3.561 - 'xencons=off'  --> disable virtual console
   3.562 - 'xencons=tty'  --> attach console to /dev/tty1 (tty0 at boot-time)
   3.563 - 'xencons=ttyS' --> attach console to /dev/ttyS0
   3.564 -The default is to attach to /dev/tty1, and also to create dummy
   3.565 -devices for /dev/tty2-63 to avoid warnings from many standard distro
   3.566 -startup scripts. The exception is domain 0, which by default attaches
   3.567 -to /dev/ttyS0.
   3.568 -
   3.569 -Note that, because domains>0 don't have any privileged access at all,
   3.570 -certain commands in the default boot sequence will fail e.g. attempts
   3.571 -to update the hwclock, change the console font, update the keytable
   3.572 -map, start apmd (power management), or gpm (mouse cursor).  Either
   3.573 -ignore the errors, or remove them from the startup scripts.  Deleting
   3.574 -the following links are a good start: S24pcmcia S09isdn S17keytable
   3.575 -S26apmd S85gpm
   3.576 -
   3.577 -If you want to use a single root file system that works cleanly for
   3.578 -domain0 and domains>0, one trick is to use different 'init' run
   3.579 -levels. For example, on the Xen Demo CD we use run level 3 for domain
   3.580 -0, and run level 4 for domains>0. This enables different startup
   3.581 -scripts to be run in depending on the run level number passed on the
   3.582 -kernel command line.
   3.583 -
   3.584 -Xenlinux kernels can be built to use runtime loadable modules just
   3.585 -like normal linux kernels. Modules should be installed under
   3.586 -/lib/modules in the normal way.
   3.587 -
   3.588 -If there's some kernel feature that hasn't been built into our default
   3.589 -kernel, there's a pretty good change that if its a non-hardware
   3.590 -related option you'll just be able to enable it and rebuild.  If its
   3.591 -not on the xconfig menu, hack the arch/xen/config.in to put the menu
   3.592 -back in.
   3.593 -
   3.594 -If you're going to use the link local 169.254.1.x addresses to
   3.595 -communicate between VMs, there are a couple of other issues to watch
   3.596 -out for. RH9 appears to have a bug where by default it configures the
   3.597 -loopback interface with a 169.254 address, which stops it working
   3.598 -properly on eth0 for communicating with other domains.
   3.599 -
   3.600 -This utterly daft RH9 behaviour can be stopped by appending
   3.601 -"NOZEROCONF=yes" to /etc/sysconfig/networking-scripts/ifcfg-lo
   3.602 -
   3.603 -If you're going to use NFS root files systems mounted either from an
   3.604 -external server or from domain0 there are a couple of other gotchas.
   3.605 -The default /etc/sysconfig/iptables rules block NFS, so part way
   3.606 -through the boot sequence things will suddenly go dead.
   3.607 -
   3.608 -If you're planning on having a separate NFS /usr partition, the RH9
   3.609 -boot scripts don't make life easy, as they attempt to mount NFS file
   3.610 -systems way to late in the boot process. The easiest way I found to do
   3.611 -this was to have a '/linuxrc' script run ahead of /sbin/init that
   3.612 -mounts /usr:
   3.613 - #!/bin/bash
   3.614 - /sbin/ipconfig lo 127.0.0.1
   3.615 - /sbin/portmap
   3.616 - /bin/mount /usr
   3.617 - exec /sbin/init "$@" <>/dev/console 2>&1
   3.618 -
   3.619 -The one slight complication with the above is that /sbib/portmap is
   3.620 -dynamically linked against /usr/lib/libwrap.so.0 Since this is in
   3.621 -/usr, it won't work. I solved this by copying the file (and link)
   3.622 -below the /usr mount point, and just let the file be 'covered' when
   3.623 -the mount happens.
   3.624 -
   3.625 -In some installations, where a shared read-only /usr is being used, it
   3.626 -may be desirable to move other large directories over into the
   3.627 -read-only /usr. For example, on the XenDemoCD we replace /bin /lib and
   3.628 -/sbin with links into /usr/root/bin /usr/root/lib and /usr/root/sbin
   3.629 -respectively. This creates other problems for running the /linuxrc
   3.630 -script, requiring bash, portmap, mount, ifconfig, and a handful of
   3.631 -other shared libraries to be copied below the mount point. I guess I
   3.632 -should have written a little statically linked C program...
   3.633 -
   3.634 -
   3.635 -
   3.636 -Description of how the XenDemoCD boots
   3.637 -======================================
   3.638 -
   3.639 -1. Grub is used to load Xen, a Xenlinux kernel, and an initrd (initial
   3.640 -ram disk). [The source of the version of Grub used is in /usr/local/src]
   3.641 -
   3.642 -2. the init=/linuxrc command line causes linux to execute /linuxrc in
   3.643 -the initrd. 
   3.644 -
   3.645 -3. the /linuxrc file attempts to mount the CD by trying the likely
   3.646 -locations : /dev/hd[abcd].  
   3.647 -
   3.648 -4. it then creates a 'tmpfs' file system and untars the
   3.649 -'XenDemoCD/root.tar.gz' file into the tmpfs. This contains hopefully
   3.650 -all the files that need to be mutable (this would be so much easier
   3.651 -if Linux supported 'stacked' or union file systems...)
   3.652 -
   3.653 -5. Next, /linuxrc uses the pivot_root call to change the root file
   3.654 -system to the tmpfs, with the CD mounted as /usr.
   3.655 -
   3.656 -6. It then invokes /sbin/init in the tmpfs and the boot proceeds
   3.657 -normally.
   3.658 -
   3.659 -
   3.660 -Building your own version of the XenDemoCD
   3.661 -==========================================
   3.662 -
   3.663 -The 'live ISO' version of RedHat is based heavily on Peter Anvin's
   3.664 -SuperRescue CD version 2.1.2 and J. McDaniel's Plan-B:
   3.665 -
   3.666 - http://www.kernel.org/pub/dist/superrescue/v2/
   3.667 - http://projectplanb.org/
   3.668 -
   3.669 -Since Xen uses a "multiboot" image format, it was necessary to change
   3.670 -the bootloader from isolinux to Grub0.93 with Leonid Lisovskiy's
   3.671 -<lly@pisem.net> grub.0.93-iso9660.patch
   3.672 -
   3.673 -The Xen Demo CD contains all of the build scripts that were used to
   3.674 -create it, so it is possible to 'unpack' the current iso, modifiy it,
   3.675 -then build a new iso. The procedure for doing so is as follows:
   3.676 -
   3.677 -First, mount either the CD, or the iso image of the CD:
   3.678 - 
   3.679 -  mount /dev/cdrom /mnt/cdrom 
   3.680 -or:
   3.681 -  mount -o loop xendemo-1.0.iso  /mnt/cdrom
   3.682 -
   3.683 -cd to the directory you want to 'unpack' the iso into then run the
   3.684 -unpack script:
   3.685 -
   3.686 -  cd /local/xendemocd
   3.687 -  /mnt/cdrom/XenDemoCD/unpack-iso.sh
   3.688 -
   3.689 -The result is a 'build' directory containing the file system tree
   3.690 -under the 'root' directory. e.g. /local/xendemocd/build/root
   3.691 -
   3.692 -To add or remove rpms, its possible to use 'rpm' with the --root
   3.693 -option to set the path. For more complex changes, it easiest to boot a
   3.694 -machine using using the tree via NFS root. Before doing this, you'll
   3.695 -need to edit fstab to comment out the seperate mount of /usr.
   3.696 -
   3.697 -One thing to watch out for: as part of the CD build process, the
   3.698 -contents of the 'rootpatch' tree gets copied over the existing 'root'
   3.699 -tree replacing various files. The intention of the rootpatch tree is
   3.700 -to contain the files that have been modified from the original RH
   3.701 -distribution (e.g. various /etc files). This was done to make it
   3.702 -easier to upgrade to newer RH versions in the future. The downside of
   3.703 -this is that if you edit an existing file in the root tree you should
   3.704 -check that you don't also need to propagate the change to the
   3.705 -rootpatch tree to avoid it being overwritten.
   3.706 -
   3.707 -Once you've made the changes and want to build a new iso, here's the
   3.708 -procedure:
   3.709 -
   3.710 -cd /local/xendemocd/build  
   3.711 -echo '<put_your_name_here>' > Builder
   3.712 -./make.sh put_your_version_id_here >../buildlog 2>&1            
   3.713 -
   3.714 -This process can take 30 mins even on a fast machine, but you should
   3.715 -eventually end up with an iso image in the build directory.
   3.716 -
   3.717 -Notes:
   3.718 -
   3.719 -  root      - the root of the file system heirarchy as presented to the
   3.720 -              running system
   3.721 -
   3.722 -  rootpatch - contains files that have been modified from the standard
   3.723 -              RH, and copied over the root tree as part of the build
   3.724 -              procedure.
   3.725 -
   3.726 -  irtree    - the file system tree that will go into the initrd (initial
   3.727 -              ram disk)
   3.728 -
   3.729 -  work      - a working directory used in the build process
   3.730 -
   3.731 -  usr       - this should really be in 'work' as its created as part of the
   3.732 -              build process. It contains the 'immutable' files that will
   3.733 -              be served from the CD rather than the tmpfs containing the
   3.734 -              contents of root.tar.gz. Some files that are normally in /etc 
   3.735 -              or /var that are large and actually unlikely to need changing 
   3.736 -              have been moved into /usr/root and replaced with links.
   3.737 -
   3.738 -
   3.739 -Ian Pratt
   3.740 -9 Sep 2003
     4.1 --- a/TODO	Tue Oct 26 17:08:38 2004 +0000
     4.2 +++ b/TODO	Thu Oct 28 16:15:46 2004 +0000
     4.3 @@ -1,43 +1,34 @@
     4.4 -
     4.5 -
     4.6 -Known limitations and work in progress
     4.7 -======================================
     4.8 +Future plans and enhancements
     4.9 +=============================
    4.10  
    4.11 -The current Xen Virtual Firewall Router (VFR) implementation in the
    4.12 -snapshot tree is very rudimentary, and in particular, lacks the RSIP
    4.13 -IP port-space sharing across domains that provides a better
    4.14 -alternative to NAT.  There's a complete new implementation under
    4.15 -development which also supports much better logging and auditing
    4.16 -support. For now, if you want NAT, see the xen_nat_enable scripts and
    4.17 -get domain0 to do it for you.
    4.18 +For up-to-date details of features currently under implementation,
    4.19 +visit the Xen project roadmap at:
    4.20 +http://www.cl.cam.ac.uk/Research/SRG/netos/xen/roadmap.html
    4.21  
    4.22 +IO enhancements
    4.23 +---------------
    4.24  There are also a number of memory management enhancements that didn't
    4.25  make this release: We have plans for a "universal buffer cache" that
    4.26  enables otherwise unused system memory to be used by domains in a
    4.27 -read-only fashion. We also have plans for inter-domain shared-memory
    4.28 -to enable high-performance bulk transport for cases where the usual
    4.29 -internal networking performance isn't good enough (e.g. communication
    4.30 -with a internal file server on another domain).
    4.31 +read-only fashion.
    4.32  
    4.33 -We have the equivalent of balloon driver functionality to control
    4.34 -domain's memory usage, enabling a domain to give back unused pages to
    4.35 -Xen. This needs properly documenting, and perhaps a way of domain0
    4.36 -signalling to a domain that it requires it to reduce its memory
    4.37 -footprint, rather than just the domain volunteering (see section on
    4.38 -the improved control interface).
    4.39 -
    4.40 +Disk Scheduling
    4.41 +---------------
    4.42  The current disk scheduler is rather simplistic (batch round robin),
    4.43  and could be replaced by e.g. Cello if we have QoS isolation
    4.44  problems. For most things it seems to work OK, but there's currently
    4.45  no service differentiation or weighting.
    4.46  
    4.47 +Improved load-balancing
    4.48 +-----------------------
    4.49  Currently, although Xen runs on SMP and SMT (hyperthreaded) machines,
    4.50  the scheduling is far from smart -- domains are currently statically
    4.51  assigned to a CPU when they are created (in a round robin fashion).
    4.52 -The scheduler needs to be modified such that before going idle a
    4.53 -logical CPU looks for work on other run queues (particularly on the
    4.54 -same physical CPU). 
    4.55 +We'd like to see a user-space load-balancing daemon that can shift
    4.56 +domains between CPUs as their activity changes.
    4.57  
    4.58 +Multiprocessor Guest VMs
    4.59 +------------------------
    4.60  Xen currently only supports uniprocessor guest OSes. We have designed
    4.61  the Xen interface with MP guests in mind, and plan to build an MP
    4.62  Linux guest in due course. Basically, an MP guest would consist of
    4.63 @@ -48,3 +39,21 @@ page directory to a write-able page, we 
    4.64  still has the page in its TLB to ensure memory system integrity.  One
    4.65  other issue for supporting MP guests is that we'll need some sort of
    4.66  CPU gang scheduler, which will require some research.
    4.67 +
    4.68 +Cluster Management
    4.69 +------------------
    4.70 +There have been discussions regarding a unified cluster controller
    4.71 +for Xen deployments.  This would leverage the existing features of
    4.72 +Xen to present a uniform control interface for managing a cluster
    4.73 +as a pool of resources, rather than a set of completely distinct
    4.74 +machines.
    4.75 +
    4.76 +PAE Support on 32-bit x86
    4.77 +-------------------------
    4.78 +Xen can currently use up to 4GB of memory. It's possible for x86
    4.79 +machines to address more than that (64GB), but it requires using a
    4.80 +different page table format (3-level rather than 2-level) that we
    4.81 +currently don't support. Adding 3-level PAE support wouldn't be
    4.82 +difficult, but we'd also need to add support to all the guest
    4.83 +OSs. We do not plan to add this support ourselves but volunteers
    4.84 +are welcome!
     5.1 --- a/docs/src/user.tex	Tue Oct 26 17:08:38 2004 +0000
     5.2 +++ b/docs/src/user.tex	Thu Oct 28 16:15:46 2004 +0000
     5.3 @@ -1,6 +1,7 @@
     5.4  \documentclass[11pt,twoside,final,openright]{xenstyle}
     5.5  \usepackage{a4,graphicx,setspace}
     5.6  \setstretch{1.15}
     5.7 +%\input{style.tex}
     5.8  
     5.9  \begin{document}
    5.10  
    5.11 @@ -56,7 +57,7 @@ Contributions of material, suggestions a
    5.12  }
    5.13  
    5.14  Xen is a { \em paravirtualising } virtual machine monitor (VMM) or
    5.15 -``Hypervisor'' for the x86 processor architecture.  Xen can securely
    5.16 +`Hypervisor' for the x86 processor architecture.  Xen can securely
    5.17  multiplex heterogeneous virtual machines on a single physical with
    5.18  near-native performance.  The virtual machine technology facilitates
    5.19  enterprise-grade functionality, including:
    5.20 @@ -119,9 +120,9 @@ Possible usage scenarios for Xen include
    5.21        drivers to achieve good hardware support
    5.22  \end{description}
    5.23  
    5.24 -\section{Structure}
    5.25 +\section{Features}
    5.26  
    5.27 -\subsection{High level}
    5.28 +\subsection{High level structure}
    5.29  
    5.30  A Xen system has multiple layers.  The lowest layer is Xen itself ---
    5.31  the most privileged piece of code in the system.  On top of Xen run
    5.32 @@ -137,7 +138,7 @@ their virtual devices.  It also performs
    5.33  migration of other virtual machines.  Where it is used, the X server
    5.34  is also run in domain 0.
    5.35  
    5.36 -Within Domain 0, a process called ``Xend'' runs to manage the system.
    5.37 +Within Domain 0, a process called `Xend' runs to manage the system.
    5.38  Xend is responsible for managing virtual machines and providing access
    5.39  to their consoles.  Commands are issued to Xend over an HTTP
    5.40  interface, either from a command-line tool or from a web browser.
    5.41 @@ -157,6 +158,31 @@ system kernels must explicitly support X
    5.42  virtual machine, { \em user space applications and libraries
    5.43  do not require modification }.
    5.44  
    5.45 +\subsection{Scalability}
    5.46 +
    5.47 +We've successfully booted over 128 copies of Linux on the same machine
    5.48 +(a dual CPU hyperthreaded Xeon box) but we imagine that it would be
    5.49 +more normal to use some smaller number, perhaps 10-20.
    5.50 +
    5.51 +A common question is `how many virtual machines can I run on hardware
    5.52 +xyz?'. The answer is very application dependent, but the rule of thumb
    5.53 +is that you should expect to be able to run the same workload under
    5.54 +multiple guest OSes that you could run under a single Linux instance,
    5.55 +with an additional overhead of a few MB per OS instance.  This is
    5.56 +possible because of the low overhead of Xen's virtualisation strategy.
    5.57 +
    5.58 +\subsection{Live Migration}
    5.59 +
    5.60 +One key feature in this new release of Xen is `live migration'. This
    5.61 +enables virtual machines instances to be dynamically moved between
    5.62 +physical Xen machines, with typical {\em downtimes of just a few tens
    5.63 +of milliseconds}. The migration is almost imperceptible, even for
    5.64 +interactive users.
    5.65 +
    5.66 +Live migration is very useful for admins that want to take a node down
    5.67 +for maintenance, or to load balance a large number of virtual machines
    5.68 +across a cluster.
    5.69 +
    5.70  \section{Hardware Support}
    5.71  
    5.72  Xen currently runs on the x86 architecture, but could in principle be
    5.73 @@ -168,7 +194,7 @@ at:\\
    5.74  {\tt http://www.cl.cam.ac.uk/netos/papers/2003-xensosp.pdf}\\
    5.75  Work to port Xen to x86\_64 and IA64 is currently underway.
    5.76  
    5.77 -Xen requires a ``P6'' or newer processor (e.g. Pentium Pro, Celeron,
    5.78 +Xen requires a `P6' or newer processor (e.g. Pentium Pro, Celeron,
    5.79  Pentium II, Pentium III, Pentium IV, Xeon, AMD Athlon, AMD Duron).
    5.80  Multiprocessor machines are supported, and we also have basic support
    5.81  for HyperThreading (SMT), although this remains a topic for ongoing
    5.82 @@ -195,12 +221,12 @@ other hardware by configuring your XenLi
    5.83  \section{History}
    5.84  
    5.85  
    5.86 -``Xen'' is a Virtual Machine Monitor (VMM) originally developed by the
    5.87 +`Xen' is a Virtual Machine Monitor (VMM) originally developed by the
    5.88  Systems Research Group of the University of Cambridge Computer
    5.89  Laboratory, as part of the UK-EPSRC funded XenoServers project.
    5.90  
    5.91 -The XenoServers project aims to provide a ``public infrastructure for
    5.92 -global distributed computing'', and Xen plays a key part in that,
    5.93 +The XenoServers project aims to provide a `public infrastructure for
    5.94 +global distributed computing', and Xen plays a key part in that,
    5.95  allowing us to efficiently partition a single machine to enable
    5.96  multiple independent clients to run their operating systems and
    5.97  applications in an environment providing protection, resource
    5.98 @@ -210,7 +236,7 @@ information along with pointers to paper
    5.99  
   5.100  Xen has since grown into a project in its own right, enabling us to
   5.101  investigate interesting research issues regarding the best techniques
   5.102 -for virtualizing resources such as the CPU, memory, disk and network.
   5.103 +for virtualising resources such as the CPU, memory, disk and network.
   5.104  The project has been bolstered by support from Intel Research
   5.105  Cambridge, and HP Labs, who are now working closely with us.
   5.106  % We're also in receipt of support from Microsoft Research Cambridge to
   5.107 @@ -330,7 +356,7 @@ The Xen source code repository is struct
   5.108  
   5.109  \section{Build and install}
   5.110  
   5.111 -The Xen makefile includes a target ``world'' that will do the
   5.112 +The Xen makefile includes a target `world' that will do the
   5.113  following:
   5.114  
   5.115  \begin{itemize}
   5.116 @@ -345,21 +371,21 @@ following:
   5.117  
   5.118  Inspect the Makefile if you want to see what goes on during a build.
   5.119  Building Xen and the tools is straightforward, but XenLinux is more
   5.120 -complicated.  The makefile needs a `pristine' linux kernel tree which
   5.121 +complicated.  The makefile needs a `pristine' Linux kernel tree which
   5.122  it will then add the Xen architecture files to.  You can tell the
   5.123 -makefile the location of the appropriate linux compressed tar file by
   5.124 +makefile the location of the appropriate Linux compressed tar file by
   5.125  setting the LINUX\_SRC environment variable, e.g. \\
   5.126  \verb!# LINUX_SRC=/tmp/linux-2.6.8.1.tar.bz2 make world! \\ or by
   5.127  placing the tar file somewhere in the search path of {\tt
   5.128 -LINUX\_SRC\_PATH} which defaults to ``{\tt .:..}".  If the makefile
   5.129 +LINUX\_SRC\_PATH} which defaults to `{\tt .:..}'.  If the makefile
   5.130  can't find a suitable kernel tar file it attempts to download it from
   5.131  kernel.org (this won't work if you're behind a firewall).
   5.132  
   5.133  After untaring the pristine kernel tree, the makefile uses the {\tt
   5.134  mkbuildtree} script to add the Xen patches to the kernel.  It then
   5.135 -builds two different XenLinux images, one with a ``-xen0'' extension
   5.136 +builds two different XenLinux images, one with a `-xen0' extension
   5.137  which contains hardware device drivers and drivers for Xen's virtual
   5.138 -devices, and one with a ``-xenU'' extension that just contains the
   5.139 +devices, and one with a `-xenU' extension that just contains the
   5.140  virtual ones.
   5.141  
   5.142  The procedure is similar to build the Linux 2.4 port: \\
   5.143 @@ -407,7 +433,7 @@ The difference between the two Linux ker
   5.144  the configuration file used for each.  The "U" suffixed unprivileged
   5.145  version doesn't contain any of the physical hardware device drivers
   5.146  --- it is 30\% smaller and hence may be preferred for your
   5.147 -non-privileged domains.  The ``0'' suffixed privileged version can be
   5.148 +non-privileged domains.  The `0' suffixed privileged version can be
   5.149  used to boot the system, as well as in driver domains and unprivileged
   5.150  domains.
   5.151  
   5.152 @@ -565,7 +591,7 @@ second to the location of \path{/usr} (i
   5.153  domains). [i.e. {\tt disk = ['phy:your\_hard\_drive\%d,sda1,w' \%
   5.154  (base\_partition\_number + vmid), 'phy:your\_usr\_partition,sda6,r' ]}
   5.155  \item[dhcp] Uncomment the dhcp variable, so that the domain will
   5.156 -receive its IP address from a DHCP server. [i.e. {\tt dhcp=''dhcp''}]
   5.157 +receive its IP address from a DHCP server. [i.e. {\tt dhcp='dhcp'}]
   5.158  \end{description}
   5.159  
   5.160  You may also want to edit the {\bf vif} variable in order to choose
   5.161 @@ -631,8 +657,8 @@ configuration file (or a link to it) und
   5.162  
   5.163  A Sys-V style init script for RedHat and LSB-compliant systems is
   5.164  provided and will be automatically copied to \path{/etc/init.d/}
   5.165 -during install.  You can then enable it in the appriate way for your
   5.166 -distribution.
   5.167 +during install.  You can then enable it in the appropriate way for
   5.168 +your distribution.
   5.169  
   5.170  For instance, on RedHat:
   5.171  
   5.172 @@ -723,13 +749,22 @@ or:
   5.173  # xm console 5
   5.174  \end{verbatim}
   5.175  
   5.176 -\chapter{Other kinds of storage}
   5.177 +\chapter{Domain filesystem storage}
   5.178  
   5.179  It is possible to directly export any Linux block device to a virtual,
   5.180  or to export filesystems / devices to virtual machines using standard
   5.181 -network protocals (e.g. NBD, iSCSI, NFS, etc).  This chapter covers
   5.182 +network protocols (e.g. NBD, iSCSI, NFS, etc).  This chapter covers
   5.183  some of the possibilities.
   5.184  
   5.185 +\section{Warning: Block device sharing}
   5.186 +
   5.187 +Block devices should only be shared between domains in a read-only
   5.188 +fashion otherwise the Linux kernels will obviously get very confused
   5.189 +as the file system structure may change underneath them (having the
   5.190 +same partition mounted rw twice is a sure fire way to cause
   5.191 +irreparable damage)!  If you want read-write sharing, export the
   5.192 +directory to other domains via NFS from domain0.
   5.193 +
   5.194  \section{File-backed virtual block devices}
   5.195  
   5.196  It is possible to use a file in Domain 0 as the primary storage for a
   5.197 @@ -989,9 +1024,9 @@ domains and provides a user friendly dom
   5.198                             a complete system of real hardware devices.
   5.199  
   5.200  \item[Hypervisor]          An alternative term for { \bf VMM }, used
   5.201 -                           because it means ``beyond supervisor'',
   5.202 +                           because it means `beyond supervisor',
   5.203                             since it is responsible for managing multiple
   5.204 -                           ``supervisor'' kernels.
   5.205 +                           `supervisor' kernels.
   5.206  
   5.207  \item[Live migration]      A technique for moving a running virtual
   5.208                             machine to another physical host, without
   5.209 @@ -1049,8 +1084,8 @@ domains and provides a user friendly dom
   5.210  \chapter{Advanced Network Configuration}
   5.211  
   5.212  For simple systems with a single ethernet interface with a simple
   5.213 -configuration, the default installation should work ``out of the
   5.214 -box''.  More complicated network setups, for instance with multiple
   5.215 +configuration, the default installation should work `out of the
   5.216 +box'.  More complicated network setups, for instance with multiple
   5.217  ethernet interfaces and / or existing bridging setups will require
   5.218  some special configuration.
   5.219  
   5.220 @@ -1073,7 +1108,7 @@ Xen virtual network when Xend starts and
   5.221  cleanup when Xend exits.
   5.222  
   5.223  In the default configuration, this script creates the bridge
   5.224 -``xen-br0'' and moves eth0 onto that bridge, modifying the routing
   5.225 +`xen-br0' and moves eth0 onto that bridge, modifying the routing
   5.226  accordingly.
   5.227  
   5.228  In configurations where the bridge already exists, this script could
   5.229 @@ -1254,13 +1289,32 @@ can be configured in either format of co
   5.230  
   5.231  \section{Administration Domains}
   5.232  
   5.233 -Administration privileges allow a domain to use the ``dom0
   5.234 -operations'' (so called because they are usually available only to
   5.235 +Administration privileges allow a domain to use the `dom0
   5.236 +operations' (so called because they are usually available only to
   5.237  domain 0).  A privileged domain can build other domains, set scheduling
   5.238  parameters, etc.
   5.239  
   5.240  % Support for other administrative domains is not yet available...
   5.241  
   5.242 +\chapter{Debugging}
   5.243 +
   5.244 +Xen has a set of debugging features that can be useful to try and
   5.245 +figure out what's going on. Hit 'h' on the serial line (if you
   5.246 +specified a baud rate on the Xen command line) or ScrollLock-h on the
   5.247 +keyboard to get a list of supported commands.
   5.248 +
   5.249 +If you have a crash you'll likely get a crash dump containing an EIP
   5.250 +(PC) which, along with an 'objdump -d image', can be useful in
   5.251 +figuring out what's happened.  Debug a Xenlinux image just as you
   5.252 +would any other Linux kernel.
   5.253 +
   5.254 +We supply a handy debug terminal program which you can find in
   5.255 +/usr/local/src/xen-2.0.bk/tools/misc/miniterm/
   5.256 +This should be built and executed on another machine that is connected
   5.257 +via a null modem cable. Documentation is included.
   5.258 +Alternatively, if the Xen machine is connected to a serial-port server
   5.259 +then we supply a dumb TCP terminal client, {\tt xencons}.
   5.260 +
   5.261  \chapter{Xen build options}
   5.262  
   5.263  For most users, the default build of Xen will be adequate.  For some
   5.264 @@ -1616,6 +1670,61 @@ template and the new image, and using {\
   5.265  simply copying the image file.  Once this is done, modify the
   5.266  image-specific settings (hostname, network settings, etc).
   5.267  
   5.268 +\chapter{Installing Xen / XenLinux on Redhat / Fedora}
   5.269 +
   5.270 +When using Xen / Xenlinux on a standard Linux distribution there are
   5.271 +a couple of things to watch out for:
   5.272 +
   5.273 +Note that, because domains>0 don't have any privileged access at all,
   5.274 +certain commands in the default boot sequence will fail e.g. attempts
   5.275 +to update the hwclock, change the console font, update the keytable
   5.276 +map, start apmd (power management), or gpm (mouse cursor).  Either
   5.277 +ignore the errors (they should be harmless), or remove them from the
   5.278 +startup scripts.  Deleting the following links are a good start:
   5.279 +S24pcmcia S09isdn S17keytable S26apmd S85gpm.
   5.280 +
   5.281 +If you want to use a single root file system that works cleanly for
   5.282 +domain0 and domains>0, a useful trick is to use different 'init' run
   5.283 +levels. For example, on the Xen Demo CD we use run level 3 for domain
   5.284 +0, and run level 4 for domains>0. This enables different startup
   5.285 +scripts to be run in depending on the run level number passed on the
   5.286 +kernel command line.
   5.287 +
   5.288 +If you're going to use NFS root files systems mounted either from an
   5.289 +external server or from domain0 there are a couple of other gotchas.
   5.290 +The default /etc/sysconfig/iptables rules block NFS, so part way
   5.291 +through the boot sequence things will suddenly go dead.
   5.292 +
   5.293 +If you're planning on having a separate NFS /usr partition, the RH9
   5.294 +boot scripts don't make life easy - they attempt to mount NFS file
   5.295 +systems way to late in the boot process. The easiest way I found to do
   5.296 +this was to have a '/linuxrc' script run ahead of /sbin/init that
   5.297 +mounts /usr:
   5.298 +
   5.299 +\begin{verbatim}
   5.300 + #!/bin/bash
   5.301 + /sbin/ipconfig lo 127.0.0.1
   5.302 + /sbin/portmap
   5.303 + /bin/mount /usr
   5.304 + exec /sbin/init "$@" <>/dev/console 2>&1
   5.305 +\end{verbatim}
   5.306 +
   5.307 +The one slight complication with the above is that /sbib/portmap is
   5.308 +dynamically linked against /usr/lib/libwrap.so.0 Since this is in
   5.309 +/usr, it won't work. This can be solved by copying the file (and link)
   5.310 +below the /usr mount point, and just let the file be 'covered' when
   5.311 +the mount happens.
   5.312 +
   5.313 +In some installations, where a shared read-only /usr is being used, it
   5.314 +may be desirable to move other large directories over into the
   5.315 +read-only /usr. For example, you might replace /bin /lib and /sbin
   5.316 +with links into /usr/root/bin /usr/root/lib and /usr/root/sbin
   5.317 +respectively. This creates other problems for running the /linuxrc
   5.318 +script, requiring bash, portmap, mount, ifconfig, and a handful of
   5.319 +other shared libraries to be copied below the mount point - little
   5.320 +statically linked C program would solve this problem.
   5.321 +
   5.322 +
   5.323  \end{document}
   5.324  
   5.325  
   5.326 @@ -1646,4 +1755,52 @@ image-specific settings (hostname, netwo
   5.327  %% You can use these modules to write your own custom scripts or you can
   5.328  %% customise the scripts supplied in the Xen distribution.
   5.329  
   5.330 +
   5.331 +
   5.332  % Explain about AGP GART
   5.333 +
   5.334 +
   5.335 +%% If you're not intending to configure the new domain with an IP address
   5.336 +%% on your LAN, then you'll probably want to use NAT. The
   5.337 +%% 'xen_nat_enable' installs a few useful iptables rules into domain0 to
   5.338 +%% enable NAT. [NB: We plan to support RSIP in future]
   5.339 +
   5.340 +
   5.341 +
   5.342 +
   5.343 +%% Installing the file systems from the CD
   5.344 +%% =======================================
   5.345 +
   5.346 +%% If you haven't got an existing Linux installation onto which you can
   5.347 +%% just drop down the Xen and Xenlinux images, then the file systems on
   5.348 +%% the CD provide a quick way of doing an install. However, you would be
   5.349 +%% better off in the long run doing a proper install of your preferred
   5.350 +%% distro and installing Xen onto that, rather than just doing the hack
   5.351 +%% described below:
   5.352 +
   5.353 +%% Choose one or two partitions, depending on whether you want a separate
   5.354 +%% /usr or not. Make file systems on it/them e.g.: 
   5.355 +%%   mkfs -t ext3 /dev/hda3
   5.356 +%%   [or mkfs -t ext2 /dev/hda3 && tune2fs -j /dev/hda3 if using an old
   5.357 +%% version of mkfs]
   5.358 +
   5.359 +%% Next, mount the file system(s) e.g.:
   5.360 +%%   mkdir /mnt/root && mount /dev/hda3 /mnt/root
   5.361 +%%   [mkdir /mnt/usr && mount /dev/hda4 /mnt/usr]
   5.362 +  
   5.363 +%% To install the root file system, simply untar /usr/XenDemoCD/root.tar.gz:
   5.364 +%%   cd /mnt/root && tar -zxpf /usr/XenDemoCD/root.tar.gz
   5.365 +
   5.366 +%% You'll need to edit /mnt/root/etc/fstab to reflect your file system
   5.367 +%% configuration. Changing the password file (etc/shadow) is probably a
   5.368 +%% good idea too.
   5.369 +
   5.370 +%% To install the usr file system, copy the file system from CD on /usr,
   5.371 +%% though leaving out the "XenDemoCD" and "boot" directories:
   5.372 +%%   cd /usr && cp -a X11R6 etc java libexec root src bin dict kerberos local sbin tmp doc include lib man share /mnt/usr
   5.373 +
   5.374 +%% If you intend to boot off these file systems (i.e. use them for
   5.375 +%% domain 0), then you probably want to copy the /usr/boot directory on
   5.376 +%% the cd over the top of the current symlink to /boot on your root
   5.377 +%% filesystem (after deleting the current symlink) i.e.:
   5.378 +%%   cd /mnt/root ; rm boot ; cp -a /usr/boot .
     6.1 --- a/tools/misc/Makefile	Tue Oct 26 17:08:38 2004 +0000
     6.2 +++ b/tools/misc/Makefile	Thu Oct 28 16:15:46 2004 +0000
     6.3 @@ -17,7 +17,7 @@ HDRS     = $(wildcard *.h)
     6.4  SRCS     = $(wildcard *.c)
     6.5  OBJS     = $(patsubst %.c,%.o,$(SRCS))
     6.6  
     6.7 -TARGETS  = xen_cpuperf
     6.8 +TARGETS  = 
     6.9  
    6.10  INSTALL_BIN  = $(TARGETS) xencons
    6.11  INSTALL_SBIN = netfix xm xend xensv
     7.1 --- a/tools/misc/p4perf.h	Tue Oct 26 17:08:38 2004 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,559 +0,0 @@
     7.4 -/*
     7.5 - * For P6 use PERFCTR1 (0 used for APIC NMI watchdog). Must setup after
     7.6 - * APIC NMI watchdog setup. Note that if this previous setup doesn't happen
     7.7 - * we still must enable both counters.
     7.8 - *
     7.9 - * P4 Xeon with Hyperthreading has counters per physical package which can
    7.10 - * count events from either logical CPU. However, in many cases more than
    7.11 - * ECSR and CCCR/counter can be used to count the same event. For instr or
    7.12 - * uops retired, use either ESCR0/IQ_CCCR0 ESCR1/IQ_CCCR2.
    7.13 - *
    7.14 - * USE CONFIG_MPENTIUM4_HT for a P4 Xeon with hyperthreading.
    7.15 - *
    7.16 - * Note that the counters may be initialised on each logical processor
    7.17 - * which will cause each physical processor to be initialised twice. This
    7.18 - * should not cause a problem.
    7.19 - */
    7.20 -
    7.21 -#ifndef P4PERF_H
    7.22 -#define P4PERF_H
    7.23 -
    7.24 -#ifdef __KERNEL__
    7.25 -#include <asm/msr.h>
    7.26 -#endif
    7.27 -
    7.28 -/*****************************************************************************
    7.29 - * Performance counter configuration.                                        *
    7.30 - *****************************************************************************/
    7.31 -
    7.32 -#ifndef P6_EVNTSEL_OS
    7.33 -# define P6_EVNTSEL_OS     (1 << 17)
    7.34 -# define P6_EVNTSEL_USR    (1 << 16)
    7.35 -# define P6_EVNTSEL_E      (1 << 18)
    7.36 -# define P6_EVNTSEL_EN     (1 << 22)
    7.37 -#endif
    7.38 -#define P6_PERF_INST_RETIRED 0xc0
    7.39 -#define P6_PERF_UOPS_RETIRED 0xc2
    7.40 -
    7.41 -#define P4_ESCR_USR                    (1 << 2)
    7.42 -#define P4_ESCR_OS                     (1 << 3)
    7.43 -#define P4_ESCR_T0_USR                 (1 << 2) /* First logical CPU  */
    7.44 -#define P4_ESCR_T0_OS                  (1 << 3)
    7.45 -#define P4_ESCR_T1_USR                 (1 << 0) /* Second logical CPU */
    7.46 -#define P4_ESCR_T1_OS                  (1 << 1)
    7.47 -#define P4_ESCR_TE                     (1 << 4)
    7.48 -#define P4_ESCR_THREADS(t)             (t)
    7.49 -#define P4_ESCR_TV(tag)                (tag << 5)
    7.50 -#define P4_ESCR_EVNTSEL(e)             (e << 25)
    7.51 -#define P4_ESCR_EVNTMASK(e)            (e << 9)
    7.52 -
    7.53 -#define P4_ESCR_EVNTSEL_FRONT_END      0x08
    7.54 -#define P4_ESCR_EVNTSEL_EXECUTION      0x0c
    7.55 -#define P4_ESCR_EVNTSEL_REPLAY         0x09
    7.56 -#define P4_ESCR_EVNTSEL_INSTR_RETIRED  0x02
    7.57 -#define P4_ESCR_EVNTSEL_UOPS_RETIRED   0x01
    7.58 -#define P4_ESCR_EVNTSEL_UOP_TYPE       0x02
    7.59 -#define P4_ESCR_EVNTSEL_RET_MBR_TYPE   0x05
    7.60 -//#define P4_ESCR_EVNTSEL_RET_MBR_TYPE   0x04
    7.61 -
    7.62 -#define P4_ESCR_EVNTMASK_FE_NBOGUS     0x01
    7.63 -#define P4_ESCR_EVNTMASK_FE_BOGUS      0x02
    7.64 -
    7.65 -#define P4_ESCR_EVNTMASK_EXEC_NBOGUS0  0x01
    7.66 -#define P4_ESCR_EVNTMASK_EXEC_NBOGUS1  0x02
    7.67 -#define P4_ESCR_EVNTMASK_EXEC_NBOGUS2  0x04
    7.68 -#define P4_ESCR_EVNTMASK_EXEC_NBOGUS3  0x08
    7.69 -#define P4_ESCR_EVNTMASK_EXEC_BOGUS0   0x10
    7.70 -#define P4_ESCR_EVNTMASK_EXEC_BOGUS1   0x20
    7.71 -#define P4_ESCR_EVNTMASK_EXEC_BOGUS2   0x40
    7.72 -#define P4_ESCR_EVNTMASK_EXEC_BOGUS3   0x80
    7.73 -
    7.74 -#define P4_ESCR_EVNTMASK_REPLAY_NBOGUS 0x01
    7.75 -#define P4_ESCR_EVNTMASK_REPLAY_BOGUS  0x02
    7.76 -
    7.77 -#define P4_ESCR_EVNTMASK_IRET_NB_NTAG  0x01
    7.78 -#define P4_ESCR_EVNTMASK_IRET_NB_TAG   0x02
    7.79 -#define P4_ESCR_EVNTMASK_IRET_B_NTAG   0x04
    7.80 -#define P4_ESCR_EVNTMASK_IRET_B_TAG    0x08
    7.81 -
    7.82 -#define P4_ESCR_EVNTMASK_URET_NBOGUS   0x01
    7.83 -#define P4_ESCR_EVNTMASK_URET_BOGUS    0x02
    7.84 -
    7.85 -#define P4_ESCR_EVNTMASK_UOP_LOADS     0x02
    7.86 -#define P4_ESCR_EVNTMASK_UOP_STORES    0x04
    7.87 -
    7.88 -#define P4_ESCR_EVNTMASK_RMBRT_COND    0x02
    7.89 -#define P4_ESCR_EVNTMASK_RMBRT_CALL    0x04
    7.90 -#define P4_ESCR_EVNTMASK_RMBRT_RETURN  0x08
    7.91 -#define P4_ESCR_EVNTMASK_RMBRT_INDIR   0x10
    7.92 -
    7.93 -#define P4_ESCR_EVNTMASK_RBRT_COND     0x02
    7.94 -#define P4_ESCR_EVNTMASK_RBRT_CALL     0x04
    7.95 -#define P4_ESCR_EVNTMASK_RBRT_RETURN   0x08
    7.96 -#define P4_ESCR_EVNTMASK_RBRT_INDIR    0x10
    7.97 -
    7.98 -//#define P4_ESCR_EVNTMASK_INSTR_RETIRED 0x01  /* Non bogus, not tagged */
    7.99 -//#define P4_ESCR_EVNTMASK_UOPS_RETIRED  0x01  /* Non bogus             */
   7.100 -
   7.101 -#define P4_CCCR_OVF                    (1 << 31)
   7.102 -#define P4_CCCR_CASCADE                (1 << 30)
   7.103 -#define P4_CCCR_FORCE_OVF              (1 << 25)
   7.104 -#define P4_CCCR_EDGE                   (1 << 24)
   7.105 -#define P4_CCCR_COMPLEMENT             (1 << 19)
   7.106 -#define P4_CCCR_COMPARE                (1 << 18)
   7.107 -#define P4_CCCR_THRESHOLD(t)           (t << 20)
   7.108 -#define P4_CCCR_ENABLE                 (1 << 12)
   7.109 -#define P4_CCCR_ESCR(escr)             (escr << 13)
   7.110 -#define P4_CCCR_ACTIVE_THREAD(t)       (t << 16)   /* Set to 11 */
   7.111 -#define P4_CCCR_OVF_PMI_T0             (1 << 26)
   7.112 -#define P4_CCCR_OVF_PMI_T1             (1 << 27)
   7.113 -#define P4_CCCR_RESERVED               (3 << 16)
   7.114 -#define P4_CCCR_OVF_PMI                (1 << 26)
   7.115 -
   7.116 -// BPU
   7.117 -#define MSR_P4_BPU_COUNTER0            0x300
   7.118 -#define MSR_P4_BPU_COUNTER1            0x301
   7.119 -#define MSR_P4_BPU_CCCR0               0x360
   7.120 -#define MSR_P4_BPU_CCCR1               0x361
   7.121 -
   7.122 -#define MSR_P4_BPU_COUNTER2            0x302
   7.123 -#define MSR_P4_BPU_COUNTER3            0x303
   7.124 -#define MSR_P4_BPU_CCCR2               0x362
   7.125 -#define MSR_P4_BPU_CCCR3               0x363
   7.126 -
   7.127 -#define MSR_P4_BSU_ESCR0               0x3a0
   7.128 -#define MSR_P4_FSB_ESCR0               0x3a2
   7.129 -#define MSR_P4_MOB_ESCR0               0x3aa
   7.130 -#define MSR_P4_PMH_ESCR0               0x3ac
   7.131 -#define MSR_P4_BPU_ESCR0               0x3b2
   7.132 -#define MSR_P4_IS_ESCR0                0x3b4
   7.133 -#define MSR_P4_ITLB_ESCR0              0x3b6
   7.134 -#define MSR_P4_IX_ESCR0                0x3c8
   7.135 -
   7.136 -#define P4_BSU_ESCR0_NUMBER            7
   7.137 -#define P4_FSB_ESCR0_NUMBER            6
   7.138 -#define P4_MOB_ESCR0_NUMBER            2
   7.139 -#define P4_PMH_ESCR0_NUMBER            4
   7.140 -#define P4_BPU_ESCR0_NUMBER            0
   7.141 -#define P4_IS_ESCR0_NUMBER             1
   7.142 -#define P4_ITLB_ESCR0_NUMBER           3
   7.143 -#define P4_IX_ESCR0_NUMBER             5
   7.144 -
   7.145 -#define MSR_P4_BSU_ESCR1               0x3a1
   7.146 -#define MSR_P4_FSB_ESCR1               0x3a3
   7.147 -#define MSR_P4_MOB_ESCR1               0x3ab
   7.148 -#define MSR_P4_PMH_ESCR1               0x3ad
   7.149 -#define MSR_P4_BPU_ESCR1               0x3b3
   7.150 -#define MSR_P4_IS_ESCR1                0x3b5
   7.151 -#define MSR_P4_ITLB_ESCR1              0x3b7
   7.152 -#define MSR_P4_IX_ESCR1                0x3c9
   7.153 -
   7.154 -#define P4_BSU_ESCR1_NUMBER            7
   7.155 -#define P4_FSB_ESCR1_NUMBER            6
   7.156 -#define P4_MOB_ESCR1_NUMBER            2
   7.157 -#define P4_PMH_ESCR1_NUMBER            4
   7.158 -#define P4_BPU_ESCR1_NUMBER            0
   7.159 -#define P4_IS_ESCR1_NUMBER             1
   7.160 -#define P4_ITLB_ESCR1_NUMBER           3
   7.161 -#define P4_IX_ESCR1_NUMBER             5
   7.162 -
   7.163 -// MS
   7.164 -#define MSR_P4_MS_COUNTER0             0x304
   7.165 -#define MSR_P4_MS_COUNTER1             0x305
   7.166 -#define MSR_P4_MS_CCCR0                0x364
   7.167 -#define MSR_P4_MS_CCCR1                0x365
   7.168 -
   7.169 -#define MSR_P4_MS_COUNTER2             0x306
   7.170 -#define MSR_P4_MS_COUNTER3             0x307
   7.171 -#define MSR_P4_MS_CCCR2                0x366
   7.172 -#define MSR_P4_MS_CCCR3                0x367
   7.173 -
   7.174 -#define MSR_P4_MS_ESCR0                0x3c0
   7.175 -#define MSR_P4_TBPU_ESCR0              0x3c2
   7.176 -#define MSR_P4_TC_ESCR0                0x3c4
   7.177 -
   7.178 -#define P4_MS_ESCR0_NUMBER             0
   7.179 -#define P4_TBPU_ESCR0_NUMBER           2
   7.180 -#define P4_TC_ESCR0_NUMBER             1
   7.181 -
   7.182 -#define MSR_P4_MS_ESCR1                0x3c1
   7.183 -#define MSR_P4_TBPU_ESCR1              0x3c3
   7.184 -#define MSR_P4_TC_ESCR1                0x3c5
   7.185 -
   7.186 -#define P4_MS_ESCR1_NUMBER             0
   7.187 -#define P4_TBPU_ESCR1_NUMBER           2
   7.188 -#define P4_TC_ESCR1_NUMBER             1
   7.189 -
   7.190 -// FLAME
   7.191 -#define MSR_P4_FLAME_COUNTER0          0x308
   7.192 -#define MSR_P4_FLAME_COUNTER1          0x309
   7.193 -#define MSR_P4_FLAME_CCCR0             0x368
   7.194 -#define MSR_P4_FLAME_CCCR1             0x369
   7.195 -
   7.196 -#define MSR_P4_FLAME_COUNTER2          0x30a
   7.197 -#define MSR_P4_FLAME_COUNTER3          0x30b
   7.198 -#define MSR_P4_FLAME_CCCR2             0x36a
   7.199 -#define MSR_P4_FLAME_CCCR3             0x36b
   7.200 -
   7.201 -#define MSR_P4_FIRM_ESCR0              0x3a4
   7.202 -#define MSR_P4_FLAME_ESCR0             0x3a6
   7.203 -#define MSR_P4_DAC_ESCR0               0x3a8
   7.204 -#define MSR_P4_SAAT_ESCR0              0x3ae
   7.205 -#define MSR_P4_U2L_ESCR0               0x3b0
   7.206 -
   7.207 -#define P4_FIRM_ESCR0_NUMBER           1
   7.208 -#define P4_FLAME_ESCR0_NUMBER          0
   7.209 -#define P4_DAC_ESCR0_NUMBER            5
   7.210 -#define P4_SAAT_ESCR0_NUMBER           2
   7.211 -#define P4_U2L_ESCR0_NUMBER            3
   7.212 -
   7.213 -#define MSR_P4_FIRM_ESCR1              0x3a5
   7.214 -#define MSR_P4_FLAME_ESCR1             0x3a7
   7.215 -#define MSR_P4_DAC_ESCR1               0x3a9
   7.216 -#define MSR_P4_SAAT_ESCR1              0x3af
   7.217 -#define MSR_P4_U2L_ESCR1               0x3b1
   7.218 -
   7.219 -#define P4_FIRM_ESCR1_NUMBER           1
   7.220 -#define P4_FLAME_ESCR1_NUMBER          0
   7.221 -#define P4_DAC_ESCR1_NUMBER            5
   7.222 -#define P4_SAAT_ESCR1_NUMBER           2
   7.223 -#define P4_U2L_ESCR1_NUMBER            3
   7.224 -
   7.225 -// IQ
   7.226 -#define MSR_P4_IQ_COUNTER0             0x30c
   7.227 -#define MSR_P4_IQ_COUNTER1             0x30d
   7.228 -#define MSR_P4_IQ_CCCR0                0x36c
   7.229 -#define MSR_P4_IQ_CCCR1                0x36d
   7.230 -
   7.231 -#define MSR_P4_IQ_COUNTER2             0x30e
   7.232 -#define MSR_P4_IQ_COUNTER3             0x30f
   7.233 -#define MSR_P4_IQ_CCCR2                0x36e
   7.234 -#define MSR_P4_IQ_CCCR3                0x36f
   7.235 -
   7.236 -#define MSR_P4_IQ_COUNTER4             0x310
   7.237 -#define MSR_P4_IQ_COUNTER5             0x311
   7.238 -#define MSR_P4_IQ_CCCR4                0x370
   7.239 -#define MSR_P4_IQ_CCCR5                0x371
   7.240 -
   7.241 -#define MSR_P4_CRU_ESCR0               0x3b8
   7.242 -#define MSR_P4_CRU_ESCR2               0x3cc
   7.243 -#define MSR_P4_CRU_ESCR4               0x3e0
   7.244 -#define MSR_P4_IQ_ESCR0                0x3ba
   7.245 -#define MSR_P4_RAT_ESCR0               0x3bc
   7.246 -#define MSR_P4_SSU_ESCR0               0x3be
   7.247 -#define MSR_P4_ALF_ESCR0               0x3ca
   7.248 -
   7.249 -#define P4_CRU_ESCR0_NUMBER            4
   7.250 -#define P4_CRU_ESCR2_NUMBER            5
   7.251 -#define P4_CRU_ESCR4_NUMBER            6
   7.252 -#define P4_IQ_ESCR0_NUMBER             0
   7.253 -#define P4_RAT_ESCR0_NUMBER            2
   7.254 -#define P4_SSU_ESCR0_NUMBER            3
   7.255 -#define P4_ALF_ESCR0_NUMBER            1
   7.256 -
   7.257 -#define MSR_P4_CRU_ESCR1               0x3b9
   7.258 -#define MSR_P4_CRU_ESCR3               0x3cd
   7.259 -#define MSR_P4_CRU_ESCR5               0x3e1
   7.260 -#define MSR_P4_IQ_ESCR1                0x3bb
   7.261 -#define MSR_P4_RAT_ESCR1               0x3bd
   7.262 -#define MSR_P4_ALF_ESCR1               0x3cb
   7.263 -
   7.264 -#define P4_CRU_ESCR1_NUMBER            4
   7.265 -#define P4_CRU_ESCR3_NUMBER            5
   7.266 -#define P4_CRU_ESCR5_NUMBER            6
   7.267 -#define P4_IQ_ESCR1_NUMBER             0
   7.268 -#define P4_RAT_ESCR1_NUMBER            2
   7.269 -#define P4_ALF_ESCR1_NUMBER            1
   7.270 -
   7.271 -#define P4_BPU_COUNTER0_NUMBER         0
   7.272 -#define P4_BPU_COUNTER1_NUMBER         1
   7.273 -#define P4_BPU_COUNTER2_NUMBER         2
   7.274 -#define P4_BPU_COUNTER3_NUMBER         3
   7.275 -
   7.276 -#define P4_MS_COUNTER0_NUMBER          4
   7.277 -#define P4_MS_COUNTER1_NUMBER          5
   7.278 -#define P4_MS_COUNTER2_NUMBER          6
   7.279 -#define P4_MS_COUNTER3_NUMBER          7
   7.280 -
   7.281 -#define P4_FLAME_COUNTER0_NUMBER       8
   7.282 -#define P4_FLAME_COUNTER1_NUMBER       9
   7.283 -#define P4_FLAME_COUNTER2_NUMBER       10
   7.284 -#define P4_FLAME_COUNTER3_NUMBER       11
   7.285 -
   7.286 -#define P4_IQ_COUNTER0_NUMBER          12
   7.287 -#define P4_IQ_COUNTER1_NUMBER          13
   7.288 -#define P4_IQ_COUNTER2_NUMBER          14
   7.289 -#define P4_IQ_COUNTER3_NUMBER          15
   7.290 -#define P4_IQ_COUNTER4_NUMBER          16
   7.291 -#define P4_IQ_COUNTER5_NUMBER          17
   7.292 -
   7.293 -/* PEBS
   7.294 - */
   7.295 -#define MSR_P4_PEBS_ENABLE             0x3F1
   7.296 -#define MSR_P4_PEBS_MATRIX_VERT        0x3F2
   7.297 -
   7.298 -#define P4_PEBS_ENABLE_MY_THR          (1 << 25)
   7.299 -#define P4_PEBS_ENABLE_OTH_THR         (1 << 26)
   7.300 -#define P4_PEBS_ENABLE                 (1 << 24)
   7.301 -#define P4_PEBS_BIT0                   (1 << 0)
   7.302 -#define P4_PEBS_BIT1                   (1 << 1)
   7.303 -#define P4_PEBS_BIT2                   (1 << 2)
   7.304 -
   7.305 -#define P4_PEBS_MATRIX_VERT_BIT0       (1 << 0)
   7.306 -#define P4_PEBS_MATRIX_VERT_BIT1       (1 << 1)
   7.307 -#define P4_PEBS_MATRIX_VERT_BIT2       (1 << 2)
   7.308 -
   7.309 -/* Replay tagging.
   7.310 - */
   7.311 -#define P4_REPLAY_TAGGING_PEBS_L1LMR   P4_PEBS_BIT0
   7.312 -#define P4_REPLAY_TAGGING_PEBS_L2LMR   P4_PEBS_BIT1
   7.313 -#define P4_REPLAY_TAGGING_PEBS_DTLMR   P4_PEBS_BIT2
   7.314 -#define P4_REPLAY_TAGGING_PEBS_DTSMR   P4_PEBS_BIT2
   7.315 -#define P4_REPLAY_TAGGING_PEBS_DTAMR   P4_PEBS_BIT2
   7.316 -
   7.317 -#define P4_REPLAY_TAGGING_VERT_L1LMR   P4_PEBS_MATRIX_VERT_BIT0
   7.318 -#define P4_REPLAY_TAGGING_VERT_L2LMR   P4_PEBS_MATRIX_VERT_BIT0
   7.319 -#define P4_REPLAY_TAGGING_VERT_DTLMR   P4_PEBS_MATRIX_VERT_BIT0
   7.320 -#define P4_REPLAY_TAGGING_VERT_DTSMR   P4_PEBS_MATRIX_VERT_BIT1
   7.321 -#define P4_REPLAY_TAGGING_VERT_DTAMR   P4_PEBS_MATRIX_VERT_BIT0 | P4_PEBS_MATRIX_VERT_BIT1
   7.322 -
   7.323 -
   7.324 -
   7.325 -
   7.326 -/*****************************************************************************
   7.327 - *                                                                           *
   7.328 - *****************************************************************************/
   7.329 -
   7.330 -// x87_FP_uop
   7.331 -#define EVENT_SEL_x87_FP_uop                0x04
   7.332 -#define EVENT_MASK_x87_FP_uop_ALL           (1 << 15)
   7.333 -
   7.334 -// execution event (at retirement)
   7.335 -#define EVENT_SEL_execution_event           0x0C
   7.336 -
   7.337 -// scalar_SP_uop
   7.338 -#define EVENT_SEL_scalar_SP_uop             0x0a
   7.339 -#define EVENT_MASK_scalar_SP_uop_ALL        (1 << 15)
   7.340 -
   7.341 -// scalar_DP_uop
   7.342 -#define EVENT_SEL_scalar_DP_uop             0x0e
   7.343 -#define EVENT_MASK_scalar_DP_uop_ALL        (1 << 15)
   7.344 -
   7.345 -// Instruction retired
   7.346 -#define EVENT_SEL_instr_retired             0x02
   7.347 -#define EVENT_MASK_instr_retired_ALL        0x0f
   7.348 -
   7.349 -// uOps retired
   7.350 -#define EVENT_SEL_uops_retired              0x01
   7.351 -#define EVENT_MASK_uops_retired_ALL         0x03
   7.352 -
   7.353 -// L1 misses retired
   7.354 -#define EVENT_SEL_replay_event              0x09
   7.355 -#define EVENT_MASK_replay_event_ALL         0x03
   7.356 -
   7.357 -// Trace cache
   7.358 -#define EVENT_SEL_BPU_fetch_request         0x03
   7.359 -#define EVENT_MASK_BPU_fetch_request_TCMISS 0x01
   7.360 -
   7.361 -// Bus activity
   7.362 -#define EVENT_SEL_FSB_data_activity               0x17
   7.363 -#define EVENT_MASK_FSB_data_activity_DRDY_DRV     0x01
   7.364 -#define EVENT_MASK_FSB_data_activity_DRDY_OWN     0x02
   7.365 -#define EVENT_MASK_FSB_data_activity_DRDY_OOTHER  0x04
   7.366 -#define EVENT_MASK_FSB_data_activity_DBSY_DRV     0x08
   7.367 -#define EVENT_MASK_FSB_data_activity_DBSY_OWN     0x10
   7.368 -#define EVENT_MASK_FSB_data_activity_DBSY_OOTHER  0x20
   7.369 -
   7.370 -// Cache L2
   7.371 -#define EVENT_SEL_BSQ_cache_reference             0x0c
   7.372 -#define EVENT_MASK_BSQ_cache_reference_RD_L2_HITS 0x001
   7.373 -#define EVENT_MASK_BSQ_cache_reference_RD_L2_HITE 0x002
   7.374 -#define EVENT_MASK_BSQ_cache_reference_RD_L2_HITM 0x004
   7.375 -
   7.376 -#define EVENT_MASK_BSQ_cache_reference_RD_L3_HITS 0x008
   7.377 -#define EVENT_MASK_BSQ_cache_reference_RD_L3_HITE 0x010
   7.378 -#define EVENT_MASK_BSQ_cache_reference_RD_L3_HITM 0x020
   7.379 -
   7.380 -#define EVENT_MASK_BSQ_cache_reference_RD_L2_MISS 0x100
   7.381 -#define EVENT_MASK_BSQ_cache_reference_RD_L3_MISS 0x200
   7.382 -#define EVENT_MASK_BSQ_cache_reference_WR_L2_MISS 0x400
   7.383 -
   7.384 -/*****************************************************************************
   7.385 - *                                                                           *
   7.386 - *****************************************************************************/
   7.387 -
   7.388 -
   7.389 -/* The following turn configuration macros into 1/0 to allow code to be
   7.390 - * selected using if(MPENTIUM4_HT) rather then #ifdef (to avoid stale code).
   7.391 - * We rely on the compiler to optimise out unreachable code,
   7.392 - */
   7.393 -#ifdef CONFIG_MPENTIUM4_HT
   7.394 -# define MPENTIUM4_HT 1
   7.395 -#else
   7.396 -# define MPENTIUM4_HT 0
   7.397 -#endif
   7.398 -
   7.399 -#ifdef CONFIG_MPENTIUMIII
   7.400 -# define MPENTIUMIII 1
   7.401 -#else
   7.402 -# define MPENTIUMIII 0
   7.403 -#endif
   7.404 -
   7.405 -#ifdef CONFIG_MPENTIUM4
   7.406 -# define MPENTIUM4 1
   7.407 -#else
   7.408 -# define MPENTIUM4 0
   7.409 -#endif
   7.410 -
   7.411 -/*****************************************************************************
   7.412 - * MSR access macros                                                         *
   7.413 - *****************************************************************************/
   7.414 -
   7.415 -/* rpcc: get full 64-bit Pentium TSC value
   7.416 - */
   7.417 -static __inline__ unsigned long long int rpcc(void) 
   7.418 -{
   7.419 -    unsigned int __h, __l;
   7.420 -    __asm__ __volatile__ ("rdtsc" :"=a" (__l), "=d" (__h));
   7.421 -    return (((unsigned long long)__h) << 32) + __l;
   7.422 -}
   7.423 -
   7.424 -/*****************************************************************************
   7.425 - * Functions.                                                                *
   7.426 - *****************************************************************************/
   7.427 -
   7.428 -#ifdef __KERNEL__
   7.429 -static inline void smt_sched_setup(void)
   7.430 -{
   7.431 -    if (MPENTIUMIII) {
   7.432 -        unsigned int evntsel, x;
   7.433 -        
   7.434 -        /* Make sure counters enabled. */
   7.435 -        rdmsr(MSR_P6_EVNTSEL0, evntsel, x);
   7.436 -        evntsel |= P6_EVNTSEL_EN;
   7.437 -        wrmsr(MSR_P6_EVNTSEL0, evntsel, 0);
   7.438 -        
   7.439 -        evntsel =
   7.440 -            P6_PERF_INST_RETIRED | 
   7.441 -            P6_EVNTSEL_OS        | 
   7.442 -            P6_EVNTSEL_USR       | 
   7.443 -            P6_EVNTSEL_E;
   7.444 -        wrmsr(MSR_P6_EVNTSEL1, evntsel, 0);
   7.445 -    }
   7.446 -
   7.447 -    if(MPENTIUM4) {
   7.448 -        unsigned int x;
   7.449 -        
   7.450 -        /* Program the ESCR */
   7.451 -        x = P4_ESCR_USR                                    |
   7.452 -            P4_ESCR_OS                                     | 
   7.453 -            P4_ESCR_EVNTSEL(P4_ESCR_EVNTSEL_INSTR_RETIRED) | 
   7.454 -            P4_ESCR_EVNTMASK(P4_ESCR_EVNTMASK_IRET_NB_NTAG);
   7.455 -        wrmsr(MSR_P4_CRU_ESCR0, x, 0);
   7.456 -        
   7.457 -        /* Program the CCCR */
   7.458 -        if (MPENTIUM4_HT) {
   7.459 -            x = P4_CCCR_ENABLE                    | 
   7.460 -                P4_CCCR_ESCR(P4_CRU_ESCR0_NUMBER) |
   7.461 -                P4_CCCR_ACTIVE_THREAD(3);
   7.462 -        }
   7.463 -        else {
   7.464 -            x = P4_CCCR_ENABLE                    | 
   7.465 -                P4_CCCR_ESCR(P4_CRU_ESCR0_NUMBER) |
   7.466 -                P4_CCCR_RESERVED;
   7.467 -        }
   7.468 -        wrmsr(MSR_P4_IQ_CCCR0, x, 0);
   7.469 -
   7.470 -        if (MPENTIUM4_HT) {
   7.471 -
   7.472 -            /* Program the second ESCR */
   7.473 -            x = P4_ESCR_T1_USR                                 |
   7.474 -                P4_ESCR_T1_OS                                  | 
   7.475 -                P4_ESCR_EVNTSEL(P4_ESCR_EVNTSEL_INSTR_RETIRED) | 
   7.476 -                P4_ESCR_EVNTMASK(P4_ESCR_EVNTMASK_IRET_NB_NTAG);
   7.477 -            wrmsr(MSR_P4_CRU_ESCR1, x, 0);
   7.478 -            
   7.479 -            /* Program the second CCCR */
   7.480 -            x = P4_CCCR_ENABLE                    |
   7.481 -                P4_CCCR_ESCR(P4_CRU_ESCR1_NUMBER) |
   7.482 -                P4_CCCR_ACTIVE_THREAD(3);
   7.483 -            wrmsr(MSR_P4_IQ_CCCR2, x, 0);
   7.484 -        }
   7.485 -    }
   7.486 -
   7.487 -    if (!MPENTIUMIII && !MPENTIUM4) {
   7.488 -        printk("WARNING: Not setting up IPC performance counters.\n");
   7.489 -    } else {
   7.490 -        printk("Setting up IPC performance counters.\n");
   7.491 -    }
   7.492 -}
   7.493 -
   7.494 -#ifdef CONFIG_MPENTIUMIII
   7.495 -# define MY_MSR_COUNTER MSR_P6_PERFCTR1
   7.496 -#endif
   7.497 -#ifdef CONFIG_MPENTIUM4
   7.498 -# define MY_MSR_COUNTER MSR_P4_IQ_COUNTER0
   7.499 -#endif
   7.500 -#ifndef MY_MSR_COUNTER
   7.501 -# define MY_MSR_COUNTER 0 /* Never used but ensures compilation */
   7.502 -#endif
   7.503 -#define MY_MSR_COUNTER0 MSR_P4_IQ_COUNTER0
   7.504 -#define MY_MSR_COUNTER1 MSR_P4_IQ_COUNTER2
   7.505 -
   7.506 -# define smt_sched_start_sample(task)                                        \
   7.507 -{                                                                            \
   7.508 -    unsigned int l, h;                                                       \
   7.509 -                                                                             \
   7.510 -    if (MPENTIUM4_HT) {                                                      \
   7.511 -        unsigned int msr =                                                   \
   7.512 -            (task->processor & 1)?MY_MSR_COUNTER1:MY_MSR_COUNTER0;           \
   7.513 -        rdmsr(msr, l, h);                                                    \
   7.514 -    }                                                                        \
   7.515 -    else {                                                                   \
   7.516 -        rdmsr(MY_MSR_COUNTER, l, h);                                         \
   7.517 -    }                                                                        \
   7.518 -    task->ipc_sample_start_count_lo = l;                                     \
   7.519 -    task->ipc_sample_start_count_hi = h;                                     \
   7.520 -    rdtsc(l, h);                                                             \
   7.521 -    task->ipc_sample_start_cycle_lo = l;                                     \
   7.522 -    task->ipc_sample_start_cycle_hi = h;                                     \
   7.523 -}
   7.524 -
   7.525 -# define smt_sched_stop_sample(task)                                         \
   7.526 -{                                                                            \
   7.527 -    if (task->ipc_sample_start_cycle_hi != 0)                                \
   7.528 -    {                                                                        \
   7.529 -        unsigned int cl, ch, tl, th;                                         \
   7.530 -        unsigned int c, t;                                                   \
   7.531 -                                                                             \
   7.532 -        if (MPENTIUM4_HT) {                                                  \
   7.533 -            unsigned int msr =                                               \
   7.534 -                (task->processor & 1)?MY_MSR_COUNTER1:MY_MSR_COUNTER0;       \
   7.535 -            rdmsr(msr, cl, ch);                                              \
   7.536 -        }                                                                    \
   7.537 -        else {                                                               \
   7.538 -            rdmsr(MY_MSR_COUNTER, cl, ch);                                   \
   7.539 -        }                                                                    \
   7.540 -                                                                             \
   7.541 -        rdtsc(tl, th);                                                       \
   7.542 -                                                                             \
   7.543 -        c = cl - task->ipc_sample_start_count_lo;                            \
   7.544 -        t = tl - task->ipc_sample_start_cycle_lo;                            \
   7.545 -        task->ipc_average = IPC_AVERAGE(task->ipc_average,                   \
   7.546 -                                        ((double)c)/((double)t));            \
   7.547 -        task->ipc_sample_start_cycle_hi = 0;                                 \
   7.548 -                                                                             \
   7.549 -    }                                                                        \
   7.550 -    else                                                                     \
   7.551 -        task->ipc_average = 0.0;                                             \
   7.552 -                                                                             \
   7.553 -}
   7.554 -
   7.555 -//        task->ipc_sample_latest =                                            
   7.556 -//            (unsigned int)(1000.0*((double)c)/((double)t));                  
   7.557 -#endif /* __KERNEL__ */
   7.558 -
   7.559 -
   7.560 -#endif /* P4PERF_H */
   7.561 -
   7.562 -/* End of $RCSfile$ */
     8.1 --- a/tools/misc/setdomainmaxmem	Tue Oct 26 17:08:38 2004 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,34 +0,0 @@
     8.4 -#!/usr/bin/env perl
     8.5 -
     8.6 -use strict;
     8.7 -require "sys/ioctl.ph";
     8.8 -
     8.9 -sub SIZEOF_HYPERCALL () { 24; }
    8.10 -sub STRUCT_PRIVCMD_HYPERCALL () {"L P";}
    8.11 -sub IOCTL_PRIVCMD_HYPERCALL ()
    8.12 -        { &_IOC( &_IOC_NONE, ord('P'), 0, SIZEOF_HYPERCALL );}
    8.13 -sub __HYPERVISOR_dom0_op () {7;}
    8.14 -sub DOM0_INTERFACE_VERSION () {0xaaaa0010;}
    8.15 -sub DOM0_SETDOMAINMAXMEM () {28;}
    8.16 -sub STRUCT_DOM0_OP_PREFIX () {"L L";}
    8.17 -sub STRUCT_SETDOMAINMAXMEM () {STRUCT_DOM0_OP_PREFIX."L x4 L";}
    8.18 -sub XEN_PRIVCMD () {"/proc/xen/privcmd";}
    8.19 -
    8.20 -sub setdomainmaxmem($$) {
    8.21 -    my ($domain,$bytes) = @_;
    8.22 -    my $msg = pack(STRUCT_SETDOMAINMAXMEM,DOM0_SETDOMAINMAXMEM,
    8.23 -        DOM0_INTERFACE_VERSION,  $domain, $bytes);
    8.24 -    my $cmd = pack(STRUCT_PRIVCMD_HYPERCALL,__HYPERVISOR_dom0_op,$msg);
    8.25 -    open(XEN,XEN_PRIVCMD) or die "$!\n";
    8.26 -    ioctl(XEN, IOCTL_PRIVCMD_HYPERCALL, $cmd) or die "ioctl: $!";
    8.27 -    close XEN;
    8.28 -}
    8.29 -
    8.30 -my ($bytes,$suffix) = $ARGV[1] =~ m/(^\d+)([mMkKgG])/;
    8.31 -$bytes<<=10 if $suffix =~ m/[kK]/;
    8.32 -$bytes<<=20 if $suffix =~ m/[mM]/;
    8.33 -$bytes<<=30 if $suffix =~ m/[gG]/;
    8.34 -
    8.35 -printf "set domain $ARGV[0] to $bytes\n";
    8.36 -setdomainmaxmem($ARGV[0],$bytes);
    8.37 -
     9.1 --- a/tools/misc/xen_cpuperf.c	Tue Oct 26 17:08:38 2004 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,271 +0,0 @@
     9.4 -/*
     9.5 - * User mode program to prod MSR values through /proc/perfcntr
     9.6 - */
     9.7 -
     9.8 -#include <sys/types.h>
     9.9 -#include <sched.h>
    9.10 -#include <error.h>
    9.11 -#include <stdio.h>
    9.12 -#include <unistd.h>
    9.13 -#include <stdlib.h>
    9.14 -#include <string.h>
    9.15 -
    9.16 -#include "p4perf.h"
    9.17 -#include "xc_private.h"
    9.18 -
    9.19 -void dom0_wrmsr( int privfd,
    9.20 -                 int cpu_mask, 
    9.21 -                 int msr, 
    9.22 -                 unsigned int low, 
    9.23 -                 unsigned int high )
    9.24 -{
    9.25 -    dom0_op_t op;
    9.26 -    op.cmd = DOM0_MSR;
    9.27 -    op.u.msr.write = 1;
    9.28 -    op.u.msr.msr = msr;
    9.29 -    op.u.msr.cpu_mask = cpu_mask;
    9.30 -    op.u.msr.in1 = low;
    9.31 -    op.u.msr.in2 = high;
    9.32 -    do_dom0_op(privfd, &op);
    9.33 -}
    9.34 -
    9.35 -unsigned long long dom0_rdmsr( int privfd,
    9.36 -                               int cpu_mask,
    9.37 -                               int msr )
    9.38 -{
    9.39 -    dom0_op_t op;
    9.40 -    op.cmd = DOM0_MSR;
    9.41 -    op.u.msr.write = 0;
    9.42 -    op.u.msr.msr = msr;
    9.43 -    op.u.msr.cpu_mask = cpu_mask;
    9.44 -    do_dom0_op(privfd, &op);
    9.45 -    return (((unsigned long long)op.u.msr.out2)<<32) | op.u.msr.out1 ;
    9.46 -} 
    9.47 -
    9.48 -struct macros {
    9.49 -    char         *name;
    9.50 -    unsigned long msr_addr;
    9.51 -    int           number;
    9.52 -};
    9.53 -
    9.54 -struct macros msr[] = {
    9.55 -    {"BPU_COUNTER0", 0x300, 0},
    9.56 -    {"BPU_COUNTER1", 0x301, 1},
    9.57 -    {"BPU_COUNTER2", 0x302, 2},
    9.58 -    {"BPU_COUNTER3", 0x303, 3},
    9.59 -    {"MS_COUNTER0", 0x304, 4},
    9.60 -    {"MS_COUNTER1", 0x305, 5},
    9.61 -    {"MS_COUNTER2", 0x306, 6},
    9.62 -    {"MS_COUNTER3", 0x307, 7},
    9.63 -    {"FLAME_COUNTER0", 0x308, 8},
    9.64 -    {"FLAME_COUNTER1", 0x309, 9},
    9.65 -    {"FLAME_COUNTER2", 0x30a, 10},
    9.66 -    {"FLAME_COUNTER3", 0x30b, 11},
    9.67 -    {"IQ_COUNTER0", 0x30c, 12},
    9.68 -    {"IQ_COUNTER1", 0x30d, 13},
    9.69 -    {"IQ_COUNTER2", 0x30e, 14},
    9.70 -    {"IQ_COUNTER3", 0x30f, 15},
    9.71 -    {"IQ_COUNTER4", 0x310, 16},
    9.72 -    {"IQ_COUNTER5", 0x311, 17},
    9.73 -    {"BPU_CCCR0", 0x360, 0},
    9.74 -    {"BPU_CCCR1", 0x361, 1},
    9.75 -    {"BPU_CCCR2", 0x362, 2},
    9.76 -    {"BPU_CCCR3", 0x363, 3},
    9.77 -    {"MS_CCCR0", 0x364, 4},
    9.78 -    {"MS_CCCR1", 0x365, 5},
    9.79 -    {"MS_CCCR2", 0x366, 6},
    9.80 -    {"MS_CCCR3", 0x367, 7},
    9.81 -    {"FLAME_CCCR0", 0x368, 8},
    9.82 -    {"FLAME_CCCR1", 0x369, 9},
    9.83 -    {"FLAME_CCCR2", 0x36a, 10},
    9.84 -    {"FLAME_CCCR3", 0x36b, 11},
    9.85 -    {"IQ_CCCR0", 0x36c, 12},
    9.86 -    {"IQ_CCCR1", 0x36d, 13},
    9.87 -    {"IQ_CCCR2", 0x36e, 14},
    9.88 -    {"IQ_CCCR3", 0x36f, 15},
    9.89 -    {"IQ_CCCR4", 0x370, 16},
    9.90 -    {"IQ_CCCR5", 0x371, 17},
    9.91 -    {"BSU_ESCR0", 0x3a0, 7},
    9.92 -    {"BSU_ESCR1", 0x3a1, 7},
    9.93 -    {"FSB_ESCR0", 0x3a2, 6},
    9.94 -    {"FSB_ESCR1", 0x3a3, 6},
    9.95 -    {"MOB_ESCR0", 0x3aa, 2},
    9.96 -    {"MOB_ESCR1", 0x3ab, 2},
    9.97 -    {"PMH_ESCR0", 0x3ac, 4},
    9.98 -    {"PMH_ESCR1", 0x3ad, 4},
    9.99 -    {"BPU_ESCR0", 0x3b2, 0},
   9.100 -    {"BPU_ESCR1", 0x3b3, 0},
   9.101 -    {"IS_ESCR0", 0x3b4, 1},
   9.102 -    {"IS_ESCR1", 0x3b5, 1},
   9.103 -    {"ITLB_ESCR0", 0x3b6, 3},
   9.104 -    {"ITLB_ESCR1", 0x3b7, 3},
   9.105 -    {"IX_ESCR0", 0x3c8, 5},
   9.106 -    {"IX_ESCR1", 0x3c9, 5},
   9.107 -    {"MS_ESCR0", 0x3c0, 0},
   9.108 -    {"MS_ESCR1", 0x3c1, 0},
   9.109 -    {"TBPU_ESCR0", 0x3c2, 2},
   9.110 -    {"TBPU_ESCR1", 0x3c3, 2},
   9.111 -    {"TC_ESCR0", 0x3c4, 1},
   9.112 -    {"TC_ESCR1", 0x3c5, 1},
   9.113 -    {"FIRM_ESCR0", 0x3a4, 1},
   9.114 -    {"FIRM_ESCR1", 0x3a5, 1},
   9.115 -    {"FLAME_ESCR0", 0x3a6, 0},
   9.116 -    {"FLAME_ESCR1", 0x3a7, 0},
   9.117 -    {"DAC_ESCR0", 0x3a8, 5},
   9.118 -    {"DAC_ESCR1", 0x3a9, 5},
   9.119 -    {"SAAT_ESCR0", 0x3ae, 2},
   9.120 -    {"SAAT_ESCR1", 0x3af, 2},
   9.121 -    {"U2L_ESCR0", 0x3b0, 3},
   9.122 -    {"U2L_ESCR1", 0x3b1, 3},
   9.123 -    {"CRU_ESCR0", 0x3b8, 4},
   9.124 -    {"CRU_ESCR1", 0x3b9, 4},
   9.125 -    {"CRU_ESCR2", 0x3cc, 5},
   9.126 -    {"CRU_ESCR3", 0x3cd, 5},
   9.127 -    {"CRU_ESCR4", 0x3e0, 6},
   9.128 -    {"CRU_ESCR5", 0x3e1, 6},
   9.129 -    {"IQ_ESCR0", 0x3ba, 0},
   9.130 -    {"IQ_ESCR1", 0x3bb, 0},
   9.131 -    {"RAT_ESCR0", 0x3bc, 2},
   9.132 -    {"RAT_ESCR1", 0x3bd, 2},
   9.133 -    {"SSU_ESCR0", 0x3be, 3},
   9.134 -    {"SSU_ESCR1", 0x3bf, 3},
   9.135 -    {"ALF_ESCR0", 0x3ca, 1},
   9.136 -    {"ALF_ESCR1", 0x3cb, 1},
   9.137 -    {"PEBS_ENABLE", 0x3f1, 0},
   9.138 -    {"PEBS_MATRIX_VERT", 0x3f2, 0},
   9.139 -    {NULL, 0, 0}
   9.140 -};
   9.141 -
   9.142 -struct macros *lookup_macro(char *str)
   9.143 -{
   9.144 -    struct macros *m;
   9.145 -
   9.146 -    m = msr;
   9.147 -    while (m->name) {
   9.148 -        if (strcmp(m->name, str) == 0)
   9.149 -            return m;
   9.150 -        m++;
   9.151 -    }
   9.152 -    return NULL;
   9.153 -}
   9.154 -
   9.155 -int main(int argc, char **argv)
   9.156 -{
   9.157 -    int c, t = 0xc, es = 0, em = 0, tv = 0, te = 0;
   9.158 -    unsigned int cpu_mask = 1; 
   9.159 -    struct macros *escr = NULL, *cccr = NULL;
   9.160 -    unsigned long escr_val, cccr_val;
   9.161 -    int debug = 0;
   9.162 -    unsigned long pebs = 0, pebs_vert = 0;
   9.163 -    int pebs_x = 0, pebs_vert_x = 0;
   9.164 -    int read = 0, privfd;
   9.165 - 
   9.166 -    while ((c = getopt(argc, argv, "dc:t:e:m:T:E:C:P:V:r")) != -1) {
   9.167 -        switch((char)c) {
   9.168 -        case 'P':
   9.169 -            pebs |= 1 << atoi(optarg);
   9.170 -            pebs_x = 1;
   9.171 -            break;
   9.172 -        case 'V':
   9.173 -            pebs_vert |= 1 << atoi(optarg);
   9.174 -            pebs_vert_x = 1;
   9.175 -            break;
   9.176 -        case 'd':
   9.177 -            debug = 1;
   9.178 -            break;
   9.179 -        case 'c':
   9.180 -        {
   9.181 -            int cpu = atoi(optarg);
   9.182 -            cpu_mask  = (cpu == -1)?(~0):(1<<cpu);
   9.183 -            break;
   9.184 -        }
   9.185 -        case 't': // ESCR thread bits
   9.186 -            t = atoi(optarg);
   9.187 -            break;
   9.188 -        case 'e': // eventsel
   9.189 -            es = atoi(optarg);
   9.190 -            break;
   9.191 -        case 'm': // eventmask
   9.192 -            em = atoi(optarg);
   9.193 -            break;
   9.194 -        case 'T': // tag value
   9.195 -            tv = atoi(optarg);
   9.196 -            te = 1;
   9.197 -            break;
   9.198 -        case 'E':
   9.199 -            escr = lookup_macro(optarg);
   9.200 -            if (!escr) {
   9.201 -                fprintf(stderr, "Macro '%s' not found.\n", optarg);
   9.202 -                exit(1);
   9.203 -            }
   9.204 -            break;
   9.205 -        case 'C':
   9.206 -            cccr = lookup_macro(optarg);
   9.207 -            if (!cccr) {
   9.208 -                fprintf(stderr, "Macro '%s' not found.\n", optarg);
   9.209 -                exit(1);
   9.210 -            }
   9.211 -            break;
   9.212 -	case 'r':
   9.213 -	    read = 1;
   9.214 -	    break;
   9.215 -        }
   9.216 -    }
   9.217 -
   9.218 -    if ( (privfd = open("/proc/xen/privcmd", O_RDWR)) == -1 )
   9.219 -    {
   9.220 -        fprintf(stderr, "Could not open privileged Xen control interface.\n");
   9.221 -        exit(1);
   9.222 -    }
   9.223 -
   9.224 -    if (read) {
   9.225 -	while((cpu_mask&1)) {
   9.226 -            int i;
   9.227 -            for (i=0x300;i<0x312;i++)
   9.228 -            {
   9.229 -                printf("%010llx ",dom0_rdmsr( privfd, cpu_mask, i ) );
   9.230 -            }
   9.231 -            printf("\n");
   9.232 -            cpu_mask>>=1;
   9.233 -	}
   9.234 -	exit(1);
   9.235 -    }
   9.236 -
   9.237 -    if (!escr) {
   9.238 -        fprintf(stderr, "Need an ESCR.\n");
   9.239 -        exit(1);
   9.240 -    }
   9.241 -    if (!cccr) {
   9.242 -        fprintf(stderr, "Need a counter number.\n");
   9.243 -        exit(1);
   9.244 -    }
   9.245 -
   9.246 -    escr_val = P4_ESCR_THREADS(t) | P4_ESCR_EVNTSEL(es) |
   9.247 -        P4_ESCR_EVNTMASK(em) | P4_ESCR_TV(tv) | ((te)?P4_ESCR_TE:0);
   9.248 -    cccr_val = P4_CCCR_ENABLE | P4_CCCR_ESCR(escr->number) |
   9.249 -        P4_CCCR_ACTIVE_THREAD(3)/*reserved*/;
   9.250 -
   9.251 -    if (debug) {
   9.252 -        fprintf(stderr, "ESCR 0x%lx <= 0x%08lx\n", escr->msr_addr, escr_val);
   9.253 -        fprintf(stderr, "CCCR 0x%lx <= 0x%08lx (%u)\n",
   9.254 -                cccr->msr_addr, cccr_val, cccr->number);
   9.255 -        if (pebs_x)
   9.256 -            fprintf(stderr, "PEBS 0x%x <= 0x%08lx\n",
   9.257 -                    MSR_P4_PEBS_ENABLE, pebs);
   9.258 -        if (pebs_vert_x)
   9.259 -            fprintf(stderr, "PMV  0x%x <= 0x%08lx\n",
   9.260 -                    MSR_P4_PEBS_MATRIX_VERT, pebs_vert);
   9.261 -    }
   9.262 -
   9.263 -    dom0_wrmsr( privfd, cpu_mask, escr->msr_addr, escr_val, 0 );
   9.264 -    dom0_wrmsr( privfd, cpu_mask, cccr->msr_addr, cccr_val, 0 );
   9.265 -
   9.266 -    if (pebs_x)
   9.267 -        dom0_wrmsr( privfd, cpu_mask, MSR_P4_PEBS_ENABLE, pebs, 0 );
   9.268 -
   9.269 -    if (pebs_vert_x)
   9.270 -        dom0_wrmsr( privfd, cpu_mask, MSR_P4_PEBS_MATRIX_VERT, pebs_vert, 0 );
   9.271 -
   9.272 -    return 0;
   9.273 -}
   9.274 -
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/tools/misc/xensymoops	Thu Oct 28 16:15:46 2004 +0000
    10.3 @@ -0,0 +1,118 @@
    10.4 +#!/usr/bin/env python
    10.5 +
    10.6 +# An oops analyser for Xen
    10.7 +# Usage: xensymoops path-to-xen.s < oops-message
    10.8 +
    10.9 +# There's probably some more features that could go in here but this
   10.10 +# is sufficient to analyse most errors in my code ;-)
   10.11 +
   10.12 +# by Mark Williamson (C) 2004 Intel Research Cambridge
   10.13 +
   10.14 +import re, sys
   10.15 +
   10.16 +def read_oops():
   10.17 +    """Process an oops message on stdin and return (eip_addr, stack_addrs)
   10.18 +
   10.19 +    eip_addr is the location of EIP at the point of the crash.
   10.20 +    stack_addrs is a dictionary mapping potential code addresses in the stack
   10.21 +      to their order in the stack trace.
   10.22 +    """
   10.23 +    stackaddr_ptn = "\[([a-z,0-9]*)\]"
   10.24 +    stackaddr_re  = re.compile(stackaddr_ptn)
   10.25 +
   10.26 +    eip_ptn = ".*EIP:.*<([a-z,0-9]*)>.*"
   10.27 +    eip_re  = re.compile(eip_ptn)
   10.28 +
   10.29 +    matches = 0
   10.30 +    stack_addresses = {}
   10.31 +    eip_addr = "Not known"
   10.32 +
   10.33 +    while True:
   10.34 +        line = sys.stdin.readline()
   10.35 +        if not line: break
   10.36 +
   10.37 +        m = eip_re.match(line)
   10.38 +        if m: eip_addr = m.group(1)
   10.39 +        
   10.40 +        m = stackaddr_re.findall(line)
   10.41 +    
   10.42 +        for i in m:
   10.43 +            stack_addresses[i] = matches
   10.44 +            matches += 1
   10.45 +
   10.46 +    return (eip_addr, stack_addresses)
   10.47 +
   10.48 +def usage():
   10.49 +    print >> sys.stderr, """Usage: %s path-to-asm < oops-msg
   10.50 +    The oops message should be fed to the standard input.  The
   10.51 +    command-line argument specifies the path to the Xen assembly dump
   10.52 +    produced by \"make debug\".  The location of EIP and the backtrace
   10.53 +    will be output to standard output.
   10.54 +    """ % sys.argv[0]
   10.55 +    sys.exit()
   10.56 +
   10.57 +##### main
   10.58 +
   10.59 +if len(sys.argv) != 2:
   10.60 +    usage()
   10.61 +
   10.62 +# get address of EIP and the potential code addresses from the stack
   10.63 +(eip_addr, stk_addrs) = read_oops()
   10.64 +
   10.65 +# open Xen disassembly
   10.66 +asm_file = open(sys.argv[1])
   10.67 +
   10.68 +# regexp to match addresses of code lines in the objdump
   10.69 +addr_ptn = "([a-z,0-9]*):"
   10.70 +addr_re  = re.compile(addr_ptn)
   10.71 +
   10.72 +# regexp to match the start of functions in the objdump
   10.73 +func_ptn = "(.*<[\S]*>):"
   10.74 +func_re  = re.compile(func_ptn)
   10.75 +
   10.76 +func = "<No function>" # holds the name of the current function being scanned
   10.77 +
   10.78 +eip_func = "<No function>" # name of the function EIP was in
   10.79 +
   10.80 +# list of (position in original backtrace, code address, function) tuples
   10.81 +# describing all the potential code addresses we identified in the backtrace
   10.82 +# whose addresses we also located in the objdump output
   10.83 +backtrace = []
   10.84 +
   10.85 +while True:
   10.86 +    line = asm_file.readline()
   10.87 +    if not line: break
   10.88 +
   10.89 +    # if we've read the start of the function, record the name and address
   10.90 +    fm = func_re.match(line)
   10.91 +    if fm:
   10.92 +        func = fm.group(1)
   10.93 +        continue
   10.94 +
   10.95 +    # try match the address at the start of the line
   10.96 +    m = addr_re.match(line)
   10.97 +    if not m: continue
   10.98 +
   10.99 +    # we're on a code line...
  10.100 +
  10.101 +    address = m.group(1)
  10.102 +
  10.103 +    # if this address was seen as a potential code address in the backtrace then
  10.104 +    # record it in the backtrace list
  10.105 +    if stk_addrs.has_key(address):
  10.106 +        backtrace.append((stk_addrs[address], address, func))
  10.107 +
  10.108 +    # if this was the address that EIP...
  10.109 +    if address == eip_addr:
  10.110 +        eip_func = func
  10.111 +
  10.112 +
  10.113 +print "EIP %s in function %s" % (eip_addr, eip_func)
  10.114 +print "Backtrace:"
  10.115 +
  10.116 +# sorting will order primarily by the first element of each tuple,
  10.117 +# i.e. the order in the original oops
  10.118 +backtrace.sort()
  10.119 +
  10.120 +for (i, a, f) in backtrace:
  10.121 +    print "%s in function %s" % ( a, f )
    11.1 --- a/tools/misc/xensymoops.py	Tue Oct 26 17:08:38 2004 +0000
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,118 +0,0 @@
    11.4 -#!/usr/bin/env python
    11.5 -
    11.6 -# An oops analyser for Xen
    11.7 -# Usage: xensymoops path-to-xen.s < oops-message
    11.8 -
    11.9 -# There's probably some more features that could go in here but this
   11.10 -# is sufficient to analyse most errors in my code ;-)
   11.11 -
   11.12 -# by Mark Williamson (C) 2004 Intel Research Cambridge
   11.13 -
   11.14 -import re, sys
   11.15 -
   11.16 -def read_oops():
   11.17 -    """Process an oops message on stdin and return (eip_addr, stack_addrs)
   11.18 -
   11.19 -    eip_addr is the location of EIP at the point of the crash.
   11.20 -    stack_addrs is a dictionary mapping potential code addresses in the stack
   11.21 -      to their order in the stack trace.
   11.22 -    """
   11.23 -    stackaddr_ptn = "\[([a-z,0-9]*)\]"
   11.24 -    stackaddr_re  = re.compile(stackaddr_ptn)
   11.25 -
   11.26 -    eip_ptn = ".*EIP:.*<([a-z,0-9]*)>.*"
   11.27 -    eip_re  = re.compile(eip_ptn)
   11.28 -
   11.29 -    matches = 0
   11.30 -    stack_addresses = {}
   11.31 -    eip_addr = "Not known"
   11.32 -
   11.33 -    while True:
   11.34 -        line = sys.stdin.readline()
   11.35 -        if not line: break
   11.36 -
   11.37 -        m = eip_re.match(line)
   11.38 -        if m: eip_addr = m.group(1)
   11.39 -        
   11.40 -        m = stackaddr_re.findall(line)
   11.41 -    
   11.42 -        for i in m:
   11.43 -            stack_addresses[i] = matches
   11.44 -            matches += 1
   11.45 -
   11.46 -    return (eip_addr, stack_addresses)
   11.47 -
   11.48 -def usage():
   11.49 -    print >> sys.stderr, """Usage: %s path-to-asm < oops-msg
   11.50 -    The oops message should be fed to the standard input.  The
   11.51 -    command-line argument specifies the path to the Xen assembly dump
   11.52 -    produced by \"make debug\".  The location of EIP and the backtrace
   11.53 -    will be output to standard output.
   11.54 -    """ % sys.argv[0]
   11.55 -    sys.exit()
   11.56 -
   11.57 -##### main
   11.58 -
   11.59 -if len(sys.argv) != 2:
   11.60 -    usage()
   11.61 -
   11.62 -# get address of EIP and the potential code addresses from the stack
   11.63 -(eip_addr, stk_addrs) = read_oops()
   11.64 -
   11.65 -# open Xen disassembly
   11.66 -asm_file = open(sys.argv[1])
   11.67 -
   11.68 -# regexp to match addresses of code lines in the objdump
   11.69 -addr_ptn = "([a-z,0-9]*):"
   11.70 -addr_re  = re.compile(addr_ptn)
   11.71 -
   11.72 -# regexp to match the start of functions in the objdump
   11.73 -func_ptn = "(.*<[\S]*>):"
   11.74 -func_re  = re.compile(func_ptn)
   11.75 -
   11.76 -func = "<No function>" # holds the name of the current function being scanned
   11.77 -
   11.78 -eip_func = "<No function>" # name of the function EIP was in
   11.79 -
   11.80 -# list of (position in original backtrace, code address, function) tuples
   11.81 -# describing all the potential code addresses we identified in the backtrace
   11.82 -# whose addresses we also located in the objdump output
   11.83 -backtrace = []
   11.84 -
   11.85 -while True:
   11.86 -    line = asm_file.readline()
   11.87 -    if not line: break
   11.88 -
   11.89 -    # if we've read the start of the function, record the name and address
   11.90 -    fm = func_re.match(line)
   11.91 -    if fm:
   11.92 -        func = fm.group(1)
   11.93 -        continue
   11.94 -
   11.95 -    # try match the address at the start of the line
   11.96 -    m = addr_re.match(line)
   11.97 -    if not m: continue
   11.98 -
   11.99 -    # we're on a code line...
  11.100 -
  11.101 -    address = m.group(1)
  11.102 -
  11.103 -    # if this address was seen as a potential code address in the backtrace then
  11.104 -    # record it in the backtrace list
  11.105 -    if stk_addrs.has_key(address):
  11.106 -        backtrace.append((stk_addrs[address], address, func))
  11.107 -
  11.108 -    # if this was the address that EIP...
  11.109 -    if address == eip_addr:
  11.110 -        eip_func = func
  11.111 -
  11.112 -
  11.113 -print "EIP %s in function %s" % (eip_addr, eip_func)
  11.114 -print "Backtrace:"
  11.115 -
  11.116 -# sorting will order primarily by the first element of each tuple,
  11.117 -# i.e. the order in the original oops
  11.118 -backtrace.sort()
  11.119 -
  11.120 -for (i, a, f) in backtrace:
  11.121 -    print "%s in function %s" % ( a, f )