ia64/xen-unstable

changeset 7785:e002282b79c8

Merged.
author emellor@leeni.uk.xensource.com
date Fri Nov 11 15:36:16 2005 +0100 (2005-11-11)
parents c927e3761a96 cc5450d52e49
children 1444adb1c407
files linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c tools/libxc/xc_ia64_stubs.c
line diff
     1.1 --- a/buildconfigs/Rules.mk	Fri Nov 11 15:36:07 2005 +0100
     1.2 +++ b/buildconfigs/Rules.mk	Fri Nov 11 15:36:16 2005 +0100
     1.3 @@ -84,7 +84,7 @@ ref-%/.valid-ref: pristine-%/.valid-pris
     1.4  	rm -rf $(@D)
     1.5  	cp -al $(<D) $(@D)
     1.6  	if [ -d patches/$* ] ; then \
     1.7 -	    for i in patches/$*/*.patch ; do ( cd $(@D) ; patch -p1 <../$$i || exit 1 ) ; done ; \
     1.8 +	    for i in patches/$*/*.patch ; do patch -d $(@D) -p1 <$$i || exit 1 ; done ; \
     1.9  	fi
    1.10  	touch $@ # update timestamp to avoid rebuild
    1.11  endif
     2.1 --- a/docs/src/user.tex	Fri Nov 11 15:36:07 2005 +0100
     2.2 +++ b/docs/src/user.tex	Fri Nov 11 15:36:16 2005 +0100
     2.3 @@ -9,7 +9,6 @@
     2.4  \latexhtml{\newcommand{\path}[1]{{\small {\tt #1}}}}{\newcommand{\path}[1]{{\tt #1}}}
     2.5  
     2.6  
     2.7 -
     2.8  \begin{document}
     2.9  
    2.10  % TITLE PAGE
    2.11 @@ -21,24 +20,24 @@
    2.12  \vfill
    2.13  \vfill
    2.14  \begin{tabular}{l}
    2.15 -{\Huge \bf Users' manual} \\[4mm]
    2.16 -{\huge Xen v2.0 for x86} \\[80mm]
    2.17 +{\Huge \bf Users' Manual} \\[4mm]
    2.18 +{\huge Xen v3.0} \\[80mm]
    2.19  
    2.20 -{\Large Xen is Copyright (c) 2002-2004, The Xen Team} \\[3mm]
    2.21 +{\Large Xen is Copyright (c) 2002-2005, The Xen Team} \\[3mm]
    2.22  {\Large University of Cambridge, UK} \\[20mm]
    2.23  \end{tabular}
    2.24  \end{center}
    2.25  
    2.26 -{\bf
    2.27 -DISCLAIMER: This documentation is currently under active development
    2.28 -and as such there may be mistakes and omissions --- watch out for
    2.29 -these and please report any you find to the developer's mailing list.
    2.30 -Contributions of material, suggestions and corrections are welcome.
    2.31 -}
    2.32 +{\bf DISCLAIMER: This documentation is currently under active
    2.33 +  development and as such there may be mistakes and omissions ---
    2.34 +  watch out for these and please report any you find to the
    2.35 +  developers' mailing list.  Contributions of material, suggestions
    2.36 +  and corrections are welcome.}
    2.37  
    2.38  \vfill
    2.39  \cleardoublepage
    2.40  
    2.41 +
    2.42  % TABLE OF CONTENTS
    2.43  \pagestyle{plain}
    2.44  \pagenumbering{roman}
    2.45 @@ -46,6 +45,7 @@ Contributions of material, suggestions a
    2.46    \tableofcontents }
    2.47  \cleardoublepage
    2.48  
    2.49 +
    2.50  % PREPARE FOR MAIN TEXT
    2.51  \pagenumbering{arabic}
    2.52  \raggedbottom
    2.53 @@ -68,7 +68,7 @@ Contributions of material, suggestions a
    2.54  %% Chapter Installation moved to installation.tex
    2.55  \include{src/user/installation}
    2.56  
    2.57 -%% Chapter Starting Additional Domains  moved to start_addl_dom.tex
    2.58 +%% Chapter Starting Additional Domains moved to start_addl_dom.tex
    2.59  \include{src/user/start_addl_dom}
    2.60  
    2.61  %% Chapter Domain Management Tools moved to domain_mgmt.tex
    2.62 @@ -87,6 +87,9 @@ Contributions of material, suggestions a
    2.63  %% Chapter Domain Configuration moved to domain_configuration.tex
    2.64  \include{src/user/domain_configuration}
    2.65  
    2.66 +%% Chapter Securing Xen
    2.67 +\include{src/user/securing_xen}
    2.68 +
    2.69  %% Chapter Build, Boot and Debug Options moved to build.tex
    2.70  \include{src/user/build}
    2.71  
    2.72 @@ -99,25 +102,25 @@ that bug reports, suggestions and contri
    2.73  software (or the documentation) should be sent to the Xen developers'
    2.74  mailing list (address below).
    2.75  
    2.76 +
    2.77  \section{Other Documentation}
    2.78  
    2.79  For developers interested in porting operating systems to Xen, the
    2.80 -{\em Xen Interface Manual} is distributed in the \path{docs/}
    2.81 -directory of the Xen source distribution.  
    2.82 +\emph{Xen Interface Manual} is distributed in the \path{docs/}
    2.83 +directory of the Xen source distribution.
    2.84  
    2.85 -%Various HOWTOs are available in \path{docs/HOWTOS} but this content is
    2.86 -%being integrated into this manual.
    2.87 +% Various HOWTOs are available in \path{docs/HOWTOS} but this content
    2.88 +% is being integrated into this manual.
    2.89  
    2.90  
    2.91  \section{Online References}
    2.92  
    2.93  The official Xen web site is found at:
    2.94 -\begin{quote}
    2.95 -{\tt http://www.cl.cam.ac.uk/netos/xen/}
    2.96 +\begin{quote} {\tt http://www.cl.cam.ac.uk/netos/xen/}
    2.97  \end{quote}
    2.98  
    2.99 -This contains links to the latest versions of all on-line 
   2.100 -documentation (including the lateset version of the FAQ). 
   2.101 +This contains links to the latest versions of all online
   2.102 +documentation, including the latest version of the FAQ.
   2.103  
   2.104  
   2.105  \section{Mailing Lists}
   2.106 @@ -126,17 +129,17 @@ There are currently four official Xen ma
   2.107  
   2.108  \begin{description}
   2.109  \item[xen-devel@lists.xensource.com] Used for development
   2.110 -discussions and bug reports.  Subscribe at: \\
   2.111 -{\small {\tt http://lists.xensource.com/xen-devel}}
   2.112 +  discussions and bug reports.  Subscribe at: \\
   2.113 +  {\small {\tt http://lists.xensource.com/xen-devel}}
   2.114  \item[xen-users@lists.xensource.com] Used for installation and usage
   2.115 -discussions and requests for help.  Subscribe at: \\
   2.116 -{\small {\tt http://lists.xensource.com/xen-users}}
   2.117 +  discussions and requests for help.  Subscribe at: \\
   2.118 +  {\small {\tt http://lists.xensource.com/xen-users}}
   2.119  \item[xen-announce@lists.xensource.com] Used for announcements only.
   2.120 -Subscribe at: \\
   2.121 -{\small {\tt http://lists.xensource.com/xen-announce}}
   2.122 -\item[xen-changelog@lists.xensource.com]  Changelog feed
   2.123 -from the unstable and 2.0 trees - developer oriented.  Subscribe at: \\
   2.124 -{\small {\tt http://lists.xensource.com/xen-changelog}}
   2.125 +  Subscribe at: \\
   2.126 +  {\small {\tt http://lists.xensource.com/xen-announce}}
   2.127 +\item[xen-changelog@lists.xensource.com] Changelog feed
   2.128 +  from the unstable and 2.0 trees - developer oriented.  Subscribe at: \\
   2.129 +  {\small {\tt http://lists.xensource.com/xen-changelog}}
   2.130  \end{description}
   2.131  
   2.132  
   2.133 @@ -149,11 +152,11 @@ from the unstable and 2.0 trees - develo
   2.134  %% Chapter Installing Xen on Red Hat moved to redhat.tex
   2.135  \include{src/user/redhat}
   2.136  
   2.137 -
   2.138  %% Chapter Glossary of Terms moved to glossary.tex
   2.139  \include{src/user/glossary}
   2.140  
   2.141  
   2.142 +
   2.143  \end{document}
   2.144  
   2.145  
   2.146 @@ -181,36 +184,35 @@ from the unstable and 2.0 trees - develo
   2.147  %% # import xenctl.utils
   2.148  %% # help(xenctl.utils)
   2.149  
   2.150 -%% You can use these modules to write your own custom scripts or you can
   2.151 -%% customise the scripts supplied in the Xen distribution.
   2.152 +%% You can use these modules to write your own custom scripts or you
   2.153 +%% can customise the scripts supplied in the Xen distribution.
   2.154  
   2.155  
   2.156  
   2.157  % Explain about AGP GART
   2.158  
   2.159  
   2.160 -%% If you're not intending to configure the new domain with an IP address
   2.161 -%% on your LAN, then you'll probably want to use NAT. The
   2.162 -%% 'xen_nat_enable' installs a few useful iptables rules into domain0 to
   2.163 -%% enable NAT. [NB: We plan to support RSIP in future]
   2.164 -
   2.165 +%% If you're not intending to configure the new domain with an IP
   2.166 +%% address on your LAN, then you'll probably want to use NAT. The
   2.167 +%% 'xen_nat_enable' installs a few useful iptables rules into domain0
   2.168 +%% to enable NAT. [NB: We plan to support RSIP in future]
   2.169  
   2.170  
   2.171  
   2.172  %% Installing the file systems from the CD
   2.173  %% =======================================
   2.174  
   2.175 -%% If you haven't got an existing Linux installation onto which you can
   2.176 -%% just drop down the Xen and Xenlinux images, then the file systems on
   2.177 -%% the CD provide a quick way of doing an install. However, you would be
   2.178 -%% better off in the long run doing a proper install of your preferred
   2.179 -%% distro and installing Xen onto that, rather than just doing the hack
   2.180 -%% described below:
   2.181 +%% If you haven't got an existing Linux installation onto which you
   2.182 +%% can just drop down the Xen and Xenlinux images, then the file
   2.183 +%% systems on the CD provide a quick way of doing an install. However,
   2.184 +%% you would be better off in the long run doing a proper install of
   2.185 +%% your preferred distro and installing Xen onto that, rather than
   2.186 +%% just doing the hack described below:
   2.187  
   2.188 -%% Choose one or two partitions, depending on whether you want a separate
   2.189 -%% /usr or not. Make file systems on it/them e.g.: 
   2.190 -%%   mkfs -t ext3 /dev/hda3
   2.191 -%%   [or mkfs -t ext2 /dev/hda3 && tune2fs -j /dev/hda3 if using an old
   2.192 +%% Choose one or two partitions, depending on whether you want a
   2.193 +%% separate /usr or not. Make file systems on it/them e.g.:
   2.194 +%% mkfs -t ext3 /dev/hda3
   2.195 +%% [or mkfs -t ext2 /dev/hda3 && tune2fs -j /dev/hda3 if using an old
   2.196  %% version of mkfs]
   2.197  
   2.198  %% Next, mount the file system(s) e.g.:
   2.199 @@ -224,12 +226,14 @@ from the unstable and 2.0 trees - develo
   2.200  %% configuration. Changing the password file (etc/shadow) is probably a
   2.201  %% good idea too.
   2.202  
   2.203 -%% To install the usr file system, copy the file system from CD on /usr,
   2.204 -%% though leaving out the "XenDemoCD" and "boot" directories:
   2.205 -%%   cd /usr && cp -a X11R6 etc java libexec root src bin dict kerberos local sbin tmp doc include lib man share /mnt/usr
   2.206 +%% To install the usr file system, copy the file system from CD on
   2.207 +%% /usr, though leaving out the "XenDemoCD" and "boot" directories:
   2.208 +%%   cd /usr && cp -a X11R6 etc java libexec root src bin dict kerberos
   2.209 +%%    local sbin tmp doc include lib man share /mnt/usr
   2.210  
   2.211  %% If you intend to boot off these file systems (i.e. use them for
   2.212 -%% domain 0), then you probably want to copy the /usr/boot directory on
   2.213 -%% the cd over the top of the current symlink to /boot on your root
   2.214 -%% filesystem (after deleting the current symlink) i.e.:
   2.215 +%% domain 0), then you probably want to copy the /usr/boot
   2.216 +%% directory on the cd over the top of the current symlink to /boot
   2.217 +%% on your root filesystem (after deleting the current symlink)
   2.218 +%% i.e.:
   2.219  %%   cd /mnt/root ; rm boot ; cp -a /usr/boot .
     3.1 --- a/docs/src/user/installation.tex	Fri Nov 11 15:36:07 2005 +0100
     3.2 +++ b/docs/src/user/installation.tex	Fri Nov 11 15:36:16 2005 +0100
     3.3 @@ -17,7 +17,7 @@ want to run more than one virtual machin
     3.4  required if you wish to build from source.
     3.5  \begin{itemize}
     3.6  \item A working Linux distribution using the GRUB bootloader and
     3.7 -  running on a P6-class (or newer) CPU.
     3.8 +  running on a P6-class or newer CPU\@.
     3.9  \item [$\dag$] The \path{iproute2} package.
    3.10  \item [$\dag$] The Linux bridge-utils\footnote{Available from {\tt
    3.11        http://bridge.sourceforge.net}} (e.g., \path{/sbin/brctl})
    3.12 @@ -30,29 +30,29 @@ required if you wish to build from sourc
    3.13    alternatively it can be installed by running `{\sl make
    3.14      install-twisted}' in the root of the Xen source tree.
    3.15  \item [$*$] Build tools (gcc v3.2.x or v3.3.x, binutils, GNU make).
    3.16 -\item [$*$] Development installation of libcurl (e.g., libcurl-devel)
    3.17 -\item [$*$] Development installation of zlib (e.g., zlib-dev).
    3.18 -\item [$*$] Development installation of Python v2.2 or later (e.g.,
    3.19 +\item [$*$] Development installation of libcurl (e.g.,\ libcurl-devel).
    3.20 +\item [$*$] Development installation of zlib (e.g.,\ zlib-dev).
    3.21 +\item [$*$] Development installation of Python v2.2 or later (e.g.,\ 
    3.22    python-dev).
    3.23  \item [$*$] \LaTeX\ and transfig are required to build the
    3.24    documentation.
    3.25  \end{itemize}
    3.26  
    3.27 -Once you have satisfied the relevant prerequisites, you can now
    3.28 -install either a binary or source distribution of Xen.
    3.29 +Once you have satisfied these prerequisites, you can now install
    3.30 +either a binary or source distribution of Xen.
    3.31  
    3.32  
    3.33  \section{Installing from Binary Tarball}
    3.34  
    3.35  Pre-built tarballs are available for download from the Xen download
    3.36 -page
    3.37 -\begin{quote} {\tt http://xen.sf.net}
    3.38 +page:
    3.39 +\begin{quote} {\tt http://www.xensource.com/downloads/}
    3.40  \end{quote}
    3.41  
    3.42  Once you've downloaded the tarball, simply unpack and install:
    3.43  \begin{verbatim}
    3.44 -# tar zxvf xen-2.0-install.tgz
    3.45 -# cd xen-2.0-install
    3.46 +# tar zxvf xen-3.0-install.tgz
    3.47 +# cd xen-3.0-install
    3.48  # sh ./install.sh
    3.49  \end{verbatim}
    3.50  
    3.51 @@ -62,48 +62,29 @@ as described in Section~\ref{s:configure
    3.52  
    3.53  \section{Installing from Source}
    3.54  
    3.55 -This section describes how to obtain, build, and install Xen from
    3.56 +This section describes how to obtain, build and install Xen from
    3.57  source.
    3.58  
    3.59  \subsection{Obtaining the Source}
    3.60  
    3.61 -The Xen source tree is available as either a compressed source tar
    3.62 -ball or as a clone of our master BitKeeper repository.
    3.63 +The Xen source tree is available as either a compressed source tarball
    3.64 +or as a clone of our master Mercurial repository.
    3.65  
    3.66  \begin{description}
    3.67  \item[Obtaining the Source Tarball]\mbox{} \\
    3.68 -  Stable versions (and daily snapshots) of the Xen source tree are
    3.69 -  available as compressed tarballs from the Xen download page
    3.70 -  \begin{quote} {\tt http://xen.sf.net}
    3.71 +  Stable versions and daily snapshots of the Xen source tree are
    3.72 +  available from the Xen download page:
    3.73 +  \begin{quote} {\tt \tt http://www.xensource.com/downloads/}
    3.74    \end{quote}
    3.75 -
    3.76 -\item[Using BitKeeper]\mbox{} \\
    3.77 -  If you wish to install Xen from a clone of our latest BitKeeper
    3.78 -  repository then you will need to install the BitKeeper tools.
    3.79 -  Download instructions for BitKeeper can be obtained by filling out
    3.80 -  the form at:
    3.81 -  \begin{quote} {\tt http://www.bitmover.com/cgi-bin/download.cgi}
    3.82 -\end{quote}
    3.83 -The public master BK repository for the 2.0 release lives at:
    3.84 -\begin{quote} {\tt bk://xen.bkbits.net/xen-2.0.bk}
    3.85 -\end{quote} 
    3.86 -You can use BitKeeper to download it and keep it updated with the
    3.87 -latest features and fixes.
    3.88 -
    3.89 -Change to the directory in which you want to put the source code, then
    3.90 -run:
    3.91 -\begin{verbatim}
    3.92 -# bk clone bk://xen.bkbits.net/xen-2.0.bk
    3.93 -\end{verbatim}
    3.94 -
    3.95 -Under your current directory, a new directory named \path{xen-2.0.bk}
    3.96 -has been created, which contains all the source code for Xen, the OS
    3.97 -ports, and the control tools. You can update your repository with the
    3.98 -latest changes at any time by running:
    3.99 -\begin{verbatim}
   3.100 -# cd xen-2.0.bk # to change into the local repository
   3.101 -# bk pull       # to update the repository
   3.102 -\end{verbatim}
   3.103 +\item[Obtaining the source via Mercurial]\mbox{} \\
   3.104 +  The source tree may also be obtained via the public Mercurial
   3.105 +  repository hosted at:
   3.106 +  \begin{quote}{\tt http://xenbits.xensource.com}.
   3.107 +  \end{quote} See the instructions and the Getting Started Guide
   3.108 +  referenced at:
   3.109 +  \begin{quote}
   3.110 +    {\tt http://www.xensource.com/downloads/}.
   3.111 +  \end{quote}
   3.112  \end{description}
   3.113  
   3.114  % \section{The distribution}
   3.115 @@ -124,7 +105,7 @@ latest changes at any time by running:
   3.116  
   3.117  \subsection{Building from Source}
   3.118  
   3.119 -The top-level Xen Makefile includes a target `world' that will do the
   3.120 +The top-level Xen Makefile includes a target ``world'' that will do the
   3.121  following:
   3.122  
   3.123  \begin{itemize}
   3.124 @@ -132,17 +113,17 @@ following:
   3.125  \item Build the control tools, including \xend.
   3.126  \item Download (if necessary) and unpack the Linux 2.6 source code,
   3.127    and patch it for use with Xen.
   3.128 -\item Build a Linux kernel to use in domain 0 and a smaller
   3.129 +\item Build a Linux kernel to use in domain~0 and a smaller
   3.130    unprivileged kernel, which can optionally be used for unprivileged
   3.131    virtual machines.
   3.132  \end{itemize}
   3.133  
   3.134  After the build has completed you should have a top-level directory
   3.135 -called \path{dist/} in which all resulting targets will be placed; of
   3.136 -particular interest are the two kernels XenLinux kernel images, one
   3.137 -with a `-xen0' extension which contains hardware device drivers and
   3.138 -drivers for Xen's virtual devices, and one with a `-xenU' extension
   3.139 -that just contains the virtual ones. These are found in
   3.140 +called \path{dist/} in which all resulting targets will be placed. Of
   3.141 +particular interest are the two XenLinux kernel images, one with a
   3.142 +``-xen0'' extension which contains hardware device drivers and drivers
   3.143 +for Xen's virtual devices, and one with a ``-xenU'' extension that
   3.144 +just contains the virtual ones. These are found in
   3.145  \path{dist/install/boot/} along with the image for Xen itself and the
   3.146  configuration files used during the build.
   3.147  
   3.148 @@ -150,17 +131,15 @@ The NetBSD port can be built using:
   3.149  \begin{quote}
   3.150  \begin{verbatim}
   3.151  # make netbsd20
   3.152 -\end{verbatim}
   3.153 -\end{quote}
   3.154 +\end{verbatim}\end{quote}
   3.155  NetBSD port is built using a snapshot of the netbsd-2-0 cvs branch.
   3.156 -The snapshot is downloaded as part of the build process, if it is not
   3.157 +The snapshot is downloaded as part of the build process if it is not
   3.158  yet present in the \path{NETBSD\_SRC\_PATH} search path.  The build
   3.159 -process also downloads a toolchain which includes all the tools
   3.160 +process also downloads a toolchain which includes all of the tools
   3.161  necessary to build the NetBSD kernel under Linux.
   3.162  
   3.163 -To customize further the set of kernels built you need to edit the
   3.164 -top-level Makefile. Look for the line:
   3.165 -
   3.166 +To customize the set of kernels built you need to edit the top-level
   3.167 +Makefile. Look for the line:
   3.168  \begin{quote}
   3.169  \begin{verbatim}
   3.170  KERNELS ?= mk.linux-2.6-xen0 mk.linux-2.6-xenU
   3.171 @@ -189,7 +168,6 @@ kernel containing only virtual device dr
   3.172  %% After untaring the pristine kernel tree, the makefile uses the {\tt
   3.173  %%   mkbuildtree} script to add the Xen patches to the kernel.
   3.174  
   3.175 -
   3.176  %% \framebox{\parbox{5in}{
   3.177  %%     {\bf Distro specific:} \\
   3.178  %%     {\it Gentoo} --- if not using udev (most installations,
   3.179 @@ -201,7 +179,7 @@ kernel containing only virtual device dr
   3.180  % If you have an SMP machine you may wish to give the {\tt '-j4'}
   3.181  % argument to make to get a parallel build.
   3.182  
   3.183 -If you wish to build a customized XenLinux kernel (e.g. to support
   3.184 +If you wish to build a customized XenLinux kernel (e.g.\ to support
   3.185  additional devices or enable distribution-required features), you can
   3.186  use the standard Linux configuration mechanisms, specifying that the
   3.187  architecture being built for is \path{xen}, e.g:
   3.188 @@ -215,21 +193,21 @@ architecture being built for is \path{xe
   3.189  \end{quote}
   3.190  
   3.191  You can also copy an existing Linux configuration (\path{.config})
   3.192 -into \path{linux-2.6.11-xen0} and execute:
   3.193 +into e.g.\ \path{linux-2.6.11-xen0} and execute:
   3.194  \begin{quote}
   3.195  \begin{verbatim}
   3.196  # make ARCH=xen oldconfig
   3.197  \end{verbatim}
   3.198  \end{quote}
   3.199  
   3.200 -You may be prompted with some Xen-specific options; we advise
   3.201 +You may be prompted with some Xen-specific options. We advise
   3.202  accepting the defaults for these options.
   3.203  
   3.204 -Note that the only difference between the two types of Linux kernel
   3.205 -that are built is the configuration file used for each.  The `U'
   3.206 +Note that the only difference between the two types of Linux kernels
   3.207 +that are built is the configuration file used for each.  The ``U''
   3.208  suffixed (unprivileged) versions don't contain any of the physical
   3.209  hardware device drivers, leading to a 30\% reduction in size; hence
   3.210 -you may prefer these for your non-privileged domains.  The `0'
   3.211 +you may prefer these for your non-privileged domains.  The ``0''
   3.212  suffixed privileged versions can be used to boot the system, as well
   3.213  as in driver domains and unprivileged domains.
   3.214  
   3.215 @@ -259,10 +237,10 @@ destinations.
   3.216  
   3.217  The \path{dist/install/boot} directory will also contain the config
   3.218  files used for building the XenLinux kernels, and also versions of Xen
   3.219 -and XenLinux kernels that contain debug symbols (\path{xen-syms-2.0.6}
   3.220 -and \path{vmlinux-syms-2.6.11.11-xen0}) which are essential for
   3.221 -interpreting crash dumps.  Retain these files as the developers may
   3.222 -wish to see them if you post on the mailing list.
   3.223 +and XenLinux kernels that contain debug symbols such as
   3.224 +(\path{xen-syms-2.0.6} and \path{vmlinux-syms-2.6.11.11-xen0}) which
   3.225 +are essential for interpreting crash dumps.  Retain these files as the
   3.226 +developers may wish to see them if you post on the mailing list.
   3.227  
   3.228  
   3.229  \section{Configuration}
   3.230 @@ -280,23 +258,23 @@ distribution.  The entry should look som
   3.231  
   3.232  {\small
   3.233  \begin{verbatim}
   3.234 -title Xen 2.0 / XenLinux 2.6
   3.235 -  kernel /boot/xen-2.0.gz dom0_mem=131072
   3.236 +title Xen 3.0 / XenLinux 2.6
   3.237 +  kernel /boot/xen-3.0.gz dom0_mem=131072
   3.238    module /boot/vmlinuz-2.6-xen0 root=/dev/sda4 ro console=tty0
   3.239  \end{verbatim}
   3.240  }
   3.241  
   3.242  The kernel line tells GRUB where to find Xen itself and what boot
   3.243 -parameters should be passed to it (in this case, setting domain 0's
   3.244 +parameters should be passed to it (in this case, setting the domain~0
   3.245  memory allocation in kilobytes and the settings for the serial port).
   3.246  For more details on the various Xen boot parameters see
   3.247  Section~\ref{s:xboot}.
   3.248  
   3.249  The module line of the configuration describes the location of the
   3.250  XenLinux kernel that Xen should start and the parameters that should
   3.251 -be passed to it (these are standard Linux parameters, identifying the
   3.252 +be passed to it. Tthese are standard Linux parameters, identifying the
   3.253  root device and specifying it be initially mounted read only and
   3.254 -instructing that console output be sent to the screen).  Some
   3.255 +instructing that console output be sent to the screen. Some
   3.256  distributions such as SuSE do not require the \path{ro} parameter.
   3.257  
   3.258  %% \framebox{\parbox{5in}{
   3.259 @@ -307,25 +285,22 @@ distributions such as SuSE do not requir
   3.260  
   3.261  
   3.262  If you want to use an initrd, just add another \path{module} line to
   3.263 -the configuration, as usual:
   3.264 -
   3.265 +the configuration, like:
   3.266  {\small
   3.267  \begin{verbatim}
   3.268    module /boot/my_initrd.gz
   3.269  \end{verbatim}
   3.270  }
   3.271  
   3.272 -As always when installing a new kernel, it is recommended that you do
   3.273 -not delete existing menu options from \path{menu.lst} --- you may want
   3.274 -to boot your old Linux kernel in future, particularly if you have
   3.275 -problems.
   3.276 +When installing a new kernel, it is recommended that you do not delete
   3.277 +existing menu options from \path{menu.lst}, as you may wish to boot
   3.278 +your old Linux kernel in future, particularly if you have problems.
   3.279  
   3.280  \subsection{Serial Console (optional)}
   3.281  
   3.282  %% kernel /boot/xen-2.0.gz dom0_mem=131072 com1=115200,8n1
   3.283  %% module /boot/vmlinuz-2.6-xen0 root=/dev/sda4 ro
   3.284  
   3.285 -
   3.286  In order to configure Xen serial console output, it is necessary to
   3.287  add an boot option to your GRUB config; e.g.\ replace the above kernel
   3.288  line with:
   3.289 @@ -343,24 +318,23 @@ One can also configure XenLinux to share
   3.290  achieve this append ``\path{console=ttyS0}'' to your module line.
   3.291  
   3.292  If you wish to be able to log in over the XenLinux serial console it
   3.293 -is necessary to add a line into \path{/etc/inittab}, just as per
   3.294 -regular Linux. Simply add the line:
   3.295 +is necessary to add a line into \path{/etc/inittab}. Add the line:
   3.296  \begin{quote} {\small {\tt c:2345:respawn:/sbin/mingetty ttyS0}}
   3.297  \end{quote}
   3.298  
   3.299 -and you should be able to log in. Note that to successfully log in as
   3.300 -root over the serial line will require adding \path{ttyS0} to
   3.301 -\path{/etc/securetty} in most modern distributions.
   3.302 +and you should be able to log in. To successfully log in as root over
   3.303 +the serial line will require adding \path{ttyS0} to
   3.304 +\path{/etc/securetty} if it is not already there.
   3.305  
   3.306  \subsection{TLS Libraries}
   3.307  
   3.308  Users of the XenLinux 2.6 kernel should disable Thread Local Storage
   3.309 -(e.g.\ by doing a \path{mv /lib/tls /lib/tls.disabled}) before
   3.310 -attempting to run with a XenLinux kernel\footnote{If you boot without
   3.311 +(TLS) (e.g.\ by doing a \path{mv /lib/tls /lib/tls.disabled}) before
   3.312 +attempting to boot a XenLinux kernel\footnote{If you boot without
   3.313    first disabling TLS, you will get a warning message during the boot
   3.314    process. In this case, simply perform the rename after the machine
   3.315    is up and then run \texttt{/sbin/ldconfig} to make it take effect.}.
   3.316 -You can always reenable it by restoring the directory to its original
   3.317 +You can always reenable TLS by restoring the directory to its original
   3.318  location (i.e.\ \path{mv /lib/tls.disabled /lib/tls}).
   3.319  
   3.320  The reason for this is that the current TLS implementation uses
   3.321 @@ -369,19 +343,19 @@ not disabled, an emulation mode is used 
   3.322  performance substantially.
   3.323  
   3.324  We hope that this issue can be resolved by working with Linux
   3.325 -distribution vendors to implement a minor backward-compatible change
   3.326 +distributions to implement a minor backward-compatible change
   3.327  to the TLS library.
   3.328  
   3.329  
   3.330  \section{Booting Xen}
   3.331  
   3.332  It should now be possible to restart the system and use Xen.  Reboot
   3.333 -as usual but choose the new Xen option when the Grub screen appears.
   3.334 +and choose the new Xen option when the Grub screen appears.
   3.335  
   3.336  What follows should look much like a conventional Linux boot.  The
   3.337  first portion of the output comes from Xen itself, supplying low level
   3.338 -information about itself and the machine it is running on.  The
   3.339 -following portion of the output comes from XenLinux.
   3.340 +information about itself and the underlying hardware.  The last
   3.341 +portion of the output comes from XenLinux.
   3.342  
   3.343  You may see some errors during the XenLinux boot.  These are not
   3.344  necessarily anything to worry about --- they may result from kernel
   3.345 @@ -389,5 +363,5 @@ configuration differences between your X
   3.346  usually use.
   3.347  
   3.348  When the boot completes, you should be able to log into your system as
   3.349 -usual.  If you are unable to log in to your system running Xen, you
   3.350 -should still be able to reboot with your normal Linux kernel.
   3.351 +usual.  If you are unable to log in, you should still be able to
   3.352 +reboot with your normal Linux kernel.
     4.1 --- a/docs/src/user/introduction.tex	Fri Nov 11 15:36:07 2005 +0100
     4.2 +++ b/docs/src/user/introduction.tex	Fri Nov 11 15:36:16 2005 +0100
     4.3 @@ -2,7 +2,7 @@
     4.4  
     4.5  
     4.6  Xen is a \emph{paravirtualising} virtual machine monitor (VMM), or
     4.7 -`hypervisor', for the x86 processor architecture.  Xen can securely
     4.8 +``hypervisor'', for the x86 processor architecture.  Xen can securely
     4.9  execute multiple virtual machines on a single physical system with
    4.10  close-to-native performance.  The virtual machine technology
    4.11  facilitates enterprise-grade functionality, including:
    4.12 @@ -11,7 +11,7 @@ facilitates enterprise-grade functionali
    4.13  \item Virtual machines with performance close to native hardware.
    4.14  \item Live migration of running virtual machines between physical
    4.15    hosts.
    4.16 -\item Excellent hardware support (supports most Linux device drivers).
    4.17 +\item Excellent hardware support. Supports most Linux device drivers.
    4.18  \item Sandboxed, re-startable device drivers.
    4.19  \end{itemize}
    4.20  
    4.21 @@ -28,7 +28,7 @@ system kernels must explicitly support X
    4.22  space applications and libraries \emph{do not} require modification.
    4.23  
    4.24  Xen support is available for increasingly many operating systems:
    4.25 -right now, Linux and NetBSD are available for Xen 2.0.
    4.26 +right now, Linux and NetBSD are available for Xen 3.0.
    4.27  A FreeBSD port is undergoing testing and will be incorporated into the
    4.28  release soon. Other OS ports, including Plan 9, are in progress.  We
    4.29  hope that that arch-xen patches will be incorporated into the
    4.30 @@ -43,14 +43,14 @@ Possible usage scenarios for Xen include
    4.31  \item [Multiple OS configurations.] Run multiple operating systems
    4.32    simultaneously, for instance for compatibility or QA purposes.
    4.33  \item [Server consolidation.] Move multiple servers onto a single
    4.34 -  physical host with performance and fault isolation provided at
    4.35 +  physical host with performance and fault isolation provided at the
    4.36    virtual machine boundaries.
    4.37  \item [Cluster computing.] Management at VM granularity provides more
    4.38    flexibility than separately managing each physical host, but better
    4.39    control and isolation than single-system image solutions,
    4.40    particularly by using live migration for load balancing.
    4.41  \item [Hardware support for custom OSes.] Allow development of new
    4.42 -  OSes while benefiting from the wide-ranging hardware support of
    4.43 +  OSes while benefitting from the wide-ranging hardware support of
    4.44    existing OSes such as Linux.
    4.45  \end{description}
    4.46  
    4.47 @@ -58,44 +58,44 @@ Possible usage scenarios for Xen include
    4.48  \section{Structure of a Xen-Based System}
    4.49  
    4.50  A Xen system has multiple layers, the lowest and most privileged of
    4.51 -which is Xen itself. 
    4.52 +which is Xen itself.
    4.53  
    4.54 -Xen in turn may host multiple \emph{guest} operating systems, each of
    4.55 -which is executed within a secure virtual machine (in Xen terminology,
    4.56 -a \emph{domain}). Domains are scheduled by Xen to make effective use
    4.57 -of the available physical CPUs.  Each guest OS manages its own
    4.58 -applications, which includes responsibility for scheduling each
    4.59 -application within the time allotted to the VM by Xen.
    4.60 +Xen may host multiple \emph{guest} operating systems, each of which is
    4.61 +executed within a secure virtual machine. In Xen terminology, a
    4.62 +\emph{domain}. Domains are scheduled by Xen to make effective use of
    4.63 +the available physical CPUs.  Each guest OS manages its own
    4.64 +applications. This management includes the responsibility of
    4.65 +scheduling each application within the time allotted to the VM by Xen.
    4.66  
    4.67 -The first domain, \emph{domain 0}, is created automatically when the
    4.68 -system boots and has special management privileges. Domain 0 builds
    4.69 +The first domain, \emph{domain~0}, is created automatically when the
    4.70 +system boots and has special management privileges. Domain~0 builds
    4.71  other domains and manages their virtual devices. It also performs
    4.72  administrative tasks such as suspending, resuming and migrating other
    4.73  virtual machines.
    4.74  
    4.75 -Within domain 0, a process called \emph{xend} runs to manage the
    4.76 -system.  \Xend is responsible for managing virtual machines and
    4.77 -providing access to their consoles.  Commands are issued to \xend over
    4.78 -an HTTP interface, either from a command-line tool or from a web
    4.79 +Within domain~0, a process called \emph{xend} runs to manage the
    4.80 +system.  \Xend\ is responsible for managing virtual machines and
    4.81 +providing access to their consoles.  Commands are issued to \xend\ 
    4.82 +over an HTTP interface, either from a command-line tool or from a web
    4.83  browser.
    4.84  
    4.85  
    4.86  \section{Hardware Support}
    4.87  
    4.88  Xen currently runs only on the x86 architecture, requiring a `P6' or
    4.89 -newer processor (e.g. Pentium Pro, Celeron, Pentium II, Pentium III,
    4.90 -Pentium IV, Xeon, AMD Athlon, AMD Duron).  Multiprocessor machines are
    4.91 -supported, and we also have basic support for HyperThreading (SMT),
    4.92 +newer processor (e.g.\ Pentium Pro, Celeron, Pentium~II, Pentium~III,
    4.93 +Pentium~IV, Xeon, AMD~Athlon, AMD~Duron).  Multiprocessor machines are
    4.94 +supported, and there is basic support for HyperThreading (SMT),
    4.95  although this remains a topic for ongoing research. A port
    4.96 -specifically for x86/64 is in progress, although Xen already runs on
    4.97 -such systems in 32-bit legacy mode. In addition a port to the IA64
    4.98 +specifically for x86/64 is in progress. Xen already runs on such
    4.99 +systems in 32-bit legacy mode. In addition, a port to the IA64
   4.100  architecture is approaching completion. We hope to add other
   4.101  architectures such as PPC and ARM in due course.
   4.102  
   4.103  Xen can currently use up to 4GB of memory.  It is possible for x86
   4.104  machines to address up to 64GB of physical memory but there are no
   4.105 -current plans to support these systems: The x86/64 port is the planned
   4.106 -route to supporting larger memory sizes.
   4.107 +plans to support these systems: The x86/64 port is the planned route
   4.108 +to supporting larger memory sizes.
   4.109  
   4.110  Xen offloads most of the hardware support issues to the guest OS
   4.111  running in Domain~0.  Xen itself contains only the code required to
   4.112 @@ -112,23 +112,22 @@ other hardware by configuring your XenLi
   4.113  
   4.114  Xen was originally developed by the Systems Research Group at the
   4.115  University of Cambridge Computer Laboratory as part of the XenoServers
   4.116 -project, funded by the UK-EPSRC.
   4.117 +project, funded by the UK-EPSRC\@.
   4.118  
   4.119 -XenoServers aim to provide a `public infrastructure for global
   4.120 -distributed computing', and Xen plays a key part in that, allowing us
   4.121 -to efficiently partition a single machine to enable multiple
   4.122 -independent clients to run their operating systems and applications in
   4.123 -an environment providing protection, resource isolation and
   4.124 -accounting.  The project web page contains further information along
   4.125 -with pointers to papers and technical reports:
   4.126 +XenoServers aim to provide a ``public infrastructure for global
   4.127 +distributed computing''. Xen plays a key part in that, allowing one to
   4.128 +efficiently partition a single machine to enable multiple independent
   4.129 +clients to run their operating systems and applications in an
   4.130 +environment. This environment provides protection, resource isolation
   4.131 +and accounting.  The project web page contains further information
   4.132 +along with pointers to papers and technical reports:
   4.133  \path{http://www.cl.cam.ac.uk/xeno}
   4.134  
   4.135 -Xen has since grown into a fully-fledged project in its own right,
   4.136 -enabling us to investigate interesting research issues regarding the
   4.137 -best techniques for virtualising resources such as the CPU, memory,
   4.138 -disk and network.  The project has been bolstered by support from
   4.139 -Intel Research Cambridge, and HP Labs, who are now working closely
   4.140 -with us.
   4.141 +Xen has grown into a fully-fledged project in its own right, enabling
   4.142 +us to investigate interesting research issues regarding the best
   4.143 +techniques for virtualising resources such as the CPU, memory, disk
   4.144 +and network.  The project has been bolstered by support from Intel
   4.145 +Research Cambridge and HP Labs, who are now working closely with us.
   4.146  
   4.147  Xen was first described in a paper presented at SOSP in
   4.148  2003\footnote{\tt
   4.149 @@ -137,7 +136,7 @@ first public release (1.0) was made that
   4.150  significantly matured and is now used in production scenarios on many
   4.151  sites.
   4.152  
   4.153 -Xen 2.0 features greatly enhanced hardware support, configuration
   4.154 +Xen 3.0 features greatly enhanced hardware support, configuration
   4.155  flexibility, usability and a larger complement of supported operating
   4.156  systems. This latest release takes Xen a step closer to becoming the
   4.157  definitive open source solution for virtualisation.
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/docs/src/user/securing_xen.tex	Fri Nov 11 15:36:16 2005 +0100
     5.3 @@ -0,0 +1,85 @@
     5.4 +\chapter{Securing Xen}
     5.5 +
     5.6 +This chapter describes how to secure a Xen system. It describes a number
     5.7 +of scenarios and provides a corresponding set of best practices. It
     5.8 +begins with a section devoted to understanding the security implications
     5.9 +of a Xen system.
    5.10 +
    5.11 +
    5.12 +\section{Xen Security Considerations}
    5.13 +
    5.14 +When deploying a Xen system, one must be sure to secure the management
    5.15 +domain (Domain-0) as much as possible. If the management domain is
    5.16 +compromised, all other domains are also vulnerable. The following are a
    5.17 +set of best practices for Domain-0:
    5.18 +
    5.19 +\begin{enumerate}
    5.20 +\item \textbf{Run the smallest number of necessary services.} The less
    5.21 +  things that are present in a management partition, the better.
    5.22 +  Remember, a service running as root in the management domain has full
    5.23 +  access to all other domains on the system.
    5.24 +\item \textbf{Use a firewall to restrict the traffic to the management
    5.25 +    domain.} A firewall with default-reject rules will help prevent
    5.26 +  attacks on the management domain.
    5.27 +\item \textbf{Do not allow users to access Domain-0.} The Linux kernel
    5.28 +  has been known to have local-user root exploits. If you allow normal
    5.29 +  users to access Domain-0 (even as unprivileged users) you run the risk
    5.30 +  of a kernel exploit making all of your domains vulnerable.
    5.31 +\end{enumerate}
    5.32 +
    5.33 +\section{Security Scenarios}
    5.34 +
    5.35 +
    5.36 +\subsection{The Isolated Management Network}
    5.37 +
    5.38 +In this scenario, each node has two network cards in the cluster. One
    5.39 +network card is connected to the outside world and one network card is a
    5.40 +physically isolated management network specifically for Xen instances to
    5.41 +use.
    5.42 +
    5.43 +As long as all of the management partitions are trusted equally, this is
    5.44 +the most secure scenario. No additional configuration is needed other
    5.45 +than forcing Xend to bind to the management interface for relocation.
    5.46 +
    5.47 +\textbf{FIXME:} What is the option to allow for this?
    5.48 +
    5.49 +
    5.50 +\subsection{A Subnet Behind a Firewall}
    5.51 +
    5.52 +In this scenario, each node has only one network card but the entire
    5.53 +cluster sits behind a firewall. This firewall should do at least the
    5.54 +following:
    5.55 +
    5.56 +\begin{enumerate}
    5.57 +\item Prevent IP spoofing from outside of the subnet.
    5.58 +\item Prevent access to the relocation port of any of the nodes in the
    5.59 +  cluster except from within the cluster.
    5.60 +\end{enumerate}
    5.61 +
    5.62 +The following iptables rules can be used on each node to prevent
    5.63 +migrations to that node from outside the subnet assuming the main
    5.64 +firewall does not do this for you:
    5.65 +
    5.66 +\begin{verbatim}
    5.67 +# this command disables all access to the Xen relocation
    5.68 +# port:
    5.69 +iptables -A INPUT -p tcp --destination-port 8002 -j REJECT
    5.70 +
    5.71 +# this command enables Xen relocations only from the specific
    5.72 +# subnet:
    5.73 +iptables -I INPUT -p tcp -{}-source 192.168.1.1/8 \
    5.74 +    --destination-port 8002 -j ACCEPT
    5.75 +\end{verbatim}
    5.76 +
    5.77 +\subsection{Nodes on an Untrusted Subnet}
    5.78 +
    5.79 +Migration on an untrusted subnet is not safe in current versions of Xen.
    5.80 +It may be possible to perform migrations through a secure tunnel via an
    5.81 +VPN or SSH. The only safe option in the absence of a secure tunnel is to
    5.82 +disable migration completely. The easiest way to do this is with
    5.83 +iptables:
    5.84 +
    5.85 +\begin{verbatim}
    5.86 +# this command disables all access to the Xen relocation port
    5.87 +iptables -A INPUT -p tcp -{}-destination-port 8002 -j REJECT
    5.88 +\end{verbatim}
     6.1 --- a/docs/src/user/start_addl_dom.tex	Fri Nov 11 15:36:07 2005 +0100
     6.2 +++ b/docs/src/user/start_addl_dom.tex	Fri Nov 11 15:36:16 2005 +0100
     6.3 @@ -40,8 +40,7 @@ configuration file. We provide two examp
     6.4  a starting point:
     6.5  \begin{itemize}
     6.6  \item \path{/etc/xen/xmexample1} is a simple template configuration
     6.7 -  file for describing a single VM.
     6.8 -
     6.9 +  file for describing a single VM\@.
    6.10  \item \path{/etc/xen/xmexample2} file is a template description that
    6.11    is intended to be reused for multiple virtual machines.  Setting the
    6.12    value of the \path{vmid} variable on the \path{xm} command line
    6.13 @@ -54,17 +53,17 @@ you may wish to edit include:
    6.14  \begin{quote}
    6.15  \begin{description}
    6.16  \item[kernel] Set this to the path of the kernel you compiled for use
    6.17 -  with Xen (e.g.\ \path{kernel = `/boot/vmlinuz-2.6-xenU'})
    6.18 +  with Xen (e.g.\ \path{kernel = ``/boot/vmlinuz-2.6-xenU''})
    6.19  \item[memory] Set this to the size of the domain's memory in megabytes
    6.20    (e.g.\ \path{memory = 64})
    6.21  \item[disk] Set the first entry in this list to calculate the offset
    6.22 -  of the domain's root partition, based on the domain ID.  Set the
    6.23 +  of the domain's root partition, based on the domain ID\@.  Set the
    6.24    second to the location of \path{/usr} if you are sharing it between
    6.25 -  domains (e.g.\ \path{disk = [`phy:your\_hard\_drive\%d,sda1,w' \%
    6.26 +  domains (e.g.\ \path{disk = ['phy:your\_hard\_drive\%d,sda1,w' \%
    6.27      (base\_partition\_number + vmid),
    6.28 -    `phy:your\_usr\_partition,sda6,r' ]}
    6.29 +    'phy:your\_usr\_partition,sda6,r' ]}
    6.30  \item[dhcp] Uncomment the dhcp variable, so that the domain will
    6.31 -  receive its IP address from a DHCP server (e.g.\ \path{dhcp=`dhcp'})
    6.32 +  receive its IP address from a DHCP server (e.g.\ \path{dhcp=``dhcp''})
    6.33  \end{description}
    6.34  \end{quote}
    6.35  
    6.36 @@ -72,7 +71,7 @@ You may also want to edit the {\bf vif} 
    6.37  the MAC address of the virtual ethernet interface yourself.  For
    6.38  example:
    6.39  \begin{quote}
    6.40 -\verb_vif = [`mac=00:06:AA:F6:BB:B3']_
    6.41 +\verb_vif = ['mac=00:06:AA:F6:BB:B3']_
    6.42  \end{quote}
    6.43  If you do not set this variable, \xend\ will automatically generate a
    6.44  random MAC address from an unused range.
    6.45 @@ -116,6 +115,7 @@ distribution once they have mastered the
    6.46    section of the project's SourceForge site (see
    6.47    \path{http://sf.net/projects/xen/}).
    6.48  \item Create a configuration file like the following:
    6.49 +  \begin{quote}
    6.50  \begin{verbatim}
    6.51  kernel = "/boot/vmlinuz-2.6-xenU"
    6.52  memory = 64
    6.53 @@ -124,11 +124,14 @@ nics = 1
    6.54  ip = "1.2.3.4"
    6.55  disk = ['file:/path/to/ttylinux/rootfs,sda1,w']
    6.56  root = "/dev/sda1 ro"
    6.57 -\end{verbatim}
    6.58 +\end{verbatim}    
    6.59 +  \end{quote}
    6.60  \item Now start the domain and connect to its console:
    6.61 +  \begin{quote}
    6.62  \begin{verbatim}
    6.63  xm create configfile -c
    6.64  \end{verbatim}
    6.65 +  \end{quote}
    6.66  \item Login as root, password root.
    6.67  \end{enumerate}
    6.68  
     7.1 --- a/linux-2.6-xen-sparse/arch/ia64/Kconfig	Fri Nov 11 15:36:07 2005 +0100
     7.2 +++ b/linux-2.6-xen-sparse/arch/ia64/Kconfig	Fri Nov 11 15:36:16 2005 +0100
     7.3 @@ -75,6 +75,11 @@ config XEN_BLKDEV_GRANT
     7.4  	bool
     7.5  	default y
     7.6  
     7.7 +config XEN_BLKDEV_FRONTEND
     7.8 +	depends on XEN
     7.9 +	bool
    7.10 +	default y
    7.11 +
    7.12  config SCHED_NO_NO_OMIT_FRAME_POINTER
    7.13  	bool
    7.14  	default y
     8.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c	Fri Nov 11 15:36:07 2005 +0100
     8.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c	Fri Nov 11 15:36:16 2005 +0100
     8.3 @@ -6,75 +6,146 @@
     8.4  #include <asm/hw_irq.h>
     8.5  #include <asm-xen/evtchn.h>
     8.6  
     8.7 -#define MAX_EVTCHN 256
     8.8 +#define MAX_EVTCHN 1024
     8.9 +
    8.10 +/* Xen will never allocate port zero for any purpose. */
    8.11 +#define VALID_EVTCHN(_chn) (((_chn) != 0) && ((_chn) < MAX_EVTCHN))
    8.12 +
    8.13 +/* Binding types. Hey, only IRQT_VIRQ and IRQT_EVTCHN are supported now
    8.14 + * for XEN/IA64 - ktian1
    8.15 + */
    8.16 +enum { IRQT_UNBOUND, IRQT_PIRQ, IRQT_VIRQ, IRQT_IPI, IRQT_EVTCHN };
    8.17  
    8.18 -#define VALID_EVTCHN(_chn) ((_chn) >= 0)
    8.19 +/* Constructor for packed IRQ information. */
    8.20 +#define mk_irq_info(type, index, evtchn)				\
    8.21 +	(((u32)(type) << 24) | ((u32)(index) << 16) | (u32)(evtchn))
    8.22 +/* Convenient shorthand for packed representation of an unbound IRQ. */
    8.23 +#define IRQ_UNBOUND	mk_irq_info(IRQT_UNBOUND, 0, 0)
    8.24 +/* Accessor macros for packed IRQ information. */
    8.25 +#define evtchn_from_irq(irq) ((u16)(irq_info[irq]))
    8.26 +#define index_from_irq(irq)  ((u8)(irq_info[irq] >> 16))
    8.27 +#define type_from_irq(irq)   ((u8)(irq_info[irq] >> 24))
    8.28  
    8.29 +/* Packed IRQ information: binding type, sub-type index, and event channel. */
    8.30 +static u32 irq_info[NR_IRQS];
    8.31 +
    8.32 +/* One note for XEN/IA64 is that we have all event channels bound to one
    8.33 + * physical irq vector. So we always mean evtchn vector identical to 'irq'
    8.34 + * vector in this context. - ktian1
    8.35 + */
    8.36  static struct {
    8.37  	irqreturn_t (*handler)(int, void *, struct pt_regs *);
    8.38  	void *dev_id;
    8.39 +	char opened;	/* Whether allocated */
    8.40  } evtchns[MAX_EVTCHN];
    8.41  
    8.42 -int virq_to_evtchn[NR_VIRQS] = {-1};
    8.43 -unsigned int bind_virq_to_evtchn(int virq)
    8.44 +/*
    8.45 + * This lock protects updates to the following mapping and reference-count
    8.46 + * arrays. The lock does not need to be acquired to read the mapping tables.
    8.47 + */
    8.48 +static spinlock_t irq_mapping_update_lock;
    8.49 +
    8.50 +#define unbound_irq(e) (VALID_EVTCHN(e) && (!evtchns[(e)].opened))
    8.51 +int bind_virq_to_irqhandler(
    8.52 +	unsigned int virq,
    8.53 +	unsigned int cpu,
    8.54 +	irqreturn_t (*handler)(int, void *, struct pt_regs *),
    8.55 +	unsigned long irqflags,
    8.56 +	const char *devname,
    8.57 +	void *dev_id)
    8.58  {
    8.59      evtchn_op_t op;
    8.60 +    int evtchn;
    8.61 +
    8.62 +    spin_lock(&irq_mapping_update_lock);
    8.63  
    8.64      op.cmd = EVTCHNOP_bind_virq;
    8.65      op.u.bind_virq.virq = virq;
    8.66 -    op.u.bind_virq.vcpu = 0;
    8.67 -    if ( HYPERVISOR_event_channel_op(&op) != 0 )
    8.68 -        BUG();
    8.69 +    op.u.bind_virq.vcpu = cpu;
    8.70 +    BUG_ON(HYPERVISOR_event_channel_op(&op) != 0 );
    8.71 +    evtchn = op.u.bind_virq.port;
    8.72  
    8.73 -    virq_to_evtchn[virq] = op.u.bind_virq.port;
    8.74 -    return op.u.bind_virq.port;
    8.75 -}
    8.76 +    if (!unbound_irq(evtchn))
    8.77 +	return -EINVAL;
    8.78  
    8.79 -#if 0
    8.80 -void notify_remote_via_irq(int virq)
    8.81 -{
    8.82 -	printk("notify_remote_via_irq called... FIXME??\n");
    8.83 -	while(1);
    8.84 +    evtchns[evtchn].handler = handler;
    8.85 +    evtchns[evtchn].dev_id = dev_id;
    8.86 +    evtchns[evtchn].opened = 1;
    8.87 +    irq_info[evtchn] = mk_irq_info(IRQT_VIRQ, virq, evtchn);
    8.88 +
    8.89 +    unmask_evtchn(evtchn);
    8.90 +    spin_unlock(&irq_mapping_update_lock);
    8.91 +    return evtchn;
    8.92  }
    8.93 -#endif
    8.94  
    8.95  int bind_evtchn_to_irqhandler(unsigned int evtchn,
    8.96                     irqreturn_t (*handler)(int, void *, struct pt_regs *),
    8.97                     unsigned long irqflags, const char * devname, void *dev_id)
    8.98  {
    8.99 -    if (evtchn >= MAX_EVTCHN)
   8.100 -        return -EINVAL;
   8.101 +    spin_lock(&irq_mapping_update_lock);
   8.102 +
   8.103 +    if (!unbound_irq(evtchn))
   8.104 +	return -EINVAL;
   8.105  
   8.106      evtchns[evtchn].handler = handler;
   8.107      evtchns[evtchn].dev_id = dev_id;
   8.108 +    evtchns[evtchn].opened = 1;
   8.109 +    irq_info[evtchn] = mk_irq_info(IRQT_EVTCHN, 0, evtchn);
   8.110 +
   8.111      unmask_evtchn(evtchn);
   8.112 -    //return 0;
   8.113 -    /* On ia64, there's only one irq vector allocated for all event channels,
   8.114 -     * so let's just return evtchn as handle for later communication
   8.115 -     */
   8.116 +    spin_unlock(&irq_mapping_update_lock);
   8.117      return evtchn;
   8.118  }
   8.119  
   8.120 -void unbind_evtchn_from_irqhandler(unsigned int evtchn, void *dev_id)
   8.121 +int bind_ipi_to_irqhandler(
   8.122 +	unsigned int ipi,
   8.123 +	unsigned int cpu,
   8.124 +	irqreturn_t (*handler)(int, void *, struct pt_regs *),
   8.125 +	unsigned long irqflags,
   8.126 +	const char *devname,
   8.127 +	void *dev_id)
   8.128 +{
   8.129 +    printk("%s is called which has not been supported now...?\n", __FUNCTION__);
   8.130 +    while(1);
   8.131 +}
   8.132 +
   8.133 +void unbind_from_irqhandler(unsigned int irq, void *dev_id)
   8.134  {
   8.135 -    if (evtchn >= MAX_EVTCHN)
   8.136 +    evtchn_op_t op;
   8.137 +    int evtchn = evtchn_from_irq(irq);
   8.138 +
   8.139 +    spin_lock(&irq_mapping_update_lock);
   8.140 +
   8.141 +    if (unbound_irq(irq))
   8.142          return;
   8.143  
   8.144 +    op.cmd = EVTCHNOP_close;
   8.145 +    op.u.close.port = evtchn;
   8.146 +    BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
   8.147 +
   8.148 +    switch (type_from_irq(irq)) {
   8.149 +	case IRQT_VIRQ:
   8.150 +	    /* Add smp stuff later... */
   8.151 +	    break;
   8.152 +	case IRQT_IPI:
   8.153 +	    /* Add smp stuff later... */
   8.154 +	    break;
   8.155 +	default:
   8.156 +	    break;
   8.157 +    }
   8.158 +
   8.159      mask_evtchn(evtchn);
   8.160      evtchns[evtchn].handler = NULL;
   8.161 -}
   8.162 +    evtchns[evtchn].opened = 0;
   8.163  
   8.164 -void unbind_evtchn_from_irq(unsigned int evtchn)
   8.165 -{
   8.166 -	printk("unbind_evtchn_from_irq called... FIXME??\n");
   8.167 -	while(1);
   8.168 +    spin_unlock(&irq_mapping_update_lock);
   8.169  }
   8.170  
   8.171  void notify_remote_via_irq(int irq)
   8.172  {
   8.173 -	int evtchn = virq_to_evtchn[irq];	// FIXME... is this right??
   8.174 +	int evtchn = evtchn_from_irq(irq);
   8.175  
   8.176 -	if (VALID_EVTCHN(evtchn))
   8.177 +	if (!unbound_irq(evtchn))
   8.178  		notify_remote_via_evtchn(evtchn);
   8.179  }
   8.180  
   8.181 @@ -148,9 +219,7 @@ void __init evtchn_init(void)
   8.182  
   8.183      vcpu_info->arch.evtchn_vector = evtchn_irq;
   8.184      printk("xen-event-channel using irq %d\n", evtchn_irq);
   8.185 +
   8.186 +    spin_lock_init(&irq_mapping_update_lock);
   8.187 +    memset(evtchns, 0, sizeof(evtchns));
   8.188  }
   8.189 -
   8.190 -/* Following are set of interfaces unused on IA64/XEN, just keep it here */
   8.191 -
   8.192 -void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu) {}
   8.193 -int teardown_irq(unsigned int irq, struct irqaction * old) {return 0;}
     9.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c	Fri Nov 11 15:36:07 2005 +0100
     9.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c	Fri Nov 11 15:36:16 2005 +0100
     9.3 @@ -208,6 +208,7 @@ fastcall void do_invalid_op(struct pt_re
     9.4  static void dump_fault_path(unsigned long address)
     9.5  {
     9.6  	unsigned long *p, page;
     9.7 +	unsigned long mfn; 
     9.8  
     9.9  	preempt_disable();
    9.10  	page = __pa(per_cpu(cur_pgd, smp_processor_id()));
    9.11 @@ -217,20 +218,22 @@ static void dump_fault_path(unsigned lon
    9.12  	p += (address >> 30) * 2;
    9.13  	printk(KERN_ALERT "%08lx -> *pde = %08lx:%08lx\n", page, p[1], p[0]);
    9.14  	if (p[0] & 1) {
    9.15 -		page = p[0] & PAGE_MASK;
    9.16 +		mfn  = (p[0] >> PAGE_SHIFT) | ((p[1] & 0x7) << 20); 
    9.17 +		page = mfn_to_pfn(mfn) << PAGE_SHIFT; 
    9.18 +		p  = (unsigned long *)__va(page);
    9.19  		address &= 0x3fffffff;
    9.20 -		page = machine_to_phys(page);
    9.21 -		p  = (unsigned long *)__va(page);
    9.22  		p += (address >> 21) * 2;
    9.23 -		printk(KERN_ALERT "%08lx -> *pme = %08lx:%08lx\n", page, p[1], p[0]);
    9.24 +		printk(KERN_ALERT "%08lx -> *pme = %08lx:%08lx\n", 
    9.25 +		       page, p[1], p[0]);
    9.26  #ifndef CONFIG_HIGHPTE
    9.27  		if (p[0] & 1) {
    9.28 -			page = p[0] & PAGE_MASK;
    9.29 +			mfn  = (p[0] >> PAGE_SHIFT) | ((p[1] & 0x7) << 20); 
    9.30 +			page = mfn_to_pfn(mfn) << PAGE_SHIFT; 
    9.31 +			p  = (unsigned long *) __va(page);
    9.32  			address &= 0x001fffff;
    9.33 -			page = machine_to_phys(page);
    9.34 -			p  = (unsigned long *) __va(page);
    9.35  			p += (address >> 12) * 2;
    9.36 -			printk(KERN_ALERT "%08lx -> *pte = %08lx:%08lx\n", page, p[1], p[0]);
    9.37 +			printk(KERN_ALERT "%08lx -> *pte = %08lx:%08lx\n",
    9.38 +			       page, p[1], p[0]);
    9.39  		}
    9.40  #endif
    9.41  	}
    10.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/skbuff.c	Fri Nov 11 15:36:07 2005 +0100
    10.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/skbuff.c	Fri Nov 11 15:36:16 2005 +0100
    10.3 @@ -17,7 +17,7 @@
    10.4  /* Referenced in netback.c. */
    10.5  /*static*/ kmem_cache_t *skbuff_cachep;
    10.6  
    10.7 -#define MAX_SKBUFF_ORDER 2
    10.8 +#define MAX_SKBUFF_ORDER 4
    10.9  static kmem_cache_t *skbuff_order_cachep[MAX_SKBUFF_ORDER + 1];
   10.10  
   10.11  static struct {
    11.1 --- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c	Fri Nov 11 15:36:07 2005 +0100
    11.2 +++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c	Fri Nov 11 15:36:16 2005 +0100
    11.3 @@ -97,9 +97,7 @@ static inline unsigned char *
    11.4  transmission_set_buffer(struct transmission *t,
    11.5                          unsigned char *buffer, unsigned int len)
    11.6  {
    11.7 -	if (NULL != t->request) {
    11.8 -		kfree(t->request);
    11.9 -	}
   11.10 +	kfree(t->request);
   11.11  	t->request = kmalloc(len, GFP_KERNEL);
   11.12  	if (t->request) {
   11.13  		memcpy(t->request,
   11.14 @@ -113,12 +111,8 @@ transmission_set_buffer(struct transmiss
   11.15  static inline void
   11.16  transmission_free(struct transmission *t)
   11.17  {
   11.18 -	if (t->request) {
   11.19 -		kfree(t->request);
   11.20 -	}
   11.21 -	if (t->rcv_buffer) {
   11.22 -		kfree(t->rcv_buffer);
   11.23 -	}
   11.24 +	kfree(t->request);
   11.25 +	kfree(t->rcv_buffer);
   11.26  	kfree(t);
   11.27  }
   11.28  
    12.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Fri Nov 11 15:36:07 2005 +0100
    12.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Fri Nov 11 15:36:16 2005 +0100
    12.3 @@ -51,6 +51,12 @@ static int map_frontend_page(blkif_t *bl
    12.4  	blkif->shmem_ref = shared_page;
    12.5  	blkif->shmem_handle = op.handle;
    12.6  
    12.7 +#ifdef __ia64__
    12.8 +	/* on some arch's, map_grant_ref behaves like mmap, in that the
    12.9 +	 * passed address is a hint and a different address may be returned */
   12.10 +	blkif->blk_ring_area->addr = gnttab_map_vaddr(op);
   12.11 +#endif
   12.12 +
   12.13  	return 0;
   12.14  }
   12.15  
    13.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Fri Nov 11 15:36:07 2005 +0100
    13.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Fri Nov 11 15:36:16 2005 +0100
    13.3 @@ -48,8 +48,7 @@ static int blkback_remove(struct xenbus_
    13.4  	unregister_xenbus_watch(&be->backend_watch);
    13.5  	if (be->blkif)
    13.6  		blkif_put(be->blkif);
    13.7 -	if (be->frontpath)
    13.8 -		kfree(be->frontpath);
    13.9 +	kfree(be->frontpath);
   13.10  	kfree(be);
   13.11  	return 0;
   13.12  }
   13.13 @@ -274,8 +273,7 @@ static int blkback_probe(struct xenbus_d
   13.14   free_be:
   13.15  	if (be->backend_watch.node)
   13.16  		unregister_xenbus_watch(&be->backend_watch);
   13.17 -	if (frontend)
   13.18 -		kfree(frontend);
   13.19 +	kfree(frontend);
   13.20  	kfree(be);
   13.21  	return err;
   13.22  }
    14.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Fri Nov 11 15:36:07 2005 +0100
    14.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Fri Nov 11 15:36:16 2005 +0100
    14.3 @@ -607,8 +607,7 @@ again:
    14.4   destroy_blkring:
    14.5  	blkif_free(info);
    14.6   out:
    14.7 -	if (backend)
    14.8 -		kfree(backend);
    14.9 +	kfree(backend);
   14.10  	return err;
   14.11  }
   14.12  
    15.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c	Fri Nov 11 15:36:07 2005 +0100
    15.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c	Fri Nov 11 15:36:16 2005 +0100
    15.3 @@ -52,8 +52,7 @@ static int blkback_remove(struct xenbus_
    15.4  	unregister_xenbus_watch(&be->backend_watch);
    15.5  	if (be->blkif)
    15.6  		blkif_put(be->blkif);
    15.7 -	if (be->frontpath)
    15.8 -		kfree(be->frontpath);
    15.9 +	kfree(be->frontpath);
   15.10  	kfree(be);
   15.11  	return 0;
   15.12  }
   15.13 @@ -201,8 +200,7 @@ static int blkback_probe(struct xenbus_d
   15.14   free_be:
   15.15  	if (be->backend_watch.node)
   15.16  		unregister_xenbus_watch(&be->backend_watch);
   15.17 -	if (frontend)
   15.18 -		kfree(frontend);
   15.19 +	kfree(frontend);
   15.20  	kfree(be);
   15.21  	return err;
   15.22  }
    16.1 --- a/linux-2.6-xen-sparse/drivers/xen/console/console.c	Fri Nov 11 15:36:07 2005 +0100
    16.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c	Fri Nov 11 15:36:16 2005 +0100
    16.3 @@ -241,11 +241,7 @@ console_initcall(xen_console_init);
    16.4  #endif
    16.5  
    16.6  /*** Useful function for console debugging -- goes straight to Xen. ***/
    16.7 -#ifdef CONFIG_XEN_PRIVILEGED_GUEST
    16.8  asmlinkage int xprintk(const char *fmt, ...)
    16.9 -#else
   16.10 -asmlinkage int xprintk(const char *fmt, ...)
   16.11 -#endif
   16.12  {
   16.13  	va_list args;
   16.14  	int printk_len;
    17.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c	Fri Nov 11 15:36:07 2005 +0100
    17.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c	Fri Nov 11 15:36:16 2005 +0100
    17.3 @@ -160,10 +160,8 @@ static int __init make_loopback(int i)
    17.4  	return 0;
    17.5  
    17.6   fail:
    17.7 -	if (dev1 != NULL)
    17.8 -		kfree(dev1);
    17.9 -	if (dev2 != NULL)
   17.10 -		kfree(dev2);
   17.11 +	kfree(dev1);
   17.12 +	kfree(dev2);
   17.13  	return err;
   17.14  }
   17.15  
    18.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c	Fri Nov 11 15:36:07 2005 +0100
    18.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c	Fri Nov 11 15:36:16 2005 +0100
    18.3 @@ -46,8 +46,7 @@ static int netback_remove(struct xenbus_
    18.4  	unregister_xenbus_watch(&be->backend_watch);
    18.5  	if (be->netif)
    18.6  		netif_disconnect(be->netif);
    18.7 -	if (be->frontpath)
    18.8 -		kfree(be->frontpath);
    18.9 +	kfree(be->frontpath);
   18.10  	kfree(be);
   18.11  	return 0;
   18.12  }
   18.13 @@ -253,8 +252,7 @@ static int netback_probe(struct xenbus_d
   18.14   free_be:
   18.15  	if (be->backend_watch.node)
   18.16  		unregister_xenbus_watch(&be->backend_watch);
   18.17 -	if (frontend)
   18.18 -		kfree(frontend);
   18.19 +	kfree(frontend);
   18.20  	kfree(be);
   18.21  	return err;
   18.22  }
    19.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Fri Nov 11 15:36:07 2005 +0100
    19.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Fri Nov 11 15:36:16 2005 +0100
    19.3 @@ -917,7 +917,7 @@ static int create_netdev(int handle, str
    19.4  	np->netdev = netdev;
    19.5  
    19.6   exit:
    19.7 -	if ((err != 0) && (netdev != NULL))
    19.8 +	if (err != 0)
    19.9  		kfree(netdev);
   19.10  	else if (val != NULL)
   19.11  		*val = netdev;
   19.12 @@ -1173,8 +1173,7 @@ again:
   19.13   destroy_ring:
   19.14  	shutdown_device(info);
   19.15   out:
   19.16 -	if (backend)
   19.17 -		kfree(backend);
   19.18 +	kfree(backend);
   19.19  	return err;
   19.20  }
   19.21  
    20.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c	Fri Nov 11 15:36:07 2005 +0100
    20.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c	Fri Nov 11 15:36:16 2005 +0100
    20.3 @@ -167,9 +167,7 @@ static void inline
    20.4  packet_free(struct packet *pak)
    20.5  {
    20.6  	del_singleshot_timer_sync(&pak->processing_timer);
    20.7 -	if (pak->data_buffer) {
    20.8 -		kfree(pak->data_buffer);
    20.9 -	}
   20.10 +	kfree(pak->data_buffer);
   20.11  	/*
   20.12  	 * cannot do tpmif_put(pak->tpmif); bad things happen
   20.13  	 * on the last tpmif_put()
    21.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Fri Nov 11 15:36:07 2005 +0100
    21.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Fri Nov 11 15:36:16 2005 +0100
    21.3 @@ -41,19 +41,16 @@ static int tpmback_remove(struct xenbus_
    21.4  {
    21.5  	struct backend_info *be = dev->data;
    21.6  
    21.7 -	if (be->watch.node) {
    21.8 +	if (be->watch.node)
    21.9  		unregister_xenbus_watch(&be->watch);
   21.10 -	}
   21.11  	unregister_xenbus_watch(&be->backend_watch);
   21.12  
   21.13  	tpmif_vtpm_close(be->instance);
   21.14  
   21.15 -	if (be->tpmif) {
   21.16 +	if (be->tpmif)
   21.17  		tpmif_put(be->tpmif);
   21.18 -	}
   21.19  
   21.20 -	if (be->frontpath)
   21.21 -		kfree(be->frontpath);
   21.22 +	kfree(be->frontpath);
   21.23  	kfree(be);
   21.24  	return 0;
   21.25  }
   21.26 @@ -258,8 +255,7 @@ static int tpmback_probe(struct xenbus_d
   21.27  free_be:
   21.28  	if (be->backend_watch.node)
   21.29  		unregister_xenbus_watch(&be->backend_watch);
   21.30 -	if (frontend)
   21.31 -		kfree(frontend);
   21.32 +	kfree(frontend);
   21.33  	kfree(be);
   21.34  	return err;
   21.35  }
    22.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c	Fri Nov 11 15:36:07 2005 +0100
    22.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c	Fri Nov 11 15:36:16 2005 +0100
    22.3 @@ -387,8 +387,7 @@ abort_transaction:
    22.4  destroy_tpmring:
    22.5  	destroy_tpmring(info, &my_private);
    22.6  out:
    22.7 -	if (backend)
    22.8 -		kfree(backend);
    22.9 +	kfree(backend);
   22.10  	return err;
   22.11  }
   22.12  
    23.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Fri Nov 11 15:36:07 2005 +0100
    23.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Fri Nov 11 15:36:16 2005 +0100
    23.3 @@ -570,10 +570,8 @@ void xenbus_dev_error(struct xenbus_devi
    23.4  	}
    23.5  
    23.6  fail:
    23.7 -	if (printf_buffer)
    23.8 -		kfree(printf_buffer);
    23.9 -	if (path_buffer)
   23.10 -		kfree(path_buffer);
   23.11 +	kfree(printf_buffer);
   23.12 +	kfree(path_buffer);
   23.13  }
   23.14  EXPORT_SYMBOL(xenbus_dev_error);
   23.15  
    24.1 --- a/tools/blktap/blkif.c	Fri Nov 11 15:36:07 2005 +0100
    24.2 +++ b/tools/blktap/blkif.c	Fri Nov 11 15:36:16 2005 +0100
    24.3 @@ -108,8 +108,7 @@ void free_blkif(blkif_t *blkif)
    24.4          }
    24.5          pblkif = &curs->hash_next;
    24.6      }
    24.7 -    if (blkif != NULL)
    24.8 -        free(blkif);
    24.9 +    free(blkif);
   24.10  }
   24.11  
   24.12  void blkif_register_request_hook(blkif_t *blkif, char *name, 
    25.1 --- a/tools/blktap/parallax/blockstore.c	Fri Nov 11 15:36:07 2005 +0100
    25.2 +++ b/tools/blktap/parallax/blockstore.c	Fri Nov 11 15:36:16 2005 +0100
    25.3 @@ -604,8 +604,7 @@ void *readblock_indiv(int server, uint64
    25.4      return block;
    25.5  
    25.6      err:
    25.7 -    if (qe->block)
    25.8 -        free(qe->block);
    25.9 +    free(qe->block);
   25.10      free((void *)qe);
   25.11      return NULL;
   25.12  }
   25.13 @@ -1072,7 +1071,7 @@ uint64_t allocblock_hint(void *block, ui
   25.14   *
   25.15   *   @return: pointer to new block, NULL on error
   25.16   */
   25.17 -void *newblock() {
   25.18 +void *newblock(void) {
   25.19      void *block = malloc(BLOCK_SIZE);
   25.20      if (block == NULL) {
   25.21          perror("newblock");
   25.22 @@ -1089,7 +1088,6 @@ void *newblock() {
   25.23   *   @block: block to be freed
   25.24   */
   25.25  void freeblock(void *block) {
   25.26 -    if (block != NULL)
   25.27          free(block);
   25.28  }
   25.29  
    26.1 --- a/tools/blktap/parallax/blockstored.c	Fri Nov 11 15:36:07 2005 +0100
    26.2 +++ b/tools/blktap/parallax/blockstored.c	Fri Nov 11 15:36:16 2005 +0100
    26.3 @@ -232,7 +232,7 @@ uint64_t allocblock(void *block) {
    26.4   *
    26.5   *   @return: pointer to new block, NULL on error
    26.6   */
    26.7 -void *newblock() {
    26.8 +void *newblock(void) {
    26.9      void *block = malloc(BLOCK_SIZE);
   26.10      if (block == NULL) {
   26.11          perror("newblock");
   26.12 @@ -249,7 +249,6 @@ void *newblock() {
   26.13   *   @block: block to be freed
   26.14   */
   26.15  void freeblock(void *block) {
   26.16 -    if (block != NULL)
   26.17          free(block);
   26.18  }
   26.19  
    27.1 --- a/tools/blktap/parallax/requests-async.c	Fri Nov 11 15:36:07 2005 +0100
    27.2 +++ b/tools/blktap/parallax/requests-async.c	Fri Nov 11 15:36:16 2005 +0100
    27.3 @@ -715,7 +715,7 @@ static void write_cb(struct io_ret r, vo
    27.4          r.u.i  = -1;
    27.5          /* free any saved node vals. */
    27.6          for (i=0; i<3; i++)
    27.7 -            if (req->radix[i] != 0) free(req->radix[i]);
    27.8 +            free(req->radix[i]);
    27.9          free(req);
   27.10          cb(r, req_param);
   27.11      }
    28.1 --- a/tools/blktap/xenbus.c	Fri Nov 11 15:36:07 2005 +0100
    28.2 +++ b/tools/blktap/xenbus.c	Fri Nov 11 15:36:16 2005 +0100
    28.3 @@ -339,10 +339,8 @@ static int backend_remove(struct xs_hand
    28.4      /* Free everything else. */
    28.5      if (be->blkif)
    28.6          free_blkif(be->blkif);
    28.7 -    if (be->frontpath)
    28.8 -        free(be->frontpath);
    28.9 -    if (be->backpath)
   28.10 -        free(be->backpath);
   28.11 +    free(be->frontpath);
   28.12 +    free(be->backpath);
   28.13      free(be);
   28.14      return 0;
   28.15  }
   28.16 @@ -406,8 +404,7 @@ static void frontend_changed(struct xs_h
   28.17      return;
   28.18  
   28.19   fail:
   28.20 -    if (fepath)
   28.21 -        free(fepath);
   28.22 +    free(fepath);
   28.23  }
   28.24  
   28.25  
   28.26 @@ -460,9 +457,7 @@ static void backend_changed(struct xs_ha
   28.27      }
   28.28  
   28.29   fail:
   28.30 -    if (path)
   28.31 -        free(path);
   28.32 -
   28.33 +    free(path);
   28.34  }
   28.35  
   28.36  static void blkback_probe(struct xs_handle *h, struct xenbus_watch *w, 
   28.37 @@ -537,12 +532,10 @@ static void blkback_probe(struct xs_hand
   28.38  	return;
   28.39  
   28.40   free_be:
   28.41 -	if ((be) && (be->backend_watch.node))
   28.42 +	if (be && (be->backend_watch.node))
   28.43              unregister_xenbus_watch(h, &be->backend_watch);
   28.44 -	if (frontend)
   28.45 -            free(frontend);
   28.46 -        if (bepath)
   28.47 -            free(bepath);
   28.48 +        free(frontend);
   28.49 +        free(bepath);
   28.50  	free(be);
   28.51  	return;
   28.52  }
    29.1 --- a/tools/console/daemon/io.c	Fri Nov 11 15:36:07 2005 +0100
    29.2 +++ b/tools/console/daemon/io.c	Fri Nov 11 15:36:16 2005 +0100
    29.3 @@ -344,8 +344,7 @@ static struct domain *create_domain(int 
    29.4  
    29.5  	return dom;
    29.6   out:
    29.7 -	if (dom->conspath)
    29.8 -		free(dom->conspath);
    29.9 +	free(dom->conspath);
   29.10  	free(dom);
   29.11  	return NULL;
   29.12  }
   29.13 @@ -380,20 +379,16 @@ static void cleanup_domain(struct domain
   29.14  	if (!buffer_empty(&d->buffer))
   29.15  		return;
   29.16  
   29.17 -	if (d->buffer.data) {
   29.18 -		free(d->buffer.data);
   29.19 -		d->buffer.data = NULL;
   29.20 -	}
   29.21 -
   29.22  	if (d->tty_fd != -1) {
   29.23  		close(d->tty_fd);
   29.24  		d->tty_fd = -1;
   29.25  	}
   29.26  
   29.27 -	if (d->conspath) {
   29.28 -		free(d->conspath);
   29.29 -		d->conspath = NULL;
   29.30 -	}
   29.31 +	free(d->buffer.data);
   29.32 +	d->buffer.data = NULL;
   29.33 +
   29.34 +	free(d->conspath);
   29.35 +	d->conspath = NULL;
   29.36  
   29.37  	remove_domain(d);
   29.38  }
    30.1 --- a/tools/examples/network-bridge	Fri Nov 11 15:36:07 2005 +0100
    30.2 +++ b/tools/examples/network-bridge	Fri Nov 11 15:36:16 2005 +0100
    30.3 @@ -20,9 +20,9 @@
    30.4  #
    30.5  # Vars:
    30.6  #
    30.7 -# vifnum     Virtual device number to use (default 0). Numbers >=1
    30.8 +# vifnum     Virtual device number to use (default 0). Numbers >=8
    30.9  #            require the netback driver to have nloopbacks set to a
   30.10 -#            higher value than its default of 1.
   30.11 +#            higher value than its default of 8.
   30.12  # bridge     The bridge to use (default xenbr${vifnum}).
   30.13  # netdev     The interface to add to the bridge (default eth${vifnum}).
   30.14  # antispoof  Whether to use iptables to prevent spoofing (default no).
    31.1 --- a/tools/ioemu/hw/magic-load.c	Fri Nov 11 15:36:07 2005 +0100
    31.2 +++ b/tools/ioemu/hw/magic-load.c	Fri Nov 11 15:36:16 2005 +0100
    31.3 @@ -196,10 +196,8 @@ static void load_symbols(struct elfhdr *
    31.4  	goto error_freesyms;
    31.5  
    31.6      /* Commit */
    31.7 -    if (disas_symtab)
    31.8 -	qemu_free(disas_symtab); /* XXX Merge with old symbols? */
    31.9 -    if (disas_strtab)
   31.10 -	qemu_free(disas_strtab);
   31.11 +    qemu_free(disas_symtab); /* XXX Merge with old symbols? */
   31.12 +    qemu_free(disas_strtab);
   31.13      disas_symtab = syms;
   31.14      disas_num_syms = nsyms;
   31.15      disas_strtab = str;
    32.1 --- a/tools/ioemu/vnc.c	Fri Nov 11 15:36:07 2005 +0100
    32.2 +++ b/tools/ioemu/vnc.c	Fri Nov 11 15:36:16 2005 +0100
    32.3 @@ -187,8 +187,7 @@ static void mouse_find_bounding_box_of_d
    32.4  
    32.5  static void start_mouse_calibration() {
    32.6  	int size = screen->height*screen->paddedWidthInBytes;
    32.7 -	if(mouse_magic->calibration)
    32.8 -		free(mouse_magic->calibration);
    32.9 +	free(mouse_magic->calibration);
   32.10  	mouse_magic->calibration = malloc(size);
   32.11  	memcpy(mouse_magic->calibration, screen->frameBuffer, size);
   32.12  	calibration_step=0;
   32.13 @@ -198,8 +197,7 @@ static void start_mouse_calibration() {
   32.14  }
   32.15  
   32.16  static void stop_mouse_calibration() {
   32.17 -	if(mouse_magic->calibration)
   32.18 -		free(mouse_magic->calibration);
   32.19 +	free(mouse_magic->calibration);
   32.20  	mouse_magic->calibration = 0;
   32.21  }
   32.22  
    33.1 --- a/tools/libxc/Makefile	Fri Nov 11 15:36:07 2005 +0100
    33.2 +++ b/tools/libxc/Makefile	Fri Nov 11 15:36:16 2005 +0100
    33.3 @@ -102,6 +102,7 @@ install: build
    33.4  	$(INSTALL_DATA) libxenguest.a $(DESTDIR)/usr/$(LIBDIR)
    33.5  	ln -sf libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenguest.so.$(MAJOR)
    33.6  	ln -sf libxenguest.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenguest.so
    33.7 +	$(INSTALL_DATA) xenguest.h $(DESTDIR)/usr/include
    33.8  
    33.9  .PHONY: TAGS clean rpm install all
   33.10  
    34.1 --- a/tools/libxc/xc_ia64_stubs.c	Fri Nov 11 15:36:07 2005 +0100
    34.2 +++ b/tools/libxc/xc_ia64_stubs.c	Fri Nov 11 15:36:16 2005 +0100
    34.3 @@ -77,7 +77,7 @@ int xc_ia64_copy_to_domain_pages(int xc_
    34.4  {
    34.5      // N.B. gva should be page aligned
    34.6      
    34.7 -    unsigned long *page_array=NULL;
    34.8 +    unsigned long *page_array = NULL;
    34.9      int i;
   34.10  
   34.11      if ( (page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL ){
   34.12 @@ -99,8 +99,7 @@ int xc_ia64_copy_to_domain_pages(int xc_
   34.13      return 0;
   34.14      
   34.15  error_out:
   34.16 -    if (page_array)
   34.17 -        free(page_array);
   34.18 +    free(page_array);
   34.19      return -1;
   34.20  }
   34.21  
   34.22 @@ -603,7 +602,7 @@ int xc_vmx_build(int xc_handle,
   34.23                   int memsize,
   34.24                   const char *image_name,
   34.25                   unsigned int control_evtchn,
   34.26 -		 unsigned int lapic,
   34.27 +                 unsigned int lapic,
   34.28                   unsigned int vcpus,
   34.29                   unsigned int store_evtchn,
   34.30                   unsigned long *store_mfn)
   34.31 @@ -657,8 +656,7 @@ int xc_vmx_build(int xc_handle,
   34.32          goto error_out;
   34.33      }
   34.34  
   34.35 -    if ( image != NULL )
   34.36 -        free(image);
   34.37 +    free(image);
   34.38  
   34.39      ctxt->flags = VGCF_VMX_GUEST;
   34.40      ctxt->regs.cr_iip = 0x80000000ffffffb0UL;
   34.41 @@ -675,9 +673,7 @@ int xc_vmx_build(int xc_handle,
   34.42      return rc;
   34.43  
   34.44   error_out:
   34.45 -    if ( image != NULL )
   34.46 -        free(image);
   34.47 -
   34.48 +    free(image);
   34.49      return -1;
   34.50  }
   34.51  
    35.1 --- a/tools/libxc/xc_linux_build.c	Fri Nov 11 15:36:07 2005 +0100
    35.2 +++ b/tools/libxc/xc_linux_build.c	Fri Nov 11 15:36:16 2005 +0100
    35.3 @@ -670,10 +670,8 @@ static int setup_guest(int xc_handle,
    35.4      return 0;
    35.5  
    35.6   error_out:
    35.7 -    if ( mmu != NULL )
    35.8 -        free(mmu);
    35.9 -    if ( page_array != NULL )
   35.10 -        free(page_array);
   35.11 +    free(mmu);
   35.12 +    free(page_array);
   35.13      return -1;
   35.14  }
   35.15  #endif
   35.16 @@ -768,8 +766,7 @@ int xc_linux_build(int xc_handle,
   35.17          close(initrd_fd);
   35.18      if ( initrd_gfd )
   35.19          gzclose(initrd_gfd);
   35.20 -    if ( image != NULL )
   35.21 -        free(image);
   35.22 +    free(image);
   35.23  
   35.24  #ifdef __ia64__
   35.25      /* based on new_thread in xen/arch/ia64/domain.c */
   35.26 @@ -858,9 +855,7 @@ int xc_linux_build(int xc_handle,
   35.27          gzclose(initrd_gfd);
   35.28      else if ( initrd_fd >= 0 )
   35.29          close(initrd_fd);
   35.30 -    if ( image != NULL )
   35.31 -        free(image);
   35.32 -
   35.33 +    free(image);
   35.34      return -1;
   35.35  }
   35.36  
    36.1 --- a/tools/libxc/xc_vmx_build.c	Fri Nov 11 15:36:07 2005 +0100
    36.2 +++ b/tools/libxc/xc_vmx_build.c	Fri Nov 11 15:36:16 2005 +0100
    36.3 @@ -565,10 +565,8 @@ static int setup_guest(int xc_handle,
    36.4      return 0;
    36.5  
    36.6   error_out:
    36.7 -    if ( mmu != NULL )
    36.8 -        free(mmu);
    36.9 -    if ( page_array != NULL )
   36.10 -        free(page_array);
   36.11 +    free(mmu);
   36.12 +    free(page_array);
   36.13      return -1;
   36.14  }
   36.15  
   36.16 @@ -663,8 +661,7 @@ int xc_vmx_build(int xc_handle,
   36.17          goto error_out;
   36.18      }
   36.19  
   36.20 -    if ( image != NULL )
   36.21 -        free(image);
   36.22 +    free(image);
   36.23  
   36.24      ctxt->flags = VGCF_VMX_GUEST;
   36.25      /* FPU is set up to default initial state. */
   36.26 @@ -710,9 +707,7 @@ int xc_vmx_build(int xc_handle,
   36.27      return rc;
   36.28  
   36.29   error_out:
   36.30 -    if ( image != NULL )
   36.31 -        free(image);
   36.32 -
   36.33 +    free(image);
   36.34      return -1;
   36.35  }
   36.36  
    37.1 --- a/tools/python/xen/lowlevel/xs/xs.c	Fri Nov 11 15:36:07 2005 +0100
    37.2 +++ b/tools/python/xen/lowlevel/xs/xs.c	Fri Nov 11 15:36:16 2005 +0100
    37.3 @@ -114,8 +114,7 @@ static PyObject *xspy_read(PyObject *sel
    37.4      }
    37.5      val = PyString_FromStringAndSize(xsval, xsval_n);
    37.6   exit:
    37.7 -    if (xsval)
    37.8 -        free(xsval);
    37.9 +    free(xsval);
   37.10      return val;
   37.11  }
   37.12  
   37.13 @@ -427,8 +426,7 @@ static PyObject *xspy_set_permissions(Py
   37.14      val = Py_None;
   37.15   exit:
   37.16      Py_XDECREF(tuple0);
   37.17 -    if (xsperms)
   37.18 -        free(xsperms);
   37.19 +    free(xsperms);
   37.20      return val;
   37.21  }
   37.22  
   37.23 @@ -541,8 +539,7 @@ again:
   37.24      /* Create tuple (path, token). */
   37.25      val = Py_BuildValue("(sO)", xsval[XS_WATCH_PATH], token);
   37.26   exit:
   37.27 -    if (xsval)
   37.28 -        free(xsval);
   37.29 +    free(xsval);
   37.30      return val;
   37.31  }
   37.32  
    38.1 --- a/tools/vtpm_manager/manager/securestorage.c	Fri Nov 11 15:36:07 2005 +0100
    38.2 +++ b/tools/vtpm_manager/manager/securestorage.c	Fri Nov 11 15:36:16 2005 +0100
    38.3 @@ -393,8 +393,7 @@ TPM_RESULT VTPM_LoadService(void) {
    38.4    vtpmlogerror(VTPM_LOG_VTPM, "Failed to load service data with error = %s\n", tpm_get_error_name(status));
    38.5   egress:
    38.6    
    38.7 -  if (flat_global)
    38.8 -    free(flat_global);
    38.9 +  free(flat_global);
   38.10    close(fh);
   38.11    
   38.12    return status;
    39.1 --- a/tools/vtpm_manager/util/bsg.c	Fri Nov 11 15:36:07 2005 +0100
    39.2 +++ b/tools/vtpm_manager/util/bsg.c	Fri Nov 11 15:36:16 2005 +0100
    39.3 @@ -616,8 +616,7 @@ static void BSG_Destroy_private(BSG_Type
    39.4    else if (format == __FMT_SIZE || format == __FMT_HSIZE) {
    39.5      s += size;
    39.6      BSG_BYTE* ptr = *(BSG_BYTE**) s;
    39.7 -    if (ptr)
    39.8 -      free(ptr);
    39.9 +    free(ptr);
   39.10      s += sizeof(void*);
   39.11    } else if (format == __FMT_PACKED) {
   39.12  
    40.1 --- a/tools/xenstat/libxenstat/src/xenstat.c	Fri Nov 11 15:36:07 2005 +0100
    40.2 +++ b/tools/xenstat/libxenstat/src/xenstat.c	Fri Nov 11 15:36:16 2005 +0100
    40.3 @@ -284,10 +284,8 @@ void xenstat_free_node(xenstat_node * no
    40.4  
    40.5  	if (node) {
    40.6  		if (node->domains) {
    40.7 -			for (i = 0; i < node->num_domains; i++) {
    40.8 -				if (node->domains[i].name)
    40.9 -					free(node->domains[i].name);
   40.10 -			}
   40.11 +			for (i = 0; i < node->num_domains; i++)
   40.12 +				free(node->domains[i].name);
   40.13  
   40.14  			for (i = 0; i < NUM_COLLECTORS; i++)
   40.15  				if((node->flags & collectors[i].flag)
    41.1 --- a/tools/xenstore/xenstored_core.c	Fri Nov 11 15:36:07 2005 +0100
    41.2 +++ b/tools/xenstore/xenstored_core.c	Fri Nov 11 15:36:16 2005 +0100
    41.3 @@ -1411,8 +1411,6 @@ static void manual_node(const char *name
    41.4  	talloc_free(node);
    41.5  }
    41.6  
    41.7 -#
    41.8 -
    41.9  static void setup_structure(void)
   41.10  {
   41.11  	char *tdbname;
    42.1 --- a/xen/acm/acm_chinesewall_hooks.c	Fri Nov 11 15:36:07 2005 +0100
    42.2 +++ b/xen/acm/acm_chinesewall_hooks.c	Fri Nov 11 15:36:16 2005 +0100
    42.3 @@ -117,8 +117,7 @@ static int chwall_init_domain_ssid(void 
    42.4  static void chwall_free_domain_ssid(void *chwall_ssid)
    42.5  {
    42.6      traceprintk("%s.\n", __func__);
    42.7 -    if (chwall_ssid != NULL)
    42.8 -        xfree(chwall_ssid);
    42.9 +    xfree(chwall_ssid);
   42.10      return;
   42.11  }
   42.12  
   42.13 @@ -344,14 +343,10 @@ static int chwall_set_policy(u8 * buf, u
   42.14      chwall_bin_pol.max_types = chwall_buf->chwall_max_types;
   42.15      chwall_bin_pol.max_ssidrefs = chwall_buf->chwall_max_ssidrefs;
   42.16      chwall_bin_pol.max_conflictsets = chwall_buf->chwall_max_conflictsets;
   42.17 -    if (chwall_bin_pol.ssidrefs != NULL)
   42.18 -        xfree(chwall_bin_pol.ssidrefs);
   42.19 -    if (chwall_bin_pol.conflict_aggregate_set != NULL)
   42.20 -        xfree(chwall_bin_pol.conflict_aggregate_set);
   42.21 -    if (chwall_bin_pol.running_types != NULL)
   42.22 -        xfree(chwall_bin_pol.running_types);
   42.23 -    if (chwall_bin_pol.conflict_sets != NULL)
   42.24 -        xfree(chwall_bin_pol.conflict_sets);
   42.25 +    xfree(chwall_bin_pol.ssidrefs);
   42.26 +    xfree(chwall_bin_pol.conflict_aggregate_set);
   42.27 +    xfree(chwall_bin_pol.running_types);
   42.28 +    xfree(chwall_bin_pol.conflict_sets);
   42.29      chwall_bin_pol.ssidrefs = ssids;
   42.30      chwall_bin_pol.conflict_aggregate_set = conflict_aggregate_set;
   42.31      chwall_bin_pol.running_types = running_types;
   42.32 @@ -360,14 +355,10 @@ static int chwall_set_policy(u8 * buf, u
   42.33  
   42.34   error_free:
   42.35      printk("%s: ERROR setting policy.\n", __func__);
   42.36 -    if (ssids != NULL)
   42.37 -        xfree(ssids);
   42.38 -    if (conflict_sets != NULL)
   42.39 -        xfree(conflict_sets);
   42.40 -    if (running_types != NULL)
   42.41 -        xfree(running_types);
   42.42 -    if (conflict_aggregate_set != NULL)
   42.43 -        xfree(conflict_aggregate_set);
   42.44 +    xfree(ssids);
   42.45 +    xfree(conflict_sets);
   42.46 +    xfree(running_types);
   42.47 +    xfree(conflict_aggregate_set);
   42.48      return -EFAULT;
   42.49  }
   42.50  
    43.1 --- a/xen/acm/acm_simple_type_enforcement_hooks.c	Fri Nov 11 15:36:07 2005 +0100
    43.2 +++ b/xen/acm/acm_simple_type_enforcement_hooks.c	Fri Nov 11 15:36:16 2005 +0100
    43.3 @@ -130,8 +130,7 @@ static void
    43.4  ste_free_domain_ssid(void *ste_ssid)
    43.5  {
    43.6      traceprintk("%s.\n", __func__);
    43.7 -    if (ste_ssid != NULL)
    43.8 -        xfree(ste_ssid);
    43.9 +    xfree(ste_ssid);
   43.10      return;
   43.11  }
   43.12  
   43.13 @@ -320,8 +319,7 @@ ste_set_policy(u8 *buf, u32 buf_size)
   43.14      /* 3. replace old policy (activate new policy) */
   43.15      ste_bin_pol.max_types = ste_buf->ste_max_types;
   43.16      ste_bin_pol.max_ssidrefs = ste_buf->ste_max_ssidrefs;
   43.17 -    if (ste_bin_pol.ssidrefs) 
   43.18 -        xfree(ste_bin_pol.ssidrefs);
   43.19 +    xfree(ste_bin_pol.ssidrefs);
   43.20      ste_bin_pol.ssidrefs = (domaintype_t *)ssidrefsbuf;
   43.21  
   43.22      /* clear all ste caches */
   43.23 @@ -338,7 +336,7 @@ ste_set_policy(u8 *buf, u32 buf_size)
   43.24  
   43.25   error_free:
   43.26      printk("%s: ERROR setting policy.\n", __func__);
   43.27 -    if (ssidrefsbuf != NULL) xfree(ssidrefsbuf);
   43.28 +    xfree(ssidrefsbuf);
   43.29      return -EFAULT;
   43.30  }
   43.31  
    44.1 --- a/xen/arch/ia64/linux-xen/sal.c	Fri Nov 11 15:36:07 2005 +0100
    44.2 +++ b/xen/arch/ia64/linux-xen/sal.c	Fri Nov 11 15:36:16 2005 +0100
    44.3 @@ -14,12 +14,12 @@
    44.4  #include <linux/spinlock.h>
    44.5  #include <linux/string.h>
    44.6  
    44.7 +#ifdef XEN
    44.8 +#include <linux/smp.h>
    44.9 +#endif
   44.10  #include <asm/page.h>
   44.11  #include <asm/sal.h>
   44.12  #include <asm/pal.h>
   44.13 -#ifdef XEN
   44.14 -#include <linux/smp.h>
   44.15 -#endif
   44.16  
   44.17   __cacheline_aligned DEFINE_SPINLOCK(sal_lock);
   44.18  unsigned long sal_platform_features;
    45.1 --- a/xen/arch/ia64/xen/grant_table.c	Fri Nov 11 15:36:07 2005 +0100
    45.2 +++ b/xen/arch/ia64/xen/grant_table.c	Fri Nov 11 15:36:16 2005 +0100
    45.3 @@ -1348,8 +1348,7 @@ grant_table_create(
    45.4      if ( t != NULL )
    45.5      {
    45.6          xfree(t->active);
    45.7 -        if ( t->maptrack != NULL )
    45.8 -            free_xenheap_page(t->maptrack);
    45.9 +        free_xenheap_page(t->maptrack);
   45.10          xfree(t);
   45.11      }
   45.12      return -ENOMEM;
    46.1 --- a/xen/arch/ia64/xen/process.c	Fri Nov 11 15:36:07 2005 +0100
    46.2 +++ b/xen/arch/ia64/xen/process.c	Fri Nov 11 15:36:16 2005 +0100
    46.3 @@ -760,6 +760,22 @@ printf("*** Handled privop masquerading 
    46.4  	    case 30:
    46.5  		// FIXME: Should we handle unaligned refs in Xen??
    46.6  		vector = IA64_UNALIGNED_REF_VECTOR; break;
    46.7 +	    case 32:
    46.8 +		printf("ia64_handle_reflection: handling FP fault");
    46.9 +		vector = IA64_FP_FAULT_VECTOR; break;
   46.10 +	    case 33:
   46.11 +		printf("ia64_handle_reflection: handling FP trap");
   46.12 +		vector = IA64_FP_TRAP_VECTOR; break;
   46.13 +	    case 34:
   46.14 +		printf("ia64_handle_reflection: handling lowerpriv trap");
   46.15 +		vector = IA64_LOWERPRIV_TRANSFER_TRAP_VECTOR; break;
   46.16 +	    case 35:
   46.17 +		printf("ia64_handle_reflection: handling taken branch trap");
   46.18 +		vector = IA64_TAKEN_BRANCH_TRAP_VECTOR; break;
   46.19 +	    case 36:
   46.20 +		printf("ia64_handle_reflection: handling single step trap");
   46.21 +		vector = IA64_SINGLE_STEP_TRAP_VECTOR; break;
   46.22 +
   46.23  	    default:
   46.24  		printf("ia64_handle_reflection: unhandled vector=0x%lx\n",vector);
   46.25  		while(vector);
    47.1 --- a/xen/arch/x86/mm.c	Fri Nov 11 15:36:07 2005 +0100
    47.2 +++ b/xen/arch/x86/mm.c	Fri Nov 11 15:36:16 2005 +0100
    47.3 @@ -3369,10 +3369,8 @@ int ptwr_init(struct domain *d)
    47.4  
    47.5      if ( (x == NULL) || (y == NULL) )
    47.6      {
    47.7 -        if ( x != NULL )
    47.8 -            free_xenheap_page(x);
    47.9 -        if ( y != NULL )
   47.10 -            free_xenheap_page(y);
   47.11 +        free_xenheap_page(x);
   47.12 +        free_xenheap_page(y);
   47.13          return -ENOMEM;
   47.14      }
   47.15  
    48.1 --- a/xen/arch/x86/mtrr/generic.c	Fri Nov 11 15:36:07 2005 +0100
    48.2 +++ b/xen/arch/x86/mtrr/generic.c	Fri Nov 11 15:36:16 2005 +0100
    48.3 @@ -71,8 +71,7 @@ void __init get_mtrr_state(void)
    48.4  /*  Free resources associated with a struct mtrr_state  */
    48.5  void __init finalize_mtrr_state(void)
    48.6  {
    48.7 -	if (mtrr_state.var_ranges)
    48.8 -		xfree(mtrr_state.var_ranges);
    48.9 +	xfree(mtrr_state.var_ranges);
   48.10  	mtrr_state.var_ranges = NULL;
   48.11  }
   48.12  
    49.1 --- a/xen/arch/x86/vmx_io.c	Fri Nov 11 15:36:07 2005 +0100
    49.2 +++ b/xen/arch/x86/vmx_io.c	Fri Nov 11 15:36:16 2005 +0100
    49.3 @@ -459,14 +459,56 @@ static void vmx_mmio_assist(struct cpu_u
    49.4          }
    49.5          break;
    49.6  
    49.7 -    case INSTR_MOVZ:
    49.8 +    case INSTR_MOVZX:
    49.9          if (dst & REGISTER) {
   49.10 -            index = operand_index(dst);
   49.11              switch (size) {
   49.12 -            case BYTE: p->u.data = p->u.data & 0xFFULL; break;
   49.13 -            case WORD: p->u.data = p->u.data & 0xFFFFULL; break;
   49.14 -            case LONG: p->u.data = p->u.data & 0xFFFFFFFFULL; break;
   49.15 +            case BYTE:
   49.16 +                p->u.data &= 0xFFULL;
   49.17 +                break;
   49.18 +
   49.19 +            case WORD:
   49.20 +                p->u.data &= 0xFFFFULL;
   49.21 +                break;
   49.22 +
   49.23 +            case LONG:
   49.24 +                p->u.data &= 0xFFFFFFFFULL;
   49.25 +                break;
   49.26 +
   49.27 +            default:
   49.28 +                printk("Impossible source operand size of movzx instr: %d\n", size);
   49.29 +                domain_crash_synchronous();
   49.30              }
   49.31 +            index = operand_index(dst);
   49.32 +            set_reg_value(operand_size(dst), index, 0, regs, p->u.data);
   49.33 +        }
   49.34 +        break;
   49.35 +
   49.36 +    case INSTR_MOVSX:
   49.37 +        if (dst & REGISTER) {
   49.38 +            switch (size) {
   49.39 +            case BYTE:
   49.40 +                p->u.data &= 0xFFULL;
   49.41 +                if ( p->u.data & 0x80ULL )
   49.42 +                    p->u.data |= 0xFFFFFFFFFFFFFF00ULL;
   49.43 +                break;
   49.44 +
   49.45 +            case WORD:
   49.46 +                p->u.data &= 0xFFFFULL;
   49.47 +                if ( p->u.data & 0x8000ULL )
   49.48 +                    p->u.data |= 0xFFFFFFFFFFFF0000ULL;
   49.49 +                break;
   49.50 +
   49.51 +            case LONG:
   49.52 +                p->u.data &= 0xFFFFFFFFULL;
   49.53 +                if ( p->u.data & 0x80000000ULL )
   49.54 +                    p->u.data |= 0xFFFFFFFF00000000ULL;
   49.55 +                break;
   49.56 +
   49.57 +            default:
   49.58 +                printk("Impossible source operand size of movsx instr: %d\n", size);
   49.59 +                domain_crash_synchronous();
   49.60 +            }
   49.61 +            index = operand_index(dst);
   49.62              set_reg_value(operand_size(dst), index, 0, regs, p->u.data);
   49.63          }
   49.64          break;
    50.1 --- a/xen/arch/x86/vmx_platform.c	Fri Nov 11 15:36:07 2005 +0100
    50.2 +++ b/xen/arch/x86/vmx_platform.c	Fri Nov 11 15:36:16 2005 +0100
    50.3 @@ -581,25 +581,39 @@ static int vmx_decode(int vm86, unsigned
    50.4      }
    50.5  
    50.6      switch (*++opcode) {
    50.7 -    case 0xB6: /* movz m8, r16/r32 */
    50.8 -        instr->instr = INSTR_MOVZ;
    50.9 +    case 0xB6: /* movzx m8, r16/r32/r64 */
   50.10 +        instr->instr = INSTR_MOVZX;
   50.11          GET_OP_SIZE_FOR_NONEBYTE(instr->op_size);
   50.12          index = get_index(opcode + 1, rex);
   50.13          instr->operand[0] = mk_operand(BYTE, 0, 0, MEMORY);
   50.14          instr->operand[1] = mk_operand(instr->op_size, index, 0, REGISTER);
   50.15          return DECODE_success;
   50.16  
   50.17 -    case 0xB7: /* movz m16/m32, r32/r64 */
   50.18 -        instr->instr = INSTR_MOVZ;
   50.19 +    case 0xB7: /* movzx m16/m32, r32/r64 */
   50.20 +        instr->instr = INSTR_MOVZX;
   50.21 +        GET_OP_SIZE_FOR_NONEBYTE(instr->op_size);
   50.22          index = get_index(opcode + 1, rex);
   50.23 -        if (rex & 0x8) {
   50.24 -            instr->op_size = LONG;
   50.25 -            instr->operand[1] = mk_operand(QUAD, index, 0, REGISTER);
   50.26 -        } else {
   50.27 -            instr->op_size = WORD;
   50.28 -            instr->operand[1] = mk_operand(LONG, index, 0, REGISTER);
   50.29 -        }
   50.30 -        instr->operand[0] = mk_operand(instr->op_size, 0, 0, MEMORY);
   50.31 +        if (rex & 0x8)
   50.32 +            instr->operand[0] = mk_operand(LONG, 0, 0, MEMORY);
   50.33 +        else
   50.34 +            instr->operand[0] = mk_operand(WORD, 0, 0, MEMORY);
   50.35 +        instr->operand[1] = mk_operand(instr->op_size, index, 0, REGISTER);
   50.36 +        return DECODE_success;
   50.37 +
   50.38 +    case 0xBE: /* movsx m8, r16/r32/r64 */
   50.39 +        instr->instr = INSTR_MOVSX;
   50.40 +        GET_OP_SIZE_FOR_NONEBYTE(instr->op_size);
   50.41 +        index = get_index(opcode + 1, rex);
   50.42 +        instr->operand[0] = mk_operand(BYTE, 0, 0, MEMORY);
   50.43 +        instr->operand[1] = mk_operand(instr->op_size, index, 0, REGISTER);
   50.44 +        return DECODE_success;
   50.45 +
   50.46 +    case 0xBF: /* movsx m16, r32/r64 */
   50.47 +        instr->instr = INSTR_MOVSX;
   50.48 +        GET_OP_SIZE_FOR_NONEBYTE(instr->op_size);
   50.49 +        index = get_index(opcode + 1, rex);
   50.50 +        instr->operand[0] = mk_operand(WORD, 0, 0, MEMORY);
   50.51 +        instr->operand[1] = mk_operand(instr->op_size, index, 0, REGISTER);
   50.52          return DECODE_success;
   50.53  
   50.54      case 0xA3: /* bt r32, m32 */
   50.55 @@ -702,7 +716,7 @@ static void mmio_operands(int type, unsi
   50.56          send_mmio_req(type, gpa, 1, inst->op_size, value, IOREQ_WRITE, 0);
   50.57      } else if (inst->operand[0] & MEMORY) { /* dest is register */
   50.58          /* send the request and wait for the value */
   50.59 -        if (inst->instr == INSTR_MOVZ)
   50.60 +        if ( (inst->instr == INSTR_MOVZX) || (inst->instr == INSTR_MOVSX) )
   50.61              send_mmio_req(type, gpa, 1, size_reg, 0, IOREQ_READ, 0);
   50.62          else
   50.63              send_mmio_req(type, gpa, 1, inst->op_size, 0, IOREQ_READ, 0);
   50.64 @@ -827,7 +841,8 @@ void handle_mmio(unsigned long va, unsig
   50.65          break;
   50.66      }
   50.67  
   50.68 -    case INSTR_MOVZ:
   50.69 +    case INSTR_MOVZX:
   50.70 +    case INSTR_MOVSX:
   50.71          mmio_operands(IOREQ_TYPE_COPY, gpa, &mmio_inst, mmio_opp, regs);
   50.72          break;
   50.73  
    51.1 --- a/xen/arch/x86/vmx_vlapic.c	Fri Nov 11 15:36:07 2005 +0100
    51.2 +++ b/xen/arch/x86/vmx_vlapic.c	Fri Nov 11 15:36:16 2005 +0100
    51.3 @@ -567,7 +567,9 @@ static unsigned long vlapic_read(struct 
    51.4  
    51.5      if ( len != 4) {
    51.6          /* some bugs on kernel cause read this with byte*/
    51.7 -        printk("Local APIC read with len = %lx, should be 4 instead\n", len);
    51.8 +        VMX_DBG_LOG(DBG_LEVEL_VLAPIC,
    51.9 +                    "Local APIC read with len = %lx, should be 4 instead\n",
   51.10 +                    len);
   51.11      }
   51.12  
   51.13      alignment = offset & 0x3;
    52.1 --- a/xen/arch/x86/vmx_vmcs.c	Fri Nov 11 15:36:07 2005 +0100
    52.2 +++ b/xen/arch/x86/vmx_vmcs.c	Fri Nov 11 15:36:16 2005 +0100
    52.3 @@ -564,19 +564,14 @@ err_out:
    52.4  
    52.5  void destroy_vmcs(struct arch_vmx_struct *arch_vmx)
    52.6  {
    52.7 -    if(arch_vmx->vmcs != NULL)
    52.8 -        free_vmcs(arch_vmx->vmcs);
    52.9 -    if(arch_vmx->io_bitmap_a != 0) {
   52.10 -        free_xenheap_pages(
   52.11 -            arch_vmx->io_bitmap_a, get_order_from_bytes(0x1000));
   52.12 -        arch_vmx->io_bitmap_a = 0;
   52.13 -    }
   52.14 -    if(arch_vmx->io_bitmap_b != 0) {
   52.15 -        free_xenheap_pages(
   52.16 -            arch_vmx->io_bitmap_b, get_order_from_bytes(0x1000));
   52.17 -        arch_vmx->io_bitmap_b = 0;
   52.18 -    }
   52.19 -    arch_vmx->vmcs = 0;
   52.20 +    free_vmcs(arch_vmx->vmcs);
   52.21 +    arch_vmx->vmcs = NULL;
   52.22 +
   52.23 +    free_xenheap_pages(arch_vmx->io_bitmap_a, get_order_from_bytes(0x1000));
   52.24 +    arch_vmx->io_bitmap_a = NULL;
   52.25 +
   52.26 +    free_xenheap_pages(arch_vmx->io_bitmap_b, get_order_from_bytes(0x1000));
   52.27 +    arch_vmx->io_bitmap_b = NULL;
   52.28  }
   52.29  
   52.30  /*
    53.1 --- a/xen/common/event_channel.c	Fri Nov 11 15:36:07 2005 +0100
    53.2 +++ b/xen/common/event_channel.c	Fri Nov 11 15:36:16 2005 +0100
    53.3 @@ -621,8 +621,7 @@ void evtchn_destroy(struct domain *d)
    53.4              (void)__evtchn_close(d, i);
    53.5  
    53.6      for ( i = 0; i < NR_EVTCHN_BUCKETS; i++ )
    53.7 -        if ( d->evtchn[i] != NULL )
    53.8 -            xfree(d->evtchn[i]);
    53.9 +        xfree(d->evtchn[i]);
   53.10  }
   53.11  
   53.12  /*
    54.1 --- a/xen/common/grant_table.c	Fri Nov 11 15:36:07 2005 +0100
    54.2 +++ b/xen/common/grant_table.c	Fri Nov 11 15:36:16 2005 +0100
    54.3 @@ -1107,8 +1107,7 @@ grant_table_create(
    54.4      if ( t != NULL )
    54.5      {
    54.6          xfree(t->active);
    54.7 -        if ( t->maptrack != NULL )
    54.8 -            free_xenheap_page(t->maptrack);
    54.9 +        free_xenheap_page(t->maptrack);
   54.10          xfree(t);
   54.11      }
   54.12      return -ENOMEM;
    55.1 --- a/xen/common/page_alloc.c	Fri Nov 11 15:36:07 2005 +0100
    55.2 +++ b/xen/common/page_alloc.c	Fri Nov 11 15:36:16 2005 +0100
    55.3 @@ -470,6 +470,9 @@ void free_xenheap_pages(void *v, unsigne
    55.4  {
    55.5      unsigned long flags;
    55.6  
    55.7 +    if ( v == NULL )
    55.8 +        return;
    55.9 +
   55.10      memguard_guard_range(v, 1 << (order + PAGE_SHIFT));    
   55.11  
   55.12      local_irq_save(flags);
    56.1 --- a/xen/include/asm-x86/vmx_platform.h	Fri Nov 11 15:36:07 2005 +0100
    56.2 +++ b/xen/include/asm-x86/vmx_platform.h	Fri Nov 11 15:36:16 2005 +0100
    56.3 @@ -55,17 +55,18 @@
    56.4  #define REPNZ   0x2
    56.5  #define OVERLAP 0x4
    56.6  
    56.7 -#define INSTR_PIO 1
    56.8 -#define INSTR_OR 2
    56.9 -#define INSTR_AND 3
   56.10 -#define INSTR_XOR 4
   56.11 -#define INSTR_CMP 5
   56.12 -#define INSTR_MOV 6
   56.13 -#define INSTR_MOVS 7
   56.14 -#define INSTR_MOVZ 8
   56.15 -#define INSTR_STOS 9
   56.16 -#define INSTR_TEST 10
   56.17 -#define INSTR_BT 11
   56.18 +#define INSTR_PIO   1
   56.19 +#define INSTR_OR    2
   56.20 +#define INSTR_AND   3
   56.21 +#define INSTR_XOR   4
   56.22 +#define INSTR_CMP   5
   56.23 +#define INSTR_MOV   6
   56.24 +#define INSTR_MOVS  7
   56.25 +#define INSTR_MOVZX 8
   56.26 +#define INSTR_MOVSX 9
   56.27 +#define INSTR_STOS  10
   56.28 +#define INSTR_TEST  11
   56.29 +#define INSTR_BT    12
   56.30  
   56.31  struct instruction {
   56.32      __s8    instr; /* instruction type */