sched.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /******************************************************************************
  2. * sched.h
  3. *
  4. * Scheduler state interactions
  5. *
  6. * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
  7. */
  8. #ifndef __XEN_PUBLIC_SCHED_H__
  9. #define __XEN_PUBLIC_SCHED_H__
  10. #include <xen/interface/event_channel.h>
  11. /*
  12. * The prototype for this hypercall is:
  13. * long sched_op_new(int cmd, void *arg)
  14. * @cmd == SCHEDOP_??? (scheduler operation).
  15. * @arg == Operation-specific extra argument(s), as described below.
  16. *
  17. * **NOTE**:
  18. * Versions of Xen prior to 3.0.2 provide only the following legacy version
  19. * of this hypercall, supporting only the commands yield, block and shutdown:
  20. * long sched_op(int cmd, unsigned long arg)
  21. * @cmd == SCHEDOP_??? (scheduler operation).
  22. * @arg == 0 (SCHEDOP_yield and SCHEDOP_block)
  23. * == SHUTDOWN_* code (SCHEDOP_shutdown)
  24. */
  25. /*
  26. * Voluntarily yield the CPU.
  27. * @arg == NULL.
  28. */
  29. #define SCHEDOP_yield 0
  30. /*
  31. * Block execution of this VCPU until an event is received for processing.
  32. * If called with event upcalls masked, this operation will atomically
  33. * reenable event delivery and check for pending events before blocking the
  34. * VCPU. This avoids a "wakeup waiting" race.
  35. * @arg == NULL.
  36. */
  37. #define SCHEDOP_block 1
  38. /*
  39. * Halt execution of this domain (all VCPUs) and notify the system controller.
  40. * @arg == pointer to sched_shutdown structure.
  41. */
  42. #define SCHEDOP_shutdown 2
  43. struct sched_shutdown {
  44. unsigned int reason; /* SHUTDOWN_* */
  45. };
  46. DEFINE_GUEST_HANDLE_STRUCT(sched_shutdown);
  47. /*
  48. * Poll a set of event-channel ports. Return when one or more are pending. An
  49. * optional timeout may be specified.
  50. * @arg == pointer to sched_poll structure.
  51. */
  52. #define SCHEDOP_poll 3
  53. struct sched_poll {
  54. GUEST_HANDLE(evtchn_port_t) ports;
  55. unsigned int nr_ports;
  56. uint64_t timeout;
  57. };
  58. DEFINE_GUEST_HANDLE_STRUCT(sched_poll);
  59. /*
  60. * Declare a shutdown for another domain. The main use of this function is
  61. * in interpreting shutdown requests and reasons for fully-virtualized
  62. * domains. A para-virtualized domain may use SCHEDOP_shutdown directly.
  63. * @arg == pointer to sched_remote_shutdown structure.
  64. */
  65. #define SCHEDOP_remote_shutdown 4
  66. struct sched_remote_shutdown {
  67. domid_t domain_id; /* Remote domain ID */
  68. unsigned int reason; /* SHUTDOWN_xxx reason */
  69. };
  70. /*
  71. * Latch a shutdown code, so that when the domain later shuts down it
  72. * reports this code to the control tools.
  73. * @arg == as for SCHEDOP_shutdown.
  74. */
  75. #define SCHEDOP_shutdown_code 5
  76. /*
  77. * Setup, poke and destroy a domain watchdog timer.
  78. * @arg == pointer to sched_watchdog structure.
  79. * With id == 0, setup a domain watchdog timer to cause domain shutdown
  80. * after timeout, returns watchdog id.
  81. * With id != 0 and timeout == 0, destroy domain watchdog timer.
  82. * With id != 0 and timeout != 0, poke watchdog timer and set new timeout.
  83. */
  84. #define SCHEDOP_watchdog 6
  85. struct sched_watchdog {
  86. uint32_t id; /* watchdog ID */
  87. uint32_t timeout; /* timeout */
  88. };
  89. /*
  90. * Reason codes for SCHEDOP_shutdown. These may be interpreted by control
  91. * software to determine the appropriate action. For the most part, Xen does
  92. * not care about the shutdown code.
  93. */
  94. #define SHUTDOWN_poweroff 0 /* Domain exited normally. Clean up and kill. */
  95. #define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */
  96. #define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */
  97. #define SHUTDOWN_crash 3 /* Tell controller we've crashed. */
  98. #define SHUTDOWN_watchdog 4 /* Restart because watchdog time expired. */
  99. /*
  100. * Domain asked to perform 'soft reset' for it. The expected behavior is to
  101. * reset internal Xen state for the domain returning it to the point where it
  102. * was created but leaving the domain's memory contents and vCPU contexts
  103. * intact. This will allow the domain to start over and set up all Xen specific
  104. * interfaces again.
  105. */
  106. #define SHUTDOWN_soft_reset 5
  107. #endif /* __XEN_PUBLIC_SCHED_H__ */