direct-io.hg

changeset 1781:f0091709a4d9

bitkeeper revision 1.1071.1.7 (40f54af55pyLX7mn-IvUDb5re5ebeA)

In linux, make halt the same as poweroff.
Xen now observes dom 0 exit code and halts if required.
author iap10@labyrinth.cl.cam.ac.uk
date Wed Jul 14 15:02:13 2004 +0000 (2004-07-14)
parents ad09d919356e
children f61925935170
files linux-2.4.26-xen-sparse/arch/xen/kernel/process.c xen/arch/x86/domain.c xen/common/domain.c
line diff
     1.1 --- a/linux-2.4.26-xen-sparse/arch/xen/kernel/process.c	Wed Jul 14 07:10:58 2004 +0000
     1.2 +++ b/linux-2.4.26-xen-sparse/arch/xen/kernel/process.c	Wed Jul 14 15:02:13 2004 +0000
     1.3 @@ -125,14 +125,7 @@ void machine_restart(char *__unused)
     1.4  
     1.5  void machine_halt(void)
     1.6  {
     1.7 -    /* We really want to get pending console data out before we die. */
     1.8 -    extern void xencons_force_flush(void);
     1.9 -    xencons_force_flush();
    1.10 -    for ( ; ; ) /* loop without wasting cpu cycles */
    1.11 -    {
    1.12 -        HYPERVISOR_shared_info->vcpu_data[0].evtchn_upcall_pending = 0;
    1.13 -        HYPERVISOR_block();
    1.14 -    }
    1.15 +    machine_power_off();
    1.16  }
    1.17  
    1.18  void machine_power_off(void)
     2.1 --- a/xen/arch/x86/domain.c	Wed Jul 14 07:10:58 2004 +0000
     2.2 +++ b/xen/arch/x86/domain.c	Wed Jul 14 15:02:13 2004 +0000
     2.3 @@ -199,12 +199,7 @@ void machine_restart(char * __unused)
     2.4  
     2.5  void machine_halt(void)
     2.6  {
     2.7 -    machine_restart(0);
     2.8 -}
     2.9 -
    2.10 -void machine_power_off(void)
    2.11 -{
    2.12 -    machine_restart(0);
    2.13 +    while(1){ safe_halt(); }
    2.14  }
    2.15  
    2.16  void arch_do_createdomain(struct domain *d)
     3.1 --- a/xen/common/domain.c	Wed Jul 14 07:10:58 2004 +0000
     3.2 +++ b/xen/common/domain.c	Wed Jul 14 15:02:13 2004 +0000
     3.3 @@ -170,8 +170,18 @@ void domain_shutdown(u8 reason)
     3.4      if ( current->domain == 0 )
     3.5      {
     3.6          extern void machine_restart(char *);
     3.7 -        printk("Domain 0 shutdown: rebooting machine!\n");
     3.8 -        machine_restart(0);
     3.9 +        extern void machine_halt(void);
    3.10 +
    3.11 +        if ( reason == 0 ) 
    3.12 +        {
    3.13 +            printk("Domain 0 halted: Our work here is done.\n");
    3.14 +            machine_halt();
    3.15 +        }
    3.16 +        else
    3.17 +        {
    3.18 +            printk("Domain 0 shutdown: rebooting machine!\n");
    3.19 +            machine_restart(0);
    3.20 +        }
    3.21      }
    3.22  
    3.23      current->shutdown_code = reason;