win-pvdrivers

annotate common/include/public/sysctl.h @ 1106:2d392ecdd366

Fix race is xenvbd causing 30 second freeze under high load
author James Harper <james.harper@bendigoit.com.au>
date Tue Nov 11 23:08:11 2014 +1100 (2014-11-11)
parents 5712dede5a1b
children
rev   line source
andy@12 1 /******************************************************************************
andy@12 2 * sysctl.h
andy@12 3 *
andy@12 4 * System management operations. For use by node control stack.
andy@12 5 *
andy@12 6 * Permission is hereby granted, free of charge, to any person obtaining a copy
andy@12 7 * of this software and associated documentation files (the "Software"), to
andy@12 8 * deal in the Software without restriction, including without limitation the
andy@12 9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
andy@12 10 * sell copies of the Software, and to permit persons to whom the Software is
andy@12 11 * furnished to do so, subject to the following conditions:
andy@12 12 *
andy@12 13 * The above copyright notice and this permission notice shall be included in
andy@12 14 * all copies or substantial portions of the Software.
andy@12 15 *
andy@12 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
andy@12 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
andy@12 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
andy@12 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
andy@12 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
andy@12 21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
andy@12 22 * DEALINGS IN THE SOFTWARE.
andy@12 23 *
andy@12 24 * Copyright (c) 2002-2006, K Fraser
andy@12 25 */
andy@12 26
andy@12 27 #ifndef __XEN_PUBLIC_SYSCTL_H__
andy@12 28 #define __XEN_PUBLIC_SYSCTL_H__
andy@12 29
andy@12 30 #if !defined(__XEN__) && !defined(__XEN_TOOLS__)
andy@12 31 #error "sysctl operations are intended for use by node control tools only"
andy@12 32 #endif
andy@12 33
andy@12 34 #include "xen.h"
andy@12 35 #include "domctl.h"
andy@12 36
andy@12 37 #define XEN_SYSCTL_INTERFACE_VERSION 0x00000003
andy@12 38
andy@12 39 /*
andy@12 40 * Read console content from Xen buffer ring.
andy@12 41 */
andy@12 42 #define XEN_SYSCTL_readconsole 1
andy@12 43 struct xen_sysctl_readconsole {
andy@12 44 /* IN variables. */
andy@12 45 uint32_t clear; /* Non-zero -> clear after reading. */
andy@12 46 XEN_GUEST_HANDLE_64(char) buffer; /* Buffer start */
andy@12 47 /* IN/OUT variables. */
andy@12 48 uint32_t count; /* In: Buffer size; Out: Used buffer size */
andy@12 49 };
andy@12 50 typedef struct xen_sysctl_readconsole xen_sysctl_readconsole_t;
andy@12 51 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_readconsole_t);
andy@12 52
andy@12 53 /* Get trace buffers machine base address */
andy@12 54 #define XEN_SYSCTL_tbuf_op 2
andy@12 55 struct xen_sysctl_tbuf_op {
andy@12 56 /* IN variables */
andy@12 57 #define XEN_SYSCTL_TBUFOP_get_info 0
andy@12 58 #define XEN_SYSCTL_TBUFOP_set_cpu_mask 1
andy@12 59 #define XEN_SYSCTL_TBUFOP_set_evt_mask 2
andy@12 60 #define XEN_SYSCTL_TBUFOP_set_size 3
andy@12 61 #define XEN_SYSCTL_TBUFOP_enable 4
andy@12 62 #define XEN_SYSCTL_TBUFOP_disable 5
andy@12 63 uint32_t cmd;
andy@12 64 /* IN/OUT variables */
andy@12 65 struct xenctl_cpumap cpu_mask;
andy@12 66 uint32_t evt_mask;
andy@12 67 /* OUT variables */
andy@12 68 uint64_aligned_t buffer_mfn;
andy@12 69 uint32_t size;
andy@12 70 };
andy@12 71 typedef struct xen_sysctl_tbuf_op xen_sysctl_tbuf_op_t;
andy@12 72 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t);
andy@12 73
andy@12 74 /*
andy@12 75 * Get physical information about the host machine
andy@12 76 */
andy@12 77 #define XEN_SYSCTL_physinfo 3
andy@12 78 struct xen_sysctl_physinfo {
andy@12 79 uint32_t threads_per_core;
andy@12 80 uint32_t cores_per_socket;
andy@12 81 uint32_t sockets_per_node;
andy@12 82 uint32_t nr_nodes;
andy@12 83 uint32_t cpu_khz;
andy@12 84 uint64_aligned_t total_pages;
andy@12 85 uint64_aligned_t free_pages;
andy@12 86 uint64_aligned_t scrub_pages;
andy@12 87 uint32_t hw_cap[8];
andy@12 88 };
andy@12 89 typedef struct xen_sysctl_physinfo xen_sysctl_physinfo_t;
andy@12 90 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_physinfo_t);
andy@12 91
andy@12 92 /*
andy@12 93 * Get the ID of the current scheduler.
andy@12 94 */
andy@12 95 #define XEN_SYSCTL_sched_id 4
andy@12 96 struct xen_sysctl_sched_id {
andy@12 97 /* OUT variable */
andy@12 98 uint32_t sched_id;
andy@12 99 };
andy@12 100 typedef struct xen_sysctl_sched_id xen_sysctl_sched_id_t;
andy@12 101 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_sched_id_t);
andy@12 102
andy@12 103 /* Interface for controlling Xen software performance counters. */
andy@12 104 #define XEN_SYSCTL_perfc_op 5
andy@12 105 /* Sub-operations: */
andy@12 106 #define XEN_SYSCTL_PERFCOP_reset 1 /* Reset all counters to zero. */
andy@12 107 #define XEN_SYSCTL_PERFCOP_query 2 /* Get perfctr information. */
andy@12 108 struct xen_sysctl_perfc_desc {
andy@12 109 char name[80]; /* name of perf counter */
andy@12 110 uint32_t nr_vals; /* number of values for this counter */
andy@12 111 };
andy@12 112 typedef struct xen_sysctl_perfc_desc xen_sysctl_perfc_desc_t;
andy@12 113 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_desc_t);
andy@12 114 typedef uint32_t xen_sysctl_perfc_val_t;
andy@12 115 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_val_t);
andy@12 116
andy@12 117 struct xen_sysctl_perfc_op {
andy@12 118 /* IN variables. */
andy@12 119 uint32_t cmd; /* XEN_SYSCTL_PERFCOP_??? */
andy@12 120 /* OUT variables. */
andy@12 121 uint32_t nr_counters; /* number of counters description */
andy@12 122 uint32_t nr_vals; /* number of values */
andy@12 123 /* counter information (or NULL) */
andy@12 124 XEN_GUEST_HANDLE_64(xen_sysctl_perfc_desc_t) desc;
andy@12 125 /* counter values (or NULL) */
andy@12 126 XEN_GUEST_HANDLE_64(xen_sysctl_perfc_val_t) val;
andy@12 127 };
andy@12 128 typedef struct xen_sysctl_perfc_op xen_sysctl_perfc_op_t;
andy@12 129 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_op_t);
andy@12 130
andy@12 131 #define XEN_SYSCTL_getdomaininfolist 6
andy@12 132 struct xen_sysctl_getdomaininfolist {
andy@12 133 /* IN variables. */
andy@12 134 domid_t first_domain;
andy@12 135 uint32_t max_domains;
andy@12 136 XEN_GUEST_HANDLE_64(xen_domctl_getdomaininfo_t) buffer;
andy@12 137 /* OUT variables. */
andy@12 138 uint32_t num_domains;
andy@12 139 };
andy@12 140 typedef struct xen_sysctl_getdomaininfolist xen_sysctl_getdomaininfolist_t;
andy@12 141 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_getdomaininfolist_t);
andy@12 142
andy@12 143 /* Inject debug keys into Xen. */
andy@12 144 #define XEN_SYSCTL_debug_keys 7
andy@12 145 struct xen_sysctl_debug_keys {
andy@12 146 /* IN variables. */
andy@12 147 XEN_GUEST_HANDLE_64(char) keys;
andy@12 148 uint32_t nr_keys;
andy@12 149 };
andy@12 150 typedef struct xen_sysctl_debug_keys xen_sysctl_debug_keys_t;
andy@12 151 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_debug_keys_t);
andy@12 152
andy@12 153 /* Get physical CPU information. */
andy@12 154 #define XEN_SYSCTL_getcpuinfo 8
andy@12 155 struct xen_sysctl_cpuinfo {
andy@12 156 uint64_t idletime;
andy@12 157 };
andy@12 158 typedef struct xen_sysctl_cpuinfo xen_sysctl_cpuinfo_t;
andy@12 159 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpuinfo_t);
andy@12 160 struct xen_sysctl_getcpuinfo {
andy@12 161 /* IN variables. */
andy@12 162 uint32_t max_cpus;
andy@12 163 XEN_GUEST_HANDLE_64(xen_sysctl_cpuinfo_t) info;
andy@12 164 /* OUT variables. */
andy@12 165 uint32_t nr_cpus;
andy@12 166 };
andy@12 167 typedef struct xen_sysctl_getcpuinfo xen_sysctl_getcpuinfo_t;
andy@12 168 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_getcpuinfo_t);
andy@12 169
andy@12 170 struct xen_sysctl {
andy@12 171 uint32_t cmd;
andy@12 172 uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
andy@12 173 union {
andy@12 174 struct xen_sysctl_readconsole readconsole;
andy@12 175 struct xen_sysctl_tbuf_op tbuf_op;
andy@12 176 struct xen_sysctl_physinfo physinfo;
andy@12 177 struct xen_sysctl_sched_id sched_id;
andy@12 178 struct xen_sysctl_perfc_op perfc_op;
andy@12 179 struct xen_sysctl_getdomaininfolist getdomaininfolist;
andy@12 180 struct xen_sysctl_debug_keys debug_keys;
andy@12 181 struct xen_sysctl_getcpuinfo getcpuinfo;
andy@12 182 uint8_t pad[128];
andy@12 183 } u;
andy@12 184 };
andy@12 185 typedef struct xen_sysctl xen_sysctl_t;
andy@12 186 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_t);
andy@12 187
andy@12 188 #endif /* __XEN_PUBLIC_SYSCTL_H__ */
andy@12 189
andy@12 190 /*
andy@12 191 * Local variables:
andy@12 192 * mode: C
andy@12 193 * c-set-style: "BSD"
andy@12 194 * c-basic-offset: 4
andy@12 195 * tab-width: 4
andy@12 196 * indent-tabs-mode: nil
andy@12 197 * End:
andy@12 198 */