direct-io.hg

view xen/include/public/sched.h @ 9560:b128f55ca05c

Add code to make handling domain poweroff/reboot symmetrical between
paravirtualized and fully virtualized. This approach uses the new
sched_op to handle other domains than the current domain. The new
code, SCHEDOP_remote_shutdown, is very much like SCHEDOP_shutdown, but
is called with the id of the domain which is to be shut down. This
allows fully virtualized shutdown and para-virtualized shutdown to be
identical from that point forward.

A paravirtualized domain uses sched_op to shut down and set the reason
code. This will send a VIRQ_DOM_EXC, which can be handled in dom0 by
control software. In some ways, this resembles SIGCHILD/waitpid, and
is a reasonable model.

The fully virtualized case has qemu invoke xm directly. This is a
different path than paravirtualized. It also removes decision and
policy making choices from the rest of the control software and places
it within qemu. When any dom0 logic eventually gets a VIRQ_DOM_EXC,
the information about the domain is gone having been destroyed by xm.

A libxenctrl wrapper, xc_shutdown_domain has been added and qemu now
calls it.

As a freebie, #if 0 some very verbose logging code in qemu. Totally
unrelated, but as long as I was there...

Signed-off-by: Ben Thomas <ben@virtualiron.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Apr 06 15:24:00 2006 +0100 (2006-04-06)
parents 9bee4875a848
children 4e1b8be54311
line source
1 /******************************************************************************
2 * sched.h
3 *
4 * Scheduler state interactions
5 *
6 * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
7 */
9 #ifndef __XEN_PUBLIC_SCHED_H__
10 #define __XEN_PUBLIC_SCHED_H__
12 #include "event_channel.h"
14 /*
15 * The prototype for this hypercall is:
16 * long sched_op(int cmd, void *arg)
17 * @cmd == SCHEDOP_??? (scheduler operation).
18 * @arg == Operation-specific extra argument(s), as described below.
19 *
20 * Versions of Xen prior to 3.0.2 provided only the following legacy version
21 * of this hypercall, supporting only the commands yield, block and shutdown:
22 * long sched_op(int cmd, unsigned long arg)
23 * @cmd == SCHEDOP_??? (scheduler operation).
24 * @arg == 0 (SCHEDOP_yield and SCHEDOP_block)
25 * == SHUTDOWN_* code (SCHEDOP_shutdown)
26 * This legacy version is available to new guests as sched_op_compat().
27 */
29 /*
30 * Voluntarily yield the CPU.
31 * @arg == NULL.
32 */
33 #define SCHEDOP_yield 0
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
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
49 typedef struct sched_shutdown {
50 unsigned int reason; /* SHUTDOWN_* */
51 } sched_shutdown_t;
52 DEFINE_GUEST_HANDLE(sched_shutdown_t);
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
60 typedef struct sched_poll {
61 GUEST_HANDLE(evtchn_port_t) ports;
62 unsigned int nr_ports;
63 uint64_t timeout;
64 } sched_poll_t;
65 DEFINE_GUEST_HANDLE(sched_poll_t);
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
74 typedef struct sched_remote_shutdown {
75 domid_t domain_id; /* Remote domain ID */
76 unsigned int reason; /* SHUTDOWN_xxx reason */
77 } sched_remote_shutdown_t;
78 DEFINE_GUEST_HANDLE(sched_remote_shutdown_t);
80 /*
81 * Reason codes for SCHEDOP_shutdown. These may be interpreted by control
82 * software to determine the appropriate action. For the most part, Xen does
83 * not care about the shutdown code.
84 */
85 #define SHUTDOWN_poweroff 0 /* Domain exited normally. Clean up and kill. */
86 #define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */
87 #define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */
88 #define SHUTDOWN_crash 3 /* Tell controller we've crashed. */
90 #endif /* __XEN_PUBLIC_SCHED_H__ */
92 /*
93 * Local variables:
94 * mode: C
95 * c-set-style: "BSD"
96 * c-basic-offset: 4
97 * tab-width: 4
98 * indent-tabs-mode: nil
99 * End:
100 */