direct-io.hg

changeset 1536:7ce227b8b740

bitkeeper revision 1.994.1.4 (40d80db0ELJvAwrBu8alZswoyKyPpw)

Rename dom-control and scheduling interfaces for sanity and consistency.
author kaf24@scramble.cl.cam.ac.uk
date Tue Jun 22 10:45:04 2004 +0000 (2004-06-22)
parents 0e1219bec03c
children b05d7cdfc7c6
files extras/mini-os/h/hypervisor.h linux-2.4.26-xen-sparse/arch/xen/kernel/setup.c linux-2.4.26-xen-sparse/include/asm-xen/hypervisor.h tools/examples/xc_dom_control.py tools/examples/xc_dom_create.py tools/examples/xm_dom_control.py tools/examples/xm_dom_create.py tools/xc/lib/xc.h tools/xc/lib/xc_domain.c tools/xc/lib/xc_linux_build.c tools/xc/lib/xc_linux_restore.c tools/xc/lib/xc_linux_save.c tools/xc/lib/xc_netbsd_build.c tools/xc/lib/xc_private.c tools/xc/lib/xc_private.h tools/xc/py/Xc.c tools/xend/lib/domain_controller.h tools/xenmgr/lib/EventTypes.py tools/xenmgr/lib/XendClient.py tools/xenmgr/lib/XendDomain.py tools/xenmgr/lib/XendDomainInfo.py tools/xenmgr/lib/server/SrvDomain.py tools/xenmgr/lib/xm/create.py tools/xenmgr/lib/xm/main.py xen/arch/x86/process.c xen/common/debug.c xen/common/dom0_ops.c xen/common/domain.c xen/common/kernel.c xen/common/schedule.c xen/common/shadow.c xen/include/hypervisor-ifs/dom0_ops.h xen/include/hypervisor-ifs/hypervisor-if.h xen/include/xen/sched.h
line diff
     1.1 --- a/extras/mini-os/h/hypervisor.h	Tue Jun 22 09:42:30 2004 +0000
     1.2 +++ b/extras/mini-os/h/hypervisor.h	Tue Jun 22 10:45:04 2004 +0000
     1.3 @@ -148,7 +148,7 @@ static inline int HYPERVISOR_shutdown(vo
     1.4      __asm__ __volatile__ (
     1.5          TRAP_INSTR
     1.6          : "=a" (ret) : "0" (__HYPERVISOR_sched_op),
     1.7 -        "b" (SCHEDOP_suspend | (STOPCODE_shutdown << SCHEDOP_reasonshift))
     1.8 +        "b" (SCHEDOP_shutdown | (SHUTDOWN_poweroff << SCHEDOP_reasonshift))
     1.9          : "memory" );
    1.10  
    1.11      return ret;
    1.12 @@ -160,7 +160,7 @@ static inline int HYPERVISOR_reboot(void
    1.13      __asm__ __volatile__ (
    1.14          TRAP_INSTR
    1.15          : "=a" (ret) : "0" (__HYPERVISOR_sched_op),
    1.16 -        "b" (SCHEDOP_suspend | (STOPCODE_reboot << SCHEDOP_reasonshift))
    1.17 +        "b" (SCHEDOP_shutdown | (SHUTDOWN_reboot << SCHEDOP_reasonshift))
    1.18          : "memory" );
    1.19  
    1.20      return ret;
    1.21 @@ -173,7 +173,7 @@ static inline int HYPERVISOR_suspend(uns
    1.22      __asm__ __volatile__ (
    1.23          TRAP_INSTR
    1.24          : "=a" (ret) : "0" (__HYPERVISOR_sched_op),
    1.25 -        "b" (SCHEDOP_suspend | (STOPCODE_suspend << SCHEDOP_reasonshift)), 
    1.26 +        "b" (SCHEDOP_shutdown | (SHUTDOWN_suspend << SCHEDOP_reasonshift)), 
    1.27          "S" (srec) : "memory" );
    1.28  
    1.29      return ret;
     2.1 --- a/linux-2.4.26-xen-sparse/arch/xen/kernel/setup.c	Tue Jun 22 09:42:30 2004 +0000
     2.2 +++ b/linux-2.4.26-xen-sparse/arch/xen/kernel/setup.c	Tue Jun 22 10:45:04 2004 +0000
     2.3 @@ -1143,26 +1143,6 @@ void __init cpu_init (void)
     2.4  
     2.5  
     2.6  /******************************************************************************
     2.7 - * Time-to-die callback handling.
     2.8 - */
     2.9 -
    2.10 -static void shutdown_handler(ctrl_msg_t *msg, unsigned long id)
    2.11 -{
    2.12 -    extern void ctrl_alt_del(void);
    2.13 -    ctrl_if_send_response(msg);
    2.14 -    ctrl_alt_del();
    2.15 -}
    2.16 -
    2.17 -static int __init setup_shutdown_event(void)
    2.18 -{
    2.19 -    ctrl_if_register_receiver(CMSG_SHUTDOWN, shutdown_handler, 0);
    2.20 -    return 0;
    2.21 -}
    2.22 -
    2.23 -__initcall(setup_shutdown_event);
    2.24 -
    2.25 -
    2.26 -/******************************************************************************
    2.27   * Stop/pickle callback handling.
    2.28   */
    2.29  
    2.30 @@ -1294,9 +1274,15 @@ static void suspend_task(void *unused)
    2.31  
    2.32  static struct tq_struct suspend_tq;
    2.33  
    2.34 -static void suspend_handler(ctrl_msg_t *msg, unsigned long id)
    2.35 +static void shutdown_handler(ctrl_msg_t *msg, unsigned long id)
    2.36  {
    2.37 -    if ( !suspending )
    2.38 +    if ( msg->subtype != CMSG_SHUTDOWN_SUSPEND )
    2.39 +    {
    2.40 +        extern void ctrl_alt_del(void);
    2.41 +        ctrl_if_send_response(msg);
    2.42 +        ctrl_alt_del();
    2.43 +    }
    2.44 +    else if ( !suspending )
    2.45      {
    2.46  	suspending = 1;
    2.47  	suspend_tq.routine = suspend_task;
    2.48 @@ -1310,10 +1296,10 @@ static void suspend_handler(ctrl_msg_t *
    2.49      ctrl_if_send_response(msg);
    2.50  }
    2.51  
    2.52 -static int __init setup_suspend_event(void)
    2.53 +static int __init setup_shutdown_event(void)
    2.54  {
    2.55 -    ctrl_if_register_receiver(CMSG_SUSPEND, suspend_handler, 0);
    2.56 +    ctrl_if_register_receiver(CMSG_SHUTDOWN, shutdown_handler, 0);
    2.57      return 0;
    2.58  }
    2.59  
    2.60 -__initcall(setup_suspend_event);
    2.61 +__initcall(setup_shutdown_event);
     3.1 --- a/linux-2.4.26-xen-sparse/include/asm-xen/hypervisor.h	Tue Jun 22 09:42:30 2004 +0000
     3.2 +++ b/linux-2.4.26-xen-sparse/include/asm-xen/hypervisor.h	Tue Jun 22 10:45:04 2004 +0000
     3.3 @@ -248,7 +248,7 @@ static inline int HYPERVISOR_shutdown(vo
     3.4      __asm__ __volatile__ (
     3.5          TRAP_INSTR
     3.6          : "=a" (ret) : "0" (__HYPERVISOR_sched_op),
     3.7 -        "b" (SCHEDOP_suspend | (STOPCODE_shutdown << SCHEDOP_reasonshift))
     3.8 +        "b" (SCHEDOP_shutdown | (SHUTDOWN_poweroff << SCHEDOP_reasonshift))
     3.9          : "memory" );
    3.10  
    3.11      return ret;
    3.12 @@ -260,7 +260,7 @@ static inline int HYPERVISOR_reboot(void
    3.13      __asm__ __volatile__ (
    3.14          TRAP_INSTR
    3.15          : "=a" (ret) : "0" (__HYPERVISOR_sched_op),
    3.16 -        "b" (SCHEDOP_suspend | (STOPCODE_reboot << SCHEDOP_reasonshift))
    3.17 +        "b" (SCHEDOP_shutdown | (SHUTDOWN_reboot << SCHEDOP_reasonshift))
    3.18          : "memory" );
    3.19  
    3.20      return ret;
    3.21 @@ -273,7 +273,7 @@ static inline int HYPERVISOR_suspend(uns
    3.22      __asm__ __volatile__ (
    3.23          TRAP_INSTR
    3.24          : "=a" (ret) : "0" (__HYPERVISOR_sched_op),
    3.25 -        "b" (SCHEDOP_suspend | (STOPCODE_suspend << SCHEDOP_reasonshift)), 
    3.26 +        "b" (SCHEDOP_shutdown | (SHUTDOWN_suspend << SCHEDOP_reasonshift)), 
    3.27          "S" (srec) : "memory" );
    3.28  
    3.29      return ret;
     4.1 --- a/tools/examples/xc_dom_control.py	Tue Jun 22 09:42:30 2004 +0000
     4.2 +++ b/tools/examples/xc_dom_control.py	Tue Jun 22 10:45:04 2004 +0000
     4.3 @@ -9,8 +9,8 @@ def usage ():
     4.4      print >>sys.stderr, """
     4.5  Usage: %s [command] <params>
     4.6  
     4.7 -  stop      [dom]        -- pause a domain
     4.8 -  start     [dom]        -- un-pause a domain
     4.9 +  pause     [dom]        -- pause a domain
    4.10 +  unpause   [dom]        -- un-pause a domain
    4.11    shutdown  [dom] [[-w]] -- request a domain to shutdown (can specify 'all')
    4.12                              (optionally wait for complete shutdown)
    4.13    destroy   [dom]        -- immediately terminate a domain
    4.14 @@ -45,21 +45,21 @@ dom = None
    4.15  if len( sys.argv ) > 2 and re.match('\d+$', sys.argv[2]):
    4.16      dom = int(sys.argv[2])
    4.17  
    4.18 -if cmd == 'stop':
    4.19 -    rc = xc.domain_stop( dom=dom )
    4.20 +if cmd == 'pause':
    4.21 +    rc = xc.domain_pause( dom=dom )
    4.22  
    4.23 -elif cmd == 'start':
    4.24 -    rc = xc.domain_start( dom=dom )    
    4.25 +elif cmd == 'unpause':
    4.26 +    rc = xc.domain_unpause( dom=dom )    
    4.27  
    4.28  elif cmd == 'shutdown':
    4.29      list = []
    4.30      if dom != None:
    4.31 -        rc = xc.domain_destroy( dom=dom, force=0 )
    4.32 +        rc = xc.domain_destroy( dom=dom ) # should be CMSG_SHUTDOWN
    4.33          list.append(dom)
    4.34      elif sys.argv[2] == 'all':
    4.35          for i in xc.domain_getinfo():
    4.36              if i['dom'] != 0: # don't shutdown dom0!
    4.37 -                ret = xc.domain_destroy( dom=i['dom'], force=0 )
    4.38 +                ret = xc.domain_destroy( dom=i['dom'] ) # should be CMSG_SHUTDOWN
    4.39                  if ret !=0: rc = ret
    4.40                  else: list.append(i['dom'])
    4.41  
    4.42 @@ -72,7 +72,7 @@ elif cmd == 'shutdown':
    4.43                  time.sleep(1)
    4.44  
    4.45  elif cmd == 'destroy':
    4.46 -    rc = xc.domain_destroy( dom=dom, force=1 )    
    4.47 +    rc = xc.domain_destroy( dom=dom )    
    4.48  
    4.49  elif cmd == 'pincpu':
    4.50  
    4.51 @@ -90,8 +90,8 @@ elif cmd == 'list':
    4.52  
    4.53  	run   = (domain['running'] and 'r') or '-'
    4.54          block = (domain['blocked'] and 'b') or '-'
    4.55 -	stop  = (domain['stopped'] and 's') or '-'
    4.56 -	susp  = (domain['suspended'] and 'S') or '-'
    4.57 +	stop  = (domain['paused']  and 'p') or '-'
    4.58 +	susp  = (domain['shutdown'] and 's') or '-'
    4.59  	crash = (domain['crashed'] and 'c') or '-'
    4.60  
    4.61          domain['state'] = run + block + stop + susp + crash
     5.1 --- a/tools/examples/xc_dom_create.py	Tue Jun 22 09:42:30 2004 +0000
     5.2 +++ b/tools/examples/xc_dom_create.py	Tue Jun 22 10:45:04 2004 +0000
     5.3 @@ -364,7 +364,7 @@ def make_domain():
     5.4  	if not nlb: print >>open('/proc/sys/net/ipv4/ip_nonlocal_bind','w'), '0'
     5.5  
     5.6      if not dontstart:
     5.7 -        if xc.domain_start( dom=id ) < 0:
     5.8 +        if xc.domain_unpause( dom=id ) < 0:
     5.9              print "Error starting domain"
    5.10              xc.domain_destroy ( dom=id )
    5.11              sys.exit()
     6.1 --- a/tools/examples/xm_dom_control.py	Tue Jun 22 09:42:30 2004 +0000
     6.2 +++ b/tools/examples/xm_dom_control.py	Tue Jun 22 10:45:04 2004 +0000
     6.3 @@ -25,8 +25,8 @@ def usage (rc=0):
     6.4  Usage: %s [command] <params>
     6.5  
     6.6    help                   -- print usage
     6.7 -  stop      [dom]        -- pause a domain
     6.8 -  start     [dom]        -- un-pause a domain
     6.9 +  pause     [dom]        -- pause a domain
    6.10 +  unpause   [dom]        -- un-pause a domain
    6.11    shutdown  [dom] [[-w]] -- request a domain to shutdown (can specify 'all')
    6.12                              (optionally wait for complete shutdown)
    6.13    destroy   [dom]        -- immediately terminate a domain
    6.14 @@ -89,11 +89,11 @@ if len( sys.argv ) > 2 and re.match('\d+
    6.15  if cmd == "help":
    6.16      usage()
    6.17      
    6.18 -elif cmd == 'stop':
    6.19 -    rc = server.xend_domain_stop(dom)
    6.20 +elif cmd == 'pause':
    6.21 +    rc = server.xend_domain_pause(dom)
    6.22  
    6.23 -elif cmd == 'start':
    6.24 -    rc = server.xend_domain_start(dom)    
    6.25 +elif cmd == 'unpause':
    6.26 +    rc = server.xend_domain_unpause(dom)    
    6.27  
    6.28  elif cmd == 'shutdown':
    6.29      doms = []
     7.1 --- a/tools/examples/xm_dom_create.py	Tue Jun 22 09:42:30 2004 +0000
     7.2 +++ b/tools/examples/xm_dom_create.py	Tue Jun 22 10:45:04 2004 +0000
     7.3 @@ -305,7 +305,7 @@ def make_domain(config):
     7.4      else:
     7.5          console_port = None
     7.6      
     7.7 -    if server.xend_domain_start(dom) < 0:
     7.8 +    if server.xend_domain_unpause(dom) < 0:
     7.9          print "Error starting domain"
    7.10          server.xend_domain_halt(dom)
    7.11          sys.exit()
     8.1 --- a/tools/xc/lib/xc.h	Tue Jun 22 09:42:30 2004 +0000
     8.2 +++ b/tools/xc/lib/xc.h	Tue Jun 22 10:45:04 2004 +0000
     8.3 @@ -25,8 +25,8 @@ int xc_interface_close(int xc_handle);
     8.4  typedef struct {
     8.5      u32           domid;
     8.6      unsigned int  cpu;
     8.7 -    unsigned int  dying:1, crashed:1, suspended:1, 
     8.8 -                  stopped:1, blocked:1, running:1;
     8.9 +    unsigned int  dying:1, crashed:1, shutdown:1, 
    8.10 +                  paused:1, blocked:1, running:1;
    8.11      unsigned long nr_pages;
    8.12      unsigned long shared_info_frame;
    8.13      u64           cpu_time;
    8.14 @@ -40,13 +40,12 @@ int xc_domain_create(int xc_handle,
    8.15                       const char *name,
    8.16  		     int cpu,
    8.17                       u32 *pdomid);
    8.18 -int xc_domain_start(int xc_handle, 
    8.19 +int xc_domain_pause(int xc_handle, 
    8.20                      u32 domid);
    8.21 -int xc_domain_stop(int xc_handle, 
    8.22 -                   u32 domid);
    8.23 +int xc_domain_unpause(int xc_handle, 
    8.24 +                      u32 domid);
    8.25  int xc_domain_destroy(int xc_handle, 
    8.26 -                      u32 domid, 
    8.27 -                      int force);
    8.28 +                      u32 domid);
    8.29  int xc_domain_pincpu(int xc_handle,
    8.30                       u32 domid,
    8.31                       int cpu);
     9.1 --- a/tools/xc/lib/xc_domain.c	Tue Jun 22 09:42:30 2004 +0000
     9.2 +++ b/tools/xc/lib/xc_domain.c	Tue Jun 22 10:45:04 2004 +0000
     9.3 @@ -30,34 +30,32 @@ int xc_domain_create(int xc_handle,
     9.4  }    
     9.5  
     9.6  
     9.7 -int xc_domain_start(int xc_handle,
     9.8 +int xc_domain_pause(int xc_handle, 
     9.9                      u32 domid)
    9.10  {
    9.11      dom0_op_t op;
    9.12 -    op.cmd = DOM0_STARTDOMAIN;
    9.13 -    op.u.startdomain.domain = (domid_t)domid;
    9.14 +    op.cmd = DOM0_PAUSEDOMAIN;
    9.15 +    op.u.pausedomain.domain = (domid_t)domid;
    9.16      return do_dom0_op(xc_handle, &op);
    9.17  }    
    9.18  
    9.19  
    9.20 -int xc_domain_stop(int xc_handle, 
    9.21 -                   u32 domid)
    9.22 +int xc_domain_unpause(int xc_handle,
    9.23 +                      u32 domid)
    9.24  {
    9.25      dom0_op_t op;
    9.26 -    op.cmd = DOM0_STOPDOMAIN;
    9.27 -    op.u.stopdomain.domain = (domid_t)domid;
    9.28 +    op.cmd = DOM0_UNPAUSEDOMAIN;
    9.29 +    op.u.unpausedomain.domain = (domid_t)domid;
    9.30      return do_dom0_op(xc_handle, &op);
    9.31  }    
    9.32  
    9.33  
    9.34  int xc_domain_destroy(int xc_handle,
    9.35 -                      u32 domid, 
    9.36 -                      int force)
    9.37 +                      u32 domid)
    9.38  {
    9.39      dom0_op_t op;
    9.40      op.cmd = DOM0_DESTROYDOMAIN;
    9.41      op.u.destroydomain.domain = (domid_t)domid;
    9.42 -    op.u.destroydomain.force  = !!force;
    9.43      return do_dom0_op(xc_handle, &op);
    9.44  }
    9.45  
    9.46 @@ -94,12 +92,12 @@ int xc_domain_getinfo(int xc_handle,
    9.47          info->cpu     =
    9.48              (op.u.getdomaininfo.flags>>DOMFLAGS_CPUSHIFT) & DOMFLAGS_CPUMASK;
    9.49  
    9.50 -        info->dying     = (op.u.getdomaininfo.flags & DOMFLAGS_DYING);
    9.51 -        info->crashed   = (op.u.getdomaininfo.flags & DOMFLAGS_CRASHED);
    9.52 -        info->suspended = (op.u.getdomaininfo.flags & DOMFLAGS_SUSPENDED);
    9.53 -        info->stopped   = (op.u.getdomaininfo.flags & DOMFLAGS_STOPPED);
    9.54 -        info->blocked   = (op.u.getdomaininfo.flags & DOMFLAGS_BLOCKED);
    9.55 -        info->running   = (op.u.getdomaininfo.flags & DOMFLAGS_RUNNING);
    9.56 +        info->dying    = (op.u.getdomaininfo.flags & DOMFLAGS_DYING);
    9.57 +        info->crashed  = (op.u.getdomaininfo.flags & DOMFLAGS_CRASHED);
    9.58 +        info->shutdown = (op.u.getdomaininfo.flags & DOMFLAGS_SHUTDOWN);
    9.59 +        info->paused   = (op.u.getdomaininfo.flags & DOMFLAGS_PAUSED);
    9.60 +        info->blocked  = (op.u.getdomaininfo.flags & DOMFLAGS_BLOCKED);
    9.61 +        info->running  = (op.u.getdomaininfo.flags & DOMFLAGS_RUNNING);
    9.62  
    9.63          info->nr_pages = op.u.getdomaininfo.tot_pages;
    9.64          info->max_memkb = op.u.getdomaininfo.max_pages<<(PAGE_SHIFT-10);
    10.1 --- a/tools/xc/lib/xc_linux_build.c	Tue Jun 22 09:42:30 2004 +0000
    10.2 +++ b/tools/xc/lib/xc_linux_build.c	Tue Jun 22 10:45:04 2004 +0000
    10.3 @@ -436,7 +436,7 @@ int xc_linux_build(int xc_handle,
    10.4          PERROR("Could not get info on domain");
    10.5          goto error_out;
    10.6      }
    10.7 -    if ( !(op.u.getdomaininfo.flags & DOMFLAGS_STOPPED) ||
    10.8 +    if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) ||
    10.9           (ctxt->pt_base != 0) )
   10.10      {
   10.11          ERROR("Domain is already constructed");
    11.1 --- a/tools/xc/lib/xc_linux_restore.c	Tue Jun 22 09:42:30 2004 +0000
    11.2 +++ b/tools/xc/lib/xc_linux_restore.c	Tue Jun 22 10:45:04 2004 +0000
    11.3 @@ -606,13 +606,8 @@ int xc_linux_restore(int xc_handle,
    11.4  
    11.5  
    11.6   out:
    11.7 -    if ( rc != 0 )
    11.8 -    {
    11.9 -        if ( dom != 0 )
   11.10 -        {
   11.11 -            xc_domain_destroy( xc_handle, dom, 1 );
   11.12 -        }
   11.13 -    }
   11.14 +    if ( (rc != 0) && (dom != 0) )
   11.15 +        xc_domain_destroy(xc_handle, dom);
   11.16  
   11.17      if ( mmu != NULL )
   11.18          free(mmu);
    12.1 --- a/tools/xc/lib/xc_linux_save.c	Tue Jun 22 09:42:30 2004 +0000
    12.2 +++ b/tools/xc/lib/xc_linux_save.c	Tue Jun 22 10:45:04 2004 +0000
    12.3 @@ -273,10 +273,9 @@ int xc_linux_save(int xc_handle,
    12.4      }
    12.5  
    12.6      /* Ensure that the domain exists, and that it is stopped. */
    12.7 -
    12.8 -    if ( xc_domain_stop_sync( xc_handle, domid, &op, &ctxt ) )
    12.9 +    if ( xc_domain_pause(xc_handle, domid) )
   12.10      {
   12.11 -        PERROR("Could not sync stop domain");
   12.12 +        PERROR("Could not pause domain");
   12.13          goto out;
   12.14      }
   12.15  
   12.16 @@ -381,9 +380,9 @@ int xc_linux_save(int xc_handle,
   12.17              goto out;
   12.18          }
   12.19  
   12.20 -        if ( xc_domain_start( xc_handle, domid ) < 0 )
   12.21 +        if ( xc_domain_unpause(xc_handle, domid) < 0 )
   12.22          {
   12.23 -            ERROR("Couldn't restart domain");
   12.24 +            ERROR("Couldn't unpause domain");
   12.25              goto out;
   12.26          }
   12.27  
   12.28 @@ -754,8 +753,7 @@ int xc_linux_save(int xc_handle,
   12.29                  DPRINTF("Start last iteration\n");
   12.30                  last_iter = 1;
   12.31  
   12.32 -                xc_domain_stop_sync( xc_handle, domid, &op, NULL );
   12.33 -
   12.34 +                xc_domain_pause(xc_handle, domid);
   12.35              } 
   12.36  
   12.37              if ( xc_shadow_control( xc_handle, domid, 
    13.1 --- a/tools/xc/lib/xc_netbsd_build.c	Tue Jun 22 09:42:30 2004 +0000
    13.2 +++ b/tools/xc/lib/xc_netbsd_build.c	Tue Jun 22 10:45:04 2004 +0000
    13.3 @@ -258,7 +258,7 @@ int xc_netbsd_build(int xc_handle,
    13.4          PERROR("Could not get info on domain");
    13.5          goto error_out;
    13.6      }
    13.7 -    if ( !(op.u.getdomaininfo.flags & DOMFLAGS_STOPPED) ||
    13.8 +    if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) ||
    13.9           (op.u.getdomaininfo.ctxt->pt_base != 0) )
   13.10      {
   13.11          ERROR("Domain is already constructed");
    14.1 --- a/tools/xc/lib/xc_private.c	Tue Jun 22 09:42:30 2004 +0000
    14.2 +++ b/tools/xc/lib/xc_private.c	Tue Jun 22 10:45:04 2004 +0000
    14.3 @@ -199,19 +199,6 @@ int finish_mmu_updates(int xc_handle, mm
    14.4  }
    14.5  
    14.6  
    14.7 -/***********************************************************/
    14.8 -
    14.9 -/* this function is a hack until we get proper synchronous domain stop */
   14.10 -
   14.11 -int xc_domain_stop_sync( int xc_handle, domid_t domid,
   14.12 -                         dom0_op_t *op, full_execution_context_t *ctxt)
   14.13 -{
   14.14 -    op->cmd = DOM0_STOPDOMAIN;
   14.15 -    op->u.stopdomain.domain = (domid_t)domid;
   14.16 -    do_dom0_op(xc_handle, op);
   14.17 -    return 0;
   14.18 -}
   14.19 -
   14.20  long long  xc_domain_get_cpu_usage( int xc_handle, domid_t domid )
   14.21  {
   14.22      dom0_op_t op;
   14.23 @@ -229,8 +216,6 @@ long long  xc_domain_get_cpu_usage( int 
   14.24  }
   14.25  
   14.26  
   14.27 -/**********************************************************************/
   14.28 -
   14.29  /* This is shared between save and restore, and may generally be useful. */
   14.30  unsigned long csum_page (void * page)
   14.31  {
    15.1 --- a/tools/xc/lib/xc_private.h	Tue Jun 22 09:42:30 2004 +0000
    15.2 +++ b/tools/xc/lib/xc_private.h	Tue Jun 22 10:45:04 2004 +0000
    15.3 @@ -200,11 +200,6 @@ int mfn_mapper_flush_queue(mfn_mapper_t 
    15.4  void * mfn_mapper_queue_entry(mfn_mapper_t *t, int offset, 
    15.5  			      unsigned long mfn, int size );
    15.6  
    15.7 -/*********************/
    15.8 -
    15.9 -int xc_domain_stop_sync( int xc_handle, domid_t dom, 
   15.10 -			 dom0_op_t *op, full_execution_context_t *ctxt );
   15.11 -
   15.12  long long  xc_domain_get_cpu_usage( int xc_handle, domid_t domid );
   15.13  
   15.14  #endif /* __XC_PRIVATE_H__ */
    16.1 --- a/tools/xc/py/Xc.c	Tue Jun 22 09:42:30 2004 +0000
    16.2 +++ b/tools/xc/py/Xc.c	Tue Jun 22 10:45:04 2004 +0000
    16.3 @@ -55,7 +55,7 @@ static PyObject *pyxc_domain_create(PyOb
    16.4      return PyInt_FromLong(dom);
    16.5  }
    16.6  
    16.7 -static PyObject *pyxc_domain_start(PyObject *self,
    16.8 +static PyObject *pyxc_domain_pause(PyObject *self,
    16.9                                     PyObject *args,
   16.10                                     PyObject *kwds)
   16.11  {
   16.12 @@ -68,16 +68,16 @@ static PyObject *pyxc_domain_start(PyObj
   16.13      if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) )
   16.14          return NULL;
   16.15  
   16.16 -    if ( xc_domain_start(xc->xc_handle, dom) != 0 )
   16.17 +    if ( xc_domain_pause(xc->xc_handle, dom) != 0 )
   16.18          return PyErr_SetFromErrno(xc_error);
   16.19      
   16.20      Py_INCREF(zero);
   16.21      return zero;
   16.22  }
   16.23  
   16.24 -static PyObject *pyxc_domain_stop(PyObject *self,
   16.25 -                                  PyObject *args,
   16.26 -                                  PyObject *kwds)
   16.27 +static PyObject *pyxc_domain_unpause(PyObject *self,
   16.28 +                                     PyObject *args,
   16.29 +                                     PyObject *kwds)
   16.30  {
   16.31      XcObject *xc = (XcObject *)self;
   16.32  
   16.33 @@ -88,7 +88,7 @@ static PyObject *pyxc_domain_stop(PyObje
   16.34      if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) )
   16.35          return NULL;
   16.36  
   16.37 -    if ( xc_domain_stop(xc->xc_handle, dom) != 0 )
   16.38 +    if ( xc_domain_unpause(xc->xc_handle, dom) != 0 )
   16.39          return PyErr_SetFromErrno(xc_error);
   16.40      
   16.41      Py_INCREF(zero);
   16.42 @@ -102,15 +102,13 @@ static PyObject *pyxc_domain_destroy(PyO
   16.43      XcObject *xc = (XcObject *)self;
   16.44  
   16.45      u32 dom;
   16.46 -    int force = 0;
   16.47  
   16.48 -    static char *kwd_list[] = { "dom", "force", NULL };
   16.49 +    static char *kwd_list[] = { "dom", NULL };
   16.50  
   16.51 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list, 
   16.52 -                                      &dom, &force) )
   16.53 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) )
   16.54          return NULL;
   16.55  
   16.56 -    if ( xc_domain_destroy(xc->xc_handle, dom, force) != 0 )
   16.57 +    if ( xc_domain_destroy(xc->xc_handle, dom) != 0 )
   16.58          return PyErr_SetFromErrno(xc_error);
   16.59      
   16.60      Py_INCREF(zero);
   16.61 @@ -171,8 +169,8 @@ static PyObject *pyxc_domain_getinfo(PyO
   16.62                            "cpu",       info[i].cpu,
   16.63                            "dying",     info[i].dying,
   16.64                            "crashed",   info[i].crashed,
   16.65 -                          "suspended", info[i].suspended,
   16.66 -                          "stopped",   info[i].stopped,
   16.67 +                          "shutdown",  info[i].shutdown,
   16.68 +                          "paused",    info[i].paused,
   16.69                            "blocked",   info[i].blocked,
   16.70                            "running",   info[i].running,
   16.71                            "mem_kb",    info[i].nr_pages*4,
   16.72 @@ -270,7 +268,7 @@ static PyObject *pyxc_linux_save(PyObjec
   16.73              if ( rc == 0 )
   16.74              {
   16.75                  printf("Migration succesful -- destroy local copy\n");
   16.76 -                xc_domain_destroy( xc->xc_handle, dom, 1 );
   16.77 +                xc_domain_destroy(xc->xc_handle, dom);
   16.78                  close(sd);
   16.79                  Py_INCREF(zero);
   16.80                  return zero;
   16.81 @@ -281,7 +279,7 @@ static PyObject *pyxc_linux_save(PyObjec
   16.82  
   16.83      serr:
   16.84          printf("Migration failed -- restart local copy\n");
   16.85 -        xc_domain_start( xc->xc_handle, dom );
   16.86 +        xc_domain_unpause(xc->xc_handle, dom);
   16.87          PyErr_SetFromErrno(xc_error);
   16.88          if ( sd >= 0 ) close(sd);
   16.89          return NULL;
   16.90 @@ -327,7 +325,7 @@ static PyObject *pyxc_linux_save(PyObjec
   16.91              /* kill domain. We don't want to do this for checkpointing, but
   16.92                 if we don't do it here I think people will hurt themselves
   16.93                 by accident... */
   16.94 -            xc_domain_destroy( xc->xc_handle, dom, 1 );
   16.95 +            xc_domain_destroy(xc->xc_handle, dom);
   16.96              gzclose(gfd);
   16.97              close(fd);
   16.98  
   16.99 @@ -1015,26 +1013,25 @@ static PyMethodDef pyxc_methods[] = {
  16.100        " name   [str, '(anon)']: Informative textual name.\n\n"
  16.101        "Returns: [int] new domain identifier; -1 on error.\n" },
  16.102  
  16.103 -    { "domain_start", 
  16.104 -      (PyCFunction)pyxc_domain_start, 
  16.105 +    { "domain_pause", 
  16.106 +      (PyCFunction)pyxc_domain_pause, 
  16.107        METH_VARARGS | METH_KEYWORDS, "\n"
  16.108 -      "Start execution of a domain.\n"
  16.109 -      " dom [int]: Identifier of domain to be started.\n\n"
  16.110 +      "Temporarily pause execution of a domain.\n"
  16.111 +      " dom [int]: Identifier of domain to be paused.\n\n"
  16.112        "Returns: [int] 0 on success; -1 on error.\n" },
  16.113  
  16.114 -    { "domain_stop", 
  16.115 -      (PyCFunction)pyxc_domain_stop, 
  16.116 +    { "domain_unpause", 
  16.117 +      (PyCFunction)pyxc_domain_unpause, 
  16.118        METH_VARARGS | METH_KEYWORDS, "\n"
  16.119 -      "Stop execution of a domain.\n"
  16.120 -      " dom [int]: Identifier of domain to be stopped.\n\n"
  16.121 +      "(Re)start execution of a domain.\n"
  16.122 +      " dom [int]: Identifier of domain to be unpaused.\n\n"
  16.123        "Returns: [int] 0 on success; -1 on error.\n" },
  16.124  
  16.125      { "domain_destroy", 
  16.126        (PyCFunction)pyxc_domain_destroy, 
  16.127        METH_VARARGS | METH_KEYWORDS, "\n"
  16.128        "Destroy a domain.\n"
  16.129 -      " dom   [int]:    Identifier of domain to be destroyed.\n"
  16.130 -      " force [int, 0]: Bool - force immediate destruction?\n\n"
  16.131 +      " dom [int]:    Identifier of domain to be destroyed.\n\n"
  16.132        "Returns: [int] 0 on success; -1 on error.\n" },
  16.133  
  16.134      { "domain_pincpu", 
  16.135 @@ -1059,8 +1056,8 @@ static PyMethodDef pyxc_methods[] = {
  16.136        " cpu      [int]:  CPU to which this domain is bound\n"
  16.137        " dying    [int]:  Bool - is the domain dying?\n"
  16.138        " crashed  [int]:  Bool - has the domain crashed?\n"
  16.139 -      " suspended[int]:  Bool - has the domain suspended itself?\n"
  16.140 -      " stopped  [int]:  Bool - is the domain stopped by control software?\n"
  16.141 +      " shutdown [int]:  Bool - has the domain shut itself down?\n"
  16.142 +      " paused   [int]:  Bool - is the domain paused by control software?\n"
  16.143        " blocked  [int]:  Bool - is the domain blocked waiting for an event?\n"
  16.144        " running  [int]:  Bool - is the domain currently running?\n"
  16.145        " mem_kb   [int]:  Memory reservation, in kilobytes\n"
    17.1 --- a/tools/xend/lib/domain_controller.h	Tue Jun 22 09:42:30 2004 +0000
    17.2 +++ b/tools/xend/lib/domain_controller.h	Tue Jun 22 10:45:04 2004 +0000
    17.3 @@ -29,13 +29,13 @@ typedef struct {
    17.4  
    17.5  
    17.6  /*
    17.7 - * Stop codes for SCHEDOP_suspend. These are opaque to Xen but interpreted by
    17.8 - * control software to determine appropriate action.
    17.9 + * Reason codes for SCHEDOP_shutdown. These are opaque to Xen but may be
   17.10 + * interpreted by control software to determine the appropriate action. These 
   17.11 + * are only really advisories: the controller can actually do as it likes.
   17.12   */
   17.13 -
   17.14 -#define STOPCODE_shutdown   0  /* Domain exited normally. Clean up and kill. */
   17.15 -#define STOPCODE_reboot     1  /* Clean up, kill, and then restart. */
   17.16 -#define STOPCODE_suspend    2  /* Clean up, save suspend info, kill. */
   17.17 +#define SHUTDOWN_poweroff   0  /* Domain exited normally. Clean up and kill. */
   17.18 +#define SHUTDOWN_reboot     1  /* Clean up, kill, and then restart.          */
   17.19 +#define SHUTDOWN_suspend    2  /* Clean up, save suspend info, kill.         */
   17.20  
   17.21  
   17.22  /*
   17.23 @@ -69,7 +69,6 @@ typedef struct {
   17.24  #define CMSG_BLKIF_FE       2  /* Block-device frontend   */
   17.25  #define CMSG_NETIF_BE       3  /* Network-device backend  */
   17.26  #define CMSG_NETIF_FE       4  /* Network-device frontend */
   17.27 -#define CMSG_SUSPEND        5  /* Suspend messages        */
   17.28  #define CMSG_SHUTDOWN       6  /* Shutdown messages       */
   17.29  
   17.30  
   17.31 @@ -519,25 +518,15 @@ typedef struct {
   17.32  
   17.33  
   17.34  /******************************************************************************
   17.35 - * SUSPEND DEFINITIONS
   17.36 - */
   17.37 -
   17.38 -/*
   17.39 - * Subtypes for console messages.
   17.40 - */
   17.41 -/* None. */
   17.42 -
   17.43 -
   17.44 -/******************************************************************************
   17.45   * CONSOLE DEFINITIONS
   17.46   */
   17.47  
   17.48  /*
   17.49   * Subtypes for console messages.
   17.50   */
   17.51 -#define CMSG_SHUTDOWN_HALT      0   /* Shutdown and halt (don't die). */
   17.52 -#define CMSG_SHUTDOWN_POWEROFF  1   /* 'Poweroff' => clean death.     */
   17.53 -#define CMSG_SHUTDOWN_REBOOT    2   /* Shutdown and restart.          */
   17.54 -
   17.55 +#define CMSG_SHUTDOWN_POWEROFF  0   /* Clean shutdown (SHUTDOWN_poweroff).   */
   17.56 +#define CMSG_SHUTDOWN_REBOOT    1   /* Clean shutdown (SHUTDOWN_reboot).     */
   17.57 +#define CMSG_SHUTDOWN_SUSPEND   2   /* Create suspend info, then             */
   17.58 +                                    /* SHUTDOWN_suspend.                     */
   17.59  
   17.60  #endif /* __DOMAIN_CONTROLLER_H__ */
    18.1 --- a/tools/xenmgr/lib/EventTypes.py	Tue Jun 22 09:42:30 2004 +0000
    18.2 +++ b/tools/xenmgr/lib/EventTypes.py	Tue Jun 22 10:45:04 2004 +0000
    18.3 @@ -5,8 +5,8 @@
    18.4  ## xend.domain.destroy: dom, reason:died/crashed
    18.5  ## xend.domain.up ?
    18.6  
    18.7 -## xend.domain.start: dom
    18.8 -## xend.domain.stop: dom
    18.9 +## xend.domain.unpause: dom
   18.10 +## xend.domain.pause: dom
   18.11  ## xend.domain.shutdown: dom
   18.12  ## xend.domain.halt: dom
   18.13  
    19.1 --- a/tools/xenmgr/lib/XendClient.py	Tue Jun 22 09:42:30 2004 +0000
    19.2 +++ b/tools/xenmgr/lib/XendClient.py	Tue Jun 22 10:45:04 2004 +0000
    19.3 @@ -187,13 +187,13 @@ class Xend:
    19.4      def xend_domain(self, id):
    19.5          return xend_get(self.domainurl(id))
    19.6  
    19.7 -    def xend_domain_start(self, id):
    19.8 +    def xend_domain_unpause(self, id):
    19.9          return xend_call(self.domainurl(id),
   19.10 -                         {'op'      : 'start'})
   19.11 +                         {'op'      : 'unpause'})
   19.12  
   19.13 -    def xend_domain_stop(self, id):
   19.14 +    def xend_domain_pause(self, id):
   19.15          return xend_call(self.domainurl(id),
   19.16 -                         {'op'      : 'stop'})
   19.17 +                         {'op'      : 'pause'})
   19.18  
   19.19      def xend_domain_shutdown(self, id):
   19.20          return xend_call(self.domainurl(id),
    20.1 --- a/tools/xenmgr/lib/XendDomain.py	Tue Jun 22 09:42:30 2004 +0000
    20.2 +++ b/tools/xenmgr/lib/XendDomain.py	Tue Jun 22 10:45:04 2004 +0000
    20.3 @@ -188,18 +188,18 @@ class XendDomain:
    20.4          self.refresh_domain(id)
    20.5          return self.domain[id]
    20.6      
    20.7 -    def domain_start(self, id):
    20.8 -        """Start domain running.
    20.9 +    def domain_unpause(self, id):
   20.10 +        """(Re)start domain running.
   20.11          """
   20.12          dom = int(id)
   20.13 -        eserver.inject('xend.domain.start', id)
   20.14 -        return xc.domain_start(dom=dom)
   20.15 +        eserver.inject('xend.domain.unpause', id)
   20.16 +        return xc.domain_unpause(dom=dom)
   20.17      
   20.18 -    def domain_stop(self, id):
   20.19 -        """Stop domain running.
   20.20 +    def domain_pause(self, id):
   20.21 +        """Pause domain execution.
   20.22          """
   20.23          dom = int(id)
   20.24 -        return xc.domain_stop(dom=dom)
   20.25 +        return xc.domain_pause(dom=dom)
   20.26      
   20.27      def domain_shutdown(self, id):
   20.28          """Shutdown domain (nicely).
   20.29 @@ -208,7 +208,7 @@ class XendDomain:
   20.30          if dom <= 0:
   20.31              return 0
   20.32          eserver.inject('xend.domain.shutdown', id)
   20.33 -        val = xc.domain_destroy(dom=dom, force=0)
   20.34 +        val = xc.domain_destroy(dom=dom) # FIXME -- send CMSG_SHUTDOWN
   20.35          self.refresh()
   20.36          return val
   20.37      
   20.38 @@ -219,7 +219,7 @@ class XendDomain:
   20.39          if dom <= 0:
   20.40              return 0
   20.41          eserver.inject('xend.domain.halt', id)
   20.42 -        val = xc.domain_destroy(dom=dom, force=1)
   20.43 +        val = xc.domain_destroy(dom=dom)
   20.44          self.refresh()
   20.45          return val       
   20.46  
   20.47 @@ -233,7 +233,7 @@ class XendDomain:
   20.48          """Save domain state to file, halt domain.
   20.49          """
   20.50          dom = int(id)
   20.51 -        self.domain_stop(id)
   20.52 +        self.domain_pause(id)
   20.53          eserver.inject('xend.domain.save', id)
   20.54          rc = xc.linux_save(dom=dom, state_file=dst, progress=progress)
   20.55          if rc == 0:
    21.1 --- a/tools/xenmgr/lib/XendDomainInfo.py	Tue Jun 22 09:42:30 2004 +0000
    21.2 +++ b/tools/xenmgr/lib/XendDomainInfo.py	Tue Jun 22 10:45:04 2004 +0000
    21.3 @@ -113,8 +113,8 @@ class XendDomainInfo:
    21.4          if self.info:
    21.5              run   = (self.info['running'] and 'r') or '-'
    21.6              block = (self.info['blocked'] and 'b') or '-'
    21.7 -            stop  = (self.info['stopped'] and 's') or '-'
    21.8 -            susp  = (self.info['suspended'] and 'S') or '-'
    21.9 +            stop  = (self.info['paused']  and 'p') or '-'
   21.10 +            susp  = (self.info['shutdown'] and 's') or '-'
   21.11              crash = (self.info['crashed'] and 'c') or '-'
   21.12              state = run + block + stop + susp + crash
   21.13              sxpr.append(['cpu', self.info['cpu']])
   21.14 @@ -172,7 +172,7 @@ class XendDomainInfo:
   21.15      def destroy(self):
   21.16          if self.dom <= 0:
   21.17              return 0
   21.18 -        return xc.domain_destroy(dom=self.dom, force=1)
   21.19 +        return xc.domain_destroy(dom=self.dom)
   21.20  
   21.21      def show(self):
   21.22          """Print virtual machine info.
    22.1 --- a/tools/xenmgr/lib/server/SrvDomain.py	Tue Jun 22 09:42:30 2004 +0000
    22.2 +++ b/tools/xenmgr/lib/server/SrvDomain.py	Tue Jun 22 10:45:04 2004 +0000
    22.3 @@ -18,12 +18,12 @@ class SrvDomain(SrvDir):
    22.4          self.xd = XendDomain.instance()
    22.5          self.xconsole = XendConsole.instance()
    22.6  
    22.7 -    def op_start(self, op, req):
    22.8 -        val = self.xd.domain_start(self.dom.id)
    22.9 +    def op_unpause(self, op, req):
   22.10 +        val = self.xd.domain_unpause(self.dom.id)
   22.11          return val
   22.12          
   22.13 -    def op_stop(self, op, req):
   22.14 -        val = self.xd.domain_stop(self.dom.id)
   22.15 +    def op_pause(self, op, req):
   22.16 +        val = self.xd.domain_pause(self.dom.id)
   22.17          return val
   22.18  
   22.19      def op_shutdown(self, op, req):
    23.1 --- a/tools/xenmgr/lib/xm/create.py	Tue Jun 22 09:42:30 2004 +0000
    23.2 +++ b/tools/xenmgr/lib/xm/create.py	Tue Jun 22 10:45:04 2004 +0000
    23.3 @@ -270,7 +270,7 @@ def make_domain(opts, config):
    23.4      else:
    23.5          console_port = None
    23.6      
    23.7 -    if server.xend_domain_start(dom) < 0:
    23.8 +    if server.xend_domain_unpause(dom) < 0:
    23.9          server.xend_domain_halt(dom)
   23.10          opts.err("Failed to start domain %d" % dom)
   23.11      opts.info("Started domain %d, console on port %d"
    24.1 --- a/tools/xenmgr/lib/xm/main.py	Tue Jun 22 09:42:30 2004 +0000
    24.2 +++ b/tools/xenmgr/lib/xm/main.py	Tue Jun 22 10:45:04 2004 +0000
    24.3 @@ -101,25 +101,25 @@ class Xm:
    24.4          """Shutdown a domain."""
    24.5          shutdown.main(args)
    24.6  
    24.7 -    def xm_stop(self, help, args):
    24.8 -        """Stop execution of a domain."""
    24.9 +    def xm_pause(self, help, args):
   24.10 +        """Pause execution of a domain."""
   24.11          if help:
   24.12              print args[0], 'DOM'
   24.13 -            print '\nStop execution of domain DOM.'
   24.14 +            print '\nPause execution of domain DOM.'
   24.15              return
   24.16          if len(args) < 2: self.err("%s: Missing domain" % args[0])
   24.17          dom = args[1]
   24.18 -        server.xend_domain_stop(dom)
   24.19 +        server.xend_domain_pause(dom)
   24.20  
   24.21 -    def xm_start(self, help, args):
   24.22 -        """Start execution of a domain."""
   24.23 +    def xm_unpause(self, help, args):
   24.24 +        """(Re)start execution of a domain."""
   24.25          if help:
   24.26              print args[0], 'DOM'
   24.27 -            print '\nStart execution of domain DOM.'
   24.28 +            print '\n(Re)start execution of domain DOM.'
   24.29              return
   24.30          if len(args) < 2: self.err("%s: Missing domain" % args[0])
   24.31          dom = args[1]
   24.32 -        server.xend_domain_start(dom)
   24.33 +        server.xend_domain_unpause(dom)
   24.34  
   24.35      def xm_pincpu(self, help, args):
   24.36          """Pin a domain to a cpu. """
    25.1 --- a/xen/arch/x86/process.c	Tue Jun 22 09:42:30 2004 +0000
    25.2 +++ b/xen/arch/x86/process.c	Tue Jun 22 10:45:04 2004 +0000
    25.3 @@ -76,7 +76,7 @@ void startup_cpu_idle_loop(void)
    25.4  {
    25.5      /* Just some sanity to ensure that the scheduler is set up okay. */
    25.6      ASSERT(current->domain == IDLE_DOMAIN_ID);
    25.7 -    domain_start(current);
    25.8 +    domain_unpause_by_systemcontroller(current);
    25.9      __enter_scheduler();
   25.10  
   25.11      /*
    26.1 --- a/xen/common/debug.c	Tue Jun 22 09:42:30 2004 +0000
    26.2 +++ b/xen/common/debug.c	Tue Jun 22 10:45:04 2004 +0000
    26.3 @@ -52,7 +52,7 @@ void pdb_do_debug (dom0_op_t *op)
    26.4  	    struct domain *d = find_domain_by_id(op->u.debug.domain);
    26.5  	    if ( d != NULL )
    26.6  	    {
    26.7 -                domain_start(d);
    26.8 +                domain_unpause_by_systemcontroller(d);
    26.9  		put_domain(d);
   26.10  	    }
   26.11  	    else
   26.12 @@ -94,7 +94,7 @@ void pdb_do_debug (dom0_op_t *op)
   26.13  
   26.14  	    if ( d != NULL )
   26.15  	    {
   26.16 -                domain_stop(d);
   26.17 +                domain_pause_by_systemcontroller(d);
   26.18  		put_domain(d);
   26.19  	    }
   26.20  	    else
    27.1 --- a/xen/common/dom0_ops.c	Tue Jun 22 09:42:30 2004 +0000
    27.2 +++ b/xen/common/dom0_ops.c	Tue Jun 22 10:45:04 2004 +0000
    27.3 @@ -80,16 +80,16 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    27.4      }
    27.5      break;
    27.6  
    27.7 -    case DOM0_STARTDOMAIN:
    27.8 +    case DOM0_PAUSEDOMAIN:
    27.9      {
   27.10 -        struct domain *d = find_domain_by_id(op->u.startdomain.domain);
   27.11 +        struct domain *d = find_domain_by_id(op->u.pausedomain.domain);
   27.12          ret = -ESRCH;
   27.13          if ( d != NULL )
   27.14          {
   27.15              ret = -EINVAL;
   27.16 -            if ( test_bit(DF_CONSTRUCTED, &d->flags) )
   27.17 +            if ( d != current )
   27.18              {
   27.19 -                domain_start(d);
   27.20 +                domain_pause_by_systemcontroller(d);
   27.21                  ret = 0;
   27.22              }
   27.23              put_domain(d);
   27.24 @@ -97,16 +97,16 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
   27.25      }
   27.26      break;
   27.27  
   27.28 -    case DOM0_STOPDOMAIN:
   27.29 +    case DOM0_UNPAUSEDOMAIN:
   27.30      {
   27.31 -        struct domain *d = find_domain_by_id(op->u.stopdomain.domain);
   27.32 +        struct domain *d = find_domain_by_id(op->u.unpausedomain.domain);
   27.33          ret = -ESRCH;
   27.34          if ( d != NULL )
   27.35          {
   27.36              ret = -EINVAL;
   27.37 -            if ( d != current )
   27.38 +            if ( test_bit(DF_CONSTRUCTED, &d->flags) )
   27.39              {
   27.40 -                domain_stop(d);
   27.41 +                domain_unpause_by_systemcontroller(d);
   27.42                  ret = 0;
   27.43              }
   27.44              put_domain(d);
   27.45 @@ -299,16 +299,16 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
   27.46          strcpy(op->u.getdomaininfo.name, d->name);
   27.47          
   27.48          op->u.getdomaininfo.flags =
   27.49 -            (test_bit(DF_DYING,     &d->flags) ? DOMFLAGS_DYING     : 0) |
   27.50 -            (test_bit(DF_CRASHED,   &d->flags) ? DOMFLAGS_CRASHED   : 0) |
   27.51 -            (test_bit(DF_SUSPENDED, &d->flags) ? DOMFLAGS_SUSPENDED : 0) |
   27.52 -            (test_bit(DF_STOPPED,   &d->flags) ? DOMFLAGS_STOPPED   : 0) |
   27.53 -            (test_bit(DF_BLOCKED,   &d->flags) ? DOMFLAGS_BLOCKED   : 0) |
   27.54 -            (test_bit(DF_RUNNING,   &d->flags) ? DOMFLAGS_RUNNING   : 0);
   27.55 +            (test_bit(DF_DYING,     &d->flags) ? DOMFLAGS_DYING    : 0) |
   27.56 +            (test_bit(DF_CRASHED,   &d->flags) ? DOMFLAGS_CRASHED  : 0) |
   27.57 +            (test_bit(DF_SHUTDOWN,  &d->flags) ? DOMFLAGS_SHUTDOWN : 0) |
   27.58 +            (test_bit(DF_CTRLPAUSE, &d->flags) ? DOMFLAGS_PAUSED   : 0) |
   27.59 +            (test_bit(DF_BLOCKED,   &d->flags) ? DOMFLAGS_BLOCKED  : 0) |
   27.60 +            (test_bit(DF_RUNNING,   &d->flags) ? DOMFLAGS_RUNNING  : 0);
   27.61  
   27.62          op->u.getdomaininfo.flags |= d->processor << DOMFLAGS_CPUSHIFT;
   27.63          op->u.getdomaininfo.flags |= 
   27.64 -            d->suspend_code << DOMFLAGS_SUSPCODESHIFT;
   27.65 +            d->shutdown_code << DOMFLAGS_SHUTDOWNSHIFT;
   27.66  
   27.67          op->u.getdomaininfo.tot_pages   = d->tot_pages;
   27.68          op->u.getdomaininfo.max_pages   = d->max_pages;
    28.1 --- a/xen/common/domain.c	Tue Jun 22 09:42:30 2004 +0000
    28.2 +++ b/xen/common/domain.c	Tue Jun 22 10:45:04 2004 +0000
    28.3 @@ -11,6 +11,7 @@
    28.4  #include <xen/shadow.h>
    28.5  #include <xen/console.h>
    28.6  #include <xen/shadow.h>
    28.7 +#include <xen/irq.h>
    28.8  #include <asm/io.h>
    28.9  #include <asm/domain_page.h>
   28.10  #include <asm/flushtlb.h>
   28.11 @@ -193,19 +194,19 @@ void domain_crash(void)
   28.12      BUG();
   28.13  }
   28.14  
   28.15 -void domain_suspend(u8 reason)
   28.16 +void domain_shutdown(u8 reason)
   28.17  {
   28.18      struct domain *d;
   28.19  
   28.20      if ( current->domain == 0 )
   28.21      {
   28.22          extern void machine_restart(char *);
   28.23 -        printk("Domain 0 halted: rebooting machine!\n");
   28.24 +        printk("Domain 0 shutdown: rebooting machine!\n");
   28.25          machine_restart(0);
   28.26      }
   28.27  
   28.28 -    current->suspend_code = reason;
   28.29 -    set_bit(DF_SUSPENDED, &current->flags);
   28.30 +    current->shutdown_code = reason;
   28.31 +    set_bit(DF_SHUTDOWN, &current->flags);
   28.32  
   28.33      d = find_domain_by_id(0);
   28.34      send_guest_virq(d, VIRQ_DOM_EXC);
    29.1 --- a/xen/common/kernel.c	Tue Jun 22 09:42:30 2004 +0000
    29.2 +++ b/xen/common/kernel.c	Tue Jun 22 10:45:04 2004 +0000
    29.3 @@ -286,8 +286,8 @@ void cmain(unsigned long magic, multiboo
    29.4  
    29.5      init_trace_bufs();
    29.6  
    29.7 -    domain_start(current);
    29.8 -    domain_start(new_dom);
    29.9 +    domain_unpause_by_systemcontroller(current);
   29.10 +    domain_unpause_by_systemcontroller(new_dom);
   29.11      startup_cpu_idle_loop();
   29.12  }
   29.13  
    30.1 --- a/xen/common/schedule.c	Tue Jun 22 09:42:30 2004 +0000
    30.2 +++ b/xen/common/schedule.c	Tue Jun 22 10:45:04 2004 +0000
    30.3 @@ -129,7 +129,8 @@ struct domain *alloc_domain_struct(void)
    30.4   */
    30.5  void sched_add_domain(struct domain *d) 
    30.6  {
    30.7 -    set_bit(DF_STOPPED, &d->flags);
    30.8 +    /* Must be unpaused by control software to start execution. */
    30.9 +    set_bit(DF_CTRLPAUSE, &d->flags);
   30.10  
   30.11      if ( d->domain != IDLE_DOMAIN_ID )
   30.12      {
   30.13 @@ -269,9 +270,9 @@ long do_sched_op(unsigned long op)
   30.14          break;
   30.15      }
   30.16  
   30.17 -    case SCHEDOP_suspend:
   30.18 +    case SCHEDOP_shutdown:
   30.19      {
   30.20 -        domain_suspend((u8)(op >> SCHEDOP_reasonshift));
   30.21 +        domain_shutdown((u8)(op >> SCHEDOP_reasonshift));
   30.22          break;
   30.23      }
   30.24  
    31.1 --- a/xen/common/shadow.c	Tue Jun 22 09:42:30 2004 +0000
    31.2 +++ b/xen/common/shadow.c	Tue Jun 22 10:45:04 2004 +0000
    31.3 @@ -417,7 +417,7 @@ static int shadow_mode_table_op(struct d
    31.4  
    31.5          /* Might as well stop the domain as an optimization. */
    31.6  		if ( zero )
    31.7 -            domain_stop(d);
    31.8 +            domain_pause_by_systemcontroller(d);
    31.9  
   31.10  		break;
   31.11      }
    32.1 --- a/xen/include/hypervisor-ifs/dom0_ops.h	Tue Jun 22 09:42:30 2004 +0000
    32.2 +++ b/xen/include/hypervisor-ifs/dom0_ops.h	Tue Jun 22 10:45:04 2004 +0000
    32.3 @@ -19,7 +19,7 @@
    32.4   * This makes sure that old versions of dom0 tools will stop working in a
    32.5   * well-defined way (rather than crashing the machine, for instance).
    32.6   */
    32.7 -#define DOM0_INTERFACE_VERSION   0xAAAA000F
    32.8 +#define DOM0_INTERFACE_VERSION   0xAAAA0010
    32.9  
   32.10  #define MAX_DOMAIN_NAME    16
   32.11  
   32.12 @@ -63,20 +63,19 @@ typedef struct {
   32.13  typedef struct {
   32.14      /* IN variables. */
   32.15      domid_t      domain;              /*  0 */
   32.16 -    u32          force;               /*  4 */
   32.17 -} PACKED dom0_destroydomain_t; /* 8 bytes */
   32.18 +} PACKED dom0_destroydomain_t; /* 4 bytes */
   32.19  
   32.20 -#define DOM0_STARTDOMAIN      10
   32.21 +#define DOM0_PAUSEDOMAIN      10
   32.22  typedef struct {
   32.23      /* IN parameters. */
   32.24      domid_t domain;                   /*  0 */
   32.25 -} PACKED dom0_startdomain_t; /* 4 bytes */
   32.26 +} PACKED dom0_pausedomain_t; /* 4 bytes */
   32.27  
   32.28 -#define DOM0_STOPDOMAIN       11
   32.29 +#define DOM0_UNPAUSEDOMAIN    11
   32.30  typedef struct {
   32.31      /* IN parameters. */
   32.32      domid_t domain;                   /*  0 */
   32.33 -} PACKED dom0_stopdomain_t; /* 4 bytes */
   32.34 +} PACKED dom0_unpausedomain_t; /* 4 bytes */
   32.35  
   32.36  #define DOM0_GETDOMAININFO    12
   32.37  typedef struct {
   32.38 @@ -85,14 +84,14 @@ typedef struct {
   32.39      /* OUT variables. */
   32.40  #define DOMFLAGS_DYING     (1<<0) /* Domain is scheduled to die.             */
   32.41  #define DOMFLAGS_CRASHED   (1<<1) /* Crashed domain; frozen for postmortem.  */
   32.42 -#define DOMFLAGS_SUSPENDED (1<<2) /* Domain voluntarily halted it execution. */
   32.43 -#define DOMFLAGS_STOPPED   (1<<3) /* Currently stopped by control software.  */
   32.44 +#define DOMFLAGS_SHUTDOWN  (1<<2) /* The guest OS has shut itself down.      */
   32.45 +#define DOMFLAGS_PAUSED    (1<<3) /* Currently paused by control software.   */
   32.46  #define DOMFLAGS_BLOCKED   (1<<4) /* Currently blocked pending an event.     */
   32.47  #define DOMFLAGS_RUNNING   (1<<5) /* Domain is currently running.            */
   32.48  #define DOMFLAGS_CPUMASK      255 /* CPU to which this domain is bound.      */
   32.49  #define DOMFLAGS_CPUSHIFT       8
   32.50 -#define DOMFLAGS_SUSPCODEMASK 255 /* DOMSTATE_SUSPENDED guest-supplied code. */
   32.51 -#define DOMFLAGS_SUSPCODESHIFT 16
   32.52 +#define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code.  */
   32.53 +#define DOMFLAGS_SHUTDOWNSHIFT 16
   32.54      u32      flags;                   /*  4 */
   32.55      u8       name[MAX_DOMAIN_NAME];   /*  8 */
   32.56      full_execution_context_t *ctxt;   /* 24 */ /* NB. IN/OUT variable. */
   32.57 @@ -319,8 +318,8 @@ typedef struct {
   32.58      union {                           /* 8 */
   32.59  	u32                      dummy[18]; /* 72 bytes */
   32.60          dom0_createdomain_t      createdomain;
   32.61 -        dom0_startdomain_t       startdomain;
   32.62 -        dom0_stopdomain_t        stopdomain;
   32.63 +        dom0_pausedomain_t       pausedomain;
   32.64 +        dom0_unpausedomain_t     unpausedomain;
   32.65          dom0_destroydomain_t     destroydomain;
   32.66          dom0_getmemlist_t        getmemlist;
   32.67          dom0_schedctl_t          schedctl;
    33.1 --- a/xen/include/hypervisor-ifs/hypervisor-if.h	Tue Jun 22 09:42:30 2004 +0000
    33.2 +++ b/xen/include/hypervisor-ifs/hypervisor-if.h	Tue Jun 22 10:45:04 2004 +0000
    33.3 @@ -164,9 +164,9 @@
    33.4   */
    33.5  #define SCHEDOP_yield           0   /* Give up the CPU voluntarily.       */
    33.6  #define SCHEDOP_block           1   /* Block until an event is received.  */
    33.7 -#define SCHEDOP_suspend         2   /* Stop executing this domain.        */
    33.8 +#define SCHEDOP_shutdown        2   /* Stop executing this domain.        */
    33.9  #define SCHEDOP_cmdmask       255   /* 8-bit command. */
   33.10 -#define SCHEDOP_reasonshift     8   /* 8-bit suspend code. (SCHEDOP_suspend) */
   33.11 +#define SCHEDOP_reasonshift     8   /* 8-bit reason code. (SCHEDOP_shutdown) */
   33.12  
   33.13  /*
   33.14   * Commands to HYPERVISOR_console_io().
    34.1 --- a/xen/include/xen/sched.h	Tue Jun 22 09:42:30 2004 +0000
    34.2 +++ b/xen/include/xen/sched.h	Tue Jun 22 10:45:04 2004 +0000
    34.3 @@ -96,7 +96,7 @@ struct domain
    34.4  
    34.5      /* Scheduling. */
    34.6      struct list_head run_list;
    34.7 -    int              suspend_code;  /* code value from OS (if DF_SUSPENDED). */
    34.8 +    int              shutdown_code; /* code value from OS (if DF_SHUTDOWN). */
    34.9      s_time_t         lastschd;      /* time this domain was last scheduled */
   34.10      s_time_t         lastdeschd;    /* time this domain was last descheduled */
   34.11      s_time_t         cpu_time;      /* total CPU time received till now */
   34.12 @@ -193,7 +193,7 @@ struct domain *find_last_domain(void);
   34.13  extern void domain_destruct(struct domain *d);
   34.14  extern void domain_kill(struct domain *d);
   34.15  extern void domain_crash(void);
   34.16 -extern void domain_suspend(u8 reason);
   34.17 +extern void domain_shutdown(u8 reason);
   34.18  
   34.19  /* arch/process.c */
   34.20  void new_thread(struct domain *d,
   34.21 @@ -254,8 +254,8 @@ extern struct domain *task_list;
   34.22  #define DF_CONSOLEWRITEBUG 6 /* Has this domain used the obsolete console?  */
   34.23  #define DF_PHYSDEV      7 /* May this domain do IO to physical devices?     */
   34.24  #define DF_BLOCKED      8 /* Domain is blocked waiting for an event.        */
   34.25 -#define DF_STOPPED      9 /* Domain is stopped by control software.          */
   34.26 -#define DF_SUSPENDED   10 /* Guest suspended its execution for some reason. */
   34.27 +#define DF_CTRLPAUSE    9 /* Domain is paused by controller software.       */
   34.28 +#define DF_SHUTDOWN    10 /* Guest shut itself down for some reason.        */
   34.29  #define DF_CRASHED     11 /* Domain crashed inside Xen, cannot continue.    */
   34.30  #define DF_DYING       12 /* Death rattle.                                  */
   34.31  #define DF_RUNNING     13 /* Currently running on a CPU.                    */
   34.32 @@ -264,8 +264,8 @@ extern struct domain *task_list;
   34.33  static inline int domain_runnable(struct domain *d)
   34.34  {
   34.35      return ( (atomic_read(&d->pausecnt) == 0) &&
   34.36 -             !(d->flags & ((1<<DF_BLOCKED)|(1<<DF_STOPPED)|
   34.37 -                           (1<<DF_SUSPENDED)|(1<<DF_CRASHED))) );
   34.38 +             !(d->flags & ((1<<DF_BLOCKED)|(1<<DF_CTRLPAUSE)|
   34.39 +                           (1<<DF_SHUTDOWN)|(1<<DF_CRASHED))) );
   34.40  }
   34.41  
   34.42  static inline void domain_pause(struct domain *d)
   34.43 @@ -289,24 +289,17 @@ static inline void domain_unblock(struct
   34.44          domain_wake(d);
   34.45  }
   34.46  
   34.47 -static inline void domain_unsuspend(struct domain *d)
   34.48 +static inline void domain_pause_by_systemcontroller(struct domain *d)
   34.49  {
   34.50      ASSERT(d != current);
   34.51 -    if ( test_and_clear_bit(DF_SUSPENDED, &d->flags) )
   34.52 -        domain_wake(d);
   34.53 -}
   34.54 -
   34.55 -static inline void domain_stop(struct domain *d)
   34.56 -{
   34.57 -    ASSERT(d != current);
   34.58 -    if ( !test_and_set_bit(DF_STOPPED, &d->flags) )
   34.59 +    if ( !test_and_set_bit(DF_CTRLPAUSE, &d->flags) )
   34.60          domain_sleep(d);
   34.61  }
   34.62  
   34.63 -static inline void domain_start(struct domain *d)
   34.64 +static inline void domain_unpause_by_systemcontroller(struct domain *d)
   34.65  {
   34.66      ASSERT(d != current);
   34.67 -    if ( test_and_clear_bit(DF_STOPPED, &d->flags) )
   34.68 +    if ( test_and_clear_bit(DF_CTRLPAUSE, &d->flags) )
   34.69          domain_wake(d);
   34.70  }
   34.71