Linux Audio

Check our new training course

Loading...
v6.13.7
  1/* SPDX-License-Identifier: MIT */
  2/******************************************************************************
  3 * sched.h
  4 *
  5 * Scheduler state interactions
  6 *
  7 * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
  8 */
  9
 10#ifndef __XEN_PUBLIC_SCHED_H__
 11#define __XEN_PUBLIC_SCHED_H__
 12
 13#include <xen/interface/event_channel.h>
 14
 15/*
 16 * Guest Scheduler Operations
 17 *
 18 * The SCHEDOP interface provides mechanisms for a guest to interact
 19 * with the scheduler, including yield, blocking and shutting itself
 20 * down.
 21 */
 22
 23/*
 24 * The prototype for this hypercall is:
 25 * long HYPERVISOR_sched_op(enum sched_op cmd, void *arg, ...)
 26 *
 27 * @cmd == SCHEDOP_??? (scheduler operation).
 28 * @arg == Operation-specific extra argument(s), as described below.
 29 * ...  == Additional Operation-specific extra arguments, described below.
 30 *
 31 * Versions of Xen prior to 3.0.2 provided only the following legacy version
 
 32 * of this hypercall, supporting only the commands yield, block and shutdown:
 33 *  long sched_op(int cmd, unsigned long arg)
 34 * @cmd == SCHEDOP_??? (scheduler operation).
 35 * @arg == 0               (SCHEDOP_yield and SCHEDOP_block)
 36 *      == SHUTDOWN_* code (SCHEDOP_shutdown)
 37 *
 38 * This legacy version is available to new guests as:
 39 * long HYPERVISOR_sched_op_compat(enum sched_op cmd, unsigned long arg)
 40 */
 41
 42/*
 43 * Voluntarily yield the CPU.
 44 * @arg == NULL.
 45 */
 46#define SCHEDOP_yield       0
 47
 48/*
 49 * Block execution of this VCPU until an event is received for processing.
 50 * If called with event upcalls masked, this operation will atomically
 51 * reenable event delivery and check for pending events before blocking the
 52 * VCPU. This avoids a "wakeup waiting" race.
 53 * @arg == NULL.
 54 */
 55#define SCHEDOP_block       1
 56
 57/*
 58 * Halt execution of this domain (all VCPUs) and notify the system controller.
 59 * @arg == pointer to sched_shutdown structure.
 60 *
 61 * If the sched_shutdown_t reason is SHUTDOWN_suspend then
 62 * x86 PV guests must also set RDX (EDX for 32-bit guests) to the MFN
 63 * of the guest's start info page.  RDX/EDX is the third hypercall
 64 * argument.
 65 *
 66 * In addition, which reason is SHUTDOWN_suspend this hypercall
 67 * returns 1 if suspend was cancelled or the domain was merely
 68 * checkpointed, and 0 if it is resuming in a new domain.
 69 */
 70#define SCHEDOP_shutdown    2
 
 
 
 
 71
 72/*
 73 * Poll a set of event-channel ports. Return when one or more are pending. An
 74 * optional timeout may be specified.
 75 * @arg == pointer to sched_poll structure.
 76 */
 77#define SCHEDOP_poll        3
 
 
 
 
 
 
 78
 79/*
 80 * Declare a shutdown for another domain. The main use of this function is
 81 * in interpreting shutdown requests and reasons for fully-virtualized
 82 * domains.  A para-virtualized domain may use SCHEDOP_shutdown directly.
 83 * @arg == pointer to sched_remote_shutdown structure.
 84 */
 85#define SCHEDOP_remote_shutdown        4
 
 
 
 
 86
 87/*
 88 * Latch a shutdown code, so that when the domain later shuts down it
 89 * reports this code to the control tools.
 90 * @arg == sched_shutdown, as for SCHEDOP_shutdown.
 91 */
 92#define SCHEDOP_shutdown_code 5
 93
 94/*
 95 * Setup, poke and destroy a domain watchdog timer.
 96 * @arg == pointer to sched_watchdog structure.
 97 * With id == 0, setup a domain watchdog timer to cause domain shutdown
 98 *               after timeout, returns watchdog id.
 99 * With id != 0 and timeout == 0, destroy domain watchdog timer.
100 * With id != 0 and timeout != 0, poke watchdog timer and set new timeout.
101 */
102#define SCHEDOP_watchdog    6
103
104/*
105 * Override the current vcpu affinity by pinning it to one physical cpu or
106 * undo this override restoring the previous affinity.
107 * @arg == pointer to sched_pin_override structure.
108 *
109 * A negative pcpu value will undo a previous pin override and restore the
110 * previous cpu affinity.
111 * This call is allowed for the hardware domain only and requires the cpu
112 * to be part of the domain's cpupool.
113 */
114#define SCHEDOP_pin_override 7
115
116struct sched_shutdown {
117    unsigned int reason; /* SHUTDOWN_* => shutdown reason */
118};
119DEFINE_GUEST_HANDLE_STRUCT(sched_shutdown);
120
121struct sched_poll {
122    GUEST_HANDLE(evtchn_port_t) ports;
123    unsigned int nr_ports;
124    uint64_t timeout;
125};
126DEFINE_GUEST_HANDLE_STRUCT(sched_poll);
127
128struct sched_remote_shutdown {
129    domid_t domain_id;         /* Remote domain ID */
130    unsigned int reason;       /* SHUTDOWN_* => shutdown reason */
131};
132DEFINE_GUEST_HANDLE_STRUCT(sched_remote_shutdown);
133
134struct sched_watchdog {
135    uint32_t id;                /* watchdog ID */
136    uint32_t timeout;           /* timeout */
137};
138DEFINE_GUEST_HANDLE_STRUCT(sched_watchdog);
139
140struct sched_pin_override {
141    int32_t pcpu;
142};
143DEFINE_GUEST_HANDLE_STRUCT(sched_pin_override);
144
145/*
146 * Reason codes for SCHEDOP_shutdown. These may be interpreted by control
147 * software to determine the appropriate action. For the most part, Xen does
148 * not care about the shutdown code.
149 */
150#define SHUTDOWN_poweroff   0  /* Domain exited normally. Clean up and kill. */
151#define SHUTDOWN_reboot     1  /* Clean up, kill, and then restart.          */
152#define SHUTDOWN_suspend    2  /* Clean up, save suspend info, kill.         */
153#define SHUTDOWN_crash      3  /* Tell controller we've crashed.             */
154#define SHUTDOWN_watchdog   4  /* Restart because watchdog time expired.     */
155
156/*
157 * Domain asked to perform 'soft reset' for it. The expected behavior is to
158 * reset internal Xen state for the domain returning it to the point where it
159 * was created but leaving the domain's memory contents and vCPU contexts
160 * intact. This will allow the domain to start over and set up all Xen specific
161 * interfaces again.
162 */
163#define SHUTDOWN_soft_reset 5
164#define SHUTDOWN_MAX        5  /* Maximum valid shutdown reason.             */
165
166#endif /* __XEN_PUBLIC_SCHED_H__ */
v4.6
 
  1/******************************************************************************
  2 * sched.h
  3 *
  4 * Scheduler state interactions
  5 *
  6 * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
  7 */
  8
  9#ifndef __XEN_PUBLIC_SCHED_H__
 10#define __XEN_PUBLIC_SCHED_H__
 11
 12#include <xen/interface/event_channel.h>
 13
 14/*
 
 
 
 
 
 
 
 
 15 * The prototype for this hypercall is:
 16 *  long sched_op_new(int cmd, void *arg)
 
 17 * @cmd == SCHEDOP_??? (scheduler operation).
 18 * @arg == Operation-specific extra argument(s), as described below.
 
 19 *
 20 * **NOTE**:
 21 * Versions of Xen prior to 3.0.2 provide only the following legacy version
 22 * of this hypercall, supporting only the commands yield, block and shutdown:
 23 *  long sched_op(int cmd, unsigned long arg)
 24 * @cmd == SCHEDOP_??? (scheduler operation).
 25 * @arg == 0               (SCHEDOP_yield and SCHEDOP_block)
 26 *      == SHUTDOWN_* code (SCHEDOP_shutdown)
 
 
 
 27 */
 28
 29/*
 30 * Voluntarily yield the CPU.
 31 * @arg == NULL.
 32 */
 33#define SCHEDOP_yield       0
 34
 35/*
 36 * Block execution of this VCPU until an event is received for processing.
 37 * If called with event upcalls masked, this operation will atomically
 38 * reenable event delivery and check for pending events before blocking the
 39 * VCPU. This avoids a "wakeup waiting" race.
 40 * @arg == NULL.
 41 */
 42#define SCHEDOP_block       1
 43
 44/*
 45 * Halt execution of this domain (all VCPUs) and notify the system controller.
 46 * @arg == pointer to sched_shutdown structure.
 
 
 
 
 
 
 
 
 
 47 */
 48#define SCHEDOP_shutdown    2
 49struct sched_shutdown {
 50    unsigned int reason; /* SHUTDOWN_* */
 51};
 52DEFINE_GUEST_HANDLE_STRUCT(sched_shutdown);
 53
 54/*
 55 * Poll a set of event-channel ports. Return when one or more are pending. An
 56 * optional timeout may be specified.
 57 * @arg == pointer to sched_poll structure.
 58 */
 59#define SCHEDOP_poll        3
 60struct sched_poll {
 61    GUEST_HANDLE(evtchn_port_t) ports;
 62    unsigned int nr_ports;
 63    uint64_t timeout;
 64};
 65DEFINE_GUEST_HANDLE_STRUCT(sched_poll);
 66
 67/*
 68 * Declare a shutdown for another domain. The main use of this function is
 69 * in interpreting shutdown requests and reasons for fully-virtualized
 70 * domains.  A para-virtualized domain may use SCHEDOP_shutdown directly.
 71 * @arg == pointer to sched_remote_shutdown structure.
 72 */
 73#define SCHEDOP_remote_shutdown        4
 74struct sched_remote_shutdown {
 75    domid_t domain_id;         /* Remote domain ID */
 76    unsigned int reason;       /* SHUTDOWN_xxx reason */
 77};
 78
 79/*
 80 * Latch a shutdown code, so that when the domain later shuts down it
 81 * reports this code to the control tools.
 82 * @arg == as for SCHEDOP_shutdown.
 83 */
 84#define SCHEDOP_shutdown_code 5
 85
 86/*
 87 * Setup, poke and destroy a domain watchdog timer.
 88 * @arg == pointer to sched_watchdog structure.
 89 * With id == 0, setup a domain watchdog timer to cause domain shutdown
 90 *               after timeout, returns watchdog id.
 91 * With id != 0 and timeout == 0, destroy domain watchdog timer.
 92 * With id != 0 and timeout != 0, poke watchdog timer and set new timeout.
 93 */
 94#define SCHEDOP_watchdog    6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 95struct sched_watchdog {
 96    uint32_t id;                /* watchdog ID */
 97    uint32_t timeout;           /* timeout */
 98};
 
 
 
 
 
 
 99
100/*
101 * Reason codes for SCHEDOP_shutdown. These may be interpreted by control
102 * software to determine the appropriate action. For the most part, Xen does
103 * not care about the shutdown code.
104 */
105#define SHUTDOWN_poweroff   0  /* Domain exited normally. Clean up and kill. */
106#define SHUTDOWN_reboot     1  /* Clean up, kill, and then restart.          */
107#define SHUTDOWN_suspend    2  /* Clean up, save suspend info, kill.         */
108#define SHUTDOWN_crash      3  /* Tell controller we've crashed.             */
109#define SHUTDOWN_watchdog   4  /* Restart because watchdog time expired.     */
 
110/*
111 * Domain asked to perform 'soft reset' for it. The expected behavior is to
112 * reset internal Xen state for the domain returning it to the point where it
113 * was created but leaving the domain's memory contents and vCPU contexts
114 * intact. This will allow the domain to start over and set up all Xen specific
115 * interfaces again.
116 */
117#define SHUTDOWN_soft_reset 5
 
118
119#endif /* __XEN_PUBLIC_SCHED_H__ */