sched.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 "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. * Reason codes for SCHEDOP_shutdown. These may be interpreted by control
  61. * software to determine the appropriate action. For the most part, Xen does
  62. * not care about the shutdown code.
  63. */
  64. #define SHUTDOWN_poweroff 0 /* Domain exited normally. Clean up and kill. */
  65. #define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */
  66. #define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */
  67. #define SHUTDOWN_crash 3 /* Tell controller we've crashed. */
  68. #endif /* __XEN_PUBLIC_SCHED_H__ */