ia64/xen-unstable

view xen/common/shutdown.c @ 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 1c85fe14169f
children 0c857419d354
line source
1 #include <xen/config.h>
2 #include <xen/init.h>
3 #include <xen/lib.h>
4 #include <xen/sched.h>
5 #include <xen/domain.h>
6 #include <xen/delay.h>
7 #include <xen/shutdown.h>
8 #include <asm/debugger.h>
9 #include <public/sched.h>
11 /* opt_noreboot: If true, machine will need manual reset on error. */
12 int opt_noreboot;
13 boolean_param("noreboot", opt_noreboot);
15 static void maybe_reboot(void)
16 {
17 if ( opt_noreboot )
18 {
19 printk("'noreboot' set - not rebooting.\n");
20 machine_halt();
21 }
22 else
23 {
24 printk("rebooting machine in 5 seconds.\n");
25 watchdog_disable();
26 mdelay(5000);
27 machine_restart();
28 }
29 }
31 void dom0_shutdown(u8 reason)
32 {
33 switch ( reason )
34 {
35 case SHUTDOWN_poweroff:
36 {
37 printk("Domain 0 halted: halting machine.\n");
38 machine_halt();
39 break; /* not reached */
40 }
42 case SHUTDOWN_crash:
43 {
44 debugger_trap_immediate();
45 printk("Domain 0 crashed: ");
46 maybe_reboot();
47 break; /* not reached */
48 }
50 case SHUTDOWN_reboot:
51 {
52 printk("Domain 0 shutdown: rebooting machine.\n");
53 machine_restart();
54 break; /* not reached */
55 }
57 default:
58 {
59 printk("Domain 0 shutdown (unknown reason %u): ", reason);
60 maybe_reboot();
61 break; /* not reached */
62 }
63 }
64 }