ia64/xen-unstable

view stubdom/stubdom-dm @ 17062:0769835cf50f

x86 shadow: Reduce scope of shadow lock.

emulate_map_dest doesn't require holding lock, since
only shadow related operation possibly involved is to
remove shadow which is less frequent and can acquire
lock inside. Rest are either guest table walk or
per-vcpu monitor table manipulation

Signed-off-by Kevin Tian <kevin.tian@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Feb 14 10:33:12 2008 +0000 (2008-02-14)
parents a905c582a406
children 2a8eaba24bf0
line source
1 #!/bin/bash
2 #
3 # Copyright 2007-2008 Samuel Thibault <samuel.thibault@eu.citrix.net>
4 #
5 # dm script around stubdomains.
6 #
8 # To fit xterms nicely
9 height=339
11 # Parse arguments
13 domid=
14 domname=
15 vncviewer=0
16 vncpid=
17 while [ "$#" -gt 0 ];
18 do
19 if [ "$#" -ge 2 ];
20 then
21 case "$1" in
22 -d) domid=$2; shift ;;
23 -domain-name) domname=$2; shift ;;
24 -vnc)
25 ip=${2%:*};
26 vnc_port=${2#*:};
27 shift
28 ;;
29 esac
30 fi
31 case "$1" in
32 -vncviewer) vncviewer=1 ;;
33 esac
34 shift
35 done
37 [ -z "$domid" ] && ( echo "couldn't find domain ID" ; exit 1 )
38 [ -z "$domname" ] && ( echo "couldn't find domain name" ; exit 1 )
40 # Termination handler
42 term() {
43 kill %1
44 (
45 [ -n "$vncpid" ] && kill -9 $vncpid
46 xm destroy stubdom-$domname
47 #xm destroy $domname
48 ) &
49 # We need to exit immediately so as to let xend do the commands above
50 exit 0
51 }
53 trap term SIGHUP
55 ############
56 # stubdomain
57 # Wait for any previous stubdom to terminate
58 while xm list | grep stubdom-$domname
59 do
60 sleep 1
61 done
63 creation="xm create -c stubdom-$domname target=$domid memory=32"
65 (while true ; do sleep 60 ; done) | $creation &
66 #xterm -geometry +0+0 -e /bin/sh -c "$creation ; echo ; echo press ENTER to shut down ; read" &
67 consolepid=$!
70 while ! vnc_port=`xenstore-read /local/domain/$domid/console/vnc-port`
71 do
72 # Check that the stubdom job is still alive
73 kill -0 $consolepid || term
74 sleep 1
75 done
77 ################
78 # DEBUG: tcpdump
79 #while ! stubdomid=`xm domid stubdom-$domname`
80 #do
81 # sleep 1
82 #done
83 #xterm -geometry 160x25+0+$height -e /bin/sh -c "tcpdump -n -i vif$stubdomid.0" &
84 #xterm -geometry 160x25+0+$((2 * $height)) -e /bin/sh -c "tcpdump -n -i vif$stubdomid.1" &
86 ###########
87 # vncviewer
88 if [ "$vncviewer" = 1 ]
89 then
90 vncviewer $ip:$vnc_port &
91 vncpid=$!
92 fi
94 # wait for SIGHUP or stubdom termination
95 wait $consolepid
97 term