direct-io.hg

changeset 15496:15fe623c3421

Merge with PPC tree.
author Keir Fraser <keir@xensource.com>
date Sat Jul 07 10:09:51 2007 +0100 (2007-07-07)
parents 50fab2124ef0 5fbe4c7ec743
children 8528da5be577
files
line diff
     1.1 --- a/docs/man/xm.pod.1	Fri Jul 06 16:25:10 2007 -0500
     1.2 +++ b/docs/man/xm.pod.1	Sat Jul 07 10:09:51 2007 +0100
     1.3 @@ -4,7 +4,7 @@ xm - Xen management user interface
     1.4  
     1.5  =head1 SYNOPSIS
     1.6  
     1.7 -xm <subcommand> [args]
     1.8 +B<xm> I<subcommand> [I<args>]
     1.9  
    1.10  =head1 DESCRIPTION
    1.11  
    1.12 @@ -13,46 +13,50 @@ domains. The program can be used to crea
    1.13  domains. It can also be used to list current domains, enable or pin
    1.14  VCPUs, and attach or detach virtual block devices.
    1.15  
    1.16 -The basic structure of every xm command is almost always:
    1.17 -
    1.18 -  xm <subcommand> <domain-id> [OPTIONS]
    1.19 +The basic structure of every B<xm> command is almost always:
    1.20  
    1.21 -Where I<subcommand> is one of the sub commands listed below, I<domain-id>
    1.22 +=over 2
    1.23 +
    1.24 +B<xm> I<subcommand> I<domain-id> [I<OPTIONS>]
    1.25 +
    1.26 +=back
    1.27 +
    1.28 +Where I<subcommand> is one of the subcommands listed below, I<domain-id>
    1.29  is the numeric domain id, or the domain name (which will be internally
    1.30 -translated to domain id), and I<OPTIONS> are sub command specific
    1.31 +translated to domain id), and I<OPTIONS> are subcommand specific
    1.32  options.  There are a few exceptions to this rule in the cases where
    1.33 -the sub command in question acts on all domains, the entire machine,
    1.34 -or directly on the xen hypervisor.  Those exceptions will be clear for
    1.35 -each of those sub commands.
    1.36 +the subcommand in question acts on all domains, the entire machine,
    1.37 +or directly on the Xen hypervisor.  Those exceptions will be clear for
    1.38 +each of those subcommands.
    1.39  
    1.40  =head1 NOTES
    1.41  
    1.42  All B<xm> operations rely upon the Xen control daemon, aka B<xend>.
    1.43 -For any xm commands to run xend must also be running.  For this reason
    1.44 -you should start xend as a service when your system first boots using
    1.45 -xen.
    1.46 +For any B<xm> commands to run, xend must also be running.  For this
    1.47 +reason you should start xend as a service when your system first boots
    1.48 +using Xen.
    1.49  
    1.50  Most B<xm> commands require root privileges to run due to the
    1.51  communications channels used to talk to the hypervisor.  Running as
    1.52  non root will return an error.
    1.53  
    1.54  Most B<xm> commands act asynchronously, so just because the B<xm>
    1.55 -command returned, doesn't mean the action is complete.  This is
    1.56 +command returned doesn't mean the action is complete.  This is
    1.57  important, as many operations on domains, like create and shutdown,
    1.58  can take considerable time (30 seconds or more) to bring the machine
    1.59  into a fully compliant state.  If you want to know when one of these
    1.60 -actions has finished you must poll through xm list periodically.
    1.61 +actions has finished you must poll through B<xm list> periodically.
    1.62  
    1.63  =head1 DOMAIN SUBCOMMANDS
    1.64  
    1.65 -The following sub commands manipulate domains directly, as stated
    1.66 -previously most commands take domain-id as the first parameter.
    1.67 +The following subcommands manipulate domains directly.  As stated
    1.68 +previously, most commands take I<domain-id> as the first parameter.
    1.69  
    1.70  =over 4
    1.71  
    1.72  =item B<console> I<domain-id>
    1.73  
    1.74 -Attach to domain domain-id's console.  If you've set up your Domains to
    1.75 +Attach to domain I<domain-id>'s console.  If you've set up your domains to
    1.76  have a traditional log in console this will look much like a normal
    1.77  text log in screen.
    1.78  
    1.79 @@ -63,15 +67,15 @@ The attached console will perform much l
    1.80  so running curses based interfaces over the console B<is not
    1.81  advised>.  Vi tends to get very odd when using it over this interface.
    1.82  
    1.83 -=item B<create> I<[-c]> I<configfile> I<[name=value]>..
    1.84 +=item B<create> [B<-c>] I<configfile> [I<name>=I<value>]..
    1.85  
    1.86 -The create sub command requires a configfile and can optional take a
    1.87 +The create sub command requires a config file and can optionally take a
    1.88  series of name value pairs that add to or override variables defined
    1.89  in the config file.  See L<xmdomain.cfg> for full details of that file
    1.90  format, and possible options used in either the configfile or
    1.91 -Name=Value combinations.
    1.92 +I<name>=I<value> combinations.
    1.93  
    1.94 -Configfile can either be an absolute path to a file, or a relative
    1.95 +I<configfile> can either be an absolute path to a file, or a relative
    1.96  path to a file located in /etc/xen.
    1.97  
    1.98  Create will return B<as soon> as the domain is started.  This B<does
    1.99 @@ -116,10 +120,10 @@ virtual networking.  (This example comes
   1.100  
   1.101  =item B<destroy> I<domain-id>
   1.102  
   1.103 -Immediately terminate the domain domain-id.  This doesn't give the domain
   1.104 -OS any chance to react, and it the equivalent of ripping the power
   1.105 -cord out on a physical machine.  In most cases you will want to use
   1.106 -the B<shutdown> command instead.
   1.107 +Immediately terminate the domain I<domain-id>.  This doesn't give the
   1.108 +domain OS any chance to react, and is the equivalent of ripping the
   1.109 +power cord out on a physical machine.  In most cases you will want to
   1.110 +use the B<shutdown> command instead.
   1.111  
   1.112  =item B<domid> I<domain-name>
   1.113  
   1.114 @@ -129,14 +133,14 @@ Converts a domain name to a domain id us
   1.115  
   1.116  Converts a domain id to a domain name using xend's internal mapping.
   1.117  
   1.118 -=item B<help> I<[--long]>
   1.119 +=item B<help> [B<--long>]
   1.120  
   1.121  Displays the short help message (i.e. common commands).
   1.122  
   1.123 -The I<--long> option prints out the complete set of B<xm> subcommands,
   1.124 +The B<--long> option prints out the complete set of B<xm> subcommands,
   1.125  grouped by function.
   1.126  
   1.127 -=item B<list> I<[--long | --label]> I<[domain-id, ...]>
   1.128 +=item B<list> [B<--long> | B<--label>] [I<domain-id> ...]
   1.129  
   1.130  Prints information about one or more domains.  If no domains are
   1.131  specified it prints out information about all domains.
   1.132 @@ -151,21 +155,23 @@ An example format for the list is as fol
   1.133      Mandrake10.2                167      128     1 ------     2.5
   1.134      Suse9.2                     168      100     1 ------     1.8
   1.135  
   1.136 -Name is the name of the domain.  ID the domain numeric id.  Mem is the
   1.137 -size of the memory allocated to the domain.  VCPUS is the number of
   1.138 -VCPUS allocated to domain.  State is the run state (see below).  Time
   1.139 -is the total run time of the domain as accounted for by Xen.
   1.140 +Name is the name of the domain.  ID the numeric domain id.  Mem is the
   1.141 +desired amount of memory to allocate to the domain (although it may
   1.142 +not be the currently allocated amount).  VCPUs is the number of
   1.143 +virtual CPUs allocated to the domain.  State is the run state (see
   1.144 +below).  Time is the total run time of the domain as accounted for by
   1.145 +Xen.
   1.146  
   1.147  B<STATES>
   1.148  
   1.149  =over 4
   1.150  
   1.151 -The State field lists 6 states for a Xen Domain, and which ones the
   1.152 -current Domain is in.
   1.153 +The State field lists 6 states for a Xen domain, and which ones the
   1.154 +current domain is in.
   1.155  
   1.156  =item B<r - running>
   1.157  
   1.158 -The domain is currently running on a CPU
   1.159 +The domain is currently running on a CPU.
   1.160  
   1.161  =item B<b - blocked>
   1.162  
   1.163 @@ -203,12 +209,12 @@ B<LONG OUTPUT>
   1.164  
   1.165  =over 4
   1.166  
   1.167 -If I<--long> is specified, the output for xm list is not the table
   1.168 +If B<--long> is specified, the output for B<xm list> is not the table
   1.169  view shown above, but instead is an S-Expression representing all
   1.170  information known about all domains asked for.  This is mostly only
   1.171  useful for external programs to parse the data.
   1.172  
   1.173 -B<Note:> there is no stable guarantees on the format of this data.
   1.174 +B<Note:> There is no stable guarantees on the format of this data.
   1.175  Use at your own risk.
   1.176  
   1.177  =back
   1.178 @@ -217,10 +223,10 @@ B<LABEL OUTPUT>
   1.179  
   1.180  =over 4
   1.181  
   1.182 -If I<--label> is specified, the security labels are added to the
   1.183 -output of xm list and the lines are sorted by the labels (ignoring
   1.184 -case). The I<--long> option prints the labels by default and cannot be
   1.185 -combined with I<--label>. See the ACCESS CONTROL SUBCOMMAND section of
   1.186 +If B<--label> is specified, the security labels are added to the
   1.187 +output of B<xm list> and the lines are sorted by the labels (ignoring
   1.188 +case). The B<--long> option prints the labels by default and cannot be
   1.189 +combined with B<--label>. See the ACCESS CONTROL SUBCOMMAND section of
   1.190  this man page for more information about labels.
   1.191  
   1.192  ==back
   1.193 @@ -230,7 +236,7 @@ B<NOTES>
   1.194  =over 4
   1.195  
   1.196  The Time column is deceptive.  Virtual IO (network and block devices)
   1.197 -used by Domains requires coordination by Domain0, which means that
   1.198 +used by domains requires coordination by Domain0, which means that
   1.199  Domain0 is actually charged for much of the time that a DomainU is
   1.200  doing IO.  Use of this time value to determine relative utilizations
   1.201  by domains is thus very suspect, as a high IO workload may show as
   1.202 @@ -240,11 +246,11 @@ less utilized than a high CPU workload. 
   1.203  
   1.204  =item B<mem-max> I<domain-id> I<mem>
   1.205  
   1.206 -Specify the maximum amount of memory the Domain is able to use.  Mem
   1.207 +Specify the maximum amount of memory the domain is able to use.  I<mem>
   1.208  is specified in megabytes. 
   1.209  
   1.210  The mem-max value may not correspond to the actual memory used in the
   1.211 -Domain, as it may balloon down it's memory to give more back to the OS.
   1.212 +domain, as it may balloon down its memory to give more back to the OS.
   1.213  
   1.214  =item B<mem-set> I<domain-id> I<mem>
   1.215  
   1.216 @@ -252,20 +258,20 @@ Set the domain's used memory using the b
   1.217  operation requires cooperation from the domain operating system, there
   1.218  is no guarantee that it will succeed.
   1.219  
   1.220 -B<Warning:> there is no good way to know in advance how small of a
   1.221 +B<Warning:> There is no good way to know in advance how small of a
   1.222  mem-set will make a domain unstable and cause it to crash.  Be very
   1.223  careful when using this command on running domains.
   1.224  
   1.225 -=item B<migrate> I<domain-id> I<host> I<[options]>
   1.226 +=item B<migrate> I<domain-id> I<host> [I<OPTIONS>]
   1.227  
   1.228 -Migrate a domain to another Host machine. B<Xend> must be running on
   1.229 -other host machine, it must be running the same version of xen, it
   1.230 +Migrate a domain to another host machine. Xend must be running on
   1.231 +other host machine, it must be running the same version of Xen, it
   1.232  must have the migration TCP port open and accepting connections from
   1.233  the source host, and there must be sufficient resources for the domain
   1.234  to run (memory, disk, etc).
   1.235  
   1.236 -Migration is pretty complicated, and has many security implications,
   1.237 -please read the Xen Users Guide to ensure you understand the
   1.238 +Migration is pretty complicated, and has many security implications.
   1.239 +Please read the Xen User's Guide to ensure you understand the
   1.240  ramifications and limitations on migration before attempting it in
   1.241  production.
   1.242  
   1.243 @@ -273,13 +279,13 @@ B<OPTIONS>
   1.244  
   1.245  =over 4
   1.246  
   1.247 -=item B<-l, --live>
   1.248 +=item B<-l>, B<--live>
   1.249  
   1.250  Use live migration.  This will migrate the domain between hosts
   1.251 -without shutting down the domain.  See the Xen Users Guide for more
   1.252 +without shutting down the domain.  See the Xen User's Guide for more
   1.253  information.
   1.254  
   1.255 -=item B<-r, --resource> I<Mbs>
   1.256 +=item B<-r>, B<--resource> I<Mbs>
   1.257  
   1.258  Set maximum Mbs allowed for migrating the domain.  This ensures that
   1.259  the network link is not saturated with migration traffic while
   1.260 @@ -293,7 +299,7 @@ Pause a domain.  When in a paused state 
   1.261  allocated resources such as memory, but will not be eligible for
   1.262  scheduling by the Xen hypervisor.
   1.263  
   1.264 -=item B<reboot> I<[options]> I<domain-id>
   1.265 +=item B<reboot> [I<OPTIONS>] I<domain-id>
   1.266  
   1.267  Reboot a domain.  This acts just as if the domain had the B<reboot>
   1.268  command run from the console.  The command returns as soon as it has
   1.269 @@ -301,18 +307,18 @@ executed the reboot action, which may be
   1.270  domain actually reboots.
   1.271  
   1.272  The behavior of what happens to a domain when it reboots is set by the
   1.273 -I<on_reboot> parameter of the xmdomain.cfg file when the domain was
   1.274 +B<on_reboot> parameter of the xmdomain.cfg file when the domain was
   1.275  created.
   1.276  
   1.277  B<OPTIONS>
   1.278  
   1.279  =over 4
   1.280  
   1.281 -=item B<-a, --all>
   1.282 +=item B<-a>, B<--all>
   1.283  
   1.284 -Reboot all domains
   1.285 +Reboot all domains.
   1.286  
   1.287 -=item B<-w, --wait>
   1.288 +=item B<-w>, B<--wait>
   1.289  
   1.290  Wait for reboot to complete before returning.  This may take a while,
   1.291  as all services in the domain will have to be shut down cleanly.
   1.292 @@ -321,7 +327,7 @@ as all services in the domain will have 
   1.293  
   1.294  =item B<restore> I<state-file>
   1.295  
   1.296 -Build a domain from an B<xm save> state file.  See I<save> for more info.
   1.297 +Build a domain from an B<xm save> state file.  See B<save> for more info.
   1.298  
   1.299  =item B<save> I<domain-id> I<state-file>
   1.300  
   1.301 @@ -334,16 +340,16 @@ This is roughly equivalent to doing a hi
   1.302  with all the same limitations.  Open network connections may be
   1.303  severed upon restore, as TCP timeouts may have expired.
   1.304  
   1.305 -=item B<shutdown> I<[options]> I<domain-id>
   1.306 +=item B<shutdown> [I<OPTIONS>] I<domain-id>
   1.307  
   1.308  Gracefully shuts down a domain.  This coordinates with the domain OS
   1.309  to perform graceful shutdown, so there is no guarantee that it will
   1.310  succeed, and may take a variable length of time depending on what
   1.311  services must be shutdown in the domain.  The command returns
   1.312 -immediately after signally the domain unless that I<-w> flag is used.
   1.313 +immediately after signally the domain unless that B<-w> flag is used.
   1.314  
   1.315  The behavior of what happens to a domain when it reboots is set by the
   1.316 -I<on_shutdown> parameter of the xmdomain.cfg file when the domain was
   1.317 +B<on_shutdown> parameter of the xmdomain.cfg file when the domain was
   1.318  created.
   1.319  
   1.320  B<OPTIONS>
   1.321 @@ -386,7 +392,7 @@ Attempting to set the VCPUs to a number 
   1.322  configured VCPU count is an error.  Trying to set VCPUs to < 1 will be
   1.323  quietly ignored.
   1.324  
   1.325 -=item B<vcpu-list> I<[domain-id]>
   1.326 +=item B<vcpu-list> [I<domain-id>]
   1.327  
   1.328  Lists VCPU information for a specific domain.  If no domain is
   1.329  specified, VCPU information for all domains will be provided.
   1.330 @@ -394,7 +400,7 @@ specified, VCPU information for all doma
   1.331  =item B<vcpu-pin> I<domain-id> I<vcpu> I<cpus>
   1.332  
   1.333  Pins the the VCPU to only run on the specific CPUs.  The keyword
   1.334 -I<all> can be used to apply the I<cpus> list to all VCPUs in the
   1.335 +B<all> can be used to apply the I<cpus> list to all VCPUs in the
   1.336  domain.
   1.337  
   1.338  Normally VCPUs can float between available CPUs whenever Xen deems a
   1.339 @@ -408,7 +414,7 @@ CPUs.
   1.340  
   1.341  =over 4
   1.342  
   1.343 -=item B<dmesg> I<[-c]>
   1.344 +=item B<dmesg> [B<-c>]
   1.345  
   1.346  Reads the Xen message buffer, similar to dmesg on a Linux system.  The
   1.347  buffer contains informational, warning, and error messages created
   1.348 @@ -419,7 +425,7 @@ B<OPTIONS>
   1.349  
   1.350  =over 4
   1.351  
   1.352 -=item B<-c, --clear>
   1.353 +=item B<-c>, B<--clear>
   1.354  
   1.355  Clears Xen's message buffer.
   1.356  
   1.357 @@ -431,8 +437,8 @@ Print information about the Xen host in 
   1.358  reporting a Xen bug, please provide this information as part of the
   1.359  bug report.
   1.360  
   1.361 -Sample xen domain info looks as follows (lines wrapped manually to
   1.362 -make the man page more readable):
   1.363 +Sample output looks as follows (lines wrapped manually to make the man
   1.364 +page more readable):
   1.365  
   1.366   host                   : talon
   1.367   release                : 2.6.12.6-xen0
   1.368 @@ -470,36 +476,36 @@ B<FIELDS>
   1.369  Not all fields will be explained here, but some of the less obvious
   1.370  ones deserve explanation:
   1.371  
   1.372 -=item I<hw_caps>
   1.373 +=item B<hw_caps>
   1.374  
   1.375  A vector showing what hardware capabilities are supported by your
   1.376  processor.  This is equivalent to, though more cryptic, the flags
   1.377  field in /proc/cpuinfo on a normal Linux machine.
   1.378  
   1.379 -=item I<free_memory>
   1.380 +=item B<free_memory>
   1.381  
   1.382 -Available memory (in MB) not allocated to Xen, or any other Domains.
   1.383 +Available memory (in MB) not allocated to Xen, or any other domains.
   1.384  
   1.385 -=item I<xen_caps>
   1.386 +=item B<xen_caps>
   1.387  
   1.388 -The xen version, architecture.  Architecture values can be one of:
   1.389 +The Xen version and architecture.  Architecture values can be one of:
   1.390  x86_32, x86_32p (i.e. PAE enabled), x86_64, ia64.
   1.391  
   1.392 -=item I<xen_changeset>
   1.393 +=item B<xen_changeset>
   1.394  
   1.395 -The xen mercurial changeset id.  Very useful for determining exactly
   1.396 +The Xen mercurial changeset id.  Very useful for determining exactly
   1.397  what version of code your Xen system was built from.
   1.398  
   1.399  =back
   1.400  
   1.401  =item B<log>
   1.402  
   1.403 -Print out the B<xend> log.  This log file can be found in
   1.404 +Print out the xend log.  This log file can be found in
   1.405  /var/log/xend.log.
   1.406  
   1.407  =item B<top>
   1.408  
   1.409 -Executes the xentop command, which provides real time monitoring of
   1.410 +Executes the B<xentop> command, which provides real time monitoring of
   1.411  domains.  Xentop is a curses interface, and reasonably self
   1.412  explanatory.
   1.413  
   1.414 @@ -508,13 +514,41 @@ explanatory.
   1.415  =head1 SCHEDULER SUBCOMMANDS
   1.416  
   1.417  Xen ships with a number of domain schedulers, which can be set at boot
   1.418 -time with the I<sched=> parameter on the Xen command line.  By
   1.419 -default I<sedf> is used for scheduling.
   1.420 +time with the B<sched=> parameter on the Xen command line.  By
   1.421 +default B<credit> is used for scheduling.
   1.422  
   1.423  FIXME: we really need a scheduler expert to write up this section.
   1.424  
   1.425  =over 4
   1.426  
   1.427 +=item B<sched-credit> [ B<-d> I<domain-id> [ B<-w>[B<=>I<WEIGHT>] | B<-c>[B<=>I<CAP>] ] ]
   1.428 +
   1.429 +Set credit scheduler parameters.  The credit scheduler is a
   1.430 +proportional fair share CPU scheduler built from the ground up to be
   1.431 +work conserving on SMP hosts.
   1.432 +
   1.433 +Each domain (including Domain0) is assigned a weight and a cap.
   1.434 +
   1.435 +B<PARAMETERS>
   1.436 +
   1.437 +=over 4
   1.438 +
   1.439 +=item I<WEIGHT>
   1.440 +
   1.441 +A domain with a weight of 512 will get twice as much CPU as a domain
   1.442 +with a weight of 256 on a contended host. Legal weights range from 1
   1.443 +to 65535 and the default is 256.
   1.444 +
   1.445 +=item I<CAP>
   1.446 +
   1.447 +The cap optionally fixes the maximum amount of CPU a domain will be
   1.448 +able to consume, even if the host system has idle CPU cycles. The cap
   1.449 +is expressed in percentage of one physical CPU: 100 is 1 physical CPU,
   1.450 +50 is half a CPU, 400 is 4 CPUs, etc. The default, 0, means there is
   1.451 +no upper cap.
   1.452 +
   1.453 +=back
   1.454 +
   1.455  =item B<sched-sedf> I<period> I<slice> I<latency-hint> I<extratime> I<weight>
   1.456  
   1.457  Set Simple EDF (Earliest Deadline First) scheduler parameters.  This
   1.458 @@ -546,7 +580,7 @@ Flag for allowing domain to run in extra
   1.459  
   1.460  =item I<weight>
   1.461  
   1.462 -Another way of setting cpu slice.
   1.463 +Another way of setting CPU slice.
   1.464  
   1.465  =back
   1.466  
   1.467 @@ -591,7 +625,7 @@ event.
   1.468  
   1.469  =over 4
   1.470  
   1.471 -=item B<block-attach> I<domain-id> I<be-dev> I<fe-dev> I<mode> I<[bedomain-id]>
   1.472 +=item B<block-attach> I<domain-id> I<be-dev> I<fe-dev> I<mode> [I<bedomain-id>]
   1.473  
   1.474  Create a new virtual block device.  This will trigger a hotplug event
   1.475  for the guest.
   1.476 @@ -619,7 +653,7 @@ devices, or by device id, such as 0x1400
   1.477  =item I<mode>
   1.478  
   1.479  The access mode for the device from the guest domain.  Supported modes
   1.480 -are I<w> (read/write) or I<r> (read-only).
   1.481 +are B<w> (read/write) or B<r> (read-only).
   1.482  
   1.483  =item I<bedomain-id>
   1.484  
   1.485 @@ -635,62 +669,65 @@ B<EXAMPLES>
   1.486  
   1.487  xm block-attach guestdomain file://path/to/dsl-2.0RC2.iso /dev/hdc ro
   1.488  
   1.489 -This will mount the dsl iso as /dev/hdc in the guestdomain as a read
   1.490 -only device.  This will probably not be detected as a cdrom by the
   1.491 +This will mount the dsl ISO as /dev/hdc in the guestdomain as a read
   1.492 +only device.  This will probably not be detected as a CD-ROM by the
   1.493  guest, but mounting /dev/hdc manually will work.
   1.494  
   1.495  =back
   1.496  
   1.497 -=item B<block-detach> I<domain-id> I<devid>
   1.498 +=item B<block-detach> I<domain-id> I<devid> [B<--force>]
   1.499  
   1.500 -Destroy a domain's virtual block device. devid B<must> be the device
   1.501 -id given to the device by domain 0.  You will need to run I<xm
   1.502 -block-list> to determine that number.
   1.503 +Detach a domain's virtual block device. I<devid> may be the symbolic
   1.504 +name or the numeric device id given to the device by domain 0.  You
   1.505 +will need to run B<xm block-list> to determine that number.
   1.506  
   1.507 -FIXME: this is currently B<broken>.  Even though a block device is
   1.508 -removed from domU, it appears to still be allocated in the domain 0.
   1.509 +Detaching the device requires the cooperation of the domain.  If the
   1.510 +domain fails to release the device (perhaps because the domain is hung
   1.511 +or is still using the device), the detach will fail.  The B<--force>
   1.512 +parameter will forcefully detach the device, but may cause IO errors
   1.513 +in the domain.
   1.514  
   1.515 -=item B<block-list> I<[-l|--long]> I<domain-id>
   1.516 +=item B<block-list> [B<-l>|B<--long>] I<domain-id>
   1.517  
   1.518  List virtual block devices for a domain.  The returned output is
   1.519 -formatted as a list or as an S-Expression if the '--long' option was given.
   1.520 +formatted as a list or as an S-Expression if the B<--long> option was given.
   1.521  
   1.522  =head2 NETWORK DEVICES
   1.523  
   1.524 -=item B<network-attach> I<domain-id> I<[script=scriptname]> I<[ip=ipaddr]>
   1.525 -I<[mac=macaddr]> I<[bridge=bridge-name]> I<[backend=bedomain-id]>
   1.526 +=item B<network-attach> I<domain-id> [B<script=>I<scriptname>] [B<ip=>I<ipaddr>]
   1.527 +[B<mac=>I<macaddr>] [B<bridge=>I<bridge-name>] [B<backend=>I<bedomain-id>]
   1.528  
   1.529 -Creates a new network device in the domain specified by domain-id.  It
   1.530 +Creates a new network device in the domain specified by I<domain-id>.  It
   1.531  takes the following optional options:
   1.532  
   1.533  B<OPTIONS>
   1.534  
   1.535  =over 4
   1.536  
   1.537 -=item I<script=scriptname>
   1.538 +=item B<script=>I<scriptname>
   1.539  
   1.540  Use the specified script name to bring up the network.  Defaults to
   1.541 -the default setting in xend-config.sxp for I<vif-script>.
   1.542 +the default setting in xend-config.sxp for B<vif-script>.
   1.543  
   1.544 -=item I<ip=ipaddr>
   1.545 +=item B<ip=>I<ipaddr>
   1.546  
   1.547  Passes the specified IP Address to the adapter on creation.  
   1.548  
   1.549  FIXME: this currently appears to be B<broken>.  I'm not sure under what
   1.550  circumstances this should actually work.
   1.551  
   1.552 -=item I<mac=macaddr>
   1.553 +=item B<mac=>I<macaddr>
   1.554  
   1.555  The MAC address that the domain will see on its Ethernet device.  If
   1.556  the device is not specified it will be randomly generated with the
   1.557  00:16:3e vendor id prefix.
   1.558  
   1.559 -=item I<bridge=bridge-name>
   1.560 +=item B<bridge=>I<bridge-name>
   1.561  
   1.562  The name of the bridge to attach the vif to, in case you have more
   1.563 -than one.  This defaults to 
   1.564 +than one.  This defaults to xenbr0.
   1.565  
   1.566 -=item I<backend=bedomain-id>
   1.567 +=item B<backend=>I<bedomain-id>
   1.568  
   1.569  The backend domain id.  By default this is domain 0.
   1.570  
   1.571 @@ -705,17 +742,17 @@ I<devid> is the virtual interface device
   1.572  FIXME: this is currently B<broken>.  Network devices aren't completely
   1.573  removed from domain 0.
   1.574  
   1.575 -=item B<network-list> I<[-l|--long]> I<domain-id>
   1.576 +=item B<network-list> [B<-l>|B<--long>]> I<domain-id>
   1.577  
   1.578  List virtual network interfaces for a domain.  The returned output is
   1.579 -formatted as a list or as an S-Expression if the '--long' option was given.
   1.580 +formatted as a list or as an S-Expression if the B<--long> option was given.
   1.581  
   1.582  =head2 VIRTUAL TPM DEVICES
   1.583  
   1.584 -=item B<vtpm-list> I<[-l|--long]> I<domain-id>
   1.585 +=item B<vtpm-list> [B<-l>|B<--long>] I<domain-id>
   1.586  
   1.587  Show the virtual TPM device for a domain.  The returned output is
   1.588 -formatted as a list or as an S-Expression if the '--long' option was given.
   1.589 +formatted as a list or as an S-Expression if the B<--long> option was given.
   1.590  
   1.591  =back
   1.592  
   1.593 @@ -728,7 +765,7 @@ out entirely.
   1.594  
   1.595  =over 4
   1.596  
   1.597 -=item B<vnet-list> I<[-l|--long]>
   1.598 +=item B<vnet-list> [B<-l>|B<--long>]
   1.599  
   1.600  List vnets.
   1.601  
   1.602 @@ -762,7 +799,7 @@ subcommands described below. Currently, 
   1.603  interpret labels:
   1.604  
   1.605  (1) Simple Type Enforcement: Labels are interpreted to decide access
   1.606 -of domains to comunication means and virtual or physical
   1.607 +of domains to communication means and virtual or physical
   1.608  resources. Communication between domains as well as access to
   1.609  resources are forbidden by default and can only take place if they are
   1.610  explicitly allowed by the security policy. The proper assignment of
   1.611 @@ -796,8 +833,8 @@ time with the B<cfgbootpolicy> subcomman
   1.612  =over 4
   1.613  
   1.614  I<policy> is a dot-separated list of names. The last part is the file
   1.615 -name pre-fix for the policy xml file. The preceding name parts are
   1.616 -translated into the local path pointing to the policy xml file
   1.617 +name pre-fix for the policy XML file. The preceding name parts are
   1.618 +translated into the local path pointing to the policy XML file
   1.619  relative to the global policy root directory
   1.620  (/etc/xen/acm-security/policies). For example,
   1.621  example.chwall_ste.client_v1 denotes the policy file
   1.622 @@ -823,16 +860,16 @@ I<boot title> parameter to specify a uni
   1.623  
   1.624  Prints the current security policy state information of Xen.
   1.625  
   1.626 -=item B<labels> [I<policy>] [I<type>=dom|res|any]
   1.627 +=item B<labels> [I<policy>] [B<type=dom>|B<res>|B<any>]
   1.628  
   1.629  Lists all labels of a I<type> (domain, resource, or both) that are
   1.630  defined in the I<policy>. Unless specified, the default I<policy> is
   1.631  the currently enforced access control policy. The default for I<type>
   1.632  is 'dom'. The labels are arranged in alphabetical order.
   1.633  
   1.634 -=item B<addlabel> I<label> dom I<configfile> [I<policy>]
   1.635 +=item B<addlabel> I<label> B<dom> I<configfile> [I<policy>]
   1.636  
   1.637 -=item B<addlabel> I<label> res I<resource> [I<policy>]
   1.638 +=item B<addlabel> I<label> B<res> I<resource> [I<policy>]
   1.639  
   1.640  Adds the security label with name I<label> to a domain
   1.641  I<configfile> (dom) or to the global resource label file for the
   1.642 @@ -841,17 +878,17 @@ currently enforced access control policy
   1.643  verifies that the I<policy> definition supports the specified I<label>
   1.644  name.
   1.645  
   1.646 -=item B<rmlabel> dom I<configfile>
   1.647 +=item B<rmlabel> B<dom> I<configfile>
   1.648  
   1.649 -=item B<rmlabel> res I<resource>
   1.650 +=item B<rmlabel> B<res> I<resource>
   1.651  
   1.652 -Works the same as the I<addlabel> command (above), except that this
   1.653 +Works the same as the B<addlabel> command (above), except that this
   1.654  command will remove the label from the domain I<configfile> (dom) or
   1.655  the global resource label file (res).
   1.656  
   1.657 -=item B<getlabel> dom I<configfile>
   1.658 +=item B<getlabel> B<dom> I<configfile>
   1.659  
   1.660 -=item B<getlabel> res I<resource>
   1.661 +=item B<getlabel> B<res> I<resource>
   1.662  
   1.663  Shows the label for the given I<configfile> or I<resource>
   1.664  
   1.665 @@ -881,7 +918,7 @@ Then recompile and install xen and the s
   1.666  
   1.667      cd xen_source_dir/xen; make clean; make; cp xen.gz /boot;
   1.668      cd xen_source_dir/tools/security; make install;
   1.669 -    reboot into xen
   1.670 +    reboot into Xen
   1.671  
   1.672  =back
   1.673  
   1.674 @@ -944,10 +981,10 @@ B<ATTACHING A SECURITY LABEL TO A DOMAIN
   1.675  
   1.676  =over 4
   1.677  
   1.678 -The I<addlabel> subcommand can attach a security label to a domain
   1.679 +The B<addlabel> subcommand can attach a security label to a domain
   1.680  configuration file, here a HomeBanking label. The example policy
   1.681  ensures that this domain does not share information with other
   1.682 -non-hombanking user domains (i.e., domains labeled as dom_Fun or
   1.683 +non-homebanking user domains (i.e., domains labeled as dom_Fun or
   1.684  dom_Boinc) and that it will not run simultaneously with domains
   1.685  labeled as dom_Fun.
   1.686  
   1.687 @@ -958,7 +995,7 @@ probably just a browser environment for 
   1.688      xm addlabel dom_HomeBanking dom myconfig.xm
   1.689  
   1.690  The very simple configuration file might now look as printed
   1.691 -below. The I<addlabel> subcommand added the B<access_control> entry at
   1.692 +below. The B<addlabel> subcommand added the B<access_control> entry at
   1.693  the end of the file, consisting of a label name and the policy that
   1.694  specifies this label name:
   1.695  
   1.696 @@ -986,7 +1023,7 @@ B<ATTACHING A SECURITY LABEL TO A RESOUR
   1.697  
   1.698  =over 4
   1.699  
   1.700 -The I<addlabel> subcommand can also be used to attach a security
   1.701 +The B<addlabel> subcommand can also be used to attach a security
   1.702  label to a resource. Following the home banking example from above,
   1.703  we can label a disk resource (e.g., a physical partition or a file)
   1.704  to make it accessible to the home banking domain. The example policy
   1.705 @@ -1002,7 +1039,7 @@ attaches this disk to the domain at boot
   1.706      disk = [ 'phy:hda6,sda2,w' ]
   1.707  
   1.708  Alternatively, the resource can be attached after booting the domain
   1.709 -by using the I<block-attach> subcommand.
   1.710 +by using the B<block-attach> subcommand.
   1.711  
   1.712      xm block-attach homebanking phy:hda6 sda2 w
   1.713  
   1.714 @@ -1010,7 +1047,7 @@ Note that labeled resources cannot be us
   1.715  off.  Any attempt to use labeled resources with security turned off
   1.716  will result in a failure with a corresponding error message.  The
   1.717  solution is to enable security or, if security is no longer desired,
   1.718 -to remove the resource label using the I<rmlabel> subcommand.
   1.719 +to remove the resource label using the B<rmlabel> subcommand.
   1.720  
   1.721  =back
   1.722  
   1.723 @@ -1048,7 +1085,7 @@ B<POLICY REPRESENTATIONS>
   1.724  =over 4
   1.725  
   1.726  We distinguish three representations of the Xen access control policy:
   1.727 -the I<source XML> version, its I<binary> counterpart, and a I<mapping>
   1.728 +the source XML version, its binary counterpart, and a mapping
   1.729  representation that enables the tools to deterministically translate
   1.730  back and forth between label names of the XML policy and label
   1.731  identifiers of the binary policy. All three versions must be kept
   1.732 @@ -1075,8 +1112,6 @@ their binary identifiers (ssidrefs) used
   1.733  
   1.734  =back
   1.735  
   1.736 -=head1 EXAMPLES
   1.737 -
   1.738  =head1 SEE ALSO
   1.739  
   1.740  B<xmdomain.cfg>(5), B<xentop>(1)
     2.1 --- a/tools/examples/xend-config.sxp	Fri Jul 06 16:25:10 2007 -0500
     2.2 +++ b/tools/examples/xend-config.sxp	Sat Jul 07 10:09:51 2007 +0100
     2.3 @@ -191,3 +191,9 @@
     2.4  # The default password for VNC console on HVM domain.
     2.5  # Empty string is no authentication.
     2.6  (vncpasswd '')
     2.7 +
     2.8 +# The default keymap to use for the VM's virtual keyboard
     2.9 +# when not specififed in VM's configuration
    2.10 +#(keymap 'en-us')
    2.11 +
    2.12 +
     3.1 --- a/tools/firmware/rombios/rombios.c	Fri Jul 06 16:25:10 2007 -0500
     3.2 +++ b/tools/firmware/rombios/rombios.c	Sat Jul 07 10:09:51 2007 +0100
     3.3 @@ -4675,6 +4675,10 @@ int09_function(DI, SI, BP, SP, BX, DX, C
     3.4        write_byte(0x0040, 0x18, mf2_flags);
     3.5        break;
     3.6  
     3.7 +    case 0x53: /* Del */
     3.8 +        if ((shift_flags & 0x0c) == 0x0c) /* Ctrl + Alt */
     3.9 +            machine_reset();
    3.10 +        /* Fall through */
    3.11      default:
    3.12        if (scancode & 0x80) return; /* toss key releases ... */
    3.13        if (scancode > MAX_SCAN_CODE) {
     4.1 --- a/tools/ioemu/keymaps/ja	Fri Jul 06 16:25:10 2007 -0500
     4.2 +++ b/tools/ioemu/keymaps/ja	Sat Jul 07 10:09:51 2007 +0100
     4.3 @@ -101,6 +101,7 @@ yen 0x7d
     4.4  bar 0x7d shift
     4.5  underscore 0x73 shift
     4.6  Henkan_Mode 0x79
     4.7 +Katakana_Real 0x70
     4.8  Katakana 0x70
     4.9  Muhenkan 0x7b
    4.10  Henkan_Mode_Real 0x79
     5.1 --- a/tools/ioemu/vnc_keysym.h	Fri Jul 06 16:25:10 2007 -0500
     5.2 +++ b/tools/ioemu/vnc_keysym.h	Sat Jul 07 10:09:51 2007 +0100
     5.3 @@ -290,12 +290,14 @@ static name2keysym_t name2keysym[]={
     5.4      /* localized keys */
     5.5  {"BackApostrophe", 0xff21},
     5.6  {"Muhenkan", 0xff22},
     5.7 -{"Katakana", 0xff25},
     5.8 +{"Katakana", 0xff27},
     5.9  {"Hankaku", 0xff29},
    5.10  {"Zenkaku_Hankaku", 0xff2a},
    5.11  {"Henkan_Mode_Real", 0xff23},
    5.12  {"Henkan_Mode_Ultra", 0xff3e},
    5.13  {"backslash_ja", 0xffa5},
    5.14 +{"Katakana_Real", 0xff25},
    5.15 +{"Eisu_toggle", 0xff30},
    5.16  
    5.17      /* dead keys */
    5.18  {"dead_grave", 0xfe50},
     6.1 --- a/tools/libxc/xc_domain.c	Fri Jul 06 16:25:10 2007 -0500
     6.2 +++ b/tools/libxc/xc_domain.c	Sat Jul 07 10:09:51 2007 +0100
     6.3 @@ -181,6 +181,7 @@ int xc_domain_getinfo(int xc_handle,
     6.4          info->blocked  = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_blocked);
     6.5          info->running  = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_running);
     6.6          info->hvm      = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_hvm_guest);
     6.7 +        info->debugged = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_debugged);
     6.8  
     6.9          info->shutdown_reason =
    6.10              (domctl.u.getdomaininfo.flags>>XEN_DOMINF_shutdownshift) &
     7.1 --- a/tools/libxc/xc_misc.c	Fri Jul 06 16:25:10 2007 -0500
     7.2 +++ b/tools/libxc/xc_misc.c	Sat Jul 07 10:09:51 2007 +0100
     7.3 @@ -60,6 +60,8 @@ int xc_physinfo(int xc_handle,
     7.4  
     7.5      sysctl.cmd = XEN_SYSCTL_physinfo;
     7.6  
     7.7 +    memcpy(&sysctl.u.physinfo, put_info, sizeof(*put_info));
     7.8 +
     7.9      if ( (ret = do_sysctl(xc_handle, &sysctl)) != 0 )
    7.10          return ret;
    7.11  
     8.1 --- a/tools/libxc/xenctrl.h	Fri Jul 06 16:25:10 2007 -0500
     8.2 +++ b/tools/libxc/xenctrl.h	Sat Jul 07 10:09:51 2007 +0100
     8.3 @@ -153,7 +153,7 @@ typedef struct xc_dominfo {
     8.4      uint32_t      ssidref;
     8.5      unsigned int  dying:1, crashed:1, shutdown:1,
     8.6                    paused:1, blocked:1, running:1,
     8.7 -                  hvm:1;
     8.8 +                  hvm:1, debugged:1;
     8.9      unsigned int  shutdown_reason; /* only meaningful if shutdown==1 */
    8.10      unsigned long nr_pages;
    8.11      unsigned long shared_info_frame;
    8.12 @@ -473,6 +473,7 @@ int xc_readconsolering(int xc_handle,
    8.13  int xc_send_debug_keys(int xc_handle, char *keys);
    8.14  
    8.15  typedef xen_sysctl_physinfo_t xc_physinfo_t;
    8.16 +typedef uint32_t xc_cpu_to_node_t;
    8.17  int xc_physinfo(int xc_handle,
    8.18                  xc_physinfo_t *info);
    8.19  
     9.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Fri Jul 06 16:25:10 2007 -0500
     9.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Sat Jul 07 10:09:51 2007 +0100
     9.3 @@ -680,33 +680,62 @@ static PyObject *pyxc_pages_to_kib(XcObj
     9.4  
     9.5  static PyObject *pyxc_physinfo(XcObject *self)
     9.6  {
     9.7 +#define MAX_CPU_ID 255
     9.8      xc_physinfo_t info;
     9.9      char cpu_cap[128], *p=cpu_cap, *q=cpu_cap;
    9.10 -    int i;
    9.11 -    
    9.12 +    int i, j, max_cpu_id;
    9.13 +    PyObject *ret_obj, *node_to_cpu_obj;
    9.14 +    xc_cpu_to_node_t map[MAX_CPU_ID];
    9.15 +
    9.16 +    set_xen_guest_handle(info.cpu_to_node, map);
    9.17 +    info.max_cpu_id = MAX_CPU_ID;
    9.18 +
    9.19      if ( xc_physinfo(self->xc_handle, &info) != 0 )
    9.20          return pyxc_error_to_exception();
    9.21  
    9.22 -    *q=0;
    9.23 -    for(i=0;i<sizeof(info.hw_cap)/4;i++)
    9.24 +    *q = 0;
    9.25 +    for ( i = 0; i < sizeof(info.hw_cap)/4; i++ )
    9.26      {
    9.27 -        p+=sprintf(p,"%08x:",info.hw_cap[i]);
    9.28 -        if(info.hw_cap[i])
    9.29 -            q=p;
    9.30 +        p += sprintf(p, "%08x:", info.hw_cap[i]);
    9.31 +        if ( info.hw_cap[i] )
    9.32 +            q = p;
    9.33      }
    9.34 -    if(q>cpu_cap)
    9.35 -        *(q-1)=0;
    9.36 +    if ( q > cpu_cap )
    9.37 +        *(q-1) = 0;
    9.38  
    9.39 -    return Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:l,s:l,s:i,s:s}",
    9.40 -                         "threads_per_core", info.threads_per_core,
    9.41 -                         "cores_per_socket", info.cores_per_socket,
    9.42 -                         "sockets_per_node", info.sockets_per_node,
    9.43 -                         "nr_nodes",         info.nr_nodes,
    9.44 -                         "total_memory",     pages_to_kib(info.total_pages),
    9.45 -                         "free_memory",      pages_to_kib(info.free_pages),
    9.46 -                         "scrub_memory",     pages_to_kib(info.scrub_pages),
    9.47 -                         "cpu_khz",          info.cpu_khz,
    9.48 -                         "hw_caps",          cpu_cap);
    9.49 +    ret_obj = Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:l,s:l,s:l,s:i,s:s}",
    9.50 +                            "nr_nodes",         info.nr_nodes,
    9.51 +                            "max_cpu_id",       info.max_cpu_id,
    9.52 +                            "threads_per_core", info.threads_per_core,
    9.53 +                            "cores_per_socket", info.cores_per_socket,
    9.54 +                            "sockets_per_node", info.sockets_per_node,
    9.55 +                            "total_memory",     pages_to_kib(info.total_pages),
    9.56 +                            "free_memory",      pages_to_kib(info.free_pages),
    9.57 +                            "scrub_memory",     pages_to_kib(info.scrub_pages),
    9.58 +                            "cpu_khz",          info.cpu_khz,
    9.59 +                            "hw_caps",          cpu_cap);
    9.60 +
    9.61 +    max_cpu_id = info.max_cpu_id;
    9.62 +    if ( max_cpu_id > MAX_CPU_ID )
    9.63 +        max_cpu_id = MAX_CPU_ID;
    9.64 +
    9.65 +    /* Construct node-to-cpu lists. */
    9.66 +    node_to_cpu_obj = PyList_New(0);
    9.67 +
    9.68 +    /* Make a list for each node. */
    9.69 +    for ( i = 0; i < info.nr_nodes; i++ )
    9.70 +    {
    9.71 +        PyObject *cpus = PyList_New(0);
    9.72 +        for ( j = 0; j <= max_cpu_id; j++ )
    9.73 +            if ( i == map[j])
    9.74 +                PyList_Append(cpus, PyInt_FromLong(j));
    9.75 +        PyList_Append(node_to_cpu_obj, cpus); 
    9.76 +    }
    9.77 +
    9.78 +    PyDict_SetItemString(ret_obj, "node_to_cpu", node_to_cpu_obj);
    9.79 + 
    9.80 +    return ret_obj;
    9.81 +#undef MAX_CPU_ID
    9.82  }
    9.83  
    9.84  static PyObject *pyxc_xeninfo(XcObject *self)
    10.1 --- a/tools/python/xen/xend/XendConfig.py	Fri Jul 06 16:25:10 2007 -0500
    10.2 +++ b/tools/python/xen/xend/XendConfig.py	Sat Jul 07 10:09:51 2007 +0100
    10.3 @@ -22,6 +22,7 @@ import types
    10.4  
    10.5  from xen.xend import sxp
    10.6  from xen.xend import uuid
    10.7 +from xen.xend import XendOptions
    10.8  from xen.xend import XendAPIStore
    10.9  from xen.xend.XendError import VmError
   10.10  from xen.xend.XendDevices import XendDevices
   10.11 @@ -392,6 +393,9 @@ class XendConfig(dict):
   10.12  
   10.13      def _platform_sanity_check(self):
   10.14          if self.is_hvm():
   10.15 +            if 'keymap' not in self['platform'] and XendOptions.instance().get_keymap():
   10.16 +                self['platform']['keymap'] = XendOptions.instance().get_keymap()
   10.17 +
   10.18              if 'device_model' not in self['platform']:
   10.19                  self['platform']['device_model'] = DEFAULT_DM
   10.20  
    11.1 --- a/tools/python/xen/xend/XendDomain.py	Fri Jul 06 16:25:10 2007 -0500
    11.2 +++ b/tools/python/xen/xend/XendDomain.py	Sat Jul 07 10:09:51 2007 +0100
    11.3 @@ -1399,10 +1399,15 @@ class XendDomain:
    11.4          dominfo = self.domain_lookup_nr(domid)
    11.5          if not dominfo:
    11.6              raise XendInvalidDomain(str(domid))
    11.7 -        try:
    11.8 -            return xc.sched_credit_domain_get(dominfo.getDomid())
    11.9 -        except Exception, ex:
   11.10 -            raise XendError(str(ex))
   11.11 +        
   11.12 +        if dominfo._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
   11.13 +            try:
   11.14 +                return xc.sched_credit_domain_get(dominfo.getDomid())
   11.15 +            except Exception, ex:
   11.16 +                raise XendError(str(ex))
   11.17 +        else:
   11.18 +            return {'weight' : dominfo.getWeight(),
   11.19 +                    'cap'    : dominfo.getCap()} 
   11.20      
   11.21      def domain_sched_credit_set(self, domid, weight = None, cap = None):
   11.22          """Set credit scheduler parameters for a domain.
   11.23 @@ -1436,7 +1441,9 @@ class XendDomain:
   11.24              assert type(weight) == int
   11.25              assert type(cap) == int
   11.26  
   11.27 -            rc = xc.sched_credit_domain_set(dominfo.getDomid(), weight, cap)
   11.28 +            rc = 0
   11.29 +            if dominfo._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
   11.30 +                rc = xc.sched_credit_domain_set(dominfo.getDomid(), weight, cap)
   11.31              if rc == 0:
   11.32                  if set_weight:
   11.33                      dominfo.setWeight(weight)
    12.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Fri Jul 06 16:25:10 2007 -0500
    12.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Sat Jul 07 10:09:51 2007 +0100
    12.3 @@ -502,9 +502,18 @@ class XendDomainInfo:
    12.4          dev_uuid = self.info.device_add(dev_type, cfg_sxp = dev_config)
    12.5          dev_config_dict = self.info['devices'][dev_uuid][1]
    12.6          log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config_dict))
    12.7 -        dev_config_dict['devid'] = devid = \
    12.8 -             self._createDevice(dev_type, dev_config_dict)
    12.9 -        self._waitForDevice(dev_type, devid)
   12.10 +
   12.11 +        if self.domid is not None:
   12.12 +            try:
   12.13 +                dev_config_dict['devid'] = devid = \
   12.14 +                    self._createDevice(dev_type, dev_config_dict)
   12.15 +                self._waitForDevice(dev_type, devid)
   12.16 +            except VmError, ex:
   12.17 +                raise ex
   12.18 +        else:
   12.19 +            devid = None
   12.20 +
   12.21 +        xen.xend.XendDomain.instance().managed_config_save(self)
   12.22          return self.getDeviceController(dev_type).sxpr(devid)
   12.23  
   12.24      def device_configure(self, dev_sxp, devid = None):
    13.1 --- a/tools/python/xen/xend/XendNode.py	Fri Jul 06 16:25:10 2007 -0500
    13.2 +++ b/tools/python/xen/xend/XendNode.py	Sat Jul 07 10:09:51 2007 +0100
    13.3 @@ -533,6 +533,54 @@ class XendNode:
    13.4                  ['version', ver],
    13.5                  ['machine', mch]]
    13.6  
    13.7 +    def list_to_rangepairs(self,cmap):
    13.8 +            cmap.sort()
    13.9 +            pairs = []
   13.10 +            x = y = 0
   13.11 +            for i in range(0,len(cmap)):
   13.12 +                try:
   13.13 +                    if ((cmap[y+1] - cmap[i]) > 1):
   13.14 +                        pairs.append((cmap[x],cmap[y]))
   13.15 +                        x = y = i+1
   13.16 +                    else:
   13.17 +                        y = y + 1
   13.18 +                # if we go off the end, then just add x to y
   13.19 +                except IndexError:
   13.20 +                    pairs.append((cmap[x],cmap[y]))
   13.21 +
   13.22 +            return pairs
   13.23 +
   13.24 +    def format_pairs(self,pairs):
   13.25 +            if not pairs:
   13.26 +                return "no cpus"
   13.27 +            out = ""
   13.28 +            for f,s in pairs:
   13.29 +                if (f==s):
   13.30 +                    out += '%d'%f
   13.31 +                else:
   13.32 +                    out += '%d-%d'%(f,s)
   13.33 +                out += ','
   13.34 +            # trim trailing ','
   13.35 +            return out[:-1]
   13.36 +
   13.37 +    def list_to_strrange(self,list):
   13.38 +        return self.format_pairs(self.list_to_rangepairs(list))
   13.39 +
   13.40 +    def format_node_to_cpu(self, pinfo):
   13.41 +        str=''
   13.42 +        whitespace=''
   13.43 +        try:
   13.44 +            node_to_cpu=pinfo['node_to_cpu']
   13.45 +            for i in range(0, pinfo['nr_nodes']):
   13.46 +                str+='%snode%d:%s\n' % (whitespace,
   13.47 +                                        i, 
   13.48 +                                      self.list_to_strrange(node_to_cpu[i]))
   13.49 +                whitespace='%25s' % ''        
   13.50 +        except:
   13.51 +            str='none\n'
   13.52 +        return str[:-1];
   13.53 +
   13.54 +
   13.55      def physinfo(self):
   13.56          info = self.xc.physinfo()
   13.57  
   13.58 @@ -545,6 +593,7 @@ class XendNode:
   13.59          # physinfo is in KiB, need it in MiB
   13.60          info['total_memory'] = info['total_memory'] / 1024
   13.61          info['free_memory']  = info['free_memory'] / 1024
   13.62 +        info['node_to_cpu']  = self.format_node_to_cpu(info)
   13.63  
   13.64          ITEM_ORDER = ['nr_cpus',
   13.65                        'nr_nodes',
   13.66 @@ -555,6 +604,7 @@ class XendNode:
   13.67                        'hw_caps',
   13.68                        'total_memory',
   13.69                        'free_memory',
   13.70 +                      'node_to_cpu'
   13.71                        ]
   13.72  
   13.73          return [[k, info[k]] for k in ITEM_ORDER]
    14.1 --- a/tools/python/xen/xend/XendOptions.py	Fri Jul 06 16:25:10 2007 -0500
    14.2 +++ b/tools/python/xen/xend/XendOptions.py	Sat Jul 07 10:09:51 2007 +0100
    14.3 @@ -278,6 +278,9 @@ class XendOptions:
    14.4          return self.get_config_string('vncpasswd',
    14.5                                       self.vncpasswd_default)
    14.6  
    14.7 +    def get_keymap(self):
    14.8 +        return self.get_config_value('keymap', None)
    14.9 +
   14.10  class XendOptionsFile(XendOptions):
   14.11  
   14.12      """Default path to the config file."""
    15.1 --- a/tools/python/xen/xend/server/SrvDomain.py	Fri Jul 06 16:25:10 2007 -0500
    15.2 +++ b/tools/python/xen/xend/server/SrvDomain.py	Sat Jul 07 10:09:51 2007 +0100
    15.3 @@ -155,7 +155,8 @@ class SrvDomain(SrvDir):
    15.4      def op_domain_sched_credit_set(self, _, req):
    15.5          fn = FormFn(self.xd.domain_sched_credit_set,
    15.6                      [['dom', 'int'],
    15.7 -                     ['weight', 'int']])
    15.8 +                     ['weight', 'int'],
    15.9 +                     ['cap', 'int']])
   15.10          val = fn(req.args, {'dom': self.dom.domid})
   15.11          return val
   15.12  
    16.1 --- a/tools/python/xen/xend/server/vfbif.py	Fri Jul 06 16:25:10 2007 -0500
    16.2 +++ b/tools/python/xen/xend/server/vfbif.py	Sat Jul 07 10:09:51 2007 +0100
    16.3 @@ -76,6 +76,11 @@ class VfbifController(DevController):
    16.4              args += [ "--listen", vnclisten ]
    16.5              if config.has_key("keymap"):
    16.6                  args += ["-k", "%s" % config["keymap"]]
    16.7 +            else:
    16.8 +                xoptions = xen.xend.XendOptions.instance()
    16.9 +                if xoptions.get_keymap():
   16.10 +                    args += ["-k", "%s" % xoptions.get_keymap()]
   16.11 +
   16.12              spawn_detached(args[0], args + std_args, os.environ)
   16.13          elif t == "sdl":
   16.14              args = [xen.util.auxbin.pathTo("xen-sdlfb")]
    17.1 --- a/tools/python/xen/xm/main.py	Fri Jul 06 16:25:10 2007 -0500
    17.2 +++ b/tools/python/xen/xm/main.py	Sat Jul 07 10:09:51 2007 +0100
    17.3 @@ -1529,7 +1529,7 @@ def xm_sched_credit(args):
    17.4  
    17.5      doms = filter(lambda x : domid_match(domid, x),
    17.6                    [parse_doms_info(dom)
    17.7 -                  for dom in getDomains(None, 'running')])
    17.8 +                  for dom in getDomains(None, 'all')])
    17.9  
   17.10      if weight is None and cap is None:
   17.11          if domid is not None and doms == []: 
   17.12 @@ -1545,7 +1545,7 @@ def xm_sched_credit(args):
   17.13                          server.xenapi.VM.get_metrics(
   17.14                              get_single_vm(d['name'])))
   17.15                  else:
   17.16 -                    info = server.xend.domain.sched_credit_get(d['domid'])
   17.17 +                    info = server.xend.domain.sched_credit_get(d['name'])
   17.18              except xmlrpclib.Fault:
   17.19                  pass
   17.20  
   17.21 @@ -1557,8 +1557,8 @@ def xm_sched_credit(args):
   17.22              info['cap']    = int(info['cap'])
   17.23              
   17.24              info['name']  = d['name']
   17.25 -            info['domid'] = int(d['domid'])
   17.26 -            print( ("%(name)-32s %(domid)5d %(weight)6d %(cap)4d") % info)
   17.27 +            info['domid'] = str(d['domid'])
   17.28 +            print( ("%(name)-32s %(domid)5s %(weight)6d %(cap)4d") % info)
   17.29      else:
   17.30          if domid is None:
   17.31              # place holder for system-wide scheduler parameters
   17.32 @@ -1566,14 +1566,24 @@ def xm_sched_credit(args):
   17.33              usage('sched-credit')
   17.34  
   17.35          if serverType == SERVER_XEN_API:
   17.36 -            server.xenapi.VM.add_to_VCPUs_params_live(
   17.37 -                get_single_vm(domid),
   17.38 -                "weight",
   17.39 -                weight)
   17.40 -            server.xenapi.VM.add_to_VCPUs_params_live(
   17.41 -                get_single_vm(domid),
   17.42 -                "cap",
   17.43 -                cap)            
   17.44 +            if doms[0]['domid']:
   17.45 +                server.xenapi.VM.add_to_VCPUs_params_live(
   17.46 +                    get_single_vm(domid),
   17.47 +                    "weight",
   17.48 +                    weight)
   17.49 +                server.xenapi.VM.add_to_VCPUs_params_live(
   17.50 +                    get_single_vm(domid),
   17.51 +                    "cap",
   17.52 +                    cap)
   17.53 +            else:
   17.54 +                server.xenapi.VM.add_to_VCPUs_params(
   17.55 +                    get_single_vm(domid),
   17.56 +                    "weight",
   17.57 +                    weight)
   17.58 +                server.xenapi.VM.add_to_VCPUs_params(
   17.59 +                    get_single_vm(domid),
   17.60 +                    "cap",
   17.61 +                    cap)
   17.62          else:
   17.63              result = server.xend.domain.sched_credit_set(domid, weight, cap)
   17.64              if result != 0:
    18.1 --- a/tools/security/xensec_ezpolicy	Fri Jul 06 16:25:10 2007 -0500
    18.2 +++ b/tools/security/xensec_ezpolicy	Sat Jul 07 10:09:51 2007 +0100
    18.3 @@ -1102,8 +1102,10 @@ def org2dict():
    18.4      for i in iterchildren(app.win.orgs.GetRootItem()):
    18.5          d = []
    18.6          for j in iterchildren(i):
    18.7 -            d.append(str(app.win.orgspanel.orgs.GetItemText(j)))
    18.8 -        o.append([str(app.win.orgspanel.orgs.GetItemText(i)) , d])
    18.9 +            d.append(
   18.10 +                  str(app.win.orgspanel.orgs.GetItemText(j).encode("utf-8")))
   18.11 +        o.append([str(app.win.orgspanel.orgs.GetItemText(i).encode("utf-8")),
   18.12 +                 d])
   18.13      dic['orgs'] = o
   18.14      c=[]
   18.15      for i in app.win.conspanel.conflictsets:
   18.16 @@ -1175,12 +1177,14 @@ def printPolicy(fd, types, cons):
   18.17                  continue
   18.18              #name is optional but must be set
   18.19              if i[0]:
   18.20 -                rer_name = str(i[0])
   18.21 +                rer_name = i[0]
   18.22              else:
   18.23 -                rer_name = str("RER")
   18.24 -            fd.write("""            <Conflict name=\"%s\">\n""" % rer_name)
   18.25 +                rer_name = "RER"
   18.26 +            fd.write("""            <Conflict name=\"""" +
   18.27 +                     rer_name.encode("utf-8") + """\">\n""")
   18.28              for j in i[1]:
   18.29 -                fd.write("""                <Type>%s</Type>\n""" % str(j))
   18.30 +                typ = j.encode("utf-8")
   18.31 +                fd.write("""                <Type>%s</Type>\n""" % typ)
   18.32              fd.write("""            </Conflict>\n""")
   18.33          fd.write("""       </ConflictSets>\n""")
   18.34  
    19.1 --- a/tools/xenmon/xenbaked.c	Fri Jul 06 16:25:10 2007 -0500
    19.2 +++ b/tools/xenmon/xenbaked.c	Sat Jul 07 10:09:51 2007 +0100
    19.3 @@ -444,7 +444,7 @@ struct t_rec **init_rec_ptrs(struct t_bu
    19.4   */
    19.5  unsigned int get_num_cpus(void)
    19.6  {
    19.7 -    xc_physinfo_t physinfo;
    19.8 +    xc_physinfo_t physinfo = { 0 };
    19.9      int xc_handle = xc_interface_open();
   19.10      int ret;
   19.11  
    20.1 --- a/tools/xenstat/libxenstat/src/xenstat.c	Fri Jul 06 16:25:10 2007 -0500
    20.2 +++ b/tools/xenstat/libxenstat/src/xenstat.c	Sat Jul 07 10:09:51 2007 +0100
    20.3 @@ -135,7 +135,7 @@ xenstat_node *xenstat_get_node(xenstat_h
    20.4  {
    20.5  #define DOMAIN_CHUNK_SIZE 256
    20.6  	xenstat_node *node;
    20.7 -	xc_physinfo_t physinfo;
    20.8 +	xc_physinfo_t physinfo = { 0 };
    20.9  	xc_domaininfo_t domaininfo[DOMAIN_CHUNK_SIZE];
   20.10  	unsigned int new_domains;
   20.11  	unsigned int i;
    21.1 --- a/tools/xentrace/xentrace.c	Fri Jul 06 16:25:10 2007 -0500
    21.2 +++ b/tools/xentrace/xentrace.c	Sat Jul 07 10:09:51 2007 +0100
    21.3 @@ -256,7 +256,7 @@ struct t_rec **init_rec_ptrs(struct t_bu
    21.4   */
    21.5  unsigned int get_num_cpus(void)
    21.6  {
    21.7 -    xc_physinfo_t physinfo;
    21.8 +    xc_physinfo_t physinfo = { 0 };
    21.9      int xc_handle = xc_interface_open();
   21.10      int ret;
   21.11      
    22.1 --- a/tools/xm-test/tests/info/02_info_compiledata_pos.py	Fri Jul 06 16:25:10 2007 -0500
    22.2 +++ b/tools/xm-test/tests/info/02_info_compiledata_pos.py	Sat Jul 07 10:09:51 2007 +0100
    22.3 @@ -18,9 +18,7 @@ map = {}
    22.4  for line in lines:
    22.5      pieces = line.split(" : ", 1)
    22.6  
    22.7 -    if len(pieces) < 2:
    22.8 -        FAIL("Found invalid line: [%s]" % line)
    22.9 -    else:
   22.10 +    if len(pieces) > 1:
   22.11          map[pieces[0]] = pieces[1]
   22.12  
   22.13  for field in ["cores_per_socket", "threads_per_core", "cpu_mhz",
    23.1 --- a/xen/arch/ia64/xen/dom0_ops.c	Fri Jul 06 16:25:10 2007 -0500
    23.2 +++ b/xen/arch/ia64/xen/dom0_ops.c	Sat Jul 07 10:09:51 2007 +0100
    23.3 @@ -240,8 +240,7 @@ long arch_do_sysctl(xen_sysctl_t *op, XE
    23.4      {
    23.5  #ifdef IA64_NUMA_PHYSINFO
    23.6          int i;
    23.7 -        node_data_t *chunks;
    23.8 -        u64 *map, cpu_to_node_map[MAX_NUMNODES];
    23.9 +        uint32_t *map, cpu_to_node_map[NR_CPUS];
   23.10  #endif
   23.11  
   23.12          xen_sysctl_physinfo_t *pi = &op->u.physinfo;
   23.13 @@ -250,11 +249,9 @@ long arch_do_sysctl(xen_sysctl_t *op, XE
   23.14              cpus_weight(cpu_sibling_map[0]);
   23.15          pi->cores_per_socket =
   23.16              cpus_weight(cpu_core_map[0]) / pi->threads_per_core;
   23.17 -        pi->sockets_per_node = 
   23.18 -            num_online_cpus() / cpus_weight(cpu_core_map[0]);
   23.19 -#ifndef IA64_NUMA_PHYSINFO
   23.20 -        pi->nr_nodes         = 1; 
   23.21 -#endif
   23.22 +        pi->nr_nodes         = num_online_nodes();
   23.23 +        pi->sockets_per_node = num_online_cpus() / 
   23.24 +            (pi->nr_nodes * pi->cores_per_socket * pi->threads_per_core);
   23.25          pi->total_pages      = total_pages; 
   23.26          pi->free_pages       = avail_domheap_pages();
   23.27          pi->scrub_pages      = avail_scrub_pages();
   23.28 @@ -264,41 +261,6 @@ long arch_do_sysctl(xen_sysctl_t *op, XE
   23.29          ret = 0;
   23.30  
   23.31  #ifdef IA64_NUMA_PHYSINFO
   23.32 -        /* fetch memory_chunk pointer from guest */
   23.33 -        get_xen_guest_handle(chunks, pi->memory_chunks);
   23.34 -
   23.35 -        printk("chunks=%p, num_node_memblks=%u\n", chunks, num_node_memblks);
   23.36 -        /* if it is set, fill out memory chunk array */
   23.37 -        if (chunks != NULL) {
   23.38 -            if (num_node_memblks == 0) {
   23.39 -                /* Non-NUMA machine.  Put pseudo-values.  */
   23.40 -                node_data_t data;
   23.41 -                data.node_start_pfn = 0;
   23.42 -                data.node_spanned_pages = total_pages;
   23.43 -                data.node_id = 0;
   23.44 -                /* copy memory chunk structs to guest */
   23.45 -                if (copy_to_guest_offset(pi->memory_chunks, 0, &data, 1)) {
   23.46 -                    ret = -EFAULT;
   23.47 -                    break;
   23.48 -                }
   23.49 -            } else {
   23.50 -                for (i = 0; i < num_node_memblks && i < PUBLIC_MAXCHUNKS; i++) {
   23.51 -                    node_data_t data;
   23.52 -                    data.node_start_pfn = node_memblk[i].start_paddr >>
   23.53 -                                          PAGE_SHIFT;
   23.54 -                    data.node_spanned_pages = node_memblk[i].size >> PAGE_SHIFT;
   23.55 -                    data.node_id = node_memblk[i].nid;
   23.56 -                    /* copy memory chunk structs to guest */
   23.57 -                    if (copy_to_guest_offset(pi->memory_chunks, i, &data, 1)) {
   23.58 -                        ret = -EFAULT;
   23.59 -                        break;
   23.60 -                    }
   23.61 -                }
   23.62 -            }
   23.63 -        }
   23.64 -        /* set number of notes */
   23.65 -        pi->nr_nodes = num_online_nodes();
   23.66 -
   23.67          /* fetch cpu_to_node pointer from guest */
   23.68          get_xen_guest_handle(map, pi->cpu_to_node);
   23.69  
    24.1 --- a/xen/arch/powerpc/mm.c	Fri Jul 06 16:25:10 2007 -0500
    24.2 +++ b/xen/arch/powerpc/mm.c	Sat Jul 07 10:09:51 2007 +0100
    24.3 @@ -187,7 +187,7 @@ int replace_grant_host_mapping(
    24.4      unsigned long addr, unsigned long frame, unsigned long new_addr,
    24.5      unsigned int flags)
    24.6  {
    24.7 -    if (new_addr)
    24.8 +    if (new_addr) {
    24.9          printk("%s: new_addr not supported\n", __func__);
   24.10          BUG();
   24.11          return GNTST_general_error;
    25.1 --- a/xen/arch/powerpc/sysctl.c	Fri Jul 06 16:25:10 2007 -0500
    25.2 +++ b/xen/arch/powerpc/sysctl.c	Sat Jul 07 10:09:51 2007 +0100
    25.3 @@ -45,10 +45,10 @@ long arch_do_sysctl(struct xen_sysctl *s
    25.4              cpus_weight(cpu_sibling_map[0]);
    25.5          pi->cores_per_socket =
    25.6              cpus_weight(cpu_core_map[0]) / pi->threads_per_core;
    25.7 -        pi->sockets_per_node = 
    25.8 -            num_online_cpus() / cpus_weight(cpu_core_map[0]);
    25.9 +        pi->sockets_per_node = num_online_cpus() / 
   25.10 +            (num_online_nodes() * pi->cores_per_socket * pi->threads_per_core);
   25.11  
   25.12 -        pi->nr_nodes         = 1;
   25.13 +        pi->nr_nodes         = num_online_nodes();
   25.14          pi->total_pages      = total_pages;
   25.15          pi->free_pages       = avail_domheap_pages();
   25.16          pi->cpu_khz          = cpu_khz;
    26.1 --- a/xen/arch/x86/hvm/vmx/intr.c	Fri Jul 06 16:25:10 2007 -0500
    26.2 +++ b/xen/arch/x86/hvm/vmx/intr.c	Sat Jul 07 10:09:51 2007 +0100
    26.3 @@ -73,7 +73,7 @@
    26.4  
    26.5  static void enable_intr_window(struct vcpu *v, enum hvm_intack intr_source)
    26.6  {
    26.7 -    u32 *cpu_exec_control = &v->arch.hvm_vcpu.u.vmx.exec_control;
    26.8 +    u32 *cpu_exec_control = &v->arch.hvm_vmx.exec_control;
    26.9      u32 ctl = CPU_BASED_VIRTUAL_INTR_PENDING;
   26.10  
   26.11      if ( unlikely(intr_source == hvm_intack_none) )
    27.1 --- a/xen/arch/x86/hvm/vmx/vmcs.c	Fri Jul 06 16:25:10 2007 -0500
    27.2 +++ b/xen/arch/x86/hvm/vmx/vmcs.c	Sat Jul 07 10:09:51 2007 +0100
    27.3 @@ -80,7 +80,7 @@ void vmx_init_vmcs_config(void)
    27.4          min, opt, MSR_IA32_VMX_PINBASED_CTLS);
    27.5  
    27.6      min = (CPU_BASED_HLT_EXITING |
    27.7 -           CPU_BASED_INVDPG_EXITING |
    27.8 +           CPU_BASED_INVLPG_EXITING |
    27.9             CPU_BASED_MWAIT_EXITING |
   27.10             CPU_BASED_MOV_DR_EXITING |
   27.11             CPU_BASED_ACTIVATE_IO_BITMAP |
   27.12 @@ -318,7 +318,7 @@ static void construct_vmcs(struct vcpu *
   27.13      __vmwrite(VM_EXIT_CONTROLS, vmx_vmexit_control);
   27.14      __vmwrite(VM_ENTRY_CONTROLS, vmx_vmentry_control);
   27.15      __vmwrite(CPU_BASED_VM_EXEC_CONTROL, vmx_cpu_based_exec_control);
   27.16 -    v->arch.hvm_vcpu.u.vmx.exec_control = vmx_cpu_based_exec_control;
   27.17 +    v->arch.hvm_vmx.exec_control = vmx_cpu_based_exec_control;
   27.18      if ( vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS )
   27.19          __vmwrite(SECONDARY_VM_EXEC_CONTROL, vmx_secondary_exec_control);
   27.20  
    28.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Fri Jul 06 16:25:10 2007 -0500
    28.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Sat Jul 07 10:09:51 2007 +0100
    28.3 @@ -433,8 +433,8 @@ static inline void vmx_save_dr(struct vc
    28.4  
    28.5      /* Clear the DR dirty flag and re-enable intercepts for DR accesses. */
    28.6      v->arch.hvm_vcpu.flag_dr_dirty = 0;
    28.7 -    v->arch.hvm_vcpu.u.vmx.exec_control |= CPU_BASED_MOV_DR_EXITING;
    28.8 -    __vmwrite(CPU_BASED_VM_EXEC_CONTROL, v->arch.hvm_vcpu.u.vmx.exec_control);
    28.9 +    v->arch.hvm_vmx.exec_control |= CPU_BASED_MOV_DR_EXITING;
   28.10 +    __vmwrite(CPU_BASED_VM_EXEC_CONTROL, v->arch.hvm_vmx.exec_control);
   28.11  
   28.12      savedebug(&v->arch.guest_context, 0);
   28.13      savedebug(&v->arch.guest_context, 1);
   28.14 @@ -1440,9 +1440,9 @@ static void vmx_dr_access(unsigned long 
   28.15      __restore_debug_registers(v);
   28.16  
   28.17      /* Allow guest direct access to DR registers */
   28.18 -    v->arch.hvm_vcpu.u.vmx.exec_control &= ~CPU_BASED_MOV_DR_EXITING;
   28.19 +    v->arch.hvm_vmx.exec_control &= ~CPU_BASED_MOV_DR_EXITING;
   28.20      __vmwrite(CPU_BASED_VM_EXEC_CONTROL,
   28.21 -              v->arch.hvm_vcpu.u.vmx.exec_control);
   28.22 +              v->arch.hvm_vmx.exec_control);
   28.23  }
   28.24  
   28.25  /*
   28.26 @@ -2984,15 +2984,15 @@ asmlinkage void vmx_vmexit_handler(struc
   28.27          break;
   28.28      case EXIT_REASON_PENDING_VIRT_INTR:
   28.29          /* Disable the interrupt window. */
   28.30 -        v->arch.hvm_vcpu.u.vmx.exec_control &= ~CPU_BASED_VIRTUAL_INTR_PENDING;
   28.31 +        v->arch.hvm_vmx.exec_control &= ~CPU_BASED_VIRTUAL_INTR_PENDING;
   28.32          __vmwrite(CPU_BASED_VM_EXEC_CONTROL,
   28.33 -                  v->arch.hvm_vcpu.u.vmx.exec_control);
   28.34 +                  v->arch.hvm_vmx.exec_control);
   28.35          break;
   28.36      case EXIT_REASON_PENDING_VIRT_NMI:
   28.37          /* Disable the NMI window. */
   28.38 -        v->arch.hvm_vcpu.u.vmx.exec_control &= ~CPU_BASED_VIRTUAL_NMI_PENDING;
   28.39 +        v->arch.hvm_vmx.exec_control &= ~CPU_BASED_VIRTUAL_NMI_PENDING;
   28.40          __vmwrite(CPU_BASED_VM_EXEC_CONTROL,
   28.41 -                  v->arch.hvm_vcpu.u.vmx.exec_control);
   28.42 +                  v->arch.hvm_vmx.exec_control);
   28.43          break;
   28.44      case EXIT_REASON_TASK_SWITCH:
   28.45          goto exit_and_crash;
    29.1 --- a/xen/arch/x86/mm/shadow/common.c	Fri Jul 06 16:25:10 2007 -0500
    29.2 +++ b/xen/arch/x86/mm/shadow/common.c	Sat Jul 07 10:09:51 2007 +0100
    29.3 @@ -506,7 +506,9 @@ void shadow_promote(struct vcpu *v, mfn_
    29.4      ASSERT(mfn_valid(gmfn));
    29.5  
    29.6      /* We should never try to promote a gmfn that has writeable mappings */
    29.7 -    ASSERT(sh_remove_write_access(v, gmfn, 0, 0) == 0);
    29.8 +    ASSERT((page->u.inuse.type_info & PGT_type_mask) != PGT_writable_page
    29.9 +           || (page->u.inuse.type_info & PGT_count_mask) == 0
   29.10 +           || v->domain->is_shutting_down);
   29.11  
   29.12      /* Is the page already shadowed? */
   29.13      if ( !test_and_set_bit(_PGC_page_table, &page->count_info) )
   29.14 @@ -1850,11 +1852,12 @@ int sh_remove_write_access(struct vcpu *
   29.15      perfc_incr(shadow_writeable_bf);
   29.16      hash_foreach(v, callback_mask, callbacks, gmfn);
   29.17  
   29.18 -    /* If that didn't catch the mapping, something is very wrong */
   29.19 +    /* If that didn't catch the mapping, then there's some non-pagetable
   29.20 +     * mapping -- ioreq page, grant mapping, &c. */
   29.21      if ( (mfn_to_page(gmfn)->u.inuse.type_info & PGT_count_mask) != 0 )
   29.22      {
   29.23 -        SHADOW_ERROR("can't find all writeable mappings of mfn %lx: "
   29.24 -                      "%lu left\n", mfn_x(gmfn),
   29.25 +        SHADOW_ERROR("can't remove write access to mfn %lx: guest has "
   29.26 +                      "%lu special-use mappings of it\n", mfn_x(gmfn),
   29.27                        (mfn_to_page(gmfn)->u.inuse.type_info&PGT_count_mask));
   29.28          domain_crash(v->domain);
   29.29      }
    30.1 --- a/xen/arch/x86/mm/shadow/multi.c	Fri Jul 06 16:25:10 2007 -0500
    30.2 +++ b/xen/arch/x86/mm/shadow/multi.c	Sat Jul 07 10:09:51 2007 +0100
    30.3 @@ -2719,10 +2719,21 @@ static int sh_page_fault(struct vcpu *v,
    30.4                     
    30.5      if ( guest_walk_tables(v, va, &gw, 1) != 0 )
    30.6      {
    30.7 -        SHADOW_PRINTK("malformed guest pagetable!");
    30.8 +        SHADOW_PRINTK("malformed guest pagetable\n");
    30.9          print_gw(&gw);
   30.10      }
   30.11  
   30.12 +    /* It's possible that the guest has put pagetables in memory that it has 
   30.13 +     * already used for some special purpose (ioreq pages, or granted pages).
   30.14 +     * If that happens we'll have killed the guest already but it's still not 
   30.15 +     * safe to propagate entries out of the guest PT so get out now. */
   30.16 +    if ( unlikely(d->is_shutting_down) )
   30.17 +    {
   30.18 +        SHADOW_PRINTK("guest is shutting down\n");
   30.19 +        shadow_unlock(d);
   30.20 +        return 0;
   30.21 +    }
   30.22 +
   30.23      sh_audit_gw(v, &gw);
   30.24  
   30.25      // We do not look at the gw->l1e, as that will not exist for superpages.
    31.1 --- a/xen/arch/x86/sysctl.c	Fri Jul 06 16:25:10 2007 -0500
    31.2 +++ b/xen/arch/x86/sysctl.c	Sat Jul 07 10:09:51 2007 +0100
    31.3 @@ -23,6 +23,10 @@
    31.4  #include <asm/hvm/hvm.h>
    31.5  #include <asm/hvm/support.h>
    31.6  #include <asm/processor.h>
    31.7 +#include <asm/numa.h>
    31.8 +#include <xen/nodemask.h>
    31.9 +
   31.10 +#define get_xen_guest_handle(val, hnd)  do { val = (hnd).p; } while (0)
   31.11  
   31.12  long arch_do_sysctl(
   31.13      struct xen_sysctl *sysctl, XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
   31.14 @@ -34,25 +38,41 @@ long arch_do_sysctl(
   31.15  
   31.16      case XEN_SYSCTL_physinfo:
   31.17      {
   31.18 +        uint32_t i, max_array_ent;
   31.19 +
   31.20          xen_sysctl_physinfo_t *pi = &sysctl->u.physinfo;
   31.21  
   31.22          pi->threads_per_core =
   31.23              cpus_weight(cpu_sibling_map[0]);
   31.24          pi->cores_per_socket =
   31.25              cpus_weight(cpu_core_map[0]) / pi->threads_per_core;
   31.26 -        pi->sockets_per_node = 
   31.27 -            num_online_cpus() / cpus_weight(cpu_core_map[0]);
   31.28 +        pi->nr_nodes = num_online_nodes();
   31.29 +        pi->sockets_per_node = num_online_cpus() / 
   31.30 +            (pi->nr_nodes * pi->cores_per_socket * pi->threads_per_core);
   31.31  
   31.32 -        pi->nr_nodes         = 1;
   31.33          pi->total_pages      = total_pages;
   31.34          pi->free_pages       = avail_domheap_pages();
   31.35          pi->scrub_pages      = avail_scrub_pages();
   31.36          pi->cpu_khz          = cpu_khz;
   31.37          memset(pi->hw_cap, 0, sizeof(pi->hw_cap));
   31.38          memcpy(pi->hw_cap, boot_cpu_data.x86_capability, NCAPINTS*4);
   31.39 -        ret = 0;
   31.40 -        if ( copy_to_guest(u_sysctl, sysctl, 1) )
   31.41 -            ret = -EFAULT;
   31.42 +
   31.43 +        max_array_ent = pi->max_cpu_id;
   31.44 +        pi->max_cpu_id = last_cpu(cpu_online_map);
   31.45 +        max_array_ent = min_t(uint32_t, max_array_ent, pi->max_cpu_id);
   31.46 +
   31.47 +        ret = -EFAULT;
   31.48 +        if ( !guest_handle_is_null(pi->cpu_to_node) )
   31.49 +        {
   31.50 +            for ( i = 0; i <= max_array_ent; i++ )
   31.51 +            {
   31.52 +                uint32_t node = cpu_online(i) ? cpu_to_node(i) : ~0u;
   31.53 +                if ( copy_to_guest_offset(pi->cpu_to_node, i, &node, 1) )
   31.54 +                    break;
   31.55 +            }
   31.56 +        }
   31.57 +
   31.58 +        ret = copy_to_guest(u_sysctl, sysctl, 1) ? -EFAULT : 0;
   31.59      }
   31.60      break;
   31.61      
    32.1 --- a/xen/common/domctl.c	Fri Jul 06 16:25:10 2007 -0500
    32.2 +++ b/xen/common/domctl.c	Sat Jul 07 10:09:51 2007 +0100
    32.3 @@ -117,6 +117,7 @@ void getdomaininfo(struct domain *d, str
    32.4          (d->is_dying                ? XEN_DOMINF_dying    : 0) |
    32.5          (d->is_shut_down            ? XEN_DOMINF_shutdown : 0) |
    32.6          (d->is_paused_by_controller ? XEN_DOMINF_paused   : 0) |
    32.7 +        (d->debugger_attached       ? XEN_DOMINF_debugged : 0) |
    32.8          d->shutdown_code << XEN_DOMINF_shutdownshift;
    32.9  
   32.10      if ( is_hvm_domain(d) )
    33.1 --- a/xen/include/asm-x86/hvm/vmx/vmcs.h	Fri Jul 06 16:25:10 2007 -0500
    33.2 +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h	Sat Jul 07 10:09:51 2007 +0100
    33.3 @@ -97,7 +97,7 @@ void vmx_vmcs_exit(struct vcpu *v);
    33.4  #define CPU_BASED_VIRTUAL_INTR_PENDING        0x00000004
    33.5  #define CPU_BASED_USE_TSC_OFFSETING           0x00000008
    33.6  #define CPU_BASED_HLT_EXITING                 0x00000080
    33.7 -#define CPU_BASED_INVDPG_EXITING              0x00000200
    33.8 +#define CPU_BASED_INVLPG_EXITING              0x00000200
    33.9  #define CPU_BASED_MWAIT_EXITING               0x00000400
   33.10  #define CPU_BASED_RDPMC_EXITING               0x00000800
   33.11  #define CPU_BASED_RDTSC_EXITING               0x00001000
    34.1 --- a/xen/include/public/domctl.h	Fri Jul 06 16:25:10 2007 -0500
    34.2 +++ b/xen/include/public/domctl.h	Sat Jul 07 10:09:51 2007 +0100
    34.3 @@ -85,6 +85,9 @@ struct xen_domctl_getdomaininfo {
    34.4   /* Domain is currently running.            */
    34.5  #define _XEN_DOMINF_running   5
    34.6  #define XEN_DOMINF_running    (1U<<_XEN_DOMINF_running)
    34.7 + /* Being debugged.  */
    34.8 +#define _XEN_DOMINF_debugged  6
    34.9 +#define XEN_DOMINF_debugged   (1U<<_XEN_DOMINF_debugged)
   34.10   /* CPU to which this domain is bound.      */
   34.11  #define XEN_DOMINF_cpumask      255
   34.12  #define XEN_DOMINF_cpushift       8
    35.1 --- a/xen/include/public/sysctl.h	Fri Jul 06 16:25:10 2007 -0500
    35.2 +++ b/xen/include/public/sysctl.h	Sat Jul 07 10:09:51 2007 +0100
    35.3 @@ -34,7 +34,7 @@
    35.4  #include "xen.h"
    35.5  #include "domctl.h"
    35.6  
    35.7 -#define XEN_SYSCTL_INTERFACE_VERSION 0x00000003
    35.8 +#define XEN_SYSCTL_INTERFACE_VERSION 0x00000004
    35.9  
   35.10  /*
   35.11   * Read console content from Xen buffer ring.
   35.12 @@ -76,6 +76,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_
   35.13   */
   35.14  #define XEN_SYSCTL_physinfo          3
   35.15  struct xen_sysctl_physinfo {
   35.16 +    /* IN variables. */
   35.17      uint32_t threads_per_core;
   35.18      uint32_t cores_per_socket;
   35.19      uint32_t sockets_per_node;
   35.20 @@ -85,6 +86,23 @@ struct xen_sysctl_physinfo {
   35.21      uint64_aligned_t free_pages;
   35.22      uint64_aligned_t scrub_pages;
   35.23      uint32_t hw_cap[8];
   35.24 +
   35.25 +    /* IN/OUT variables. */
   35.26 +    /*
   35.27 +     * IN: maximum addressable entry in the caller-provided cpu_to_node array.
   35.28 +     * OUT: largest cpu identifier in the system.
   35.29 +     * If OUT is greater than IN then the cpu_to_node array is truncated!
   35.30 +     */
   35.31 +    uint32_t max_cpu_id;
   35.32 +    /*
   35.33 +     * If not NULL, this array is filled with node identifier for each cpu.
   35.34 +     * If a cpu has no node information (e.g., cpu not present) then the
   35.35 +     * sentinel value ~0u is written.
   35.36 +     * The size of this array is specified by the caller in @max_cpu_id.
   35.37 +     * If the actual @max_cpu_id is smaller than the array then the trailing
   35.38 +     * elements of the array will not be written by the sysctl.
   35.39 +     */
   35.40 +    XEN_GUEST_HANDLE_64(uint32_t) cpu_to_node;
   35.41  };
   35.42  typedef struct xen_sysctl_physinfo xen_sysctl_physinfo_t;
   35.43  DEFINE_XEN_GUEST_HANDLE(xen_sysctl_physinfo_t);
    36.1 --- a/xen/include/xen/cpumask.h	Fri Jul 06 16:25:10 2007 -0500
    36.2 +++ b/xen/include/xen/cpumask.h	Sat Jul 07 10:09:51 2007 +0100
    36.3 @@ -222,6 +222,15 @@ static inline int __next_cpu(int n, cons
    36.4  	return min_t(int, nbits, find_next_bit(srcp->bits, nbits, n+1));
    36.5  }
    36.6  
    36.7 +#define last_cpu(src) __last_cpu(&(src), NR_CPUS)
    36.8 +static inline int __last_cpu(const cpumask_t *srcp, int nbits)
    36.9 +{
   36.10 +	int cpu, pcpu = NR_CPUS;
   36.11 +	for (cpu = first_cpu(*srcp); cpu < NR_CPUS; cpu = next_cpu(cpu, *srcp))
   36.12 +		pcpu = cpu;
   36.13 +	return pcpu;
   36.14 +}
   36.15 +
   36.16  #define cpumask_of_cpu(cpu)						\
   36.17  ({									\
   36.18  	typeof(_unused_cpumask_arg_) m;					\