ia64/xen-unstable

changeset 2775:ad13896e776c

bitkeeper revision 1.1159.1.306 (418225cdXsKP_d8tfJvM9TR5Vjv5_Q)

Manual merge.
author mwilli2@equilibrium.research
date Fri Oct 29 11:13:17 2004 +0000 (2004-10-29)
parents bd14e7f131d0 7266d3bd3b1f
children 611b907c8330
files .rootkeys README 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	Fri Oct 29 10:31:32 2004 +0000
     1.2 +++ b/.rootkeys	Fri Oct 29 11:13:17 2004 +0000
     1.3 @@ -351,15 +351,12 @@ 3f6dc142IHaf6XIcAYGmhV9nNSIHFQ tools/mis
     1.4  40c9c469kT0H9COWzA4XzPBjWK0WsA tools/misc/netfix
     1.5  4022a73cEKvrYe_DVZW2JlAxobg9wg tools/misc/nsplitd/Makefile
     1.6  4022a73cKms4Oq030x2JBzUB426lAQ tools/misc/nsplitd/nsplitd.c
     1.7 -3f870808_8aFBAcZbWiWGdgrGQyIEw tools/misc/p4perf.h
     1.8 -4113d1afyPjO8m8-9E1pVBDHzGe1jQ tools/misc/setdomainmaxmem
     1.9  3f5ef5a2ir1kVAthS14Dc5QIRCEFWg tools/misc/xen-clone
    1.10  3f5ef5a2dTZP0nnsFoeq2jRf3mWDDg tools/misc/xen-clone.README
    1.11 -3f870808zS6T6iFhqYPGelroZlVfGQ tools/misc/xen_cpuperf.c
    1.12  405eedf6_nnNhFQ1I85lhCkLK6jFGA tools/misc/xencons
    1.13  40c9c4697z76HDfkCLdMhmaEwzFoNQ tools/misc/xend
    1.14  4107986eMWVdBoz4tXYoOscpN_BCYg tools/misc/xensv
    1.15 -4056f5155QYZdsk-1fLdjsZPFTnlhg tools/misc/xensymoops.py
    1.16 +4056f5155QYZdsk-1fLdjsZPFTnlhg tools/misc/xensymoops
    1.17  40cf2937dqM1jWW87O5OoOYND8leuA tools/misc/xm
    1.18  40c9c468icGyC5RAF1bRKsCXPDCvsA tools/python/Makefile
    1.19  40ffc44dOwe1CcYXGCkYHdG_NxcccA tools/python/logging/logging-0.4.9.2/PKG-INFO
     2.1 --- a/README	Fri Oct 29 10:31:32 2004 +0000
     2.2 +++ b/README	Fri Oct 29 11:13:17 2004 +0000
     2.3 @@ -10,7 +10,8 @@
     2.4  University of Cambridge Computer Laboratory
     2.5  28 October 2004
     2.6  
     2.7 -http://www.cl.cam.ac.uk/netos/xen
     2.8 +http://www.cl.cam.ac.uk/netos/xen/
     2.9 +http://www.cl.cam.ac.uk/netos/xen/
    2.10  
    2.11  About the Xen Virtual Machine Monitor
    2.12  =====================================
    2.13 @@ -19,198 +20,13 @@ About the Xen Virtual Machine Monitor
    2.14  Systems Research Group of the University of Cambridge Computer
    2.15  Laboratory, as part of the UK-EPSRC funded XenoServers project. 
    2.16  
    2.17 -The XenoServers project aims to provide a "public infrastructure for
    2.18 -global distributed computing", and Xen plays a key part in that,
    2.19 -allowing us to efficiently partition a single machine to enable
    2.20 -multiple independent clients to run their operating systems and
    2.21 -applications in an environment providing protection, resource
    2.22 -isolation and accounting.  The project web page contains further
    2.23 -information along with pointers to papers and technical reports:
    2.24 -http://www.cl.cam.ac.uk/xeno
    2.25 -
    2.26 -Xen has since grown into a project in its own right, enabling us to
    2.27 -investigate interesting research issues regarding the best techniques
    2.28 -for virtualizing resources such as the CPU, memory, disk and network.
    2.29 -The project has been bolstered by support from Intel Research
    2.30 -Cambridge, and HP Labs, who are now working closely with us. We're
    2.31 -also in receipt of support from Microsoft Research Cambridge to port
    2.32 -Windows XP to run on Xen.
    2.33 -
    2.34 -Xen enables multiple operating system images to execute concurrently 
    2.35 -on the same hardware with very low performance overhead --- much lower
    2.36 -than commercial offerings for the same x86 platform.
    2.37 -
    2.38 -This is achieved by requiring OSs to be specifically ported to run on
    2.39 -Xen, rather than allowing unmodified OS images to be used. Crucially,
    2.40 -only the OS needs to be changed -- all of the user-level application
    2.41 -binaries, libraries etc can run unmodified. Hence the modified OS
    2.42 -kernel can typically just be dropped into any existing OS distribution
    2.43 -or installation.
    2.44 -
    2.45 -Xen currently runs on the x86 architecture, but could in principle be
    2.46 -ported to others. In fact, it would have been rather easier to write
    2.47 -Xen for pretty much any other architecture as x86 is particularly 
    2.48 -tricky to handle. A good description of Xen's design, implementation 
    2.49 -and performance is contained in our October 2003 SOSP paper, available
    2.50 -at http://www.cl.cam.ac.uk/netos/papers/2003-xensosp.pdf
    2.51 -[update: work to port Xen to x86_64 and IA64 is underway]
    2.52 -
    2.53 -Five different operating systems have been ported to run on Xen: 
    2.54 -Linux 2.4/2.6, Windows XP, NetBSD, FreeBSD and Plan 9.
    2.55 -
    2.56 -The Linux 2.4 port (currently Linux 2.4.26) works very well -- we
    2.57 -regularly use it to host complex applications such as PostgreSQL,
    2.58 -Apache, BK servers etc. It runs every user-space applications we've
    2.59 -tried.  We refer to our version of Linux ported to run on Xen as
    2.60 -"XenLinux", although really it's just standard Linux ported to a new
    2.61 -virtual CPU architecture that we call xen-x86.
    2.62 -
    2.63 -NetBSD has been ported to Xen by Christian Limpach, and will hopefully
    2.64 -soon become part of the standard release. Work on a FreeBSD port has
    2.65 -been started by Kip Macy, and we hope to see this complete for the 2.0
    2.66 -release. Ron Minnich has been working on Plan 9.
    2.67 -
    2.68 -The Windows XP port is nearly finished. It's running user space
    2.69 -applications and is generally in pretty good shape thanks to some hard
    2.70 -work by a team over the summer.  Of course, there are issues with
    2.71 -releasing this code to others.  We should be able to release the
    2.72 -source and binaries to anyone that has signed the Microsoft academic
    2.73 -source license, which these days has very reasonable terms. We are in
    2.74 -discussions with Microsoft about the possibility of being able to make
    2.75 -binary releases to a larger user community. Obviously, there are
    2.76 -issues with product activation in this environment which need to be 
    2.77 -thought through.
    2.78 -
    2.79 -So, for the moment, you only get to run Linux 2.4/2.6 and NetBSD on
    2.80 -Xen, but we hope this will change before too long.  Even running
    2.81 -multiple copies of the same OS can be very useful, as it provides a
    2.82 -means of containing faults to one OS image, and also for providing
    2.83 -performance isolation between the various OS, enabling you to either
    2.84 -restrict, or reserve resources for, particular VM instances.
    2.85 -
    2.86 -It's also useful for development -- each version of Linux can have
    2.87 -different patches applied, enabling different kernels to be tried
    2.88 -out. For example, the "vservers" patch used by PlanetLab applies
    2.89 -cleanly to our ported version of Linux.
    2.90 -
    2.91 -We've successfully booted over 128 copies of Linux on the same machine
    2.92 -(a dual CPU hyperthreaded Xeon box) but we imagine that it would be
    2.93 -more normal to use some smaller number, perhaps 10-20.
    2.94 -
    2.95 -A common question is "how many virtual machines can I run on hardware
    2.96 -xyz?". The answer is very application dependent, but the rule of thumb
    2.97 -is that you should expect to be able to run the same workload under
    2.98 -multiple guest OSs that you could run under a single Linux instance,
    2.99 -with an additional overhead of a few MB per OS instance.
   2.100 -
   2.101 -One key feature in this new release of Xen is `live migration'. This
   2.102 -enables virtual machines instances to be dynamically moved between
   2.103 -physical Xen machines, with typical downtimes of just a few tens of
   2.104 -milliseconds. This is really useful for admins that want to take a
   2.105 -node down for maintenance, or to load balance a large number of
   2.106 -virtual machines across a cluster.
   2.107 -
   2.108 -
   2.109 -Hardware support
   2.110 -================
   2.111 +Xen 2.0 offers excellent performance, hardware support and enterprise
   2.112 +grade features such as live migration.  Linux 2.6, 2.4 and NetBSD 2.0
   2.113 +are already available for Xen, with more operating system ports on the
   2.114 +way.
   2.115  
   2.116 -Xen is intended to be run on server-class machines, and the current
   2.117 -list of supported hardware very much reflects this, avoiding the need
   2.118 -for us to write drivers for "legacy" hardware. It is likely that some
   2.119 -desktop chipsets will fail to work properly with the default Xen
   2.120 -configuration: specifying 'noacpi' or 'ignorebiostables' when booting
   2.121 -Xen may help in these cases.
   2.122 -
   2.123 -Xen requires a "P6" or newer processor (e.g. Pentium Pro, Celeron,
   2.124 -Pentium II, Pentium III, Pentium IV, Xeon, AMD Athlon, AMD Duron).
   2.125 -Multiprocessor machines are supported, and we also have basic support
   2.126 -for HyperThreading (SMT), although this remains a topic for ongoing
   2.127 -research. We're also working on an AMD x86_64 port (though Xen should
   2.128 -run on Opterons in 32-bit mode just fine).
   2.129 -
   2.130 -Xen can currently use up to 4GB of memory. It's possible for x86
   2.131 -machines to address more than that (64GB), but it requires using a
   2.132 -different page table format (3-level rather than 2-level) that we
   2.133 -don't currently support, as we are concentrating on an x86_64 port
   2.134 -that will more easily support large-memory configurations.
   2.135 -
   2.136 -In contrast to previous Xen versions, in Xen 2.0 device drivers run
   2.137 -within a privileged guest OS rather than within Xen itself. This means
   2.138 -that we should be compatible with the full set of device hardware
   2.139 -supported by Linux.  The default XenLinux build contains support for
   2.140 -relatively modern server-class network and disk hardware, but you can
   2.141 -add suppport for other hardware by configuring your XenLinux kernel in
   2.142 -the normal way (e.g. "make xconfig").
   2.143 -
   2.144 -
   2.145 -Building Xen and XenLinux
   2.146 -=========================
   2.147 -
   2.148 -The public master BK repository for the 2.0 release lives at: 
   2.149 -bk://xen.bkbits.net/xen-2.0.bk
   2.150 -
   2.151 -To fetch a local copy, install the BitKeeper tools, then run: 
   2.152 -'bk clone bk://xen.bkbits.net/xen-2.0.bk'
   2.153 -
   2.154 -You can do a complete build of Xen, the control tools, and the
   2.155 -XenLinux kernel images with "make world". This can take 10 minutes
   2.156 -even on a fast machine. If you're on an SMP machine you may wish to
   2.157 -give the '-j4' argument to make to get a parallel build.  All of the
   2.158 -files that are built are placed under the ./install directory.  You
   2.159 -can then install everything to the standard system directories
   2.160 -(e.g. /boot, /usr/bin, /usr/lib/python/ etc) by typing "make install".
   2.161 +Xen is Free Open Source Software, released under the GNU GPL.
   2.162  
   2.163 -Take a look in install/boot/:
   2.164 - install/boot/xen.gz               The Xen 'kernel' (formerly image.gz)
   2.165 - install/boot/vmlinuz-2.4.27-xen0  Domain 0 XenLinux kernel (xenolinux.gz)
   2.166 - install/boot/vmlinuz-2.4.27-xenU  Unprivileged XenLinux kernel
   2.167 -
   2.168 -The difference between the two Linux kernels that are built is
   2.169 -due to the configuration file used for each. The "U" suffixed
   2.170 -unprivileged version doesn't contain any of the physical hardware
   2.171 -device drivers, so is 30% smaller and hence may be preferred for
   2.172 -your non-privileged domains.
   2.173 -
   2.174 -The install/boot directory will also contain the config files
   2.175 -used for building the XenLinux kernels, and also versions of Xen
   2.176 -and XenLinux kernels that contain debug symbols (xen-syms and
   2.177 -vmlinux-syms-2.4.27-xen0) which are essential for interpreting crash
   2.178 -dumps.
   2.179 -
   2.180 -Inspect the Makefile if you want to see what goes on during a
   2.181 -build. Building Xen and the tools is straightforward, but XenLinux is
   2.182 -more complicated. The makefile needs a 'pristine' linux kernel tree
   2.183 -which it will then add the Xen architecture files to. You can tell the
   2.184 -makefile the location of the appropriate linux compressed tar file by
   2.185 -setting the LINUX_SRC environment variable
   2.186 -(e.g. "LINUX_SRC=/tmp/linux-2.4.27.tar.gz make world") or by placing
   2.187 -the tar file somewhere in the search path of LINUX_SRC_PATH which
   2.188 -defaults to ".:..". If the makefile can't find a suitable kernel tar
   2.189 -file it attempts to download it from kernel.org, but this won't work
   2.190 -if you're behind a firewall.
   2.191 -
   2.192 -After untaring the pristine kernel tree, the makefile uses the
   2.193 -'mkbuildtree' script to add the Xen patches the kernel. "make world"
   2.194 -then build two different XenLinux images, one with a "-xen0" extension
   2.195 -which contains hardware device drivers and is intended to be used in
   2.196 -the first virtual machine ("domain 0"), and one with a "-xenU"
   2.197 -extension that just contains virtual-device drivers. The latter can be
   2.198 -used for all non hardware privileged domains, and is substantially
   2.199 -smaller than the other kernel with its selection of hardware drivers.
   2.200 -
   2.201 -If you don't want to use bitkeeper to download the source, you can
   2.202 -download prebuilt binaries and src tar balls from the project
   2.203 -downloads page:  http://www.cl.cam.ac.uk/netos/xen/downloads/
   2.204 -
   2.205 -
   2.206 -Using the domain control tools
   2.207 -==============================
   2.208 -
   2.209 -Before starting domains you'll need to start the node management
   2.210 -daemon: "xend start". 
   2.211 -The primary tool for starting and controlling domains is "xm". 
   2.212 -"xm help <cmd>" will tell you how to use it.
   2.213 -
   2.214 -Further documentation is in the docs/ directory. Postscript, PDF and
   2.215 -HTML versions of the user manual can be found in the ps/, pdf/ and
   2.216 -html/ subdirectories.
   2.217 +For full documentation, see the Xen User Manual in docs/user.pdf
   2.218 +(after running make -C docs) or the Documentation page on the Xen
   2.219 +website.
     3.1 --- a/TODO	Fri Oct 29 10:31:32 2004 +0000
     3.2 +++ b/TODO	Fri Oct 29 11:13:17 2004 +0000
     3.3 @@ -1,43 +1,34 @@
     3.4 -
     3.5 -
     3.6 -Known limitations and work in progress
     3.7 -======================================
     3.8 +Future plans and enhancements
     3.9 +=============================
    3.10  
    3.11 -The current Xen Virtual Firewall Router (VFR) implementation in the
    3.12 -snapshot tree is very rudimentary, and in particular, lacks the RSIP
    3.13 -IP port-space sharing across domains that provides a better
    3.14 -alternative to NAT.  There's a complete new implementation under
    3.15 -development which also supports much better logging and auditing
    3.16 -support. For now, if you want NAT, see the xen_nat_enable scripts and
    3.17 -get domain0 to do it for you.
    3.18 +For up-to-date details of features currently under implementation,
    3.19 +visit the Xen project roadmap at:
    3.20 +http://www.cl.cam.ac.uk/Research/SRG/netos/xen/roadmap.html
    3.21  
    3.22 +IO enhancements
    3.23 +---------------
    3.24  There are also a number of memory management enhancements that didn't
    3.25  make this release: We have plans for a "universal buffer cache" that
    3.26  enables otherwise unused system memory to be used by domains in a
    3.27 -read-only fashion. We also have plans for inter-domain shared-memory
    3.28 -to enable high-performance bulk transport for cases where the usual
    3.29 -internal networking performance isn't good enough (e.g. communication
    3.30 -with a internal file server on another domain).
    3.31 +read-only fashion.
    3.32  
    3.33 -We have the equivalent of balloon driver functionality to control
    3.34 -domain's memory usage, enabling a domain to give back unused pages to
    3.35 -Xen. This needs properly documenting, and perhaps a way of domain0
    3.36 -signalling to a domain that it requires it to reduce its memory
    3.37 -footprint, rather than just the domain volunteering (see section on
    3.38 -the improved control interface).
    3.39 -
    3.40 +Disk Scheduling
    3.41 +---------------
    3.42  The current disk scheduler is rather simplistic (batch round robin),
    3.43  and could be replaced by e.g. Cello if we have QoS isolation
    3.44  problems. For most things it seems to work OK, but there's currently
    3.45  no service differentiation or weighting.
    3.46  
    3.47 +Improved load-balancing
    3.48 +-----------------------
    3.49  Currently, although Xen runs on SMP and SMT (hyperthreaded) machines,
    3.50  the scheduling is far from smart -- domains are currently statically
    3.51  assigned to a CPU when they are created (in a round robin fashion).
    3.52 -The scheduler needs to be modified such that before going idle a
    3.53 -logical CPU looks for work on other run queues (particularly on the
    3.54 -same physical CPU). 
    3.55 +We'd like to see a user-space load-balancing daemon that can shift
    3.56 +domains between CPUs as their activity changes.
    3.57  
    3.58 +Multiprocessor Guest VMs
    3.59 +------------------------
    3.60  Xen currently only supports uniprocessor guest OSes. We have designed
    3.61  the Xen interface with MP guests in mind, and plan to build an MP
    3.62  Linux guest in due course. Basically, an MP guest would consist of
    3.63 @@ -48,3 +39,21 @@ page directory to a write-able page, we 
    3.64  still has the page in its TLB to ensure memory system integrity.  One
    3.65  other issue for supporting MP guests is that we'll need some sort of
    3.66  CPU gang scheduler, which will require some research.
    3.67 +
    3.68 +Cluster Management
    3.69 +------------------
    3.70 +There have been discussions regarding a unified cluster controller
    3.71 +for Xen deployments.  This would leverage the existing features of
    3.72 +Xen to present a uniform control interface for managing a cluster
    3.73 +as a pool of resources, rather than a set of completely distinct
    3.74 +machines.
    3.75 +
    3.76 +PAE Support on 32-bit x86
    3.77 +-------------------------
    3.78 +Xen can currently use up to 4GB of memory. It's possible for x86
    3.79 +machines to address more than that (64GB), but it requires using a
    3.80 +different page table format (3-level rather than 2-level) that we
    3.81 +currently don't support. Adding 3-level PAE support wouldn't be
    3.82 +difficult, but we'd also need to add support to all the guest
    3.83 +OSs. We do not plan to add this support ourselves but volunteers
    3.84 +are welcome!
     4.1 --- a/docs/src/user.tex	Fri Oct 29 10:31:32 2004 +0000
     4.2 +++ b/docs/src/user.tex	Fri Oct 29 11:13:17 2004 +0000
     4.3 @@ -1,6 +1,7 @@
     4.4  \documentclass[11pt,twoside,final,openright]{xenstyle}
     4.5  \usepackage{a4,graphicx,setspace,times}
     4.6  \setstretch{1.15}
     4.7 +%\input{style.tex}
     4.8  
     4.9  \begin{document}
    4.10  
    4.11 @@ -183,7 +184,7 @@ information along with pointers to paper
    4.12  
    4.13  Xen has since grown into a project in its own right, enabling us to
    4.14  investigate interesting research issues regarding the best techniques
    4.15 -for virtualizing resources such as the CPU, memory, disk and network.
    4.16 +for virtualising resources such as the CPU, memory, disk and network.
    4.17  The project has been bolstered by support from Intel Research
    4.18  Cambridge, and HP Labs, who are now working closely with us.
    4.19  
    4.20 @@ -311,9 +312,9 @@ following:
    4.21  
    4.22  Inspect the Makefile if you want to see what goes on during a build.
    4.23  Building Xen and the tools is straightforward, but XenLinux is more
    4.24 -complicated.  The makefile needs a `pristine' linux kernel tree which
    4.25 +complicated.  The makefile needs a `pristine' Linux kernel tree which
    4.26  it will then add the Xen architecture files to.  You can tell the
    4.27 -makefile the location of the appropriate linux compressed tar file by
    4.28 +makefile the location of the appropriate Linux compressed tar file by
    4.29  setting the LINUX\_SRC environment variable, e.g. \\
    4.30  \verb!# LINUX_SRC=/tmp/linux-2.6.8.1.tar.bz2 make world! \\ or by
    4.31  placing the tar file somewhere in the search path of {\tt
    4.32 @@ -531,7 +532,7 @@ second to the location of \path{/usr} (i
    4.33  domains). [i.e. {\tt disk = ['phy:your\_hard\_drive\%d,sda1,w' \%
    4.34  (base\_partition\_number + vmid), 'phy:your\_usr\_partition,sda6,r' ]}
    4.35  \item[dhcp] Uncomment the dhcp variable, so that the domain will
    4.36 -receive its IP address from a DHCP server. [i.e. {\tt dhcp=''dhcp''}]
    4.37 +receive its IP address from a DHCP server. [i.e. {\tt dhcp='dhcp'}]
    4.38  \end{description}
    4.39  
    4.40  You may also want to edit the {\bf vif} variable in order to choose
    4.41 @@ -597,8 +598,8 @@ configuration file (or a link to it) und
    4.42  
    4.43  A Sys-V style init script for RedHat and LSB-compliant systems is
    4.44  provided and will be automatically copied to \path{/etc/init.d/}
    4.45 -during install.  You can then enable it in the appriate way for your
    4.46 -distribution.
    4.47 +during install.  You can then enable it in the appropriate way for
    4.48 +your distribution.
    4.49  
    4.50  For instance, on RedHat:
    4.51  
    4.52 @@ -689,13 +690,22 @@ or:
    4.53  # xm console 5
    4.54  \end{verbatim}
    4.55  
    4.56 -\chapter{Other kinds of storage}
    4.57 +\chapter{Domain filesystem storage}
    4.58  
    4.59  It is possible to directly export any Linux block device to a virtual,
    4.60  or to export filesystems / devices to virtual machines using standard
    4.61 -network protocals (e.g. NBD, iSCSI, NFS, etc).  This chapter covers
    4.62 +network protocols (e.g. NBD, iSCSI, NFS, etc).  This chapter covers
    4.63  some of the possibilities.
    4.64  
    4.65 +\section{Warning: Block device sharing}
    4.66 +
    4.67 +Block devices should only be shared between domains in a read-only
    4.68 +fashion otherwise the Linux kernels will obviously get very confused
    4.69 +as the file system structure may change underneath them (having the
    4.70 +same partition mounted rw twice is a sure fire way to cause
    4.71 +irreparable damage)!  If you want read-write sharing, export the
    4.72 +directory to other domains via NFS from domain0.
    4.73 +
    4.74  \section{File-backed virtual block devices}
    4.75  
    4.76  It is possible to use a file in Domain 0 as the primary storage for a
    4.77 @@ -1227,6 +1237,25 @@ parameters, etc.
    4.78  
    4.79  % Support for other administrative domains is not yet available...
    4.80  
    4.81 +\chapter{Debugging}
    4.82 +
    4.83 +Xen has a set of debugging features that can be useful to try and
    4.84 +figure out what's going on. Hit 'h' on the serial line (if you
    4.85 +specified a baud rate on the Xen command line) or ScrollLock-h on the
    4.86 +keyboard to get a list of supported commands.
    4.87 +
    4.88 +If you have a crash you'll likely get a crash dump containing an EIP
    4.89 +(PC) which, along with an 'objdump -d image', can be useful in
    4.90 +figuring out what's happened.  Debug a Xenlinux image just as you
    4.91 +would any other Linux kernel.
    4.92 +
    4.93 +We supply a handy debug terminal program which you can find in
    4.94 +/usr/local/src/xen-2.0.bk/tools/misc/miniterm/
    4.95 +This should be built and executed on another machine that is connected
    4.96 +via a null modem cable. Documentation is included.
    4.97 +Alternatively, if the Xen machine is connected to a serial-port server
    4.98 +then we supply a dumb TCP terminal client, {\tt xencons}.
    4.99 +
   4.100  \chapter{Xen build options}
   4.101  
   4.102  For most users, the default build of Xen will be adequate.  For some
   4.103 @@ -1582,6 +1611,61 @@ template and the new image, and using {\
   4.104  simply copying the image file.  Once this is done, modify the
   4.105  image-specific settings (hostname, network settings, etc).
   4.106  
   4.107 +\chapter{Installing Xen / XenLinux on Redhat / Fedora}
   4.108 +
   4.109 +When using Xen / Xenlinux on a standard Linux distribution there are
   4.110 +a couple of things to watch out for:
   4.111 +
   4.112 +Note that, because domains>0 don't have any privileged access at all,
   4.113 +certain commands in the default boot sequence will fail e.g. attempts
   4.114 +to update the hwclock, change the console font, update the keytable
   4.115 +map, start apmd (power management), or gpm (mouse cursor).  Either
   4.116 +ignore the errors (they should be harmless), or remove them from the
   4.117 +startup scripts.  Deleting the following links are a good start:
   4.118 +S24pcmcia S09isdn S17keytable S26apmd S85gpm.
   4.119 +
   4.120 +If you want to use a single root file system that works cleanly for
   4.121 +domain0 and domains>0, a useful trick is to use different 'init' run
   4.122 +levels. For example, on the Xen Demo CD we use run level 3 for domain
   4.123 +0, and run level 4 for domains>0. This enables different startup
   4.124 +scripts to be run in depending on the run level number passed on the
   4.125 +kernel command line.
   4.126 +
   4.127 +If you're going to use NFS root files systems mounted either from an
   4.128 +external server or from domain0 there are a couple of other gotchas.
   4.129 +The default /etc/sysconfig/iptables rules block NFS, so part way
   4.130 +through the boot sequence things will suddenly go dead.
   4.131 +
   4.132 +If you're planning on having a separate NFS /usr partition, the RH9
   4.133 +boot scripts don't make life easy - they attempt to mount NFS file
   4.134 +systems way to late in the boot process. The easiest way I found to do
   4.135 +this was to have a '/linuxrc' script run ahead of /sbin/init that
   4.136 +mounts /usr:
   4.137 +
   4.138 +\begin{verbatim}
   4.139 + #!/bin/bash
   4.140 + /sbin/ipconfig lo 127.0.0.1
   4.141 + /sbin/portmap
   4.142 + /bin/mount /usr
   4.143 + exec /sbin/init "$@" <>/dev/console 2>&1
   4.144 +\end{verbatim}
   4.145 +
   4.146 +The one slight complication with the above is that /sbib/portmap is
   4.147 +dynamically linked against /usr/lib/libwrap.so.0 Since this is in
   4.148 +/usr, it won't work. This can be solved by copying the file (and link)
   4.149 +below the /usr mount point, and just let the file be 'covered' when
   4.150 +the mount happens.
   4.151 +
   4.152 +In some installations, where a shared read-only /usr is being used, it
   4.153 +may be desirable to move other large directories over into the
   4.154 +read-only /usr. For example, you might replace /bin /lib and /sbin
   4.155 +with links into /usr/root/bin /usr/root/lib and /usr/root/sbin
   4.156 +respectively. This creates other problems for running the /linuxrc
   4.157 +script, requiring bash, portmap, mount, ifconfig, and a handful of
   4.158 +other shared libraries to be copied below the mount point - little
   4.159 +statically linked C program would solve this problem.
   4.160 +
   4.161 +
   4.162  \end{document}
   4.163  
   4.164  
   4.165 @@ -1612,4 +1696,52 @@ image-specific settings (hostname, netwo
   4.166  %% You can use these modules to write your own custom scripts or you can
   4.167  %% customise the scripts supplied in the Xen distribution.
   4.168  
   4.169 +
   4.170 +
   4.171  % Explain about AGP GART
   4.172 +
   4.173 +
   4.174 +%% If you're not intending to configure the new domain with an IP address
   4.175 +%% on your LAN, then you'll probably want to use NAT. The
   4.176 +%% 'xen_nat_enable' installs a few useful iptables rules into domain0 to
   4.177 +%% enable NAT. [NB: We plan to support RSIP in future]
   4.178 +
   4.179 +
   4.180 +
   4.181 +
   4.182 +%% Installing the file systems from the CD
   4.183 +%% =======================================
   4.184 +
   4.185 +%% If you haven't got an existing Linux installation onto which you can
   4.186 +%% just drop down the Xen and Xenlinux images, then the file systems on
   4.187 +%% the CD provide a quick way of doing an install. However, you would be
   4.188 +%% better off in the long run doing a proper install of your preferred
   4.189 +%% distro and installing Xen onto that, rather than just doing the hack
   4.190 +%% described below:
   4.191 +
   4.192 +%% Choose one or two partitions, depending on whether you want a separate
   4.193 +%% /usr or not. Make file systems on it/them e.g.: 
   4.194 +%%   mkfs -t ext3 /dev/hda3
   4.195 +%%   [or mkfs -t ext2 /dev/hda3 && tune2fs -j /dev/hda3 if using an old
   4.196 +%% version of mkfs]
   4.197 +
   4.198 +%% Next, mount the file system(s) e.g.:
   4.199 +%%   mkdir /mnt/root && mount /dev/hda3 /mnt/root
   4.200 +%%   [mkdir /mnt/usr && mount /dev/hda4 /mnt/usr]
   4.201 +  
   4.202 +%% To install the root file system, simply untar /usr/XenDemoCD/root.tar.gz:
   4.203 +%%   cd /mnt/root && tar -zxpf /usr/XenDemoCD/root.tar.gz
   4.204 +
   4.205 +%% You'll need to edit /mnt/root/etc/fstab to reflect your file system
   4.206 +%% configuration. Changing the password file (etc/shadow) is probably a
   4.207 +%% good idea too.
   4.208 +
   4.209 +%% To install the usr file system, copy the file system from CD on /usr,
   4.210 +%% though leaving out the "XenDemoCD" and "boot" directories:
   4.211 +%%   cd /usr && cp -a X11R6 etc java libexec root src bin dict kerberos local sbin tmp doc include lib man share /mnt/usr
   4.212 +
   4.213 +%% If you intend to boot off these file systems (i.e. use them for
   4.214 +%% domain 0), then you probably want to copy the /usr/boot directory on
   4.215 +%% the cd over the top of the current symlink to /boot on your root
   4.216 +%% filesystem (after deleting the current symlink) i.e.:
   4.217 +%%   cd /mnt/root ; rm boot ; cp -a /usr/boot .
     5.1 --- a/tools/misc/Makefile	Fri Oct 29 10:31:32 2004 +0000
     5.2 +++ b/tools/misc/Makefile	Fri Oct 29 11:13:17 2004 +0000
     5.3 @@ -17,7 +17,7 @@ HDRS     = $(wildcard *.h)
     5.4  SRCS     = $(wildcard *.c)
     5.5  OBJS     = $(patsubst %.c,%.o,$(SRCS))
     5.6  
     5.7 -TARGETS  = xen_cpuperf
     5.8 +TARGETS  = 
     5.9  
    5.10  INSTALL_BIN  = $(TARGETS) xencons
    5.11  INSTALL_SBIN = netfix xm xend xensv
     6.1 --- a/tools/misc/p4perf.h	Fri Oct 29 10:31:32 2004 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,559 +0,0 @@
     6.4 -/*
     6.5 - * For P6 use PERFCTR1 (0 used for APIC NMI watchdog). Must setup after
     6.6 - * APIC NMI watchdog setup. Note that if this previous setup doesn't happen
     6.7 - * we still must enable both counters.
     6.8 - *
     6.9 - * P4 Xeon with Hyperthreading has counters per physical package which can
    6.10 - * count events from either logical CPU. However, in many cases more than
    6.11 - * ECSR and CCCR/counter can be used to count the same event. For instr or
    6.12 - * uops retired, use either ESCR0/IQ_CCCR0 ESCR1/IQ_CCCR2.
    6.13 - *
    6.14 - * USE CONFIG_MPENTIUM4_HT for a P4 Xeon with hyperthreading.
    6.15 - *
    6.16 - * Note that the counters may be initialised on each logical processor
    6.17 - * which will cause each physical processor to be initialised twice. This
    6.18 - * should not cause a problem.
    6.19 - */
    6.20 -
    6.21 -#ifndef P4PERF_H
    6.22 -#define P4PERF_H
    6.23 -
    6.24 -#ifdef __KERNEL__
    6.25 -#include <asm/msr.h>
    6.26 -#endif
    6.27 -
    6.28 -/*****************************************************************************
    6.29 - * Performance counter configuration.                                        *
    6.30 - *****************************************************************************/
    6.31 -
    6.32 -#ifndef P6_EVNTSEL_OS
    6.33 -# define P6_EVNTSEL_OS     (1 << 17)
    6.34 -# define P6_EVNTSEL_USR    (1 << 16)
    6.35 -# define P6_EVNTSEL_E      (1 << 18)
    6.36 -# define P6_EVNTSEL_EN     (1 << 22)
    6.37 -#endif
    6.38 -#define P6_PERF_INST_RETIRED 0xc0
    6.39 -#define P6_PERF_UOPS_RETIRED 0xc2
    6.40 -
    6.41 -#define P4_ESCR_USR                    (1 << 2)
    6.42 -#define P4_ESCR_OS                     (1 << 3)
    6.43 -#define P4_ESCR_T0_USR                 (1 << 2) /* First logical CPU  */
    6.44 -#define P4_ESCR_T0_OS                  (1 << 3)
    6.45 -#define P4_ESCR_T1_USR                 (1 << 0) /* Second logical CPU */
    6.46 -#define P4_ESCR_T1_OS                  (1 << 1)
    6.47 -#define P4_ESCR_TE                     (1 << 4)
    6.48 -#define P4_ESCR_THREADS(t)             (t)
    6.49 -#define P4_ESCR_TV(tag)                (tag << 5)
    6.50 -#define P4_ESCR_EVNTSEL(e)             (e << 25)
    6.51 -#define P4_ESCR_EVNTMASK(e)            (e << 9)
    6.52 -
    6.53 -#define P4_ESCR_EVNTSEL_FRONT_END      0x08
    6.54 -#define P4_ESCR_EVNTSEL_EXECUTION      0x0c
    6.55 -#define P4_ESCR_EVNTSEL_REPLAY         0x09
    6.56 -#define P4_ESCR_EVNTSEL_INSTR_RETIRED  0x02
    6.57 -#define P4_ESCR_EVNTSEL_UOPS_RETIRED   0x01
    6.58 -#define P4_ESCR_EVNTSEL_UOP_TYPE       0x02
    6.59 -#define P4_ESCR_EVNTSEL_RET_MBR_TYPE   0x05
    6.60 -//#define P4_ESCR_EVNTSEL_RET_MBR_TYPE   0x04
    6.61 -
    6.62 -#define P4_ESCR_EVNTMASK_FE_NBOGUS     0x01
    6.63 -#define P4_ESCR_EVNTMASK_FE_BOGUS      0x02
    6.64 -
    6.65 -#define P4_ESCR_EVNTMASK_EXEC_NBOGUS0  0x01
    6.66 -#define P4_ESCR_EVNTMASK_EXEC_NBOGUS1  0x02
    6.67 -#define P4_ESCR_EVNTMASK_EXEC_NBOGUS2  0x04
    6.68 -#define P4_ESCR_EVNTMASK_EXEC_NBOGUS3  0x08
    6.69 -#define P4_ESCR_EVNTMASK_EXEC_BOGUS0   0x10
    6.70 -#define P4_ESCR_EVNTMASK_EXEC_BOGUS1   0x20
    6.71 -#define P4_ESCR_EVNTMASK_EXEC_BOGUS2   0x40
    6.72 -#define P4_ESCR_EVNTMASK_EXEC_BOGUS3   0x80
    6.73 -
    6.74 -#define P4_ESCR_EVNTMASK_REPLAY_NBOGUS 0x01
    6.75 -#define P4_ESCR_EVNTMASK_REPLAY_BOGUS  0x02
    6.76 -
    6.77 -#define P4_ESCR_EVNTMASK_IRET_NB_NTAG  0x01
    6.78 -#define P4_ESCR_EVNTMASK_IRET_NB_TAG   0x02
    6.79 -#define P4_ESCR_EVNTMASK_IRET_B_NTAG   0x04
    6.80 -#define P4_ESCR_EVNTMASK_IRET_B_TAG    0x08
    6.81 -
    6.82 -#define P4_ESCR_EVNTMASK_URET_NBOGUS   0x01
    6.83 -#define P4_ESCR_EVNTMASK_URET_BOGUS    0x02
    6.84 -
    6.85 -#define P4_ESCR_EVNTMASK_UOP_LOADS     0x02
    6.86 -#define P4_ESCR_EVNTMASK_UOP_STORES    0x04
    6.87 -
    6.88 -#define P4_ESCR_EVNTMASK_RMBRT_COND    0x02
    6.89 -#define P4_ESCR_EVNTMASK_RMBRT_CALL    0x04
    6.90 -#define P4_ESCR_EVNTMASK_RMBRT_RETURN  0x08
    6.91 -#define P4_ESCR_EVNTMASK_RMBRT_INDIR   0x10
    6.92 -
    6.93 -#define P4_ESCR_EVNTMASK_RBRT_COND     0x02
    6.94 -#define P4_ESCR_EVNTMASK_RBRT_CALL     0x04
    6.95 -#define P4_ESCR_EVNTMASK_RBRT_RETURN   0x08
    6.96 -#define P4_ESCR_EVNTMASK_RBRT_INDIR    0x10
    6.97 -
    6.98 -//#define P4_ESCR_EVNTMASK_INSTR_RETIRED 0x01  /* Non bogus, not tagged */
    6.99 -//#define P4_ESCR_EVNTMASK_UOPS_RETIRED  0x01  /* Non bogus             */
   6.100 -
   6.101 -#define P4_CCCR_OVF                    (1 << 31)
   6.102 -#define P4_CCCR_CASCADE                (1 << 30)
   6.103 -#define P4_CCCR_FORCE_OVF              (1 << 25)
   6.104 -#define P4_CCCR_EDGE                   (1 << 24)
   6.105 -#define P4_CCCR_COMPLEMENT             (1 << 19)
   6.106 -#define P4_CCCR_COMPARE                (1 << 18)
   6.107 -#define P4_CCCR_THRESHOLD(t)           (t << 20)
   6.108 -#define P4_CCCR_ENABLE                 (1 << 12)
   6.109 -#define P4_CCCR_ESCR(escr)             (escr << 13)
   6.110 -#define P4_CCCR_ACTIVE_THREAD(t)       (t << 16)   /* Set to 11 */
   6.111 -#define P4_CCCR_OVF_PMI_T0             (1 << 26)
   6.112 -#define P4_CCCR_OVF_PMI_T1             (1 << 27)
   6.113 -#define P4_CCCR_RESERVED               (3 << 16)
   6.114 -#define P4_CCCR_OVF_PMI                (1 << 26)
   6.115 -
   6.116 -// BPU
   6.117 -#define MSR_P4_BPU_COUNTER0            0x300
   6.118 -#define MSR_P4_BPU_COUNTER1            0x301
   6.119 -#define MSR_P4_BPU_CCCR0               0x360
   6.120 -#define MSR_P4_BPU_CCCR1               0x361
   6.121 -
   6.122 -#define MSR_P4_BPU_COUNTER2            0x302
   6.123 -#define MSR_P4_BPU_COUNTER3            0x303
   6.124 -#define MSR_P4_BPU_CCCR2               0x362
   6.125 -#define MSR_P4_BPU_CCCR3               0x363
   6.126 -
   6.127 -#define MSR_P4_BSU_ESCR0               0x3a0
   6.128 -#define MSR_P4_FSB_ESCR0               0x3a2
   6.129 -#define MSR_P4_MOB_ESCR0               0x3aa
   6.130 -#define MSR_P4_PMH_ESCR0               0x3ac
   6.131 -#define MSR_P4_BPU_ESCR0               0x3b2
   6.132 -#define MSR_P4_IS_ESCR0                0x3b4
   6.133 -#define MSR_P4_ITLB_ESCR0              0x3b6
   6.134 -#define MSR_P4_IX_ESCR0                0x3c8
   6.135 -
   6.136 -#define P4_BSU_ESCR0_NUMBER            7
   6.137 -#define P4_FSB_ESCR0_NUMBER            6
   6.138 -#define P4_MOB_ESCR0_NUMBER            2
   6.139 -#define P4_PMH_ESCR0_NUMBER            4
   6.140 -#define P4_BPU_ESCR0_NUMBER            0
   6.141 -#define P4_IS_ESCR0_NUMBER             1
   6.142 -#define P4_ITLB_ESCR0_NUMBER           3
   6.143 -#define P4_IX_ESCR0_NUMBER             5
   6.144 -
   6.145 -#define MSR_P4_BSU_ESCR1               0x3a1
   6.146 -#define MSR_P4_FSB_ESCR1               0x3a3
   6.147 -#define MSR_P4_MOB_ESCR1               0x3ab
   6.148 -#define MSR_P4_PMH_ESCR1               0x3ad
   6.149 -#define MSR_P4_BPU_ESCR1               0x3b3
   6.150 -#define MSR_P4_IS_ESCR1                0x3b5
   6.151 -#define MSR_P4_ITLB_ESCR1              0x3b7
   6.152 -#define MSR_P4_IX_ESCR1                0x3c9
   6.153 -
   6.154 -#define P4_BSU_ESCR1_NUMBER            7
   6.155 -#define P4_FSB_ESCR1_NUMBER            6
   6.156 -#define P4_MOB_ESCR1_NUMBER            2
   6.157 -#define P4_PMH_ESCR1_NUMBER            4
   6.158 -#define P4_BPU_ESCR1_NUMBER            0
   6.159 -#define P4_IS_ESCR1_NUMBER             1
   6.160 -#define P4_ITLB_ESCR1_NUMBER           3
   6.161 -#define P4_IX_ESCR1_NUMBER             5
   6.162 -
   6.163 -// MS
   6.164 -#define MSR_P4_MS_COUNTER0             0x304
   6.165 -#define MSR_P4_MS_COUNTER1             0x305
   6.166 -#define MSR_P4_MS_CCCR0                0x364
   6.167 -#define MSR_P4_MS_CCCR1                0x365
   6.168 -
   6.169 -#define MSR_P4_MS_COUNTER2             0x306
   6.170 -#define MSR_P4_MS_COUNTER3             0x307
   6.171 -#define MSR_P4_MS_CCCR2                0x366
   6.172 -#define MSR_P4_MS_CCCR3                0x367
   6.173 -
   6.174 -#define MSR_P4_MS_ESCR0                0x3c0
   6.175 -#define MSR_P4_TBPU_ESCR0              0x3c2
   6.176 -#define MSR_P4_TC_ESCR0                0x3c4
   6.177 -
   6.178 -#define P4_MS_ESCR0_NUMBER             0
   6.179 -#define P4_TBPU_ESCR0_NUMBER           2
   6.180 -#define P4_TC_ESCR0_NUMBER             1
   6.181 -
   6.182 -#define MSR_P4_MS_ESCR1                0x3c1
   6.183 -#define MSR_P4_TBPU_ESCR1              0x3c3
   6.184 -#define MSR_P4_TC_ESCR1                0x3c5
   6.185 -
   6.186 -#define P4_MS_ESCR1_NUMBER             0
   6.187 -#define P4_TBPU_ESCR1_NUMBER           2
   6.188 -#define P4_TC_ESCR1_NUMBER             1
   6.189 -
   6.190 -// FLAME
   6.191 -#define MSR_P4_FLAME_COUNTER0          0x308
   6.192 -#define MSR_P4_FLAME_COUNTER1          0x309
   6.193 -#define MSR_P4_FLAME_CCCR0             0x368
   6.194 -#define MSR_P4_FLAME_CCCR1             0x369
   6.195 -
   6.196 -#define MSR_P4_FLAME_COUNTER2          0x30a
   6.197 -#define MSR_P4_FLAME_COUNTER3          0x30b
   6.198 -#define MSR_P4_FLAME_CCCR2             0x36a
   6.199 -#define MSR_P4_FLAME_CCCR3             0x36b
   6.200 -
   6.201 -#define MSR_P4_FIRM_ESCR0              0x3a4
   6.202 -#define MSR_P4_FLAME_ESCR0             0x3a6
   6.203 -#define MSR_P4_DAC_ESCR0               0x3a8
   6.204 -#define MSR_P4_SAAT_ESCR0              0x3ae
   6.205 -#define MSR_P4_U2L_ESCR0               0x3b0
   6.206 -
   6.207 -#define P4_FIRM_ESCR0_NUMBER           1
   6.208 -#define P4_FLAME_ESCR0_NUMBER          0
   6.209 -#define P4_DAC_ESCR0_NUMBER            5
   6.210 -#define P4_SAAT_ESCR0_NUMBER           2
   6.211 -#define P4_U2L_ESCR0_NUMBER            3
   6.212 -
   6.213 -#define MSR_P4_FIRM_ESCR1              0x3a5
   6.214 -#define MSR_P4_FLAME_ESCR1             0x3a7
   6.215 -#define MSR_P4_DAC_ESCR1               0x3a9
   6.216 -#define MSR_P4_SAAT_ESCR1              0x3af
   6.217 -#define MSR_P4_U2L_ESCR1               0x3b1
   6.218 -
   6.219 -#define P4_FIRM_ESCR1_NUMBER           1
   6.220 -#define P4_FLAME_ESCR1_NUMBER          0
   6.221 -#define P4_DAC_ESCR1_NUMBER            5
   6.222 -#define P4_SAAT_ESCR1_NUMBER           2
   6.223 -#define P4_U2L_ESCR1_NUMBER            3
   6.224 -
   6.225 -// IQ
   6.226 -#define MSR_P4_IQ_COUNTER0             0x30c
   6.227 -#define MSR_P4_IQ_COUNTER1             0x30d
   6.228 -#define MSR_P4_IQ_CCCR0                0x36c
   6.229 -#define MSR_P4_IQ_CCCR1                0x36d
   6.230 -
   6.231 -#define MSR_P4_IQ_COUNTER2             0x30e
   6.232 -#define MSR_P4_IQ_COUNTER3             0x30f
   6.233 -#define MSR_P4_IQ_CCCR2                0x36e
   6.234 -#define MSR_P4_IQ_CCCR3                0x36f
   6.235 -
   6.236 -#define MSR_P4_IQ_COUNTER4             0x310
   6.237 -#define MSR_P4_IQ_COUNTER5             0x311
   6.238 -#define MSR_P4_IQ_CCCR4                0x370
   6.239 -#define MSR_P4_IQ_CCCR5                0x371
   6.240 -
   6.241 -#define MSR_P4_CRU_ESCR0               0x3b8
   6.242 -#define MSR_P4_CRU_ESCR2               0x3cc
   6.243 -#define MSR_P4_CRU_ESCR4               0x3e0
   6.244 -#define MSR_P4_IQ_ESCR0                0x3ba
   6.245 -#define MSR_P4_RAT_ESCR0               0x3bc
   6.246 -#define MSR_P4_SSU_ESCR0               0x3be
   6.247 -#define MSR_P4_ALF_ESCR0               0x3ca
   6.248 -
   6.249 -#define P4_CRU_ESCR0_NUMBER            4
   6.250 -#define P4_CRU_ESCR2_NUMBER            5
   6.251 -#define P4_CRU_ESCR4_NUMBER            6
   6.252 -#define P4_IQ_ESCR0_NUMBER             0
   6.253 -#define P4_RAT_ESCR0_NUMBER            2
   6.254 -#define P4_SSU_ESCR0_NUMBER            3
   6.255 -#define P4_ALF_ESCR0_NUMBER            1
   6.256 -
   6.257 -#define MSR_P4_CRU_ESCR1               0x3b9
   6.258 -#define MSR_P4_CRU_ESCR3               0x3cd
   6.259 -#define MSR_P4_CRU_ESCR5               0x3e1
   6.260 -#define MSR_P4_IQ_ESCR1                0x3bb
   6.261 -#define MSR_P4_RAT_ESCR1               0x3bd
   6.262 -#define MSR_P4_ALF_ESCR1               0x3cb
   6.263 -
   6.264 -#define P4_CRU_ESCR1_NUMBER            4
   6.265 -#define P4_CRU_ESCR3_NUMBER            5
   6.266 -#define P4_CRU_ESCR5_NUMBER            6
   6.267 -#define P4_IQ_ESCR1_NUMBER             0
   6.268 -#define P4_RAT_ESCR1_NUMBER            2
   6.269 -#define P4_ALF_ESCR1_NUMBER            1
   6.270 -
   6.271 -#define P4_BPU_COUNTER0_NUMBER         0
   6.272 -#define P4_BPU_COUNTER1_NUMBER         1
   6.273 -#define P4_BPU_COUNTER2_NUMBER         2
   6.274 -#define P4_BPU_COUNTER3_NUMBER         3
   6.275 -
   6.276 -#define P4_MS_COUNTER0_NUMBER          4
   6.277 -#define P4_MS_COUNTER1_NUMBER          5
   6.278 -#define P4_MS_COUNTER2_NUMBER          6
   6.279 -#define P4_MS_COUNTER3_NUMBER          7
   6.280 -
   6.281 -#define P4_FLAME_COUNTER0_NUMBER       8
   6.282 -#define P4_FLAME_COUNTER1_NUMBER       9
   6.283 -#define P4_FLAME_COUNTER2_NUMBER       10
   6.284 -#define P4_FLAME_COUNTER3_NUMBER       11
   6.285 -
   6.286 -#define P4_IQ_COUNTER0_NUMBER          12
   6.287 -#define P4_IQ_COUNTER1_NUMBER          13
   6.288 -#define P4_IQ_COUNTER2_NUMBER          14
   6.289 -#define P4_IQ_COUNTER3_NUMBER          15
   6.290 -#define P4_IQ_COUNTER4_NUMBER          16
   6.291 -#define P4_IQ_COUNTER5_NUMBER          17
   6.292 -
   6.293 -/* PEBS
   6.294 - */
   6.295 -#define MSR_P4_PEBS_ENABLE             0x3F1
   6.296 -#define MSR_P4_PEBS_MATRIX_VERT        0x3F2
   6.297 -
   6.298 -#define P4_PEBS_ENABLE_MY_THR          (1 << 25)
   6.299 -#define P4_PEBS_ENABLE_OTH_THR         (1 << 26)
   6.300 -#define P4_PEBS_ENABLE                 (1 << 24)
   6.301 -#define P4_PEBS_BIT0                   (1 << 0)
   6.302 -#define P4_PEBS_BIT1                   (1 << 1)
   6.303 -#define P4_PEBS_BIT2                   (1 << 2)
   6.304 -
   6.305 -#define P4_PEBS_MATRIX_VERT_BIT0       (1 << 0)
   6.306 -#define P4_PEBS_MATRIX_VERT_BIT1       (1 << 1)
   6.307 -#define P4_PEBS_MATRIX_VERT_BIT2       (1 << 2)
   6.308 -
   6.309 -/* Replay tagging.
   6.310 - */
   6.311 -#define P4_REPLAY_TAGGING_PEBS_L1LMR   P4_PEBS_BIT0
   6.312 -#define P4_REPLAY_TAGGING_PEBS_L2LMR   P4_PEBS_BIT1
   6.313 -#define P4_REPLAY_TAGGING_PEBS_DTLMR   P4_PEBS_BIT2
   6.314 -#define P4_REPLAY_TAGGING_PEBS_DTSMR   P4_PEBS_BIT2
   6.315 -#define P4_REPLAY_TAGGING_PEBS_DTAMR   P4_PEBS_BIT2
   6.316 -
   6.317 -#define P4_REPLAY_TAGGING_VERT_L1LMR   P4_PEBS_MATRIX_VERT_BIT0
   6.318 -#define P4_REPLAY_TAGGING_VERT_L2LMR   P4_PEBS_MATRIX_VERT_BIT0
   6.319 -#define P4_REPLAY_TAGGING_VERT_DTLMR   P4_PEBS_MATRIX_VERT_BIT0
   6.320 -#define P4_REPLAY_TAGGING_VERT_DTSMR   P4_PEBS_MATRIX_VERT_BIT1
   6.321 -#define P4_REPLAY_TAGGING_VERT_DTAMR   P4_PEBS_MATRIX_VERT_BIT0 | P4_PEBS_MATRIX_VERT_BIT1
   6.322 -
   6.323 -
   6.324 -
   6.325 -
   6.326 -/*****************************************************************************
   6.327 - *                                                                           *
   6.328 - *****************************************************************************/
   6.329 -
   6.330 -// x87_FP_uop
   6.331 -#define EVENT_SEL_x87_FP_uop                0x04
   6.332 -#define EVENT_MASK_x87_FP_uop_ALL           (1 << 15)
   6.333 -
   6.334 -// execution event (at retirement)
   6.335 -#define EVENT_SEL_execution_event           0x0C
   6.336 -
   6.337 -// scalar_SP_uop
   6.338 -#define EVENT_SEL_scalar_SP_uop             0x0a
   6.339 -#define EVENT_MASK_scalar_SP_uop_ALL        (1 << 15)
   6.340 -
   6.341 -// scalar_DP_uop
   6.342 -#define EVENT_SEL_scalar_DP_uop             0x0e
   6.343 -#define EVENT_MASK_scalar_DP_uop_ALL        (1 << 15)
   6.344 -
   6.345 -// Instruction retired
   6.346 -#define EVENT_SEL_instr_retired             0x02
   6.347 -#define EVENT_MASK_instr_retired_ALL        0x0f
   6.348 -
   6.349 -// uOps retired
   6.350 -#define EVENT_SEL_uops_retired              0x01
   6.351 -#define EVENT_MASK_uops_retired_ALL         0x03
   6.352 -
   6.353 -// L1 misses retired
   6.354 -#define EVENT_SEL_replay_event              0x09
   6.355 -#define EVENT_MASK_replay_event_ALL         0x03
   6.356 -
   6.357 -// Trace cache
   6.358 -#define EVENT_SEL_BPU_fetch_request         0x03
   6.359 -#define EVENT_MASK_BPU_fetch_request_TCMISS 0x01
   6.360 -
   6.361 -// Bus activity
   6.362 -#define EVENT_SEL_FSB_data_activity               0x17
   6.363 -#define EVENT_MASK_FSB_data_activity_DRDY_DRV     0x01
   6.364 -#define EVENT_MASK_FSB_data_activity_DRDY_OWN     0x02
   6.365 -#define EVENT_MASK_FSB_data_activity_DRDY_OOTHER  0x04
   6.366 -#define EVENT_MASK_FSB_data_activity_DBSY_DRV     0x08
   6.367 -#define EVENT_MASK_FSB_data_activity_DBSY_OWN     0x10
   6.368 -#define EVENT_MASK_FSB_data_activity_DBSY_OOTHER  0x20
   6.369 -
   6.370 -// Cache L2
   6.371 -#define EVENT_SEL_BSQ_cache_reference             0x0c
   6.372 -#define EVENT_MASK_BSQ_cache_reference_RD_L2_HITS 0x001
   6.373 -#define EVENT_MASK_BSQ_cache_reference_RD_L2_HITE 0x002
   6.374 -#define EVENT_MASK_BSQ_cache_reference_RD_L2_HITM 0x004
   6.375 -
   6.376 -#define EVENT_MASK_BSQ_cache_reference_RD_L3_HITS 0x008
   6.377 -#define EVENT_MASK_BSQ_cache_reference_RD_L3_HITE 0x010
   6.378 -#define EVENT_MASK_BSQ_cache_reference_RD_L3_HITM 0x020
   6.379 -
   6.380 -#define EVENT_MASK_BSQ_cache_reference_RD_L2_MISS 0x100
   6.381 -#define EVENT_MASK_BSQ_cache_reference_RD_L3_MISS 0x200
   6.382 -#define EVENT_MASK_BSQ_cache_reference_WR_L2_MISS 0x400
   6.383 -
   6.384 -/*****************************************************************************
   6.385 - *                                                                           *
   6.386 - *****************************************************************************/
   6.387 -
   6.388 -
   6.389 -/* The following turn configuration macros into 1/0 to allow code to be
   6.390 - * selected using if(MPENTIUM4_HT) rather then #ifdef (to avoid stale code).
   6.391 - * We rely on the compiler to optimise out unreachable code,
   6.392 - */
   6.393 -#ifdef CONFIG_MPENTIUM4_HT
   6.394 -# define MPENTIUM4_HT 1
   6.395 -#else
   6.396 -# define MPENTIUM4_HT 0
   6.397 -#endif
   6.398 -
   6.399 -#ifdef CONFIG_MPENTIUMIII
   6.400 -# define MPENTIUMIII 1
   6.401 -#else
   6.402 -# define MPENTIUMIII 0
   6.403 -#endif
   6.404 -
   6.405 -#ifdef CONFIG_MPENTIUM4
   6.406 -# define MPENTIUM4 1
   6.407 -#else
   6.408 -# define MPENTIUM4 0
   6.409 -#endif
   6.410 -
   6.411 -/*****************************************************************************
   6.412 - * MSR access macros                                                         *
   6.413 - *****************************************************************************/
   6.414 -
   6.415 -/* rpcc: get full 64-bit Pentium TSC value
   6.416 - */
   6.417 -static __inline__ unsigned long long int rpcc(void) 
   6.418 -{
   6.419 -    unsigned int __h, __l;
   6.420 -    __asm__ __volatile__ ("rdtsc" :"=a" (__l), "=d" (__h));
   6.421 -    return (((unsigned long long)__h) << 32) + __l;
   6.422 -}
   6.423 -
   6.424 -/*****************************************************************************
   6.425 - * Functions.                                                                *
   6.426 - *****************************************************************************/
   6.427 -
   6.428 -#ifdef __KERNEL__
   6.429 -static inline void smt_sched_setup(void)
   6.430 -{
   6.431 -    if (MPENTIUMIII) {
   6.432 -        unsigned int evntsel, x;
   6.433 -        
   6.434 -        /* Make sure counters enabled. */
   6.435 -        rdmsr(MSR_P6_EVNTSEL0, evntsel, x);
   6.436 -        evntsel |= P6_EVNTSEL_EN;
   6.437 -        wrmsr(MSR_P6_EVNTSEL0, evntsel, 0);
   6.438 -        
   6.439 -        evntsel =
   6.440 -            P6_PERF_INST_RETIRED | 
   6.441 -            P6_EVNTSEL_OS        | 
   6.442 -            P6_EVNTSEL_USR       | 
   6.443 -            P6_EVNTSEL_E;
   6.444 -        wrmsr(MSR_P6_EVNTSEL1, evntsel, 0);
   6.445 -    }
   6.446 -
   6.447 -    if(MPENTIUM4) {
   6.448 -        unsigned int x;
   6.449 -        
   6.450 -        /* Program the ESCR */
   6.451 -        x = P4_ESCR_USR                                    |
   6.452 -            P4_ESCR_OS                                     | 
   6.453 -            P4_ESCR_EVNTSEL(P4_ESCR_EVNTSEL_INSTR_RETIRED) | 
   6.454 -            P4_ESCR_EVNTMASK(P4_ESCR_EVNTMASK_IRET_NB_NTAG);
   6.455 -        wrmsr(MSR_P4_CRU_ESCR0, x, 0);
   6.456 -        
   6.457 -        /* Program the CCCR */
   6.458 -        if (MPENTIUM4_HT) {
   6.459 -            x = P4_CCCR_ENABLE                    | 
   6.460 -                P4_CCCR_ESCR(P4_CRU_ESCR0_NUMBER) |
   6.461 -                P4_CCCR_ACTIVE_THREAD(3);
   6.462 -        }
   6.463 -        else {
   6.464 -            x = P4_CCCR_ENABLE                    | 
   6.465 -                P4_CCCR_ESCR(P4_CRU_ESCR0_NUMBER) |
   6.466 -                P4_CCCR_RESERVED;
   6.467 -        }
   6.468 -        wrmsr(MSR_P4_IQ_CCCR0, x, 0);
   6.469 -
   6.470 -        if (MPENTIUM4_HT) {
   6.471 -
   6.472 -            /* Program the second ESCR */
   6.473 -            x = P4_ESCR_T1_USR                                 |
   6.474 -                P4_ESCR_T1_OS                                  | 
   6.475 -                P4_ESCR_EVNTSEL(P4_ESCR_EVNTSEL_INSTR_RETIRED) | 
   6.476 -                P4_ESCR_EVNTMASK(P4_ESCR_EVNTMASK_IRET_NB_NTAG);
   6.477 -            wrmsr(MSR_P4_CRU_ESCR1, x, 0);
   6.478 -            
   6.479 -            /* Program the second CCCR */
   6.480 -            x = P4_CCCR_ENABLE                    |
   6.481 -                P4_CCCR_ESCR(P4_CRU_ESCR1_NUMBER) |
   6.482 -                P4_CCCR_ACTIVE_THREAD(3);
   6.483 -            wrmsr(MSR_P4_IQ_CCCR2, x, 0);
   6.484 -        }
   6.485 -    }
   6.486 -
   6.487 -    if (!MPENTIUMIII && !MPENTIUM4) {
   6.488 -        printk("WARNING: Not setting up IPC performance counters.\n");
   6.489 -    } else {
   6.490 -        printk("Setting up IPC performance counters.\n");
   6.491 -    }
   6.492 -}
   6.493 -
   6.494 -#ifdef CONFIG_MPENTIUMIII
   6.495 -# define MY_MSR_COUNTER MSR_P6_PERFCTR1
   6.496 -#endif
   6.497 -#ifdef CONFIG_MPENTIUM4
   6.498 -# define MY_MSR_COUNTER MSR_P4_IQ_COUNTER0
   6.499 -#endif
   6.500 -#ifndef MY_MSR_COUNTER
   6.501 -# define MY_MSR_COUNTER 0 /* Never used but ensures compilation */
   6.502 -#endif
   6.503 -#define MY_MSR_COUNTER0 MSR_P4_IQ_COUNTER0
   6.504 -#define MY_MSR_COUNTER1 MSR_P4_IQ_COUNTER2
   6.505 -
   6.506 -# define smt_sched_start_sample(task)                                        \
   6.507 -{                                                                            \
   6.508 -    unsigned int l, h;                                                       \
   6.509 -                                                                             \
   6.510 -    if (MPENTIUM4_HT) {                                                      \
   6.511 -        unsigned int msr =                                                   \
   6.512 -            (task->processor & 1)?MY_MSR_COUNTER1:MY_MSR_COUNTER0;           \
   6.513 -        rdmsr(msr, l, h);                                                    \
   6.514 -    }                                                                        \
   6.515 -    else {                                                                   \
   6.516 -        rdmsr(MY_MSR_COUNTER, l, h);                                         \
   6.517 -    }                                                                        \
   6.518 -    task->ipc_sample_start_count_lo = l;                                     \
   6.519 -    task->ipc_sample_start_count_hi = h;                                     \
   6.520 -    rdtsc(l, h);                                                             \
   6.521 -    task->ipc_sample_start_cycle_lo = l;                                     \
   6.522 -    task->ipc_sample_start_cycle_hi = h;                                     \
   6.523 -}
   6.524 -
   6.525 -# define smt_sched_stop_sample(task)                                         \
   6.526 -{                                                                            \
   6.527 -    if (task->ipc_sample_start_cycle_hi != 0)                                \
   6.528 -    {                                                                        \
   6.529 -        unsigned int cl, ch, tl, th;                                         \
   6.530 -        unsigned int c, t;                                                   \
   6.531 -                                                                             \
   6.532 -        if (MPENTIUM4_HT) {                                                  \
   6.533 -            unsigned int msr =                                               \
   6.534 -                (task->processor & 1)?MY_MSR_COUNTER1:MY_MSR_COUNTER0;       \
   6.535 -            rdmsr(msr, cl, ch);                                              \
   6.536 -        }                                                                    \
   6.537 -        else {                                                               \
   6.538 -            rdmsr(MY_MSR_COUNTER, cl, ch);                                   \
   6.539 -        }                                                                    \
   6.540 -                                                                             \
   6.541 -        rdtsc(tl, th);                                                       \
   6.542 -                                                                             \
   6.543 -        c = cl - task->ipc_sample_start_count_lo;                            \
   6.544 -        t = tl - task->ipc_sample_start_cycle_lo;                            \
   6.545 -        task->ipc_average = IPC_AVERAGE(task->ipc_average,                   \
   6.546 -                                        ((double)c)/((double)t));            \
   6.547 -        task->ipc_sample_start_cycle_hi = 0;                                 \
   6.548 -                                                                             \
   6.549 -    }                                                                        \
   6.550 -    else                                                                     \
   6.551 -        task->ipc_average = 0.0;                                             \
   6.552 -                                                                             \
   6.553 -}
   6.554 -
   6.555 -//        task->ipc_sample_latest =                                            
   6.556 -//            (unsigned int)(1000.0*((double)c)/((double)t));                  
   6.557 -#endif /* __KERNEL__ */
   6.558 -
   6.559 -
   6.560 -#endif /* P4PERF_H */
   6.561 -
   6.562 -/* End of $RCSfile$ */
     7.1 --- a/tools/misc/setdomainmaxmem	Fri Oct 29 10:31:32 2004 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,34 +0,0 @@
     7.4 -#!/usr/bin/env perl
     7.5 -
     7.6 -use strict;
     7.7 -require "sys/ioctl.ph";
     7.8 -
     7.9 -sub SIZEOF_HYPERCALL () { 24; }
    7.10 -sub STRUCT_PRIVCMD_HYPERCALL () {"L P";}
    7.11 -sub IOCTL_PRIVCMD_HYPERCALL ()
    7.12 -        { &_IOC( &_IOC_NONE, ord('P'), 0, SIZEOF_HYPERCALL );}
    7.13 -sub __HYPERVISOR_dom0_op () {7;}
    7.14 -sub DOM0_INTERFACE_VERSION () {0xaaaa0010;}
    7.15 -sub DOM0_SETDOMAINMAXMEM () {28;}
    7.16 -sub STRUCT_DOM0_OP_PREFIX () {"L L";}
    7.17 -sub STRUCT_SETDOMAINMAXMEM () {STRUCT_DOM0_OP_PREFIX."L x4 L";}
    7.18 -sub XEN_PRIVCMD () {"/proc/xen/privcmd";}
    7.19 -
    7.20 -sub setdomainmaxmem($$) {
    7.21 -    my ($domain,$bytes) = @_;
    7.22 -    my $msg = pack(STRUCT_SETDOMAINMAXMEM,DOM0_SETDOMAINMAXMEM,
    7.23 -        DOM0_INTERFACE_VERSION,  $domain, $bytes);
    7.24 -    my $cmd = pack(STRUCT_PRIVCMD_HYPERCALL,__HYPERVISOR_dom0_op,$msg);
    7.25 -    open(XEN,XEN_PRIVCMD) or die "$!\n";
    7.26 -    ioctl(XEN, IOCTL_PRIVCMD_HYPERCALL, $cmd) or die "ioctl: $!";
    7.27 -    close XEN;
    7.28 -}
    7.29 -
    7.30 -my ($bytes,$suffix) = $ARGV[1] =~ m/(^\d+)([mMkKgG])/;
    7.31 -$bytes<<=10 if $suffix =~ m/[kK]/;
    7.32 -$bytes<<=20 if $suffix =~ m/[mM]/;
    7.33 -$bytes<<=30 if $suffix =~ m/[gG]/;
    7.34 -
    7.35 -printf "set domain $ARGV[0] to $bytes\n";
    7.36 -setdomainmaxmem($ARGV[0],$bytes);
    7.37 -
     8.1 --- a/tools/misc/xen_cpuperf.c	Fri Oct 29 10:31:32 2004 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,271 +0,0 @@
     8.4 -/*
     8.5 - * User mode program to prod MSR values through /proc/perfcntr
     8.6 - */
     8.7 -
     8.8 -#include <sys/types.h>
     8.9 -#include <sched.h>
    8.10 -#include <error.h>
    8.11 -#include <stdio.h>
    8.12 -#include <unistd.h>
    8.13 -#include <stdlib.h>
    8.14 -#include <string.h>
    8.15 -
    8.16 -#include "p4perf.h"
    8.17 -#include "xc_private.h"
    8.18 -
    8.19 -void dom0_wrmsr( int privfd,
    8.20 -                 int cpu_mask, 
    8.21 -                 int msr, 
    8.22 -                 unsigned int low, 
    8.23 -                 unsigned int high )
    8.24 -{
    8.25 -    dom0_op_t op;
    8.26 -    op.cmd = DOM0_MSR;
    8.27 -    op.u.msr.write = 1;
    8.28 -    op.u.msr.msr = msr;
    8.29 -    op.u.msr.cpu_mask = cpu_mask;
    8.30 -    op.u.msr.in1 = low;
    8.31 -    op.u.msr.in2 = high;
    8.32 -    do_dom0_op(privfd, &op);
    8.33 -}
    8.34 -
    8.35 -unsigned long long dom0_rdmsr( int privfd,
    8.36 -                               int cpu_mask,
    8.37 -                               int msr )
    8.38 -{
    8.39 -    dom0_op_t op;
    8.40 -    op.cmd = DOM0_MSR;
    8.41 -    op.u.msr.write = 0;
    8.42 -    op.u.msr.msr = msr;
    8.43 -    op.u.msr.cpu_mask = cpu_mask;
    8.44 -    do_dom0_op(privfd, &op);
    8.45 -    return (((unsigned long long)op.u.msr.out2)<<32) | op.u.msr.out1 ;
    8.46 -} 
    8.47 -
    8.48 -struct macros {
    8.49 -    char         *name;
    8.50 -    unsigned long msr_addr;
    8.51 -    int           number;
    8.52 -};
    8.53 -
    8.54 -struct macros msr[] = {
    8.55 -    {"BPU_COUNTER0", 0x300, 0},
    8.56 -    {"BPU_COUNTER1", 0x301, 1},
    8.57 -    {"BPU_COUNTER2", 0x302, 2},
    8.58 -    {"BPU_COUNTER3", 0x303, 3},
    8.59 -    {"MS_COUNTER0", 0x304, 4},
    8.60 -    {"MS_COUNTER1", 0x305, 5},
    8.61 -    {"MS_COUNTER2", 0x306, 6},
    8.62 -    {"MS_COUNTER3", 0x307, 7},
    8.63 -    {"FLAME_COUNTER0", 0x308, 8},
    8.64 -    {"FLAME_COUNTER1", 0x309, 9},
    8.65 -    {"FLAME_COUNTER2", 0x30a, 10},
    8.66 -    {"FLAME_COUNTER3", 0x30b, 11},
    8.67 -    {"IQ_COUNTER0", 0x30c, 12},
    8.68 -    {"IQ_COUNTER1", 0x30d, 13},
    8.69 -    {"IQ_COUNTER2", 0x30e, 14},
    8.70 -    {"IQ_COUNTER3", 0x30f, 15},
    8.71 -    {"IQ_COUNTER4", 0x310, 16},
    8.72 -    {"IQ_COUNTER5", 0x311, 17},
    8.73 -    {"BPU_CCCR0", 0x360, 0},
    8.74 -    {"BPU_CCCR1", 0x361, 1},
    8.75 -    {"BPU_CCCR2", 0x362, 2},
    8.76 -    {"BPU_CCCR3", 0x363, 3},
    8.77 -    {"MS_CCCR0", 0x364, 4},
    8.78 -    {"MS_CCCR1", 0x365, 5},
    8.79 -    {"MS_CCCR2", 0x366, 6},
    8.80 -    {"MS_CCCR3", 0x367, 7},
    8.81 -    {"FLAME_CCCR0", 0x368, 8},
    8.82 -    {"FLAME_CCCR1", 0x369, 9},
    8.83 -    {"FLAME_CCCR2", 0x36a, 10},
    8.84 -    {"FLAME_CCCR3", 0x36b, 11},
    8.85 -    {"IQ_CCCR0", 0x36c, 12},
    8.86 -    {"IQ_CCCR1", 0x36d, 13},
    8.87 -    {"IQ_CCCR2", 0x36e, 14},
    8.88 -    {"IQ_CCCR3", 0x36f, 15},
    8.89 -    {"IQ_CCCR4", 0x370, 16},
    8.90 -    {"IQ_CCCR5", 0x371, 17},
    8.91 -    {"BSU_ESCR0", 0x3a0, 7},
    8.92 -    {"BSU_ESCR1", 0x3a1, 7},
    8.93 -    {"FSB_ESCR0", 0x3a2, 6},
    8.94 -    {"FSB_ESCR1", 0x3a3, 6},
    8.95 -    {"MOB_ESCR0", 0x3aa, 2},
    8.96 -    {"MOB_ESCR1", 0x3ab, 2},
    8.97 -    {"PMH_ESCR0", 0x3ac, 4},
    8.98 -    {"PMH_ESCR1", 0x3ad, 4},
    8.99 -    {"BPU_ESCR0", 0x3b2, 0},
   8.100 -    {"BPU_ESCR1", 0x3b3, 0},
   8.101 -    {"IS_ESCR0", 0x3b4, 1},
   8.102 -    {"IS_ESCR1", 0x3b5, 1},
   8.103 -    {"ITLB_ESCR0", 0x3b6, 3},
   8.104 -    {"ITLB_ESCR1", 0x3b7, 3},
   8.105 -    {"IX_ESCR0", 0x3c8, 5},
   8.106 -    {"IX_ESCR1", 0x3c9, 5},
   8.107 -    {"MS_ESCR0", 0x3c0, 0},
   8.108 -    {"MS_ESCR1", 0x3c1, 0},
   8.109 -    {"TBPU_ESCR0", 0x3c2, 2},
   8.110 -    {"TBPU_ESCR1", 0x3c3, 2},
   8.111 -    {"TC_ESCR0", 0x3c4, 1},
   8.112 -    {"TC_ESCR1", 0x3c5, 1},
   8.113 -    {"FIRM_ESCR0", 0x3a4, 1},
   8.114 -    {"FIRM_ESCR1", 0x3a5, 1},
   8.115 -    {"FLAME_ESCR0", 0x3a6, 0},
   8.116 -    {"FLAME_ESCR1", 0x3a7, 0},
   8.117 -    {"DAC_ESCR0", 0x3a8, 5},
   8.118 -    {"DAC_ESCR1", 0x3a9, 5},
   8.119 -    {"SAAT_ESCR0", 0x3ae, 2},
   8.120 -    {"SAAT_ESCR1", 0x3af, 2},
   8.121 -    {"U2L_ESCR0", 0x3b0, 3},
   8.122 -    {"U2L_ESCR1", 0x3b1, 3},
   8.123 -    {"CRU_ESCR0", 0x3b8, 4},
   8.124 -    {"CRU_ESCR1", 0x3b9, 4},
   8.125 -    {"CRU_ESCR2", 0x3cc, 5},
   8.126 -    {"CRU_ESCR3", 0x3cd, 5},
   8.127 -    {"CRU_ESCR4", 0x3e0, 6},
   8.128 -    {"CRU_ESCR5", 0x3e1, 6},
   8.129 -    {"IQ_ESCR0", 0x3ba, 0},
   8.130 -    {"IQ_ESCR1", 0x3bb, 0},
   8.131 -    {"RAT_ESCR0", 0x3bc, 2},
   8.132 -    {"RAT_ESCR1", 0x3bd, 2},
   8.133 -    {"SSU_ESCR0", 0x3be, 3},
   8.134 -    {"SSU_ESCR1", 0x3bf, 3},
   8.135 -    {"ALF_ESCR0", 0x3ca, 1},
   8.136 -    {"ALF_ESCR1", 0x3cb, 1},
   8.137 -    {"PEBS_ENABLE", 0x3f1, 0},
   8.138 -    {"PEBS_MATRIX_VERT", 0x3f2, 0},
   8.139 -    {NULL, 0, 0}
   8.140 -};
   8.141 -
   8.142 -struct macros *lookup_macro(char *str)
   8.143 -{
   8.144 -    struct macros *m;
   8.145 -
   8.146 -    m = msr;
   8.147 -    while (m->name) {
   8.148 -        if (strcmp(m->name, str) == 0)
   8.149 -            return m;
   8.150 -        m++;
   8.151 -    }
   8.152 -    return NULL;
   8.153 -}
   8.154 -
   8.155 -int main(int argc, char **argv)
   8.156 -{
   8.157 -    int c, t = 0xc, es = 0, em = 0, tv = 0, te = 0;
   8.158 -    unsigned int cpu_mask = 1; 
   8.159 -    struct macros *escr = NULL, *cccr = NULL;
   8.160 -    unsigned long escr_val, cccr_val;
   8.161 -    int debug = 0;
   8.162 -    unsigned long pebs = 0, pebs_vert = 0;
   8.163 -    int pebs_x = 0, pebs_vert_x = 0;
   8.164 -    int read = 0, privfd;
   8.165 - 
   8.166 -    while ((c = getopt(argc, argv, "dc:t:e:m:T:E:C:P:V:r")) != -1) {
   8.167 -        switch((char)c) {
   8.168 -        case 'P':
   8.169 -            pebs |= 1 << atoi(optarg);
   8.170 -            pebs_x = 1;
   8.171 -            break;
   8.172 -        case 'V':
   8.173 -            pebs_vert |= 1 << atoi(optarg);
   8.174 -            pebs_vert_x = 1;
   8.175 -            break;
   8.176 -        case 'd':
   8.177 -            debug = 1;
   8.178 -            break;
   8.179 -        case 'c':
   8.180 -        {
   8.181 -            int cpu = atoi(optarg);
   8.182 -            cpu_mask  = (cpu == -1)?(~0):(1<<cpu);
   8.183 -            break;
   8.184 -        }
   8.185 -        case 't': // ESCR thread bits
   8.186 -            t = atoi(optarg);
   8.187 -            break;
   8.188 -        case 'e': // eventsel
   8.189 -            es = atoi(optarg);
   8.190 -            break;
   8.191 -        case 'm': // eventmask
   8.192 -            em = atoi(optarg);
   8.193 -            break;
   8.194 -        case 'T': // tag value
   8.195 -            tv = atoi(optarg);
   8.196 -            te = 1;
   8.197 -            break;
   8.198 -        case 'E':
   8.199 -            escr = lookup_macro(optarg);
   8.200 -            if (!escr) {
   8.201 -                fprintf(stderr, "Macro '%s' not found.\n", optarg);
   8.202 -                exit(1);
   8.203 -            }
   8.204 -            break;
   8.205 -        case 'C':
   8.206 -            cccr = lookup_macro(optarg);
   8.207 -            if (!cccr) {
   8.208 -                fprintf(stderr, "Macro '%s' not found.\n", optarg);
   8.209 -                exit(1);
   8.210 -            }
   8.211 -            break;
   8.212 -	case 'r':
   8.213 -	    read = 1;
   8.214 -	    break;
   8.215 -        }
   8.216 -    }
   8.217 -
   8.218 -    if ( (privfd = open("/proc/xen/privcmd", O_RDWR)) == -1 )
   8.219 -    {
   8.220 -        fprintf(stderr, "Could not open privileged Xen control interface.\n");
   8.221 -        exit(1);
   8.222 -    }
   8.223 -
   8.224 -    if (read) {
   8.225 -	while((cpu_mask&1)) {
   8.226 -            int i;
   8.227 -            for (i=0x300;i<0x312;i++)
   8.228 -            {
   8.229 -                printf("%010llx ",dom0_rdmsr( privfd, cpu_mask, i ) );
   8.230 -            }
   8.231 -            printf("\n");
   8.232 -            cpu_mask>>=1;
   8.233 -	}
   8.234 -	exit(1);
   8.235 -    }
   8.236 -
   8.237 -    if (!escr) {
   8.238 -        fprintf(stderr, "Need an ESCR.\n");
   8.239 -        exit(1);
   8.240 -    }
   8.241 -    if (!cccr) {
   8.242 -        fprintf(stderr, "Need a counter number.\n");
   8.243 -        exit(1);
   8.244 -    }
   8.245 -
   8.246 -    escr_val = P4_ESCR_THREADS(t) | P4_ESCR_EVNTSEL(es) |
   8.247 -        P4_ESCR_EVNTMASK(em) | P4_ESCR_TV(tv) | ((te)?P4_ESCR_TE:0);
   8.248 -    cccr_val = P4_CCCR_ENABLE | P4_CCCR_ESCR(escr->number) |
   8.249 -        P4_CCCR_ACTIVE_THREAD(3)/*reserved*/;
   8.250 -
   8.251 -    if (debug) {
   8.252 -        fprintf(stderr, "ESCR 0x%lx <= 0x%08lx\n", escr->msr_addr, escr_val);
   8.253 -        fprintf(stderr, "CCCR 0x%lx <= 0x%08lx (%u)\n",
   8.254 -                cccr->msr_addr, cccr_val, cccr->number);
   8.255 -        if (pebs_x)
   8.256 -            fprintf(stderr, "PEBS 0x%x <= 0x%08lx\n",
   8.257 -                    MSR_P4_PEBS_ENABLE, pebs);
   8.258 -        if (pebs_vert_x)
   8.259 -            fprintf(stderr, "PMV  0x%x <= 0x%08lx\n",
   8.260 -                    MSR_P4_PEBS_MATRIX_VERT, pebs_vert);
   8.261 -    }
   8.262 -
   8.263 -    dom0_wrmsr( privfd, cpu_mask, escr->msr_addr, escr_val, 0 );
   8.264 -    dom0_wrmsr( privfd, cpu_mask, cccr->msr_addr, cccr_val, 0 );
   8.265 -
   8.266 -    if (pebs_x)
   8.267 -        dom0_wrmsr( privfd, cpu_mask, MSR_P4_PEBS_ENABLE, pebs, 0 );
   8.268 -
   8.269 -    if (pebs_vert_x)
   8.270 -        dom0_wrmsr( privfd, cpu_mask, MSR_P4_PEBS_MATRIX_VERT, pebs_vert, 0 );
   8.271 -
   8.272 -    return 0;
   8.273 -}
   8.274 -
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/tools/misc/xensymoops	Fri Oct 29 11:13:17 2004 +0000
     9.3 @@ -0,0 +1,118 @@
     9.4 +#!/usr/bin/env python
     9.5 +
     9.6 +# An oops analyser for Xen
     9.7 +# Usage: xensymoops path-to-xen.s < oops-message
     9.8 +
     9.9 +# There's probably some more features that could go in here but this
    9.10 +# is sufficient to analyse most errors in my code ;-)
    9.11 +
    9.12 +# by Mark Williamson (C) 2004 Intel Research Cambridge
    9.13 +
    9.14 +import re, sys
    9.15 +
    9.16 +def read_oops():
    9.17 +    """Process an oops message on stdin and return (eip_addr, stack_addrs)
    9.18 +
    9.19 +    eip_addr is the location of EIP at the point of the crash.
    9.20 +    stack_addrs is a dictionary mapping potential code addresses in the stack
    9.21 +      to their order in the stack trace.
    9.22 +    """
    9.23 +    stackaddr_ptn = "\[([a-z,0-9]*)\]"
    9.24 +    stackaddr_re  = re.compile(stackaddr_ptn)
    9.25 +
    9.26 +    eip_ptn = ".*EIP:.*<([a-z,0-9]*)>.*"
    9.27 +    eip_re  = re.compile(eip_ptn)
    9.28 +
    9.29 +    matches = 0
    9.30 +    stack_addresses = {}
    9.31 +    eip_addr = "Not known"
    9.32 +
    9.33 +    while True:
    9.34 +        line = sys.stdin.readline()
    9.35 +        if not line: break
    9.36 +
    9.37 +        m = eip_re.match(line)
    9.38 +        if m: eip_addr = m.group(1)
    9.39 +        
    9.40 +        m = stackaddr_re.findall(line)
    9.41 +    
    9.42 +        for i in m:
    9.43 +            stack_addresses[i] = matches
    9.44 +            matches += 1
    9.45 +
    9.46 +    return (eip_addr, stack_addresses)
    9.47 +
    9.48 +def usage():
    9.49 +    print >> sys.stderr, """Usage: %s path-to-asm < oops-msg
    9.50 +    The oops message should be fed to the standard input.  The
    9.51 +    command-line argument specifies the path to the Xen assembly dump
    9.52 +    produced by \"make debug\".  The location of EIP and the backtrace
    9.53 +    will be output to standard output.
    9.54 +    """ % sys.argv[0]
    9.55 +    sys.exit()
    9.56 +
    9.57 +##### main
    9.58 +
    9.59 +if len(sys.argv) != 2:
    9.60 +    usage()
    9.61 +
    9.62 +# get address of EIP and the potential code addresses from the stack
    9.63 +(eip_addr, stk_addrs) = read_oops()
    9.64 +
    9.65 +# open Xen disassembly
    9.66 +asm_file = open(sys.argv[1])
    9.67 +
    9.68 +# regexp to match addresses of code lines in the objdump
    9.69 +addr_ptn = "([a-z,0-9]*):"
    9.70 +addr_re  = re.compile(addr_ptn)
    9.71 +
    9.72 +# regexp to match the start of functions in the objdump
    9.73 +func_ptn = "(.*<[\S]*>):"
    9.74 +func_re  = re.compile(func_ptn)
    9.75 +
    9.76 +func = "<No function>" # holds the name of the current function being scanned
    9.77 +
    9.78 +eip_func = "<No function>" # name of the function EIP was in
    9.79 +
    9.80 +# list of (position in original backtrace, code address, function) tuples
    9.81 +# describing all the potential code addresses we identified in the backtrace
    9.82 +# whose addresses we also located in the objdump output
    9.83 +backtrace = []
    9.84 +
    9.85 +while True:
    9.86 +    line = asm_file.readline()
    9.87 +    if not line: break
    9.88 +
    9.89 +    # if we've read the start of the function, record the name and address
    9.90 +    fm = func_re.match(line)
    9.91 +    if fm:
    9.92 +        func = fm.group(1)
    9.93 +        continue
    9.94 +
    9.95 +    # try match the address at the start of the line
    9.96 +    m = addr_re.match(line)
    9.97 +    if not m: continue
    9.98 +
    9.99 +    # we're on a code line...
   9.100 +
   9.101 +    address = m.group(1)
   9.102 +
   9.103 +    # if this address was seen as a potential code address in the backtrace then
   9.104 +    # record it in the backtrace list
   9.105 +    if stk_addrs.has_key(address):
   9.106 +        backtrace.append((stk_addrs[address], address, func))
   9.107 +
   9.108 +    # if this was the address that EIP...
   9.109 +    if address == eip_addr:
   9.110 +        eip_func = func
   9.111 +
   9.112 +
   9.113 +print "EIP %s in function %s" % (eip_addr, eip_func)
   9.114 +print "Backtrace:"
   9.115 +
   9.116 +# sorting will order primarily by the first element of each tuple,
   9.117 +# i.e. the order in the original oops
   9.118 +backtrace.sort()
   9.119 +
   9.120 +for (i, a, f) in backtrace:
   9.121 +    print "%s in function %s" % ( a, f )
    10.1 --- a/tools/misc/xensymoops.py	Fri Oct 29 10:31:32 2004 +0000
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,118 +0,0 @@
    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 )