direct-io.hg

annotate tools/libxc/xc.h @ 1704:083178f6cdfa

bitkeeper revision 1.1044 (40ec19236iHRt47R5UsW46zQ42dHIw)

Implementation of a new scheduler. Based on BVT (Borrowed Virtual Time) but trying to give more fair allocation of CPU for diverse environments (CPU-bound domains running against I/O bound ones). For that reason I called it Fair BVT (or FBVT for short). The BVT implementation gave the basic implementation. This changeset contains also the interface to control the scheduler. Unfortunatelly the contex switch allowance cannot be changed yet (a bug). The parameters introduced in the scheduler are likely to change in near future (after running tests).
author gm281@boulderdash.cl.cam.ac.uk
date Wed Jul 07 15:39:15 2004 +0000 (2004-07-07)
parents 236a9f2698a3
children 1ac7603a60bd
rev   line source
mjw@1623 1 /******************************************************************************
mjw@1623 2 * xc.h
mjw@1623 3 *
mjw@1623 4 * A library for low-level access to the Xen control interfaces.
mjw@1623 5 *
mjw@1623 6 * Copyright (c) 2003, K A Fraser.
mjw@1623 7 */
mjw@1623 8
mjw@1623 9 #ifndef __XC_H__
mjw@1623 10 #define __XC_H__
mjw@1623 11
mjw@1623 12 typedef unsigned char u8;
mjw@1623 13 typedef unsigned short u16;
mjw@1623 14 typedef unsigned long u32;
mjw@1623 15 typedef unsigned long long u64;
mjw@1623 16 typedef signed char s8;
mjw@1623 17 typedef signed short s16;
mjw@1623 18 typedef signed long s32;
mjw@1623 19 typedef signed long long s64;
mjw@1623 20
mjw@1623 21 /* Obtain or relinquish a handle on the 'xc' library. */
mjw@1623 22 int xc_interface_open(void);
mjw@1623 23 int xc_interface_close(int xc_handle);
mjw@1623 24
mjw@1623 25 typedef struct {
mjw@1623 26 u32 domid;
mjw@1623 27 unsigned int cpu;
mjw@1623 28 unsigned int dying:1, crashed:1, shutdown:1,
mjw@1623 29 paused:1, blocked:1, running:1;
mjw@1623 30 unsigned int shutdown_reason; /* only meaningful if shutdown==1 */
mjw@1623 31 unsigned long nr_pages;
mjw@1623 32 unsigned long shared_info_frame;
mjw@1623 33 u64 cpu_time;
mjw@1623 34 #define XC_DOMINFO_MAXNAME 16
mjw@1623 35 char name[XC_DOMINFO_MAXNAME];
mjw@1623 36 unsigned long max_memkb;
mjw@1623 37 } xc_dominfo_t;
mjw@1623 38
mjw@1623 39 typedef struct xc_shadow_control_stats_st
mjw@1623 40 {
mjw@1623 41 unsigned long fault_count;
mjw@1623 42 unsigned long dirty_count;
mjw@1623 43 unsigned long dirty_net_count;
mjw@1623 44 unsigned long dirty_block_count;
mjw@1623 45 } xc_shadow_control_stats_t;
mjw@1623 46
mjw@1623 47 int xc_domain_create(int xc_handle,
mjw@1623 48 unsigned int mem_kb,
mjw@1623 49 const char *name,
mjw@1623 50 int cpu,
mjw@1623 51 u32 *pdomid);
mjw@1623 52 int xc_domain_pause(int xc_handle,
mjw@1623 53 u32 domid);
mjw@1623 54 int xc_domain_unpause(int xc_handle,
mjw@1623 55 u32 domid);
mjw@1623 56 int xc_domain_destroy(int xc_handle,
mjw@1623 57 u32 domid);
mjw@1623 58 int xc_domain_pincpu(int xc_handle,
mjw@1623 59 u32 domid,
mjw@1623 60 int cpu);
mjw@1623 61 int xc_domain_getinfo(int xc_handle,
mjw@1623 62 u32 first_domid,
mjw@1623 63 unsigned int max_doms,
mjw@1623 64 xc_dominfo_t *info);
mjw@1623 65
mjw@1623 66 int xc_shadow_control(int xc_handle,
mjw@1623 67 u32 domid,
mjw@1623 68 unsigned int sop,
mjw@1623 69 unsigned long *dirty_bitmap,
mjw@1623 70 unsigned long pages,
mjw@1623 71 xc_shadow_control_stats_t *stats);
mjw@1623 72
mjw@1623 73
mjw@1623 74 #define XCFLAGS_VERBOSE 1
mjw@1623 75 #define XCFLAGS_LIVE 2
mjw@1623 76 #define XCFLAGS_DEBUG 4
mjw@1623 77
mjw@1623 78 struct XcIOContext;
mjw@1623 79 int xc_linux_save(int xc_handle, struct XcIOContext *ioctxt);
mjw@1623 80 int xc_linux_restore(int xc_handle, struct XcIOContext *ioctxt);
mjw@1623 81
mjw@1623 82 int xc_linux_build(int xc_handle,
mjw@1623 83 u32 domid,
mjw@1623 84 const char *image_name,
mjw@1623 85 const char *ramdisk_name,
mjw@1623 86 const char *cmdline,
mjw@1623 87 unsigned int control_evtchn,
mjw@1623 88 unsigned long flags);
mjw@1623 89
mjw@1623 90 int xc_netbsd_build(int xc_handle,
mjw@1623 91 u32 domid,
mjw@1623 92 const char *image_name,
mjw@1623 93 const char *cmdline,
mjw@1623 94 unsigned int control_evtchn);
mjw@1623 95
mjw@1623 96 int xc_bvtsched_global_set(int xc_handle,
mjw@1623 97 unsigned long ctx_allow);
mjw@1623 98
mjw@1623 99 int xc_bvtsched_domain_set(int xc_handle,
mjw@1623 100 u32 domid,
mjw@1623 101 unsigned long mcuadv,
mjw@1623 102 unsigned long warp,
mjw@1623 103 unsigned long warpl,
mjw@1623 104 unsigned long warpu);
mjw@1623 105
mjw@1623 106 int xc_bvtsched_global_get(int xc_handle,
mjw@1623 107 unsigned long *ctx_allow);
mjw@1623 108
mjw@1623 109 int xc_bvtsched_domain_get(int xc_handle,
mjw@1623 110 u32 domid,
mjw@1623 111 unsigned long *mcuadv,
mjw@1623 112 unsigned long *warp,
mjw@1623 113 unsigned long *warpl,
mjw@1623 114 unsigned long *warpu);
mjw@1623 115
gm281@1704 116 int xc_fbvtsched_global_set(int xc_handle,
gm281@1704 117 unsigned long ctx_allow);
gm281@1704 118
gm281@1704 119 int xc_fbvtsched_domain_set(int xc_handle,
gm281@1704 120 u32 domid,
gm281@1704 121 unsigned long mcuadv,
gm281@1704 122 unsigned long warp,
gm281@1704 123 unsigned long warpl,
gm281@1704 124 unsigned long warpu);
gm281@1704 125
gm281@1704 126 int xc_fbvtsched_global_get(int xc_handle,
gm281@1704 127 unsigned long *ctx_allow);
gm281@1704 128
gm281@1704 129 int xc_fbvtsched_domain_get(int xc_handle,
gm281@1704 130 u32 domid,
gm281@1704 131 unsigned long *mcuadv,
gm281@1704 132 unsigned long *warp,
gm281@1704 133 unsigned long *warpl,
gm281@1704 134 unsigned long *warpu);
gm281@1704 135
mjw@1623 136 int xc_atropos_domain_set(int xc_handle,
mjw@1623 137 u32 domid,
mjw@1623 138 u64 period, u64 slice, u64 latency,
mjw@1623 139 int xtratime);
mjw@1623 140
mjw@1623 141 int xc_atropos_domain_get(int xc_handle,
mjw@1623 142 u32 domid,
mjw@1623 143 u64* period, u64 *slice, u64 *latency,
mjw@1623 144 int *xtratime);
mjw@1623 145
mjw@1623 146 int xc_rrobin_global_set(int xc_handle, u64 slice);
mjw@1623 147
mjw@1623 148 int xc_rrobin_global_get(int xc_handle, u64 *slice);
mjw@1623 149
mjw@1623 150 #define DOMID_SELF (0x7FFFFFFEU)
mjw@1623 151
mjw@1623 152 typedef struct {
mjw@1623 153 #define EVTCHNSTAT_closed 0 /* Chennel is not in use. */
mjw@1623 154 #define EVTCHNSTAT_unbound 1 /* Channel is not bound to a source. */
mjw@1623 155 #define EVTCHNSTAT_interdomain 2 /* Channel is connected to remote domain. */
mjw@1623 156 #define EVTCHNSTAT_pirq 3 /* Channel is bound to a phys IRQ line. */
mjw@1623 157 #define EVTCHNSTAT_virq 4 /* Channel is bound to a virtual IRQ line */
mjw@1623 158 int status;
mjw@1623 159 union {
mjw@1623 160 struct {
mjw@1623 161 u32 dom;
mjw@1623 162 int port;
mjw@1623 163 } interdomain;
mjw@1623 164 int pirq;
mjw@1623 165 int virq;
mjw@1623 166 } u;
mjw@1623 167 } xc_evtchn_status_t;
mjw@1623 168
mjw@1623 169 int xc_evtchn_bind_interdomain(int xc_handle,
mjw@1623 170 u32 dom1, /* may be DOMID_SELF */
mjw@1623 171 u32 dom2, /* may be DOMID_SELF */
mjw@1623 172 int *port1,
mjw@1623 173 int *port2);
mjw@1623 174 int xc_evtchn_bind_virq(int xc_handle,
mjw@1623 175 int virq,
mjw@1623 176 int *port);
mjw@1623 177 int xc_evtchn_close(int xc_handle,
mjw@1623 178 u32 dom, /* may be DOMID_SELF */
mjw@1623 179 int port);
mjw@1623 180 int xc_evtchn_send(int xc_handle,
mjw@1623 181 int local_port);
mjw@1623 182 int xc_evtchn_status(int xc_handle,
mjw@1623 183 u32 dom, /* may be DOMID_SELF */
mjw@1623 184 int port,
mjw@1623 185 xc_evtchn_status_t *status);
mjw@1623 186
mjw@1623 187 int xc_physdev_pci_access_modify(int xc_handle,
mjw@1623 188 u32 domid,
mjw@1623 189 int bus,
mjw@1623 190 int dev,
mjw@1623 191 int func,
mjw@1623 192 int enable);
mjw@1623 193
mjw@1623 194 int xc_readconsolering(int xc_handle,
mjw@1623 195 char *str,
mjw@1623 196 unsigned int max_chars,
mjw@1623 197 int clear);
mjw@1623 198
mjw@1623 199 typedef struct {
mjw@1623 200 int ht_per_core;
mjw@1623 201 int cores;
mjw@1623 202 unsigned long total_pages;
mjw@1623 203 unsigned long free_pages;
mjw@1623 204 unsigned long cpu_khz;
mjw@1623 205 } xc_physinfo_t;
mjw@1623 206
mjw@1623 207 int xc_physinfo(int xc_handle,
mjw@1623 208 xc_physinfo_t *info);
mjw@1623 209
mjw@1623 210 int xc_domain_setname(int xc_handle,
mjw@1623 211 u32 domid,
mjw@1623 212 char *name);
mjw@1623 213
mjw@1623 214 int xc_domain_setinitialmem(int xc_handle,
mjw@1623 215 u32 domid,
mjw@1623 216 unsigned int initial_memkb);
mjw@1623 217
mjw@1623 218 int xc_domain_setmaxmem(int xc_handle,
mjw@1623 219 u32 domid,
mjw@1623 220 unsigned int max_memkb);
mjw@1623 221
mjw@1623 222
mjw@1623 223 #endif /* __XC_H__ */