ia64/xen-unstable
changeset 14794:3d356a2b1c75
merge with xen-unstable.hg
author | Alex Williamson <alex.williamson@hp.com> |
---|---|
date | Wed Apr 11 07:30:02 2007 -0600 (2007-04-11) |
parents | a6800d989059 4dc14c591e6c |
children | e4bd31a66a2e db4fcb609383 |
files | unmodified_drivers/linux-2.6/util/Kbuild unmodified_drivers/linux-2.6/util/Makefile unmodified_drivers/linux-2.6/xenbus/Kbuild unmodified_drivers/linux-2.6/xenbus/Makefile |
line diff
1.1 --- a/docs/xen-api/coversheet.tex Wed Apr 11 07:28:29 2007 -0600 1.2 +++ b/docs/xen-api/coversheet.tex Wed Apr 11 07:30:02 2007 -0600 1.3 @@ -41,22 +41,17 @@ Date: \datestring{} 1.4 \end{center} 1.5 \vspace{.5cm} 1.6 \begin{large} 1.7 -\textbf{Contributors:} 1.8 -\begin{multicols}{2}{ 1.9 -Stefan Berger, IBM \\ 1.10 -Daniel Berrang\'e, Red Hat \\ 1.11 -Gareth Bestor, IBM \\ 1.12 -Hollis Blanchard, IBM \\ 1.13 -Mike Day, IBM \\ 1.14 -Jim Fehlig, Novell \\ 1.15 -Jon Harrop, XenSource \\ 1.16 -Vincent Hanquez, XenSource \\ 1.17 -John Levon, Sun Microsystems \\ 1.18 -Jon Ludlam, XenSource \\ 1.19 -Alastair Tse, XenSource \\ 1.20 -Daniel Veillard, Red Hat \\ 1.21 -Tom Wilkie, University of Cambridge} 1.22 -\end{multicols} 1.23 +\textbf{Contributors:} \\ 1.24 +\\ 1.25 +\begin{tabular}{p{0.5\textwidth}l} 1.26 +Stefan Berger, IBM & Vincent Hanquez, XenSource \\ 1.27 +Daniel Berrang\'e, Red Hat & John Levon, Sun Microsystems \\ 1.28 +Gareth Bestor, IBM & Jon Ludlam, XenSource \\ 1.29 +Hollis Blanchard, IBM & Alastair Tse, XenSource \\ 1.30 +Mike Day, IBM & Daniel Veillard, Red Hat \\ 1.31 +Jim Fehlig, Novell & Tom Wilkie, University of Cambridge \\ 1.32 +Jon Harrop, XenSource & \\ 1.33 +\end{tabular} 1.34 \end{large} 1.35 1.36 \vfill
2.1 --- a/docs/xen-api/xenapi-datamodel.tex Wed Apr 11 07:28:29 2007 -0600 2.2 +++ b/docs/xen-api/xenapi-datamodel.tex Wed Apr 11 07:30:02 2007 -0600 2.3 @@ -1558,6 +1558,81 @@ void 2.4 \vspace{0.3cm} 2.5 \vspace{0.3cm} 2.6 \vspace{0.3cm} 2.7 +\subsubsection{RPC name:~send\_sysrq} 2.8 + 2.9 +{\bf Overview:} 2.10 +Send the given key as a sysrq to this VM. The key is specified as a single 2.11 +character (a String of length 1). This can only be called when the 2.12 +specified VM is in the Running state. 2.13 + 2.14 + \noindent {\bf Signature:} 2.15 +\begin{verbatim} void send_sysrq (session_id s, VM ref vm, string key)\end{verbatim} 2.16 + 2.17 + 2.18 +\noindent{\bf Arguments:} 2.19 + 2.20 + 2.21 +\vspace{0.3cm} 2.22 +\begin{tabular}{|c|c|p{7cm}|} 2.23 + \hline 2.24 +{\bf type} & {\bf name} & {\bf description} \\ \hline 2.25 +{\tt VM ref } & vm & The VM \\ \hline 2.26 + 2.27 +{\tt string } & key & The key to send \\ \hline 2.28 + 2.29 +\end{tabular} 2.30 + 2.31 +\vspace{0.3cm} 2.32 + 2.33 + \noindent {\bf Return Type:} 2.34 +{\tt 2.35 +void 2.36 +} 2.37 + 2.38 + 2.39 + 2.40 +\vspace{0.3cm} 2.41 + 2.42 +\noindent{\bf Possible Error Codes:} {\tt VM\_BAD\_POWER\_STATE} 2.43 + 2.44 +\vspace{0.6cm} 2.45 +\subsubsection{RPC name:~send\_trigger} 2.46 + 2.47 +{\bf Overview:} 2.48 +Send the named trigger to this VM. This can only be called when the 2.49 +specified VM is in the Running state. 2.50 + 2.51 + \noindent {\bf Signature:} 2.52 +\begin{verbatim} void send_trigger (session_id s, VM ref vm, string trigger)\end{verbatim} 2.53 + 2.54 + 2.55 +\noindent{\bf Arguments:} 2.56 + 2.57 + 2.58 +\vspace{0.3cm} 2.59 +\begin{tabular}{|c|c|p{7cm}|} 2.60 + \hline 2.61 +{\bf type} & {\bf name} & {\bf description} \\ \hline 2.62 +{\tt VM ref } & vm & The VM \\ \hline 2.63 + 2.64 +{\tt string } & trigger & The trigger to send \\ \hline 2.65 + 2.66 +\end{tabular} 2.67 + 2.68 +\vspace{0.3cm} 2.69 + 2.70 + \noindent {\bf Return Type:} 2.71 +{\tt 2.72 +void 2.73 +} 2.74 + 2.75 + 2.76 + 2.77 +\vspace{0.3cm} 2.78 + 2.79 +\noindent{\bf Possible Error Codes:} {\tt VM\_BAD\_POWER\_STATE} 2.80 + 2.81 +\vspace{0.6cm} 2.82 \subsubsection{RPC name:~get\_all} 2.83 2.84 {\bf Overview:} 2.85 @@ -4107,6 +4182,9 @@ Quals & Field & Type & Description \\ 2.86 $\mathit{RO}_\mathit{run}$ & {\tt memory/actual} & int & Guest's actual memory (bytes) \\ 2.87 $\mathit{RO}_\mathit{run}$ & {\tt VCPUs/number} & int & Current number of VCPUs \\ 2.88 $\mathit{RO}_\mathit{run}$ & {\tt VCPUs/utilisation} & (int $\rightarrow$ float) Map & Utilisation for all of guest's current VCPUs \\ 2.89 +$\mathit{RO}_\mathit{run}$ & {\tt VCPUs/CPU} & (int $\rightarrow$ int) Map & VCPU to PCPU map \\ 2.90 +$\mathit{RO}_\mathit{run}$ & {\tt VCPUs/params} & (string $\rightarrow$ string) Map & The live equivalent to VM.VCPUs\_params \\ 2.91 +$\mathit{RO}_\mathit{run}$ & {\tt start\_time} & datetime & Time at which this VM was last booted \\ 2.92 $\mathit{RO}_\mathit{run}$ & {\tt last\_updated} & datetime & Time at which this information was last updated \\ 2.93 \hline 2.94 \end{longtable} 2.95 @@ -4260,6 +4338,102 @@ value of the field 2.96 \vspace{0.3cm} 2.97 \vspace{0.3cm} 2.98 \vspace{0.3cm} 2.99 +\subsubsection{RPC name:~get\_VCPUs\_CPU} 2.100 + 2.101 +{\bf Overview:} 2.102 +Get the VCPUs/CPU field of the given VM\_metrics. 2.103 + 2.104 + \noindent {\bf Signature:} 2.105 +\begin{verbatim} ((int -> int) Map) get_VCPUs_CPU (session_id s, VM_metrics ref self)\end{verbatim} 2.106 + 2.107 + 2.108 +\noindent{\bf Arguments:} 2.109 + 2.110 + 2.111 +\vspace{0.3cm} 2.112 +\begin{tabular}{|c|c|p{7cm}|} 2.113 + \hline 2.114 +{\bf type} & {\bf name} & {\bf description} \\ \hline 2.115 +{\tt VM\_metrics ref } & self & reference to the object \\ \hline 2.116 + 2.117 +\end{tabular} 2.118 + 2.119 +\vspace{0.3cm} 2.120 + 2.121 + \noindent {\bf Return Type:} 2.122 +{\tt 2.123 +(int $\rightarrow$ int) Map 2.124 +} 2.125 + 2.126 + 2.127 +value of the field 2.128 +\vspace{0.3cm} 2.129 +\vspace{0.3cm} 2.130 +\vspace{0.3cm} 2.131 +\subsubsection{RPC name:~get\_VCPUs\_params} 2.132 + 2.133 +{\bf Overview:} 2.134 +Get the VCPUs/params field of the given VM\_metrics. 2.135 + 2.136 + \noindent {\bf Signature:} 2.137 +\begin{verbatim} ((string -> string) Map) get_VCPUs_params (session_id s, VM_metrics ref self)\end{verbatim} 2.138 + 2.139 + 2.140 +\noindent{\bf Arguments:} 2.141 + 2.142 + 2.143 +\vspace{0.3cm} 2.144 +\begin{tabular}{|c|c|p{7cm}|} 2.145 + \hline 2.146 +{\bf type} & {\bf name} & {\bf description} \\ \hline 2.147 +{\tt VM\_metrics ref } & self & reference to the object \\ \hline 2.148 + 2.149 +\end{tabular} 2.150 + 2.151 +\vspace{0.3cm} 2.152 + 2.153 + \noindent {\bf Return Type:} 2.154 +{\tt 2.155 +(string $\rightarrow$ string) Map 2.156 +} 2.157 + 2.158 + 2.159 +value of the field 2.160 +\vspace{0.3cm} 2.161 +\vspace{0.3cm} 2.162 +\vspace{0.3cm} 2.163 +\subsubsection{RPC name:~get\_start\_time} 2.164 + 2.165 +{\bf Overview:} 2.166 +Get the start\_time field of the given VM\_metrics. 2.167 + 2.168 + \noindent {\bf Signature:} 2.169 +\begin{verbatim} datetime get_start_time (session_id s, VM_metrics ref self)\end{verbatim} 2.170 + 2.171 + 2.172 +\noindent{\bf Arguments:} 2.173 + 2.174 + 2.175 +\vspace{0.3cm} 2.176 +\begin{tabular}{|c|c|p{7cm}|} 2.177 + \hline 2.178 +{\bf type} & {\bf name} & {\bf description} \\ \hline 2.179 +{\tt VM\_metrics ref } & self & reference to the object \\ \hline 2.180 + 2.181 +\end{tabular} 2.182 + 2.183 +\vspace{0.3cm} 2.184 + 2.185 + \noindent {\bf Return Type:} 2.186 +{\tt 2.187 +datetime 2.188 +} 2.189 + 2.190 + 2.191 +value of the field 2.192 +\vspace{0.3cm} 2.193 +\vspace{0.3cm} 2.194 +\vspace{0.3cm} 2.195 \subsubsection{RPC name:~get\_last\_updated} 2.196 2.197 {\bf Overview:} 2.198 @@ -4744,6 +4918,8 @@ Quals & Field & Type & Description \\ 2.199 $\mathit{RO}_\mathit{run}$ & {\tt software\_version} & (string $\rightarrow$ string) Map & version strings \\ 2.200 $\mathit{RW}$ & {\tt other\_config} & (string $\rightarrow$ string) Map & additional configuration \\ 2.201 $\mathit{RO}_\mathit{run}$ & {\tt capabilities} & string Set & Xen capabilities \\ 2.202 +$\mathit{RO}_\mathit{run}$ & {\tt cpu\_configuration} & (string $\rightarrow$ string) Map & The CPU configuration on this host. May contain keys such as ``nr\_nodes'', ``sockets\_per\_node'', ``cores\_per\_socket'', or ``threads\_per\_core'' \\ 2.203 +$\mathit{RO}_\mathit{run}$ & {\tt sched\_policy} & string & Scheduler policy currently in force on this host \\ 2.204 $\mathit{RO}_\mathit{run}$ & {\tt supported\_bootloaders} & string Set & a list of the bootloaders installed on the machine \\ 2.205 $\mathit{RO}_\mathit{run}$ & {\tt resident\_VMs} & (VM ref) Set & list of VMs currently resident on host \\ 2.206 $\mathit{RW}$ & {\tt logging} & (string $\rightarrow$ string) Map & logging configuration \\ 2.207 @@ -4919,6 +5095,104 @@ dmesg string 2.208 \vspace{0.3cm} 2.209 \vspace{0.3cm} 2.210 \vspace{0.3cm} 2.211 +\subsubsection{RPC name:~dmesg\_clear} 2.212 + 2.213 +{\bf Overview:} 2.214 +Get the host xen dmesg, and clear the buffer. 2.215 + 2.216 + \noindent {\bf Signature:} 2.217 +\begin{verbatim} string dmesg_clear (session_id s, host ref host)\end{verbatim} 2.218 + 2.219 + 2.220 +\noindent{\bf Arguments:} 2.221 + 2.222 + 2.223 +\vspace{0.3cm} 2.224 +\begin{tabular}{|c|c|p{7cm}|} 2.225 + \hline 2.226 +{\bf type} & {\bf name} & {\bf description} \\ \hline 2.227 +{\tt host ref } & host & The Host to query \\ \hline 2.228 + 2.229 +\end{tabular} 2.230 + 2.231 +\vspace{0.3cm} 2.232 + 2.233 + \noindent {\bf Return Type:} 2.234 +{\tt 2.235 +string 2.236 +} 2.237 + 2.238 + 2.239 +dmesg string 2.240 +\vspace{0.3cm} 2.241 +\vspace{0.3cm} 2.242 +\vspace{0.3cm} 2.243 +\subsubsection{RPC name:~get\_log} 2.244 + 2.245 +{\bf Overview:} 2.246 +Get the host's log file. 2.247 + 2.248 + \noindent {\bf Signature:} 2.249 +\begin{verbatim} string get_log (session_id s, host ref host)\end{verbatim} 2.250 + 2.251 + 2.252 +\noindent{\bf Arguments:} 2.253 + 2.254 + 2.255 +\vspace{0.3cm} 2.256 +\begin{tabular}{|c|c|p{7cm}|} 2.257 + \hline 2.258 +{\bf type} & {\bf name} & {\bf description} \\ \hline 2.259 +{\tt host ref } & host & The Host to query \\ \hline 2.260 + 2.261 +\end{tabular} 2.262 + 2.263 +\vspace{0.3cm} 2.264 + 2.265 + \noindent {\bf Return Type:} 2.266 +{\tt 2.267 +string 2.268 +} 2.269 + 2.270 + 2.271 +The contents of the host's primary log file 2.272 +\vspace{0.3cm} 2.273 +\vspace{0.3cm} 2.274 +\vspace{0.3cm} 2.275 +\subsubsection{RPC name:~send\_debug\_keys} 2.276 + 2.277 +{\bf Overview:} 2.278 +Inject the given string as debugging keys into Xen. 2.279 + 2.280 + \noindent {\bf Signature:} 2.281 +\begin{verbatim} void send_debug_keys (session_id s, host ref host, string keys)\end{verbatim} 2.282 + 2.283 + 2.284 +\noindent{\bf Arguments:} 2.285 + 2.286 + 2.287 +\vspace{0.3cm} 2.288 +\begin{tabular}{|c|c|p{7cm}|} 2.289 + \hline 2.290 +{\bf type} & {\bf name} & {\bf description} \\ \hline 2.291 +{\tt host ref } & host & The host \\ \hline 2.292 + 2.293 +{\tt string } & keys & The keys to send \\ \hline 2.294 + 2.295 +\end{tabular} 2.296 + 2.297 +\vspace{0.3cm} 2.298 + 2.299 + \noindent {\bf Return Type:} 2.300 +{\tt 2.301 +void 2.302 +} 2.303 + 2.304 + 2.305 + 2.306 +\vspace{0.3cm} 2.307 +\vspace{0.3cm} 2.308 +\vspace{0.3cm} 2.309 \subsubsection{RPC name:~list\_methods} 2.310 2.311 {\bf Overview:} 2.312 @@ -5454,6 +5728,70 @@ value of the field 2.313 \vspace{0.3cm} 2.314 \vspace{0.3cm} 2.315 \vspace{0.3cm} 2.316 +\subsubsection{RPC name:~get\_cpu\_configuration} 2.317 + 2.318 +{\bf Overview:} 2.319 +Get the cpu\_configuration field of the given host. 2.320 + 2.321 + \noindent {\bf Signature:} 2.322 +\begin{verbatim} ((string -> string) Map) get_cpu_configuration (session_id s, host ref self)\end{verbatim} 2.323 + 2.324 + 2.325 +\noindent{\bf Arguments:} 2.326 + 2.327 + 2.328 +\vspace{0.3cm} 2.329 +\begin{tabular}{|c|c|p{7cm}|} 2.330 + \hline 2.331 +{\bf type} & {\bf name} & {\bf description} \\ \hline 2.332 +{\tt host ref } & self & reference to the object \\ \hline 2.333 + 2.334 +\end{tabular} 2.335 + 2.336 +\vspace{0.3cm} 2.337 + 2.338 + \noindent {\bf Return Type:} 2.339 +{\tt 2.340 +(string $\rightarrow$ string) Map 2.341 +} 2.342 + 2.343 + 2.344 +value of the field 2.345 +\vspace{0.3cm} 2.346 +\vspace{0.3cm} 2.347 +\vspace{0.3cm} 2.348 +\subsubsection{RPC name:~get\_sched\_policy} 2.349 + 2.350 +{\bf Overview:} 2.351 +Get the sched\_policy field of the given host. 2.352 + 2.353 + \noindent {\bf Signature:} 2.354 +\begin{verbatim} string get_sched_policy (session_id s, host ref self)\end{verbatim} 2.355 + 2.356 + 2.357 +\noindent{\bf Arguments:} 2.358 + 2.359 + 2.360 +\vspace{0.3cm} 2.361 +\begin{tabular}{|c|c|p{7cm}|} 2.362 + \hline 2.363 +{\bf type} & {\bf name} & {\bf description} \\ \hline 2.364 +{\tt host ref } & self & reference to the object \\ \hline 2.365 + 2.366 +\end{tabular} 2.367 + 2.368 +\vspace{0.3cm} 2.369 + 2.370 + \noindent {\bf Return Type:} 2.371 +{\tt 2.372 +string 2.373 +} 2.374 + 2.375 + 2.376 +value of the field 2.377 +\vspace{0.3cm} 2.378 +\vspace{0.3cm} 2.379 +\vspace{0.3cm} 2.380 \subsubsection{RPC name:~get\_supported\_bootloaders} 2.381 2.382 {\bf Overview:}
3.1 --- a/docs/xen-api/xenapi.tex Wed Apr 11 07:28:29 2007 -0600 3.2 +++ b/docs/xen-api/xenapi.tex Wed Apr 11 07:30:02 2007 -0600 3.3 @@ -17,7 +17,6 @@ 3.4 \usepackage{graphics} 3.5 \usepackage{longtable} 3.6 \usepackage{fancyhdr} 3.7 -\usepackage{multicol} 3.8 3.9 \setlength\topskip{0cm} 3.10 \setlength\topmargin{0cm}
4.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c Wed Apr 11 07:28:29 2007 -0600 4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/machine_reboot.c Wed Apr 11 07:30:02 2007 -0600 4.3 @@ -127,8 +127,10 @@ static int take_machine_down(void *p_fas 4.4 extern void time_resume(void); 4.5 4.6 if (fast_suspend) { 4.7 - preempt_disable(); 4.8 + BUG_ON(!irqs_disabled()); 4.9 } else { 4.10 + BUG_ON(irqs_disabled()); 4.11 + 4.12 for (;;) { 4.13 err = smp_suspend(); 4.14 if (err) 4.15 @@ -143,11 +145,11 @@ static int take_machine_down(void *p_fas 4.16 preempt_enable(); 4.17 xenbus_suspend_cancel(); 4.18 } 4.19 + 4.20 + local_irq_disable(); 4.21 } 4.22 4.23 mm_pin_all(); 4.24 - local_irq_disable(); 4.25 - preempt_enable(); 4.26 gnttab_suspend(); 4.27 pre_suspend(); 4.28 4.29 @@ -178,7 +180,9 @@ static int take_machine_down(void *p_fas 4.30 #endif 4.31 } 4.32 time_resume(); 4.33 - local_irq_enable(); 4.34 + 4.35 + if (!fast_suspend) 4.36 + local_irq_enable(); 4.37 4.38 return suspend_cancelled; 4.39 }
5.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c Wed Apr 11 07:28:29 2007 -0600 5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c Wed Apr 11 07:30:02 2007 -0600 5.3 @@ -34,28 +34,7 @@ static int fast_suspend; 5.4 static void __shutdown_handler(void *unused); 5.5 static DECLARE_WORK(shutdown_work, __shutdown_handler, NULL); 5.6 5.7 -#ifdef CONFIG_XEN 5.8 int __xen_suspend(int fast_suspend); 5.9 -#else 5.10 -extern void xenbus_suspend(void); 5.11 -extern void xenbus_resume(void); 5.12 -extern void platform_pci_suspend(void); 5.13 -extern void platform_pci_resume(void); 5.14 -int __xen_suspend(int fast_suspend) 5.15 -{ 5.16 - xenbus_suspend(); 5.17 - platform_pci_suspend(); 5.18 - 5.19 - /* pvdrv sleep in this hyper-call when save */ 5.20 - HYPERVISOR_shutdown(SHUTDOWN_suspend); 5.21 - 5.22 - platform_pci_resume(); 5.23 - xenbus_resume(); 5.24 - printk("PV stuff on HVM resume successfully!\n"); 5.25 - 5.26 - return 0; 5.27 -} 5.28 -#endif 5.29 5.30 static int shutdown_process(void *__unused) 5.31 { 5.32 @@ -210,13 +189,11 @@ static struct xenbus_watch shutdown_watc 5.33 }; 5.34 5.35 static struct xenbus_watch sysrq_watch = { 5.36 - .node ="control/sysrq", 5.37 + .node = "control/sysrq", 5.38 .callback = sysrq_handler 5.39 }; 5.40 5.41 -static int setup_shutdown_watcher(struct notifier_block *notifier, 5.42 - unsigned long event, 5.43 - void *data) 5.44 +static int setup_shutdown_watcher(void) 5.45 { 5.46 int err; 5.47 5.48 @@ -225,24 +202,36 @@ static int setup_shutdown_watcher(struct 5.49 "%d", &fast_suspend); 5.50 5.51 err = register_xenbus_watch(&shutdown_watch); 5.52 - if (err) 5.53 + if (err) { 5.54 printk(KERN_ERR "Failed to set shutdown watcher\n"); 5.55 - else 5.56 - xenbus_write(XBT_NIL, "control", "feature-reboot", "1"); 5.57 + return err; 5.58 + } 5.59 + xenbus_write(XBT_NIL, "control", "feature-reboot", "1"); 5.60 5.61 err = register_xenbus_watch(&sysrq_watch); 5.62 - if (err) 5.63 + if (err) { 5.64 printk(KERN_ERR "Failed to set sysrq watcher\n"); 5.65 - else 5.66 - xenbus_write(XBT_NIL, "control", "feature-sysrq", "1"); 5.67 + return err; 5.68 + } 5.69 + xenbus_write(XBT_NIL, "control", "feature-sysrq", "1"); 5.70 + 5.71 + return 0; 5.72 +} 5.73 5.74 +#ifdef CONFIG_XEN 5.75 + 5.76 +static int shutdown_event(struct notifier_block *notifier, 5.77 + unsigned long event, 5.78 + void *data) 5.79 +{ 5.80 + setup_shutdown_watcher(); 5.81 return NOTIFY_DONE; 5.82 } 5.83 5.84 static int __init setup_shutdown_event(void) 5.85 { 5.86 static struct notifier_block xenstore_notifier = { 5.87 - .notifier_call = setup_shutdown_watcher 5.88 + .notifier_call = shutdown_event 5.89 }; 5.90 register_xenstore_notifier(&xenstore_notifier); 5.91 5.92 @@ -250,3 +239,12 @@ static int __init setup_shutdown_event(v 5.93 } 5.94 5.95 subsys_initcall(setup_shutdown_event); 5.96 + 5.97 +#else /* !defined(CONFIG_XEN) */ 5.98 + 5.99 +int xen_reboot_init(void) 5.100 +{ 5.101 + return setup_shutdown_watcher(); 5.102 +} 5.103 + 5.104 +#endif /* !defined(CONFIG_XEN) */
6.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c Wed Apr 11 07:28:29 2007 -0600 6.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c Wed Apr 11 07:30:02 2007 -0600 6.3 @@ -394,8 +394,7 @@ static const struct file_operations xenb 6.4 .poll = xenbus_dev_poll, 6.5 }; 6.6 6.7 -int __init 6.8 -xenbus_dev_init(void) 6.9 +int xenbus_dev_init(void) 6.10 { 6.11 xenbus_dev_intf = create_xen_proc_entry("xenbus", 0400); 6.12 if (xenbus_dev_intf)
7.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Wed Apr 11 07:28:29 2007 -0600 7.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Wed Apr 11 07:30:02 2007 -0600 7.3 @@ -863,7 +863,7 @@ static int xsd_port_read(char *page, cha 7.4 } 7.5 #endif 7.6 7.7 -static int __init xenbus_probe_init(void) 7.8 +static int xenbus_probe_init(void) 7.9 { 7.10 int err = 0; 7.11 unsigned long page = 0; 7.12 @@ -978,10 +978,15 @@ static int __init xenbus_probe_init(void 7.13 return err; 7.14 } 7.15 7.16 +#ifdef CONFIG_XEN 7.17 postcore_initcall(xenbus_probe_init); 7.18 - 7.19 MODULE_LICENSE("Dual BSD/GPL"); 7.20 - 7.21 +#else 7.22 +int xenbus_init(void) 7.23 +{ 7.24 + return xenbus_probe_init(); 7.25 +} 7.26 +#endif 7.27 7.28 static int is_disconnected_device(struct device *dev, void *data) 7.29 {
8.1 --- a/linux-2.6-xen-sparse/include/xen/xenbus.h Wed Apr 11 07:28:29 2007 -0600 8.2 +++ b/linux-2.6-xen-sparse/include/xen/xenbus.h Wed Apr 11 07:30:02 2007 -0600 8.3 @@ -293,7 +293,7 @@ void xenbus_dev_error(struct xenbus_devi 8.4 void xenbus_dev_fatal(struct xenbus_device *dev, int err, const char *fmt, 8.5 ...); 8.6 8.7 -int __init xenbus_dev_init(void); 8.8 +int xenbus_dev_init(void); 8.9 8.10 const char *xenbus_strstate(enum xenbus_state state); 8.11 int xenbus_dev_is_online(struct xenbus_device *dev);
9.1 --- a/tools/libxc/xc_domain_restore.c Wed Apr 11 07:28:29 2007 -0600 9.2 +++ b/tools/libxc/xc_domain_restore.c Wed Apr 11 07:30:02 2007 -0600 9.3 @@ -119,6 +119,7 @@ static int uncanonicalize_pagetable(int 9.4 { 9.5 /* Have a 'valid' PFN without a matching MFN - need to alloc */ 9.6 p2m_batch[nr_mfns++] = pfn; 9.7 + p2m[pfn]--; 9.8 } 9.9 } 9.10 9.11 @@ -146,8 +147,8 @@ static int uncanonicalize_pagetable(int 9.12 continue; 9.13 9.14 pfn = (pte >> PAGE_SHIFT) & MFN_MASK_X86; 9.15 - 9.16 - if ( p2m[pfn] == INVALID_P2M_ENTRY ) 9.17 + 9.18 + if ( p2m[pfn] == (INVALID_P2M_ENTRY-1) ) 9.19 p2m[pfn] = p2m_batch[nr_mfns++]; 9.20 9.21 pte &= ~MADDR_MASK_X86; 9.22 @@ -489,6 +490,7 @@ int xc_domain_restore(int xc_handle, int 9.23 { 9.24 /* Have a live PFN which hasn't had an MFN allocated */ 9.25 p2m_batch[nr_mfns++] = pfn; 9.26 + p2m[pfn]--; 9.27 } 9.28 } 9.29 9.30 @@ -514,7 +516,7 @@ int xc_domain_restore(int xc_handle, int 9.31 region_mfn[i] = ~0UL; /* map will fail but we don't care */ 9.32 else 9.33 { 9.34 - if ( p2m[pfn] == INVALID_P2M_ENTRY ) 9.35 + if ( p2m[pfn] == (INVALID_P2M_ENTRY-1) ) 9.36 { 9.37 /* We just allocated a new mfn above; update p2m */ 9.38 p2m[pfn] = p2m_batch[nr_mfns++];
10.1 --- a/tools/libxen/include/xen_host.h Wed Apr 11 07:28:29 2007 -0600 10.2 +++ b/tools/libxen/include/xen_host.h Wed Apr 11 07:30:02 2007 -0600 10.3 @@ -79,6 +79,8 @@ typedef struct xen_host_record 10.4 xen_string_string_map *software_version; 10.5 xen_string_string_map *other_config; 10.6 struct xen_string_set *capabilities; 10.7 + xen_string_string_map *cpu_configuration; 10.8 + char *sched_policy; 10.9 struct xen_string_set *supported_bootloaders; 10.10 struct xen_vm_record_opt_set *resident_vms; 10.11 xen_string_string_map *logging; 10.12 @@ -261,6 +263,20 @@ xen_host_get_capabilities(xen_session *s 10.13 10.14 10.15 /** 10.16 + * Get the cpu_configuration field of the given host. 10.17 + */ 10.18 +extern bool 10.19 +xen_host_get_cpu_configuration(xen_session *session, xen_string_string_map **result, xen_host host); 10.20 + 10.21 + 10.22 +/** 10.23 + * Get the sched_policy field of the given host. 10.24 + */ 10.25 +extern bool 10.26 +xen_host_get_sched_policy(xen_session *session, char **result, xen_host host); 10.27 + 10.28 + 10.29 +/** 10.30 * Get the supported_bootloaders field of the given host. 10.31 */ 10.32 extern bool 10.33 @@ -414,7 +430,7 @@ xen_host_enable(xen_session *session, xe 10.34 10.35 /** 10.36 * Shutdown the host. (This function can only be called if there are no 10.37 - * currently running VMs on the host and it is disabled.) 10.38 + * currently running VMs on the host and it is disabled.). 10.39 */ 10.40 extern bool 10.41 xen_host_shutdown(xen_session *session, xen_host host); 10.42 @@ -422,7 +438,7 @@ xen_host_shutdown(xen_session *session, 10.43 10.44 /** 10.45 * Reboot the host. (This function can only be called if there are no 10.46 - * currently running VMs on the host and it is disabled.) 10.47 + * currently running VMs on the host and it is disabled.). 10.48 */ 10.49 extern bool 10.50 xen_host_reboot(xen_session *session, xen_host host); 10.51 @@ -436,6 +452,27 @@ xen_host_dmesg(xen_session *session, cha 10.52 10.53 10.54 /** 10.55 + * Get the host xen dmesg, and clear the buffer. 10.56 + */ 10.57 +extern bool 10.58 +xen_host_dmesg_clear(xen_session *session, char **result, xen_host host); 10.59 + 10.60 + 10.61 +/** 10.62 + * Get the host's log file. 10.63 + */ 10.64 +extern bool 10.65 +xen_host_get_log(xen_session *session, char **result, xen_host host); 10.66 + 10.67 + 10.68 +/** 10.69 + * Inject the given string as debugging keys into Xen. 10.70 + */ 10.71 +extern bool 10.72 +xen_host_send_debug_keys(xen_session *session, xen_host host, char *keys); 10.73 + 10.74 + 10.75 +/** 10.76 * List all supported methods. 10.77 */ 10.78 extern bool
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/tools/libxen/include/xen_int_int_map.h Wed Apr 11 07:30:02 2007 -0600 11.3 @@ -0,0 +1,53 @@ 11.4 +/* 11.5 + * Copyright (c) 2006-2007, XenSource Inc. 11.6 + * 11.7 + * This library is free software; you can redistribute it and/or 11.8 + * modify it under the terms of the GNU Lesser General Public 11.9 + * License as published by the Free Software Foundation; either 11.10 + * version 2.1 of the License, or (at your option) any later version. 11.11 + * 11.12 + * This library is distributed in the hope that it will be useful, 11.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 11.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11.15 + * Lesser General Public License for more details. 11.16 + * 11.17 + * You should have received a copy of the GNU Lesser General Public 11.18 + * License along with this library; if not, write to the Free Software 11.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11.20 + */ 11.21 + 11.22 +#ifndef XEN_INT_INT_MAP_H 11.23 +#define XEN_INT_INT_MAP_H 11.24 + 11.25 + 11.26 +#include "xen_common.h" 11.27 + 11.28 + 11.29 +typedef struct xen_int_int_map_contents 11.30 +{ 11.31 + int64_t key; 11.32 + int64_t val; 11.33 +} xen_int_int_map_contents; 11.34 + 11.35 + 11.36 +typedef struct xen_int_int_map 11.37 +{ 11.38 + size_t size; 11.39 + xen_int_int_map_contents contents[]; 11.40 +} xen_int_int_map; 11.41 + 11.42 +/** 11.43 + * Allocate a xen_int_int_map of the given size. 11.44 + */ 11.45 +extern xen_int_int_map * 11.46 +xen_int_int_map_alloc(size_t size); 11.47 + 11.48 +/** 11.49 + * Free the given xen_int_int_map, and all referenced values. The 11.50 + * given map must have been allocated by this library. 11.51 + */ 11.52 +extern void 11.53 +xen_int_int_map_free(xen_int_int_map *map); 11.54 + 11.55 + 11.56 +#endif
12.1 --- a/tools/libxen/include/xen_internal.h Wed Apr 11 07:28:29 2007 -0600 12.2 +++ b/tools/libxen/include/xen_internal.h Wed Apr 11 07:30:02 2007 -0600 12.3 @@ -86,6 +86,7 @@ extern const abstract_type abstract_type 12.4 12.5 extern const abstract_type abstract_type_string_string_map; 12.6 extern const abstract_type abstract_type_int_float_map; 12.7 +extern const abstract_type abstract_type_int_int_map; 12.8 12.9 12.10 typedef struct abstract_value
13.1 --- a/tools/libxen/include/xen_vm.h Wed Apr 11 07:28:29 2007 -0600 13.2 +++ b/tools/libxen/include/xen_vm.h Wed Apr 11 07:30:02 2007 -0600 13.3 @@ -838,6 +838,23 @@ xen_vm_set_vcpus_number_live(xen_session 13.4 13.5 13.6 /** 13.7 + * Send the given key as a sysrq to this VM. The key is specified as a 13.8 + * single character (a String of length 1). This can only be called when the 13.9 + * specified VM is in the Running state. 13.10 + */ 13.11 +extern bool 13.12 +xen_vm_send_sysrq(xen_session *session, xen_vm vm, char *key); 13.13 + 13.14 + 13.15 +/** 13.16 + * Send the named trigger to this VM. This can only be called when the 13.17 + * specified VM is in the Running state. 13.18 + */ 13.19 +extern bool 13.20 +xen_vm_send_trigger(xen_session *session, xen_vm vm, char *trigger); 13.21 + 13.22 + 13.23 +/** 13.24 * Return a list of all the VMs known to the system. 13.25 */ 13.26 extern bool
14.1 --- a/tools/libxen/include/xen_vm_metrics.h Wed Apr 11 07:28:29 2007 -0600 14.2 +++ b/tools/libxen/include/xen_vm_metrics.h Wed Apr 11 07:30:02 2007 -0600 14.3 @@ -21,6 +21,8 @@ 14.4 14.5 #include "xen_common.h" 14.6 #include "xen_int_float_map.h" 14.7 +#include "xen_int_int_map.h" 14.8 +#include "xen_string_string_map.h" 14.9 #include "xen_vm_metrics_decl.h" 14.10 14.11 14.12 @@ -66,6 +68,9 @@ typedef struct xen_vm_metrics_record 14.13 int64_t memory_actual; 14.14 int64_t vcpus_number; 14.15 xen_int_float_map *vcpus_utilisation; 14.16 + xen_int_int_map *vcpus_cpu; 14.17 + xen_string_string_map *vcpus_params; 14.18 + time_t start_time; 14.19 time_t last_updated; 14.20 } xen_vm_metrics_record; 14.21 14.22 @@ -191,6 +196,27 @@ xen_vm_metrics_get_vcpus_utilisation(xen 14.23 14.24 14.25 /** 14.26 + * Get the VCPUs/CPU field of the given VM_metrics. 14.27 + */ 14.28 +extern bool 14.29 +xen_vm_metrics_get_vcpus_cpu(xen_session *session, xen_int_int_map **result, xen_vm_metrics vm_metrics); 14.30 + 14.31 + 14.32 +/** 14.33 + * Get the VCPUs/params field of the given VM_metrics. 14.34 + */ 14.35 +extern bool 14.36 +xen_vm_metrics_get_vcpus_params(xen_session *session, xen_string_string_map **result, xen_vm_metrics vm_metrics); 14.37 + 14.38 + 14.39 +/** 14.40 + * Get the start_time field of the given VM_metrics. 14.41 + */ 14.42 +extern bool 14.43 +xen_vm_metrics_get_start_time(xen_session *session, time_t *result, xen_vm_metrics vm_metrics); 14.44 + 14.45 + 14.46 +/** 14.47 * Get the last_updated field of the given VM_metrics. 14.48 */ 14.49 extern bool
15.1 --- a/tools/libxen/src/xen_common.c Wed Apr 11 07:28:29 2007 -0600 15.2 +++ b/tools/libxen/src/xen_common.c Wed Apr 11 07:30:02 2007 -0600 15.3 @@ -35,6 +35,7 @@ 15.4 #include "xen_host.h" 15.5 #include "xen_internal.h" 15.6 #include "xen_int_float_map.h" 15.7 +#include "xen_int_int_map.h" 15.8 #include "xen_string_string_map.h" 15.9 15.10 15.11 @@ -1697,3 +1698,21 @@ const abstract_type abstract_type_int_fl 15.12 .struct_size = sizeof(xen_int_float_map_contents), 15.13 .members = int_float_members 15.14 }; 15.15 + 15.16 +static struct struct_member int_int_members[] = 15.17 +{ 15.18 + { 15.19 + .type = &abstract_type_int, 15.20 + .offset = offsetof(xen_int_int_map_contents, key) 15.21 + }, 15.22 + { 15.23 + .type = &abstract_type_int, 15.24 + .offset = offsetof(xen_int_int_map_contents, val) 15.25 + } 15.26 +}; 15.27 +const abstract_type abstract_type_int_int_map = 15.28 + { 15.29 + .typename = MAP, 15.30 + .struct_size = sizeof(xen_int_int_map_contents), 15.31 + .members = int_int_members 15.32 + };
16.1 --- a/tools/libxen/src/xen_host.c Wed Apr 11 07:28:29 2007 -0600 16.2 +++ b/tools/libxen/src/xen_host.c Wed Apr 11 07:30:02 2007 -0600 16.3 @@ -73,6 +73,12 @@ static const struct_member xen_host_reco 16.4 { .key = "capabilities", 16.5 .type = &abstract_type_string_set, 16.6 .offset = offsetof(xen_host_record, capabilities) }, 16.7 + { .key = "cpu_configuration", 16.8 + .type = &abstract_type_string_string_map, 16.9 + .offset = offsetof(xen_host_record, cpu_configuration) }, 16.10 + { .key = "sched_policy", 16.11 + .type = &abstract_type_string, 16.12 + .offset = offsetof(xen_host_record, sched_policy) }, 16.13 { .key = "supported_bootloaders", 16.14 .type = &abstract_type_string_set, 16.15 .offset = offsetof(xen_host_record, supported_bootloaders) }, 16.16 @@ -128,6 +134,8 @@ xen_host_record_free(xen_host_record *re 16.17 xen_string_string_map_free(record->software_version); 16.18 xen_string_string_map_free(record->other_config); 16.19 xen_string_set_free(record->capabilities); 16.20 + xen_string_string_map_free(record->cpu_configuration); 16.21 + free(record->sched_policy); 16.22 xen_string_set_free(record->supported_bootloaders); 16.23 xen_vm_record_opt_set_free(record->resident_vms); 16.24 xen_string_string_map_free(record->logging); 16.25 @@ -350,6 +358,40 @@ xen_host_get_capabilities(xen_session *s 16.26 16.27 16.28 bool 16.29 +xen_host_get_cpu_configuration(xen_session *session, xen_string_string_map **result, xen_host host) 16.30 +{ 16.31 + abstract_value param_values[] = 16.32 + { 16.33 + { .type = &abstract_type_string, 16.34 + .u.string_val = host } 16.35 + }; 16.36 + 16.37 + abstract_type result_type = abstract_type_string_string_map; 16.38 + 16.39 + *result = NULL; 16.40 + XEN_CALL_("host.get_cpu_configuration"); 16.41 + return session->ok; 16.42 +} 16.43 + 16.44 + 16.45 +bool 16.46 +xen_host_get_sched_policy(xen_session *session, char **result, xen_host host) 16.47 +{ 16.48 + abstract_value param_values[] = 16.49 + { 16.50 + { .type = &abstract_type_string, 16.51 + .u.string_val = host } 16.52 + }; 16.53 + 16.54 + abstract_type result_type = abstract_type_string; 16.55 + 16.56 + *result = NULL; 16.57 + XEN_CALL_("host.get_sched_policy"); 16.58 + return session->ok; 16.59 +} 16.60 + 16.61 + 16.62 +bool 16.63 xen_host_get_supported_bootloaders(xen_session *session, struct xen_string_set **result, xen_host host) 16.64 { 16.65 abstract_value param_values[] = 16.66 @@ -740,6 +782,56 @@ xen_host_dmesg(xen_session *session, cha 16.67 16.68 16.69 bool 16.70 +xen_host_dmesg_clear(xen_session *session, char **result, xen_host host) 16.71 +{ 16.72 + abstract_value param_values[] = 16.73 + { 16.74 + { .type = &abstract_type_string, 16.75 + .u.string_val = host } 16.76 + }; 16.77 + 16.78 + abstract_type result_type = abstract_type_string; 16.79 + 16.80 + *result = NULL; 16.81 + XEN_CALL_("host.dmesg_clear"); 16.82 + return session->ok; 16.83 +} 16.84 + 16.85 + 16.86 +bool 16.87 +xen_host_get_log(xen_session *session, char **result, xen_host host) 16.88 +{ 16.89 + abstract_value param_values[] = 16.90 + { 16.91 + { .type = &abstract_type_string, 16.92 + .u.string_val = host } 16.93 + }; 16.94 + 16.95 + abstract_type result_type = abstract_type_string; 16.96 + 16.97 + *result = NULL; 16.98 + XEN_CALL_("host.get_log"); 16.99 + return session->ok; 16.100 +} 16.101 + 16.102 + 16.103 +bool 16.104 +xen_host_send_debug_keys(xen_session *session, xen_host host, char *keys) 16.105 +{ 16.106 + abstract_value param_values[] = 16.107 + { 16.108 + { .type = &abstract_type_string, 16.109 + .u.string_val = host }, 16.110 + { .type = &abstract_type_string, 16.111 + .u.string_val = keys } 16.112 + }; 16.113 + 16.114 + xen_call_(session, "host.send_debug_keys", param_values, 2, NULL, NULL); 16.115 + return session->ok; 16.116 +} 16.117 + 16.118 + 16.119 +bool 16.120 xen_host_list_methods(xen_session *session, struct xen_string_set **result) 16.121 { 16.122
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 17.2 +++ b/tools/libxen/src/xen_int_int_map.c Wed Apr 11 07:30:02 2007 -0600 17.3 @@ -0,0 +1,39 @@ 17.4 +/* 17.5 + * Copyright (c) 2006-2007, XenSource Inc. 17.6 + * 17.7 + * This library is free software; you can redistribute it and/or 17.8 + * modify it under the terms of the GNU Lesser General Public 17.9 + * License as published by the Free Software Foundation; either 17.10 + * version 2.1 of the License, or (at your option) any later version. 17.11 + * 17.12 + * This library is distributed in the hope that it will be useful, 17.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 17.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17.15 + * Lesser General Public License for more details. 17.16 + * 17.17 + * You should have received a copy of the GNU Lesser General Public 17.18 + * License along with this library; if not, write to the Free Software 17.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17.20 + */ 17.21 + 17.22 + 17.23 +#include "xen_common.h" 17.24 +#include "xen_int_int_map.h" 17.25 +#include "xen_internal.h" 17.26 + 17.27 + 17.28 +xen_int_int_map * 17.29 +xen_int_int_map_alloc(size_t size) 17.30 +{ 17.31 + xen_int_int_map *result = calloc(1, sizeof(xen_int_int_map) + 17.32 + size * sizeof(struct xen_int_int_map_contents)); 17.33 + result->size = size; 17.34 + return result; 17.35 +} 17.36 + 17.37 + 17.38 +void 17.39 +xen_int_int_map_free(xen_int_int_map *map) 17.40 +{ 17.41 + free(map); 17.42 +}
18.1 --- a/tools/libxen/src/xen_vm.c Wed Apr 11 07:28:29 2007 -0600 18.2 +++ b/tools/libxen/src/xen_vm.c Wed Apr 11 07:30:02 2007 -0600 18.3 @@ -1610,6 +1610,38 @@ xen_vm_set_vcpus_number_live(xen_session 18.4 18.5 18.6 bool 18.7 +xen_vm_send_sysrq(xen_session *session, xen_vm vm, char *key) 18.8 +{ 18.9 + abstract_value param_values[] = 18.10 + { 18.11 + { .type = &abstract_type_string, 18.12 + .u.string_val = vm }, 18.13 + { .type = &abstract_type_string, 18.14 + .u.string_val = key } 18.15 + }; 18.16 + 18.17 + xen_call_(session, "VM.send_sysrq", param_values, 2, NULL, NULL); 18.18 + return session->ok; 18.19 +} 18.20 + 18.21 + 18.22 +bool 18.23 +xen_vm_send_trigger(xen_session *session, xen_vm vm, char *trigger) 18.24 +{ 18.25 + abstract_value param_values[] = 18.26 + { 18.27 + { .type = &abstract_type_string, 18.28 + .u.string_val = vm }, 18.29 + { .type = &abstract_type_string, 18.30 + .u.string_val = trigger } 18.31 + }; 18.32 + 18.33 + xen_call_(session, "VM.send_trigger", param_values, 2, NULL, NULL); 18.34 + return session->ok; 18.35 +} 18.36 + 18.37 + 18.38 +bool 18.39 xen_vm_get_all(xen_session *session, struct xen_vm_set **result) 18.40 { 18.41
19.1 --- a/tools/libxen/src/xen_vm_metrics.c Wed Apr 11 07:28:29 2007 -0600 19.2 +++ b/tools/libxen/src/xen_vm_metrics.c Wed Apr 11 07:30:02 2007 -0600 19.3 @@ -22,7 +22,9 @@ 19.4 19.5 #include "xen_common.h" 19.6 #include "xen_int_float_map.h" 19.7 +#include "xen_int_int_map.h" 19.8 #include "xen_internal.h" 19.9 +#include "xen_string_string_map.h" 19.10 #include "xen_vm_metrics.h" 19.11 19.12 19.13 @@ -49,6 +51,15 @@ static const struct_member xen_vm_metric 19.14 { .key = "VCPUs_utilisation", 19.15 .type = &abstract_type_int_float_map, 19.16 .offset = offsetof(xen_vm_metrics_record, vcpus_utilisation) }, 19.17 + { .key = "VCPUs_CPU", 19.18 + .type = &abstract_type_int_int_map, 19.19 + .offset = offsetof(xen_vm_metrics_record, vcpus_cpu) }, 19.20 + { .key = "VCPUs_params", 19.21 + .type = &abstract_type_string_string_map, 19.22 + .offset = offsetof(xen_vm_metrics_record, vcpus_params) }, 19.23 + { .key = "start_time", 19.24 + .type = &abstract_type_datetime, 19.25 + .offset = offsetof(xen_vm_metrics_record, start_time) }, 19.26 { .key = "last_updated", 19.27 .type = &abstract_type_datetime, 19.28 .offset = offsetof(xen_vm_metrics_record, last_updated) } 19.29 @@ -74,6 +85,8 @@ xen_vm_metrics_record_free(xen_vm_metric 19.30 free(record->handle); 19.31 free(record->uuid); 19.32 xen_int_float_map_free(record->vcpus_utilisation); 19.33 + xen_int_int_map_free(record->vcpus_cpu); 19.34 + xen_string_string_map_free(record->vcpus_params); 19.35 free(record); 19.36 } 19.37 19.38 @@ -168,6 +181,56 @@ xen_vm_metrics_get_vcpus_utilisation(xen 19.39 19.40 19.41 bool 19.42 +xen_vm_metrics_get_vcpus_cpu(xen_session *session, xen_int_int_map **result, xen_vm_metrics vm_metrics) 19.43 +{ 19.44 + abstract_value param_values[] = 19.45 + { 19.46 + { .type = &abstract_type_string, 19.47 + .u.string_val = vm_metrics } 19.48 + }; 19.49 + 19.50 + abstract_type result_type = abstract_type_int_int_map; 19.51 + 19.52 + *result = NULL; 19.53 + XEN_CALL_("VM_metrics.get_VCPUs_CPU"); 19.54 + return session->ok; 19.55 +} 19.56 + 19.57 + 19.58 +bool 19.59 +xen_vm_metrics_get_vcpus_params(xen_session *session, xen_string_string_map **result, xen_vm_metrics vm_metrics) 19.60 +{ 19.61 + abstract_value param_values[] = 19.62 + { 19.63 + { .type = &abstract_type_string, 19.64 + .u.string_val = vm_metrics } 19.65 + }; 19.66 + 19.67 + abstract_type result_type = abstract_type_string_string_map; 19.68 + 19.69 + *result = NULL; 19.70 + XEN_CALL_("VM_metrics.get_VCPUs_params"); 19.71 + return session->ok; 19.72 +} 19.73 + 19.74 + 19.75 +bool 19.76 +xen_vm_metrics_get_start_time(xen_session *session, time_t *result, xen_vm_metrics vm_metrics) 19.77 +{ 19.78 + abstract_value param_values[] = 19.79 + { 19.80 + { .type = &abstract_type_string, 19.81 + .u.string_val = vm_metrics } 19.82 + }; 19.83 + 19.84 + abstract_type result_type = abstract_type_datetime; 19.85 + 19.86 + XEN_CALL_("VM_metrics.get_start_time"); 19.87 + return session->ok; 19.88 +} 19.89 + 19.90 + 19.91 +bool 19.92 xen_vm_metrics_get_last_updated(xen_session *session, time_t *result, xen_vm_metrics vm_metrics) 19.93 { 19.94 abstract_value param_values[] =
20.1 --- a/tools/libxen/test/test_bindings.c Wed Apr 11 07:28:29 2007 -0600 20.2 +++ b/tools/libxen/test/test_bindings.c Wed Apr 11 07:30:02 2007 -0600 20.3 @@ -285,6 +285,40 @@ int main(int argc, char **argv) 20.4 return 1; 20.5 } 20.6 20.7 + xen_string_string_map *cpu_configuration; 20.8 + if (!xen_host_get_cpu_configuration(session, &cpu_configuration, host)) 20.9 + { 20.10 + print_error(session); 20.11 + free(dmesg); 20.12 + xen_string_set_free(capabilities); 20.13 + xen_string_set_free(supported_bootloaders); 20.14 + xen_string_string_map_free(versions); 20.15 + xen_host_free(host); 20.16 + xen_vm_record_free(vm_record); 20.17 + xen_uuid_bytes_free(vm_uuid_bytes); 20.18 + xen_uuid_free(vm_uuid); 20.19 + xen_vm_free(vm); 20.20 + CLEANUP; 20.21 + return 1; 20.22 + } 20.23 + 20.24 + char *sched_policy; 20.25 + if (!xen_host_get_sched_policy(session, &sched_policy, host)) 20.26 + { 20.27 + print_error(session); 20.28 + xen_string_string_map_free(cpu_configuration); 20.29 + xen_string_set_free(capabilities); 20.30 + xen_string_set_free(supported_bootloaders); 20.31 + xen_string_string_map_free(versions); 20.32 + xen_host_free(host); 20.33 + xen_vm_record_free(vm_record); 20.34 + xen_uuid_bytes_free(vm_uuid_bytes); 20.35 + xen_uuid_free(vm_uuid); 20.36 + xen_vm_free(vm); 20.37 + CLEANUP; 20.38 + return 1; 20.39 + } 20.40 + 20.41 printf("%s.\n", vm_uuid); 20.42 20.43 printf("In bytes, the VM UUID is "); 20.44 @@ -318,6 +352,15 @@ int main(int argc, char **argv) 20.45 } 20.46 printf("\n"); 20.47 20.48 + printf("Host has the following CPU configuration:\n"); 20.49 + for (size_t i = 0; i < cpu_configuration->size; i++) 20.50 + { 20.51 + printf(" %s -> %s.\n", cpu_configuration->contents[i].key, 20.52 + cpu_configuration->contents[i].val); 20.53 + } 20.54 + 20.55 + printf("Current scheduler policy: %s.\n\n", sched_policy); 20.56 + 20.57 printf("%s.\n", vm_record->uuid); 20.58 20.59 printf("Resident on %s.\n", (char *)vm_record->resident_on->u.handle); 20.60 @@ -334,6 +377,8 @@ int main(int argc, char **argv) 20.61 free(dmesg); 20.62 xen_string_set_free(supported_bootloaders); 20.63 xen_string_set_free(capabilities); 20.64 + xen_string_string_map_free(cpu_configuration); 20.65 + free(sched_policy); 20.66 20.67 print_vm_metrics(session, vm); 20.68 if (!session->ok) 20.69 @@ -712,6 +757,10 @@ static void print_vm_metrics(xen_session 20.70 my_strftime(time, 256, "Metrics updated at %c, local time.\n", tm); 20.71 printf(time); 20.72 20.73 + tm = localtime(&vm_metrics_record->start_time); 20.74 + my_strftime(time, 256, "VM running since %c, local time.\n", tm); 20.75 + printf(time); 20.76 + 20.77 for (size_t i = 0; i < vm_metrics_record->vcpus_utilisation->size; i++) 20.78 { 20.79 printf("%"PRId64" -> %lf.\n", 20.80 @@ -719,6 +768,22 @@ static void print_vm_metrics(xen_session 20.81 vm_metrics_record->vcpus_utilisation->contents[i].val); 20.82 } 20.83 20.84 + printf("VCPU -> PCPU mapping:\n"); 20.85 + for (size_t i = 0; i < vm_metrics_record->vcpus_cpu->size; i++) 20.86 + { 20.87 + printf(" %"PRId64" -> %"PRId64".\n", 20.88 + vm_metrics_record->vcpus_cpu->contents[i].key, 20.89 + vm_metrics_record->vcpus_cpu->contents[i].val); 20.90 + } 20.91 + 20.92 + printf("Live scheduling parameters:\n"); 20.93 + for (size_t i = 0; i < vm_metrics_record->vcpus_params->size; i++) 20.94 + { 20.95 + printf(" %s -> %s.\n", 20.96 + vm_metrics_record->vcpus_params->contents[i].key, 20.97 + vm_metrics_record->vcpus_params->contents[i].val); 20.98 + } 20.99 + 20.100 xen_vm_metrics_record_free(vm_metrics_record); 20.101 xen_vm_metrics_free(vm_metrics); 20.102
21.1 --- a/tools/python/xen/xend/XendAPI.py Wed Apr 11 07:28:29 2007 -0600 21.2 +++ b/tools/python/xen/xend/XendAPI.py Wed Apr 11 07:30:02 2007 -0600 21.3 @@ -87,7 +87,16 @@ def xen_api_todo(): 21.4 21.5 21.6 def now(): 21.7 - return xmlrpclib.DateTime(time.strftime("%Y%m%dT%H:%M:%S", time.gmtime())) 21.8 + return datetime() 21.9 + 21.10 + 21.11 +def datetime(when = None): 21.12 + """Marshall the given time as a Xen-API DateTime. 21.13 + 21.14 + @param when The time in question, given as seconds since the epoch, UTC. 21.15 + May be None, in which case the current time is used. 21.16 + """ 21.17 + return xmlrpclib.DateTime(time.gmtime(when)) 21.18 21.19 21.20 # --------------------------------------------------- 21.21 @@ -860,13 +869,13 @@ class XendAPI(object): 21.22 'metrics', 21.23 'capabilities', 21.24 'supported_bootloaders', 21.25 + 'sched_policy', 21.26 'API_version_major', 21.27 'API_version_minor', 21.28 'API_version_vendor', 21.29 'API_version_vendor_implementation'] 21.30 21.31 host_attr_rw = ['name_label', 21.32 - 'sched_policy', 21.33 'name_description', 21.34 'other_config'] 21.35
22.1 --- a/tools/python/xen/xend/XendDomainInfo.py Wed Apr 11 07:28:29 2007 -0600 22.2 +++ b/tools/python/xen/xend/XendDomainInfo.py Wed Apr 11 07:30:02 2007 -0600 22.3 @@ -430,6 +430,7 @@ class XendDomainInfo: 22.4 self._endRestore() 22.5 except: 22.6 log.exception('VM resume failed') 22.7 + self.destroy() 22.8 raise 22.9 else: 22.10 raise XendError('VM already running')
23.1 --- a/tools/python/xen/xend/XendVMMetrics.py Wed Apr 11 07:28:29 2007 -0600 23.2 +++ b/tools/python/xen/xend/XendVMMetrics.py Wed Apr 11 07:30:02 2007 -0600 23.3 @@ -138,7 +138,9 @@ class XendVMMetrics: 23.4 return {} 23.5 23.6 def get_start_time(self): 23.7 - return self.xend_domain_instance.info.get("start_time", -1) 23.8 + import xen.xend.XendAPI as XendAPI 23.9 + return XendAPI.datetime( 23.10 + self.xend_domain_instance.info.get("start_time", 0)) 23.11 23.12 def get_last_updated(self): 23.13 import xen.xend.XendAPI as XendAPI
24.1 --- a/tools/python/xen/xm/main.py Wed Apr 11 07:28:29 2007 -0600 24.2 +++ b/tools/python/xen/xm/main.py Wed Apr 11 07:30:02 2007 -0600 24.3 @@ -731,6 +731,12 @@ def xm_restore(args): 24.4 server.xend.domain.restore(savefile, paused) 24.5 24.6 24.7 +def datetime_to_secs(v): 24.8 + unwanted = ":-." 24.9 + for c in unwanted: 24.10 + v = str(v).replace(c, "") 24.11 + return time.mktime(time.strptime(v[0:14], '%Y%m%dT%H%M%S')) 24.12 + 24.13 def getDomains(domain_names, state, full = 0): 24.14 if serverType == SERVER_XEN_API: 24.15 doms_sxp = [] 24.16 @@ -756,7 +762,8 @@ def getDomains(domain_names, state, full 24.17 'vcpus': dom_metrics['VCPUs_number'], 24.18 'state': state_str, 24.19 'cpu_time': dom_metrics['VCPUs_utilisation'], 24.20 - 'start_time': dom_metrics['start_time']}) 24.21 + 'start_time': datetime_to_secs( 24.22 + dom_metrics['start_time'])}) 24.23 24.24 doms_sxp.append(['domain'] + map2sxp(dom_rec)) 24.25 doms_dict.append(dom_rec)
25.1 --- a/unmodified_drivers/linux-2.6/Makefile Wed Apr 11 07:28:29 2007 -0600 25.2 +++ b/unmodified_drivers/linux-2.6/Makefile Wed Apr 11 07:30:02 2007 -0600 25.3 @@ -1,8 +1,6 @@ 25.4 include $(M)/overrides.mk 25.5 25.6 obj-m += platform-pci/ 25.7 -obj-m += xenbus/ 25.8 obj-m += balloon/ 25.9 obj-m += blkfront/ 25.10 obj-m += netfront/ 25.11 -obj-m += util/
26.1 --- a/unmodified_drivers/linux-2.6/mkbuildtree Wed Apr 11 07:28:29 2007 -0600 26.2 +++ b/unmodified_drivers/linux-2.6/mkbuildtree Wed Apr 11 07:30:02 2007 -0600 26.3 @@ -25,7 +25,7 @@ done 26.4 ln -sf ${XL}/drivers/xen/core/gnttab.c platform-pci 26.5 ln -sf ${XL}/drivers/xen/core/features.c platform-pci 26.6 ln -sf ${XL}/drivers/xen/core/xen_proc.c xenbus 26.7 -ln -sf ${XL}/drivers/xen/core/reboot.c util 26.8 +ln -sf ${XL}/drivers/xen/core/reboot.c platform-pci 26.9 26.10 mkdir -p include/asm include/xen 26.11
27.1 --- a/unmodified_drivers/linux-2.6/platform-pci/Kbuild Wed Apr 11 07:28:29 2007 -0600 27.2 +++ b/unmodified_drivers/linux-2.6/platform-pci/Kbuild Wed Apr 11 07:30:02 2007 -0600 27.3 @@ -4,7 +4,16 @@ obj-m := xen-platform-pci.o 27.4 27.5 EXTRA_CFLAGS += -I$(M)/platform-pci 27.6 27.7 -xen-platform-pci-objs := evtchn.o platform-pci.o gnttab.o xen_support.o features.o platform-compat.o 27.8 +xen-platform-pci-objs := evtchn.o platform-pci.o gnttab.o xen_support.o 27.9 +xen-platform-pci-objs += features.o platform-compat.o 27.10 +xen-platform-pci-objs += reboot.o machine_reboot.o 27.11 + 27.12 +xen-platform-pci-objs += ../xenbus/xenbus_comms.o 27.13 +xen-platform-pci-objs += ../xenbus/xenbus_xs.o 27.14 +xen-platform-pci-objs += ../xenbus/xenbus_probe.o 27.15 +xen-platform-pci-objs += ../xenbus/xenbus_dev.o 27.16 +xen-platform-pci-objs += ../xenbus/xenbus_client.o 27.17 +xen-platform-pci-objs += ../xenbus/xen_proc.o 27.18 27.19 # Can we do better ? 27.20 ifeq ($(ARCH),ia64)
28.1 --- a/unmodified_drivers/linux-2.6/platform-pci/evtchn.c Wed Apr 11 07:28:29 2007 -0600 28.2 +++ b/unmodified_drivers/linux-2.6/platform-pci/evtchn.c Wed Apr 11 07:30:02 2007 -0600 28.3 @@ -41,16 +41,42 @@ 28.4 28.5 void *shared_info_area; 28.6 28.7 -#define MAX_EVTCHN 256 28.8 +static DEFINE_MUTEX(irq_evtchn_mutex); 28.9 + 28.10 +#define is_valid_evtchn(x) ((x) != 0) 28.11 +#define evtchn_from_irq(x) (irq_evtchn[irq].evtchn) 28.12 + 28.13 static struct { 28.14 irqreturn_t(*handler) (int, void *, struct pt_regs *); 28.15 void *dev_id; 28.16 - int close; /* close on unbind_from_irqhandler()? */ 28.17 -} evtchns[MAX_EVTCHN]; 28.18 + int evtchn; 28.19 + int close:1; /* close on unbind_from_irqhandler()? */ 28.20 + int inuse:1; 28.21 +} irq_evtchn[256]; 28.22 +static int evtchn_to_irq[NR_EVENT_CHANNELS] = { 28.23 + [0 ... NR_EVENT_CHANNELS-1] = -1 }; 28.24 + 28.25 +static int find_unbound_irq(void) 28.26 +{ 28.27 + static int warned; 28.28 + int irq; 28.29 + 28.30 + for (irq = 0; irq < ARRAY_SIZE(irq_evtchn); irq++) 28.31 + if (!irq_evtchn[irq].inuse) 28.32 + return irq; 28.33 + 28.34 + if (!warned) { 28.35 + warned = 1; 28.36 + printk(KERN_WARNING "No available IRQ to bind to: " 28.37 + "increase irq_evtchn[] size in evtchn.c.\n"); 28.38 + } 28.39 + 28.40 + return -ENOSPC; 28.41 +} 28.42 28.43 int irq_to_evtchn_port(int irq) 28.44 { 28.45 - return irq; 28.46 + return irq_evtchn[irq].evtchn; 28.47 } 28.48 EXPORT_SYMBOL(irq_to_evtchn_port); 28.49 28.50 @@ -107,21 +133,37 @@ int bind_listening_port_to_irqhandler( 28.51 void *dev_id) 28.52 { 28.53 struct evtchn_alloc_unbound alloc_unbound; 28.54 - int err; 28.55 + int err, irq; 28.56 + 28.57 + mutex_lock(&irq_evtchn_mutex); 28.58 + 28.59 + irq = find_unbound_irq(); 28.60 + if (irq < 0) { 28.61 + mutex_unlock(&irq_evtchn_mutex); 28.62 + return irq; 28.63 + } 28.64 28.65 alloc_unbound.dom = DOMID_SELF; 28.66 alloc_unbound.remote_dom = remote_domain; 28.67 - 28.68 err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound, 28.69 &alloc_unbound); 28.70 - if (err) 28.71 + if (err) { 28.72 + mutex_unlock(&irq_evtchn_mutex); 28.73 return err; 28.74 + } 28.75 28.76 - evtchns[alloc_unbound.port].handler = handler; 28.77 - evtchns[alloc_unbound.port].dev_id = dev_id; 28.78 - evtchns[alloc_unbound.port].close = 1; 28.79 + irq_evtchn[irq].handler = handler; 28.80 + irq_evtchn[irq].dev_id = dev_id; 28.81 + irq_evtchn[irq].evtchn = alloc_unbound.port; 28.82 + irq_evtchn[irq].close = 1; 28.83 + irq_evtchn[irq].inuse = 1; 28.84 + 28.85 + evtchn_to_irq[alloc_unbound.port] = irq; 28.86 + 28.87 unmask_evtchn(alloc_unbound.port); 28.88 - return alloc_unbound.port; 28.89 + 28.90 + mutex_unlock(&irq_evtchn_mutex); 28.91 + return irq; 28.92 } 28.93 EXPORT_SYMBOL(bind_listening_port_to_irqhandler); 28.94 28.95 @@ -132,35 +174,59 @@ int bind_caller_port_to_irqhandler( 28.96 const char *devname, 28.97 void *dev_id) 28.98 { 28.99 - if (caller_port >= MAX_EVTCHN) 28.100 - return -EINVAL; 28.101 - evtchns[caller_port].handler = handler; 28.102 - evtchns[caller_port].dev_id = dev_id; 28.103 - evtchns[caller_port].close = 0; 28.104 + int irq; 28.105 + 28.106 + mutex_lock(&irq_evtchn_mutex); 28.107 + 28.108 + irq = find_unbound_irq(); 28.109 + if (irq < 0) { 28.110 + mutex_unlock(&irq_evtchn_mutex); 28.111 + return irq; 28.112 + } 28.113 + 28.114 + irq_evtchn[irq].handler = handler; 28.115 + irq_evtchn[irq].dev_id = dev_id; 28.116 + irq_evtchn[irq].evtchn = caller_port; 28.117 + irq_evtchn[irq].close = 0; 28.118 + irq_evtchn[irq].inuse = 1; 28.119 + 28.120 + evtchn_to_irq[caller_port] = irq; 28.121 + 28.122 unmask_evtchn(caller_port); 28.123 - return caller_port; 28.124 + 28.125 + mutex_unlock(&irq_evtchn_mutex); 28.126 + return irq; 28.127 } 28.128 EXPORT_SYMBOL(bind_caller_port_to_irqhandler); 28.129 28.130 -void unbind_from_irqhandler(unsigned int evtchn, void *dev_id) 28.131 +void unbind_from_irqhandler(unsigned int irq, void *dev_id) 28.132 { 28.133 - if (evtchn >= MAX_EVTCHN) 28.134 - return; 28.135 + int evtchn = evtchn_from_irq(irq); 28.136 + 28.137 + mutex_lock(&irq_evtchn_mutex); 28.138 28.139 - mask_evtchn(evtchn); 28.140 - evtchns[evtchn].handler = NULL; 28.141 + if (is_valid_evtchn(evtchn)) { 28.142 + evtchn_to_irq[irq] = -1; 28.143 + mask_evtchn(evtchn); 28.144 + if (irq_evtchn[irq].close) { 28.145 + struct evtchn_close close = { .port = evtchn }; 28.146 + HYPERVISOR_event_channel_op(EVTCHNOP_close, &close); 28.147 + } 28.148 + } 28.149 28.150 - if (evtchns[evtchn].close) { 28.151 - struct evtchn_close close = { .port = evtchn }; 28.152 - HYPERVISOR_event_channel_op(EVTCHNOP_close, &close); 28.153 - } 28.154 + irq_evtchn[irq].handler = NULL; 28.155 + irq_evtchn[irq].evtchn = 0; 28.156 + irq_evtchn[irq].inuse = 0; 28.157 + 28.158 + mutex_unlock(&irq_evtchn_mutex); 28.159 } 28.160 EXPORT_SYMBOL(unbind_from_irqhandler); 28.161 28.162 void notify_remote_via_irq(int irq) 28.163 { 28.164 - int evtchn = irq; 28.165 - notify_remote_via_evtchn(evtchn); 28.166 + int evtchn = evtchn_from_irq(irq); 28.167 + if (is_valid_evtchn(evtchn)) 28.168 + notify_remote_via_evtchn(evtchn); 28.169 } 28.170 EXPORT_SYMBOL(notify_remote_via_irq); 28.171 28.172 @@ -183,9 +249,10 @@ irqreturn_t evtchn_interrupt(int irq, vo 28.173 while ((l2 = s->evtchn_pending[l1i] & ~s->evtchn_mask[l1i])) { 28.174 port = (l1i * BITS_PER_LONG) + __ffs(l2); 28.175 synch_clear_bit(port, &s->evtchn_pending[0]); 28.176 - if ((handler = evtchns[port].handler) != NULL) 28.177 - handler(port, evtchns[port].dev_id, 28.178 - regs); 28.179 + irq = evtchn_to_irq[port]; 28.180 + if ((irq >= 0) && 28.181 + ((handler = irq_evtchn[irq].handler) != NULL)) 28.182 + handler(irq, irq_evtchn[irq].dev_id, regs); 28.183 else 28.184 printk(KERN_WARNING "unexpected event channel " 28.185 "upcall on port %d!\n", port); 28.186 @@ -200,3 +267,28 @@ void force_evtchn_callback(void) 28.187 (void)HYPERVISOR_xen_version(0, NULL); 28.188 } 28.189 EXPORT_SYMBOL(force_evtchn_callback); 28.190 + 28.191 +void irq_suspend(void) 28.192 +{ 28.193 + mutex_lock(&irq_evtchn_mutex); 28.194 +} 28.195 + 28.196 +void irq_suspend_cancel(void) 28.197 +{ 28.198 + mutex_unlock(&irq_evtchn_mutex); 28.199 +} 28.200 + 28.201 +void irq_resume(void) 28.202 +{ 28.203 + int evtchn, irq; 28.204 + 28.205 + for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) { 28.206 + mask_evtchn(evtchn); 28.207 + evtchn_to_irq[evtchn] = -1; 28.208 + } 28.209 + 28.210 + for (irq = 0; irq < ARRAY_SIZE(irq_evtchn); irq++) 28.211 + irq_evtchn[irq].evtchn = 0; 28.212 + 28.213 + mutex_unlock(&irq_evtchn_mutex); 28.214 +}
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 29.2 +++ b/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c Wed Apr 11 07:30:02 2007 -0600 29.3 @@ -0,0 +1,24 @@ 29.4 +#include <linux/config.h> 29.5 +#include <xen/xenbus.h> 29.6 +#include "platform-pci.h" 29.7 +#include <asm/hypervisor.h> 29.8 + 29.9 +int __xen_suspend(int fast_suspend) 29.10 +{ 29.11 + int suspend_cancelled; 29.12 + 29.13 + xenbus_suspend(); 29.14 + platform_pci_suspend(); 29.15 + 29.16 + suspend_cancelled = HYPERVISOR_shutdown(SHUTDOWN_suspend); 29.17 + 29.18 + if (suspend_cancelled) { 29.19 + platform_pci_suspend_cancel(); 29.20 + xenbus_suspend_cancel(); 29.21 + } else { 29.22 + platform_pci_resume(); 29.23 + xenbus_resume(); 29.24 + } 29.25 + 29.26 + return 0; 29.27 +}
30.1 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c Wed Apr 11 07:28:29 2007 -0600 30.2 +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c Wed Apr 11 07:30:02 2007 -0600 30.3 @@ -1,7 +1,9 @@ 30.4 /****************************************************************************** 30.5 * platform-pci.c 30.6 + * 30.7 * Xen platform PCI device driver 30.8 - * Copyright (C) 2005, Intel Corporation. 30.9 + * Copyright (c) 2005, Intel Corporation. 30.10 + * Copyright (c) 2007, XenSource Inc. 30.11 * 30.12 * This program is free software; you can redistribute it and/or modify it 30.13 * under the terms and conditions of the GNU General Public License, 30.14 @@ -35,7 +37,9 @@ 30.15 #include <asm/hypervisor.h> 30.16 #include <asm/pgtable.h> 30.17 #include <xen/interface/memory.h> 30.18 +#include <xen/interface/hvm/params.h> 30.19 #include <xen/features.h> 30.20 +#include <xen/evtchn.h> 30.21 #include <xen/gnttab.h> 30.22 #ifdef __ia64__ 30.23 #include <asm/xen/xencomm.h> 30.24 @@ -54,14 +58,10 @@ 30.25 char *hypercall_stubs; 30.26 EXPORT_SYMBOL(hypercall_stubs); 30.27 30.28 -// Used to be xiaofeng.ling@intel.com 30.29 MODULE_AUTHOR("ssmith@xensource.com"); 30.30 MODULE_DESCRIPTION("Xen platform PCI device"); 30.31 MODULE_LICENSE("GPL"); 30.32 30.33 -unsigned long *phys_to_machine_mapping; 30.34 -EXPORT_SYMBOL(phys_to_machine_mapping); 30.35 - 30.36 static unsigned long shared_info_frame; 30.37 static uint64_t callback_via; 30.38 30.39 @@ -89,30 +89,11 @@ static int __devinit init_xen_info(void) 30.40 if (shared_info_area == NULL) 30.41 panic("can't map shared info\n"); 30.42 30.43 - phys_to_machine_mapping = NULL; 30.44 - 30.45 gnttab_init(); 30.46 30.47 return 0; 30.48 } 30.49 30.50 -static void __devexit platform_pci_remove(struct pci_dev *pdev) 30.51 -{ 30.52 - long ioaddr, iolen; 30.53 - long mmio_addr, mmio_len; 30.54 - 30.55 - ioaddr = pci_resource_start(pdev, 0); 30.56 - iolen = pci_resource_len(pdev, 0); 30.57 - mmio_addr = pci_resource_start(pdev, 1); 30.58 - mmio_len = pci_resource_len(pdev, 1); 30.59 - 30.60 - release_region(ioaddr, iolen); 30.61 - release_mem_region(mmio_addr, mmio_len); 30.62 - 30.63 - pci_set_drvdata(pdev, NULL); 30.64 - free_irq(pdev->irq, pdev); 30.65 -} 30.66 - 30.67 static unsigned long platform_mmio; 30.68 static unsigned long platform_mmio_alloc; 30.69 static unsigned long platform_mmiolen; 30.70 @@ -208,6 +189,19 @@ static uint64_t get_callback_via(struct 30.71 ((uint64_t)(pin - 1) & 3)); 30.72 } 30.73 30.74 +static int set_callback_via(uint64_t via) 30.75 +{ 30.76 + struct xen_hvm_param a; 30.77 + 30.78 + a.domid = DOMID_SELF; 30.79 + a.index = HVM_PARAM_CALLBACK_IRQ; 30.80 + a.value = via; 30.81 + return HYPERVISOR_hvm_op(HVMOP_set_param, &a); 30.82 +} 30.83 + 30.84 +int xenbus_init(void); 30.85 +int xen_reboot_init(void); 30.86 + 30.87 static int __devinit platform_pci_init(struct pci_dev *pdev, 30.88 const struct pci_device_id *ent) 30.89 { 30.90 @@ -232,15 +226,13 @@ static int __devinit platform_pci_init(s 30.91 return -ENOENT; 30.92 } 30.93 30.94 - if (request_mem_region(mmio_addr, mmio_len, DRV_NAME) == NULL) 30.95 - { 30.96 + if (request_mem_region(mmio_addr, mmio_len, DRV_NAME) == NULL) { 30.97 printk(KERN_ERR ":MEM I/O resource 0x%lx @ 0x%lx busy\n", 30.98 mmio_addr, mmio_len); 30.99 return -EBUSY; 30.100 } 30.101 30.102 - if (request_region(ioaddr, iolen, DRV_NAME) == NULL) 30.103 - { 30.104 + if (request_region(ioaddr, iolen, DRV_NAME) == NULL) { 30.105 printk(KERN_ERR DRV_NAME ":I/O resource 0x%lx @ 0x%lx busy\n", 30.106 iolen, ioaddr); 30.107 release_mem_region(mmio_addr, mmio_len); 30.108 @@ -265,6 +257,12 @@ static int __devinit platform_pci_init(s 30.109 if ((ret = set_callback_via(callback_via))) 30.110 goto out; 30.111 30.112 + if ((ret = xenbus_init())) 30.113 + goto out; 30.114 + 30.115 + if ((ret = xen_reboot_init())) 30.116 + goto out; 30.117 + 30.118 out: 30.119 if (ret) { 30.120 release_mem_region(mmio_addr, mmio_len); 30.121 @@ -289,7 +287,6 @@ MODULE_DEVICE_TABLE(pci, platform_pci_tb 30.122 static struct pci_driver platform_driver = { 30.123 name: DRV_NAME, 30.124 probe: platform_pci_init, 30.125 - remove: __devexit_p(platform_pci_remove), 30.126 id_table: platform_pci_tbl, 30.127 }; 30.128 30.129 @@ -298,13 +295,18 @@ static int pci_device_registered; 30.130 void platform_pci_suspend(void) 30.131 { 30.132 gnttab_suspend(); 30.133 + irq_suspend(); 30.134 } 30.135 -EXPORT_SYMBOL_GPL(platform_pci_suspend); 30.136 + 30.137 +void platform_pci_suspend_cancel(void) 30.138 +{ 30.139 + irq_suspend_cancel(); 30.140 + gnttab_resume(); 30.141 +} 30.142 30.143 void platform_pci_resume(void) 30.144 { 30.145 struct xen_add_to_physmap xatp; 30.146 - phys_to_machine_mapping = NULL; 30.147 30.148 /* do 2 things for PV driver restore on HVM 30.149 * 1: rebuild share info 30.150 @@ -317,34 +319,27 @@ void platform_pci_resume(void) 30.151 if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp)) 30.152 BUG(); 30.153 30.154 - if (( set_callback_via(callback_via))) 30.155 + irq_resume(); 30.156 + 30.157 + if (set_callback_via(callback_via)) 30.158 printk("platform_pci_resume failure!\n"); 30.159 30.160 gnttab_resume(); 30.161 } 30.162 -EXPORT_SYMBOL_GPL(platform_pci_resume); 30.163 30.164 static int __init platform_pci_module_init(void) 30.165 { 30.166 int rc; 30.167 30.168 rc = pci_module_init(&platform_driver); 30.169 - if (rc) 30.170 - printk(KERN_INFO DRV_NAME ":No platform pci device model found\n"); 30.171 - else 30.172 - pci_device_registered = 1; 30.173 - 30.174 - return rc; 30.175 -} 30.176 + if (rc) { 30.177 + printk(KERN_INFO DRV_NAME 30.178 + ": No platform pci device model found\n"); 30.179 + return rc; 30.180 + } 30.181 30.182 -static void __exit platform_pci_module_cleanup(void) 30.183 -{ 30.184 - printk(KERN_INFO DRV_NAME ":Do platform module cleanup\n"); 30.185 - /* disable hypervisor for callback irq */ 30.186 - set_callback_via(0); 30.187 - if (pci_device_registered) 30.188 - pci_unregister_driver(&platform_driver); 30.189 + pci_device_registered = 1; 30.190 + return 0; 30.191 } 30.192 30.193 module_init(platform_pci_module_init); 30.194 -module_exit(platform_pci_module_cleanup);
31.1 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.h Wed Apr 11 07:28:29 2007 -0600 31.2 +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.h Wed Apr 11 07:30:02 2007 -0600 31.3 @@ -1,7 +1,9 @@ 31.4 /****************************************************************************** 31.5 - * evtchn-pci.h 31.6 - * module driver support in unmodified Linux 31.7 - * Copyright (C) 2004, Intel Corporation. <xiaofeng.ling@intel.com> 31.8 + * platform-pci.h 31.9 + * 31.10 + * Xen platform PCI device driver 31.11 + * Copyright (c) 2004, Intel Corporation. <xiaofeng.ling@intel.com> 31.12 + * Copyright (c) 2007, XenSource Inc. 31.13 * 31.14 * This program is free software; you can redistribute it and/or modify it 31.15 * under the terms and conditions of the GNU General Public License, 31.16 @@ -15,31 +17,21 @@ 31.17 * You should have received a copy of the GNU General Public License along with 31.18 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 31.19 * Place - Suite 330, Boston, MA 02111-1307 USA. 31.20 - * 31.21 */ 31.22 31.23 -#ifndef __XEN_SUPPORT_H 31.24 -#define __XEN_SUPPORT_H 31.25 -#include <linux/version.h> 31.26 -#include <linux/interrupt.h> 31.27 -#include <xen/interface/hvm/params.h> 31.28 +#ifndef _XEN_PLATFORM_PCI_H 31.29 +#define _XEN_PLATFORM_PCI_H 31.30 31.31 -static inline int set_callback_via(uint64_t via) 31.32 -{ 31.33 - struct xen_hvm_param a; 31.34 - 31.35 - a.domid = DOMID_SELF; 31.36 - a.index = HVM_PARAM_CALLBACK_IRQ; 31.37 - a.value = via; 31.38 - return HYPERVISOR_hvm_op(HVMOP_set_param, &a); 31.39 -} 31.40 +#include <linux/interrupt.h> 31.41 31.42 unsigned long alloc_xen_mmio(unsigned long len); 31.43 - 31.44 int gnttab_init(void); 31.45 +irqreturn_t evtchn_interrupt(int irq, void *dev_id, struct pt_regs *regs); 31.46 +void irq_suspend(void); 31.47 +void irq_suspend_cancel(void); 31.48 31.49 -void setup_xen_features(void); 31.50 +void platform_pci_suspend(void); 31.51 +void platform_pci_suspend_cancel(void); 31.52 +void platform_pci_resume(void); 31.53 31.54 -irqreturn_t evtchn_interrupt(int irq, void *dev_id, struct pt_regs *regs); 31.55 - 31.56 -#endif 31.57 +#endif /* _XEN_PLATFORM_PCI_H */
32.1 --- a/unmodified_drivers/linux-2.6/util/Kbuild Wed Apr 11 07:28:29 2007 -0600 32.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 32.3 @@ -1,3 +0,0 @@ 32.4 -include $(M)/overrides.mk 32.5 - 32.6 -obj-m := reboot.o
33.1 --- a/unmodified_drivers/linux-2.6/util/Makefile Wed Apr 11 07:28:29 2007 -0600 33.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 33.3 @@ -1,3 +0,0 @@ 33.4 -ifneq ($(KERNELRELEASE),) 33.5 -include $(src)/Kbuild 33.6 -endif
34.1 --- a/unmodified_drivers/linux-2.6/xenbus/Kbuild Wed Apr 11 07:28:29 2007 -0600 34.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 34.3 @@ -1,10 +0,0 @@ 34.4 -include $(M)/overrides.mk 34.5 - 34.6 -obj-m += xenbus.o 34.7 -xenbus-objs = 34.8 -xenbus-objs += xenbus_comms.o 34.9 -xenbus-objs += xenbus_xs.o 34.10 -xenbus-objs += xenbus_probe.o 34.11 -xenbus-objs += xenbus_dev.o 34.12 -xenbus-objs += xenbus_client.o 34.13 -xenbus-objs += xen_proc.o
35.1 --- a/unmodified_drivers/linux-2.6/xenbus/Makefile Wed Apr 11 07:28:29 2007 -0600 35.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 35.3 @@ -1,3 +0,0 @@ 35.4 -ifneq ($(KERNELRELEASE),) 35.5 -include $(src)/Kbuild 35.6 -endif
37.1 --- a/xen/arch/x86/mm/hap/hap.c Wed Apr 11 07:28:29 2007 -0600 37.2 +++ b/xen/arch/x86/mm/hap/hap.c Wed Apr 11 07:30:02 2007 -0600 37.3 @@ -443,6 +443,7 @@ void hap_final_teardown(struct domain *d 37.4 hap_teardown(d); 37.5 37.6 p2m_teardown(d); 37.7 + ASSERT( d->arch.paging.hap.p2m_pages == 0 ); 37.8 } 37.9 37.10 void hap_teardown(struct domain *d) 37.11 @@ -635,12 +636,60 @@ void hap_update_paging_modes(struct vcpu 37.12 hap_unlock(d); 37.13 } 37.14 37.15 +#if CONFIG_PAGING_LEVELS == 3 37.16 +static void p2m_install_entry_in_monitors(struct domain *d, l3_pgentry_t *l3e) 37.17 +/* Special case, only used for external-mode domains on PAE hosts: 37.18 + * update the mapping of the p2m table. Once again, this is trivial in 37.19 + * other paging modes (one top-level entry points to the top-level p2m, 37.20 + * no maintenance needed), but PAE makes life difficult by needing a 37.21 + * copy l3es of the p2m table in eight l2h slots in the monitor table. This 37.22 + * function makes fresh copies when a p2m l3e changes. */ 37.23 +{ 37.24 + l2_pgentry_t *ml2e; 37.25 + struct vcpu *v; 37.26 + unsigned int index; 37.27 + 37.28 + index = ((unsigned long)l3e & ~PAGE_MASK) / sizeof(l3_pgentry_t); 37.29 + ASSERT(index < MACHPHYS_MBYTES>>1); 37.30 + 37.31 + for_each_vcpu(d, v) { 37.32 + if ( pagetable_get_pfn(v->arch.monitor_table) == 0 ) 37.33 + continue; 37.34 + 37.35 + ASSERT(paging_mode_external(v->domain)); 37.36 + 37.37 + if ( v == current ) /* OK to use linear map of monitor_table */ 37.38 + ml2e = __linear_l2_table + l2_linear_offset(RO_MPT_VIRT_START); 37.39 + else { 37.40 + l3_pgentry_t *ml3e; 37.41 + ml3e = hap_map_domain_page(pagetable_get_mfn(v->arch.monitor_table)); 37.42 + ASSERT(l3e_get_flags(ml3e[3]) & _PAGE_PRESENT); 37.43 + ml2e = hap_map_domain_page(_mfn(l3e_get_pfn(ml3e[3]))); 37.44 + ml2e += l2_table_offset(RO_MPT_VIRT_START); 37.45 + hap_unmap_domain_page(ml3e); 37.46 + } 37.47 + ml2e[index] = l2e_from_pfn(l3e_get_pfn(*l3e), __PAGE_HYPERVISOR); 37.48 + if ( v != current ) 37.49 + hap_unmap_domain_page(ml2e); 37.50 + } 37.51 +} 37.52 +#endif 37.53 + 37.54 void 37.55 hap_write_p2m_entry(struct vcpu *v, unsigned long gfn, l1_pgentry_t *p, 37.56 l1_pgentry_t new, unsigned int level) 37.57 { 37.58 hap_lock(v->domain); 37.59 safe_write_pte(p, new); 37.60 +#if CONFIG_PAGING_LEVELS == 3 37.61 + /* install P2M in monitor table for PAE Xen */ 37.62 + if ( level == 3 ) { 37.63 + /* We have written to the p2m l3: need to sync the per-vcpu 37.64 + * copies of it in the monitor tables */ 37.65 + p2m_install_entry_in_monitors(v->domain, (l3_pgentry_t *)p); 37.66 + 37.67 + } 37.68 +#endif 37.69 hap_unlock(v->domain); 37.70 } 37.71