ia64/xen-unstable
changeset 9779:b0ee5d9b9ebd
Clean up the xenoprofile hypercall interface.
Signed-off-by: Jose Renato Santos <jsantos@hpl.hp.com>
Signed-off-by: Jose Renato Santos <jsantos@hpl.hp.com>
author | kaf24@firebug.cl.cam.ac.uk |
---|---|
date | Wed Apr 19 18:43:39 2006 +0100 (2006-04-19) |
parents | 123ff1c70728 |
children | 83ba928544c4 |
files | linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h xen/arch/x86/oprofile/xenoprof.c xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_64/entry.S xen/include/public/xenoprof.h |
line diff
1.1 --- a/linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c Wed Apr 19 18:39:36 2006 +0100 1.2 +++ b/linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c Wed Apr 19 18:43:39 2006 +0100 1.3 @@ -35,8 +35,9 @@ static void xenoprof_stop(void); 1.4 void * vm_map_xen_pages(unsigned long maddr, int vm_size, pgprot_t prot); 1.5 1.6 static int xenoprof_enabled = 0; 1.7 -static int num_events = 0; 1.8 +static unsigned int num_events = 0; 1.9 static int is_primary = 0; 1.10 +static int active_defined; 1.11 1.12 /* sample buffers shared with Xen */ 1.13 xenoprof_buf_t * xenoprof_buf[MAX_VIRT_CPUS]; 1.14 @@ -106,7 +107,7 @@ static irqreturn_t 1.15 xenoprof_ovf_interrupt(int irq, void * dev_id, struct pt_regs * regs) 1.16 { 1.17 int head, tail, size; 1.18 - xenoprof_buf_t * buf; 1.19 + struct xenoprof_buf * buf; 1.20 int cpu; 1.21 1.22 cpu = smp_processor_id(); 1.23 @@ -196,28 +197,49 @@ static int bind_virq(void) 1.24 static int xenoprof_setup(void) 1.25 { 1.26 int ret; 1.27 + int i; 1.28 1.29 ret = bind_virq(); 1.30 if (ret) 1.31 return ret; 1.32 1.33 if (is_primary) { 1.34 - ret = HYPERVISOR_xenoprof_op(XENOPROF_reserve_counters, 1.35 - (unsigned long)NULL, 1.36 - (unsigned long)NULL); 1.37 + struct xenoprof_counter counter; 1.38 + 1.39 + /* Define dom0 as an active domain if not done yet */ 1.40 + if (!active_defined) { 1.41 + domid_t domid; 1.42 + ret = HYPERVISOR_xenoprof_op(XENOPROF_reset_active_list, NULL); 1.43 + if (ret) 1.44 + goto err; 1.45 + domid = 0; 1.46 + ret = HYPERVISOR_xenoprof_op(XENOPROF_set_active, &domid); 1.47 + if (ret) 1.48 + goto err; 1.49 + active_defined = 1; 1.50 + } 1.51 + 1.52 + ret = HYPERVISOR_xenoprof_op(XENOPROF_reserve_counters, NULL); 1.53 if (ret) 1.54 goto err; 1.55 + for (i=0; i<num_events; i++) { 1.56 + counter.ind = i; 1.57 + counter.count = (uint64_t)counter_config[i].count; 1.58 + counter.enabled = (uint32_t)counter_config[i].enabled; 1.59 + counter.event = (uint32_t)counter_config[i].event; 1.60 + counter.kernel = (uint32_t)counter_config[i].kernel; 1.61 + counter.user = (uint32_t)counter_config[i].user; 1.62 + counter.unit_mask = (uint64_t)counter_config[i].unit_mask; 1.63 + HYPERVISOR_xenoprof_op(XENOPROF_counter, 1.64 + &counter); 1.65 + } 1.66 + ret = HYPERVISOR_xenoprof_op(XENOPROF_setup_events, NULL); 1.67 1.68 - ret = HYPERVISOR_xenoprof_op(XENOPROF_setup_events, 1.69 - (unsigned long)&counter_config, 1.70 - (unsigned long)num_events); 1.71 if (ret) 1.72 goto err; 1.73 } 1.74 1.75 - ret = HYPERVISOR_xenoprof_op(XENOPROF_enable_virq, 1.76 - (unsigned long)NULL, 1.77 - (unsigned long)NULL); 1.78 + ret = HYPERVISOR_xenoprof_op(XENOPROF_enable_virq, NULL); 1.79 if (ret) 1.80 goto err; 1.81 1.82 @@ -233,17 +255,15 @@ static void xenoprof_shutdown(void) 1.83 { 1.84 xenoprof_enabled = 0; 1.85 1.86 - HYPERVISOR_xenoprof_op(XENOPROF_disable_virq, 1.87 - (unsigned long)NULL, 1.88 - (unsigned long)NULL); 1.89 + HYPERVISOR_xenoprof_op(XENOPROF_disable_virq, NULL); 1.90 1.91 if (is_primary) { 1.92 - HYPERVISOR_xenoprof_op(XENOPROF_release_counters, 1.93 - (unsigned long)NULL, 1.94 - (unsigned long)NULL); 1.95 + HYPERVISOR_xenoprof_op(XENOPROF_release_counters, NULL); 1.96 + active_defined = 0; 1.97 } 1.98 1.99 unbind_virq(); 1.100 + 1.101 } 1.102 1.103 1.104 @@ -252,9 +272,8 @@ static int xenoprof_start(void) 1.105 int ret = 0; 1.106 1.107 if (is_primary) 1.108 - ret = HYPERVISOR_xenoprof_op(XENOPROF_start, 1.109 - (unsigned long)NULL, 1.110 - (unsigned long)NULL); 1.111 + ret = HYPERVISOR_xenoprof_op(XENOPROF_start, NULL); 1.112 + 1.113 return ret; 1.114 } 1.115 1.116 @@ -262,20 +281,43 @@ static int xenoprof_start(void) 1.117 static void xenoprof_stop(void) 1.118 { 1.119 if (is_primary) 1.120 - HYPERVISOR_xenoprof_op(XENOPROF_stop, 1.121 - (unsigned long)NULL, 1.122 - (unsigned long)NULL); 1.123 + HYPERVISOR_xenoprof_op(XENOPROF_stop, NULL); 1.124 } 1.125 1.126 1.127 static int xenoprof_set_active(int * active_domains, 1.128 - unsigned int adomains) 1.129 + unsigned int adomains) 1.130 { 1.131 int ret = 0; 1.132 - if (is_primary) 1.133 - ret = HYPERVISOR_xenoprof_op(XENOPROF_set_active, 1.134 - (unsigned long)active_domains, 1.135 - (unsigned long)adomains); 1.136 + int i; 1.137 + int set_dom0 = 0; 1.138 + domid_t domid; 1.139 + 1.140 + if (!is_primary) 1.141 + return 0; 1.142 + 1.143 + if (adomains > MAX_OPROF_DOMAINS) 1.144 + return -E2BIG; 1.145 + 1.146 + ret = HYPERVISOR_xenoprof_op(XENOPROF_reset_active_list, NULL); 1.147 + if (ret) 1.148 + return ret; 1.149 + 1.150 + for (i=0; i<adomains; i++) { 1.151 + domid = active_domains[i]; 1.152 + ret = HYPERVISOR_xenoprof_op(XENOPROF_set_active, &domid); 1.153 + if (ret) 1.154 + return (ret); 1.155 + if (active_domains[i] == 0) 1.156 + set_dom0 = 1; 1.157 + } 1.158 + /* dom0 must always be active but may not be in the list */ 1.159 + if (!set_dom0) { 1.160 + domid = 0; 1.161 + ret = HYPERVISOR_xenoprof_op(XENOPROF_set_active, &domid); 1.162 + } 1.163 + 1.164 + active_defined = 1; 1.165 return ret; 1.166 } 1.167 1.168 @@ -325,44 +367,48 @@ static int using_xenoprof; 1.169 1.170 int __init oprofile_arch_init(struct oprofile_operations * ops) 1.171 { 1.172 - xenoprof_init_result_t result; 1.173 - xenoprof_buf_t * buf; 1.174 - int max_samples = 16; 1.175 + struct xenoprof_init init; 1.176 + struct xenoprof_buf * buf; 1.177 int vm_size; 1.178 int npages; 1.179 + int ret; 1.180 int i; 1.181 1.182 - int ret = HYPERVISOR_xenoprof_op(XENOPROF_init, 1.183 - (unsigned long)max_samples, 1.184 - (unsigned long)&result); 1.185 + init.max_samples = 16; 1.186 + ret = HYPERVISOR_xenoprof_op(XENOPROF_init, &init); 1.187 1.188 if (!ret) { 1.189 pgprot_t prot = __pgprot(_KERNPG_TABLE); 1.190 1.191 - num_events = result.num_events; 1.192 - is_primary = result.is_primary; 1.193 - nbuf = result.nbuf; 1.194 + num_events = init.num_events; 1.195 + is_primary = init.is_primary; 1.196 + nbuf = init.nbuf; 1.197 1.198 - npages = (result.bufsize * nbuf - 1) / PAGE_SIZE + 1; 1.199 + /* just in case - make sure we do not overflow event list 1.200 + (i.e. counter_config list) */ 1.201 + if (num_events > OP_MAX_COUNTER) 1.202 + num_events = OP_MAX_COUNTER; 1.203 + 1.204 + npages = (init.bufsize * nbuf - 1) / PAGE_SIZE + 1; 1.205 vm_size = npages * PAGE_SIZE; 1.206 1.207 - shared_buffer = (char *) vm_map_xen_pages(result.buf_maddr, 1.208 - vm_size, prot); 1.209 + shared_buffer = (char *)vm_map_xen_pages(init.buf_maddr, 1.210 + vm_size, prot); 1.211 if (!shared_buffer) { 1.212 ret = -ENOMEM; 1.213 goto out; 1.214 } 1.215 1.216 for (i=0; i< nbuf; i++) { 1.217 - buf = (xenoprof_buf_t*) 1.218 - &shared_buffer[i * result.bufsize]; 1.219 + buf = (struct xenoprof_buf*) 1.220 + &shared_buffer[i * init.bufsize]; 1.221 BUG_ON(buf->vcpu_id >= MAX_VIRT_CPUS); 1.222 xenoprof_buf[buf->vcpu_id] = buf; 1.223 } 1.224 1.225 /* cpu_type is detected by Xen */ 1.226 cpu_type[XENOPROF_CPU_TYPE_SIZE-1] = 0; 1.227 - strncpy(cpu_type, result.cpu_type, XENOPROF_CPU_TYPE_SIZE - 1); 1.228 + strncpy(cpu_type, init.cpu_type, XENOPROF_CPU_TYPE_SIZE - 1); 1.229 xenoprof_ops.cpu_type = cpu_type; 1.230 1.231 init_driverfs(); 1.232 @@ -371,6 +417,8 @@ int __init oprofile_arch_init(struct opr 1.233 1.234 for (i=0; i<NR_CPUS; i++) 1.235 ovf_irq[i] = -1; 1.236 + 1.237 + active_defined = 0; 1.238 } 1.239 out: 1.240 printk(KERN_INFO "oprofile_arch_init: ret %d, events %d, " 1.241 @@ -389,7 +437,5 @@ void __exit oprofile_arch_exit(void) 1.242 shared_buffer = NULL; 1.243 } 1.244 if (is_primary) 1.245 - HYPERVISOR_xenoprof_op(XENOPROF_shutdown, 1.246 - (unsigned long)NULL, 1.247 - (unsigned long)NULL); 1.248 + HYPERVISOR_xenoprof_op(XENOPROF_shutdown, NULL); 1.249 }
2.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h Wed Apr 19 18:39:36 2006 +0100 2.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h Wed Apr 19 18:43:39 2006 +0100 2.3 @@ -338,9 +338,9 @@ HYPERVISOR_callback_op( 2.4 2.5 static inline int 2.6 HYPERVISOR_xenoprof_op( 2.7 - int op, unsigned long arg1, unsigned long arg2) 2.8 + int op, void *arg) 2.9 { 2.10 - return _hypercall3(int, xenoprof_op, op, arg1, arg2); 2.11 + return _hypercall2(int, xenoprof_op, op, arg); 2.12 } 2.13 2.14
3.1 --- a/xen/arch/x86/oprofile/xenoprof.c Wed Apr 19 18:39:36 2006 +0100 3.2 +++ b/xen/arch/x86/oprofile/xenoprof.c Wed Apr 19 18:43:39 2006 +0100 3.3 @@ -4,6 +4,7 @@ 3.4 * (email: xenoprof@groups.hp.com) 3.5 */ 3.6 3.7 +#include <xen/guest_access.h> 3.8 #include <xen/sched.h> 3.9 #include <public/xenoprof.h> 3.10 3.11 @@ -12,7 +13,7 @@ 3.12 /* Limit amount of pages used for shared buffer (per domain) */ 3.13 #define MAX_OPROF_SHARED_PAGES 32 3.14 3.15 -int active_domains[MAX_OPROF_DOMAINS]; 3.16 +domid_t active_domains[MAX_OPROF_DOMAINS]; 3.17 int active_ready[MAX_OPROF_DOMAINS]; 3.18 unsigned int adomains; 3.19 unsigned int activated; 3.20 @@ -84,7 +85,8 @@ static void xenoprof_reset_buf(struct do 3.21 3.22 int active_index(struct domain *d) 3.23 { 3.24 - int i, id = d->domain_id; 3.25 + int i; 3.26 + domid_t id = d->domain_id; 3.27 3.28 for ( i = 0; i < adomains; i++ ) 3.29 if ( active_domains[i] == id ) 3.30 @@ -137,13 +139,11 @@ int reset_active(struct domain *d) 3.31 return 0; 3.32 } 3.33 3.34 -int set_active_domains(int num) 3.35 +int reset_active_list(void) 3.36 { 3.37 - int primary; 3.38 int i; 3.39 struct domain *d; 3.40 3.41 - /* Reset any existing active domains from previous runs. */ 3.42 for ( i = 0; i < adomains; i++ ) 3.43 { 3.44 if ( active_ready[i] ) 3.45 @@ -157,24 +157,20 @@ int set_active_domains(int num) 3.46 } 3.47 } 3.48 3.49 - adomains = num; 3.50 - 3.51 - /* Add primary profiler to list of active domains if not there yet */ 3.52 - primary = active_index(primary_profiler); 3.53 - if ( primary == -1 ) 3.54 - { 3.55 - /* Return if there is no space left on list. */ 3.56 - if ( num >= MAX_OPROF_DOMAINS ) 3.57 - return -E2BIG; 3.58 - active_domains[num] = primary_profiler->domain_id; 3.59 - num++; 3.60 - } 3.61 - 3.62 - adomains = num; 3.63 + adomains = 0; 3.64 activated = 0; 3.65 3.66 - for ( i = 0; i < adomains; i++ ) 3.67 - active_ready[i] = 0; 3.68 + return 0; 3.69 +} 3.70 + 3.71 +int add_active_list (domid_t domid) 3.72 +{ 3.73 + if ( adomains >= MAX_OPROF_DOMAINS ) 3.74 + return -E2BIG; 3.75 + 3.76 + active_domains[adomains] = domid; 3.77 + active_ready[adomains] = 0; 3.78 + adomains++; 3.79 3.80 return 0; 3.81 } 3.82 @@ -353,26 +349,31 @@ void free_xenoprof_pages(struct domain * 3.83 d->xenoprof = NULL; 3.84 } 3.85 3.86 -int xenoprof_init(int max_samples, xenoprof_init_result_t *init_result) 3.87 +int xenoprof_op_init(GUEST_HANDLE(void) arg) 3.88 { 3.89 - xenoprof_init_result_t result; 3.90 + struct xenoprof_init xenoprof_init; 3.91 int is_primary, num_events; 3.92 struct domain *d = current->domain; 3.93 int ret; 3.94 3.95 - ret = nmi_init(&num_events, &is_primary, result.cpu_type); 3.96 + if ( copy_from_guest(&xenoprof_init, arg, 1) ) 3.97 + return -EFAULT; 3.98 + 3.99 + ret = nmi_init(&num_events, 3.100 + &is_primary, 3.101 + xenoprof_init.cpu_type); 3.102 + if ( ret < 0 ) 3.103 + goto err; 3.104 + 3.105 if ( is_primary ) 3.106 primary_profiler = current->domain; 3.107 3.108 - if ( ret < 0 ) 3.109 - goto err; 3.110 - 3.111 /* 3.112 * We allocate xenoprof struct and buffers only at first time xenoprof_init 3.113 * is called. Memory is then kept until domain is destroyed. 3.114 */ 3.115 if ( (d->xenoprof == NULL) && 3.116 - ((ret = alloc_xenoprof_struct(d, max_samples)) < 0) ) 3.117 + ((ret = alloc_xenoprof_struct(d, xenoprof_init.max_samples)) < 0) ) 3.118 goto err; 3.119 3.120 xenoprof_reset_buf(d); 3.121 @@ -381,13 +382,13 @@ int xenoprof_init(int max_samples, xenop 3.122 d->xenoprof->domain_ready = 0; 3.123 d->xenoprof->is_primary = is_primary; 3.124 3.125 - result.is_primary = is_primary; 3.126 - result.num_events = num_events; 3.127 - result.nbuf = d->xenoprof->nbuf; 3.128 - result.bufsize = d->xenoprof->bufsize; 3.129 - result.buf_maddr = __pa(d->xenoprof->rawbuf); 3.130 + xenoprof_init.is_primary = is_primary; 3.131 + xenoprof_init.num_events = num_events; 3.132 + xenoprof_init.nbuf = d->xenoprof->nbuf; 3.133 + xenoprof_init.bufsize = d->xenoprof->bufsize; 3.134 + xenoprof_init.buf_maddr = __pa(d->xenoprof->rawbuf); 3.135 3.136 - if ( copy_to_user((void *)init_result, (void *)&result, sizeof(result)) ) 3.137 + if ( copy_to_guest(arg, &xenoprof_init, 1) ) 3.138 { 3.139 ret = -EFAULT; 3.140 goto err; 3.141 @@ -409,7 +410,7 @@ int xenoprof_init(int max_samples, xenop 3.142 || (op == XENOPROF_release_counters) \ 3.143 || (op == XENOPROF_shutdown)) 3.144 3.145 -int do_xenoprof_op(int op, unsigned long arg1, unsigned long arg2) 3.146 +int do_xenoprof_op(int op, GUEST_HANDLE(void) arg) 3.147 { 3.148 int ret = 0; 3.149 3.150 @@ -423,20 +424,24 @@ int do_xenoprof_op(int op, unsigned long 3.151 switch ( op ) 3.152 { 3.153 case XENOPROF_init: 3.154 - ret = xenoprof_init((int)arg1, (xenoprof_init_result_t *)arg2); 3.155 + ret = xenoprof_op_init(arg); 3.156 break; 3.157 3.158 + case XENOPROF_reset_active_list: 3.159 + { 3.160 + ret = reset_active_list(); 3.161 + break; 3.162 + } 3.163 case XENOPROF_set_active: 3.164 + { 3.165 + domid_t domid; 3.166 if ( xenoprof_state != XENOPROF_IDLE ) 3.167 return -EPERM; 3.168 - if ( arg2 > MAX_OPROF_DOMAINS ) 3.169 - return -E2BIG; 3.170 - if ( copy_from_user((void *)&active_domains, 3.171 - (void *)arg1, arg2*sizeof(int)) ) 3.172 + if ( copy_from_guest(&domid, arg, 1) ) 3.173 return -EFAULT; 3.174 - ret = set_active_domains(arg2); 3.175 + ret = add_active_list(domid); 3.176 break; 3.177 - 3.178 + } 3.179 case XENOPROF_reserve_counters: 3.180 if ( xenoprof_state != XENOPROF_IDLE ) 3.181 return -EPERM; 3.182 @@ -445,15 +450,34 @@ int do_xenoprof_op(int op, unsigned long 3.183 xenoprof_state = XENOPROF_COUNTERS_RESERVED; 3.184 break; 3.185 3.186 - case XENOPROF_setup_events: 3.187 + case XENOPROF_counter: 3.188 + { 3.189 + struct xenoprof_counter counter; 3.190 if ( xenoprof_state != XENOPROF_COUNTERS_RESERVED ) 3.191 return -EPERM; 3.192 if ( adomains == 0 ) 3.193 - set_active_domains(0); 3.194 + return -EPERM; 3.195 + 3.196 + if ( copy_from_guest(&counter, arg, 1) ) 3.197 + return -EFAULT; 3.198 + 3.199 + if ( counter.ind > OP_MAX_COUNTER ) 3.200 + return -E2BIG; 3.201 3.202 - if ( copy_from_user((void *)&counter_config, (void *)arg1, 3.203 - arg2 * sizeof(struct op_counter_config)) ) 3.204 - return -EFAULT; 3.205 + counter_config[counter.ind].count = (unsigned long) counter.count; 3.206 + counter_config[counter.ind].enabled = (unsigned long) counter.enabled; 3.207 + counter_config[counter.ind].event = (unsigned long) counter.event; 3.208 + counter_config[counter.ind].kernel = (unsigned long) counter.kernel; 3.209 + counter_config[counter.ind].user = (unsigned long) counter.user; 3.210 + counter_config[counter.ind].unit_mask = (unsigned long) counter.unit_mask; 3.211 + 3.212 + ret = 0; 3.213 + break; 3.214 + } 3.215 + 3.216 + case XENOPROF_setup_events: 3.217 + if ( xenoprof_state != XENOPROF_COUNTERS_RESERVED ) 3.218 + return -EPERM; 3.219 ret = nmi_setup_events(); 3.220 if ( !ret ) 3.221 xenoprof_state = XENOPROF_READY; 3.222 @@ -526,3 +550,13 @@ int do_xenoprof_op(int op, unsigned long 3.223 3.224 return ret; 3.225 } 3.226 + 3.227 +/* 3.228 + * Local variables: 3.229 + * mode: C 3.230 + * c-set-style: "BSD" 3.231 + * c-basic-offset: 4 3.232 + * tab-width: 4 3.233 + * indent-tabs-mode: nil 3.234 + * End: 3.235 + */
4.1 --- a/xen/arch/x86/x86_32/entry.S Wed Apr 19 18:39:36 2006 +0100 4.2 +++ b/xen/arch/x86/x86_32/entry.S Wed Apr 19 18:43:39 2006 +0100 4.3 @@ -682,7 +682,7 @@ ENTRY(hypercall_args_table) 4.4 .byte 2 /* do_nmi_op */ 4.5 .byte 2 /* do_arch_sched_op */ 4.6 .byte 2 /* do_callback_op */ /* 30 */ 4.7 - .byte 3 /* do_xenoprof_op */ 4.8 + .byte 2 /* do_xenoprof_op */ 4.9 .rept NR_hypercalls-(.-hypercall_args_table) 4.10 .byte 0 /* do_ni_hypercall */ 4.11 .endr
5.1 --- a/xen/arch/x86/x86_64/entry.S Wed Apr 19 18:39:36 2006 +0100 5.2 +++ b/xen/arch/x86/x86_64/entry.S Wed Apr 19 18:43:39 2006 +0100 5.3 @@ -590,7 +590,7 @@ ENTRY(hypercall_args_table) 5.4 .byte 2 /* do_nmi_op */ 5.5 .byte 2 /* do_arch_sched_op */ 5.6 .byte 2 /* do_callback_op */ /* 30 */ 5.7 - .byte 3 /* do_xenoprof_op */ 5.8 + .byte 2 /* do_xenoprof_op */ 5.9 .rept NR_hypercalls-(.-hypercall_args_table) 5.10 .byte 0 /* do_ni_hypercall */ 5.11 .endr
6.1 --- a/xen/include/public/xenoprof.h Wed Apr 19 18:39:36 2006 +0100 6.2 +++ b/xen/include/public/xenoprof.h Wed Apr 19 18:43:39 2006 +0100 6.3 @@ -12,18 +12,22 @@ 6.4 #define __XEN_PUBLIC_XENOPROF_H__ 6.5 6.6 /* 6.7 - * Commands to HYPERVISOR_pmc_op(). 6.8 + * Commands to HYPERVISOR_xenoprof_op(). 6.9 */ 6.10 -#define XENOPROF_init 0 6.11 -#define XENOPROF_set_active 1 6.12 -#define XENOPROF_reserve_counters 3 6.13 -#define XENOPROF_setup_events 4 6.14 -#define XENOPROF_enable_virq 5 6.15 -#define XENOPROF_start 6 6.16 -#define XENOPROF_stop 7 6.17 -#define XENOPROF_disable_virq 8 6.18 -#define XENOPROF_release_counters 9 6.19 -#define XENOPROF_shutdown 10 6.20 +#define XENOPROF_init 0 6.21 +#define XENOPROF_reset_active_list 1 6.22 +#define XENOPROF_reset_passive_list 2 6.23 +#define XENOPROF_set_active 3 6.24 +#define XENOPROF_set_passive 4 6.25 +#define XENOPROF_reserve_counters 5 6.26 +#define XENOPROF_counter 6 6.27 +#define XENOPROF_setup_events 7 6.28 +#define XENOPROF_enable_virq 8 6.29 +#define XENOPROF_start 9 6.30 +#define XENOPROF_stop 10 6.31 +#define XENOPROF_disable_virq 11 6.32 +#define XENOPROF_release_counters 12 6.33 +#define XENOPROF_shutdown 13 6.34 6.35 #define MAX_OPROF_EVENTS 32 6.36 #define MAX_OPROF_DOMAINS 25 6.37 @@ -50,25 +54,29 @@ typedef struct xenoprof_buf { 6.38 } xenoprof_buf_t; 6.39 DEFINE_GUEST_HANDLE(xenoprof_buf_t); 6.40 6.41 -typedef struct xenoprof_init_result { 6.42 +typedef struct xenoprof_init { 6.43 + int32_t max_samples; 6.44 int32_t num_events; 6.45 int32_t is_primary; 6.46 int32_t nbuf; 6.47 int32_t bufsize; 6.48 uint64_t buf_maddr; 6.49 char cpu_type[XENOPROF_CPU_TYPE_SIZE]; 6.50 -} xenoprof_init_result_t; 6.51 -DEFINE_GUEST_HANDLE(xenoprof_init_result_t); 6.52 +} xenoprof_init_t; 6.53 +DEFINE_GUEST_HANDLE(xenoprof_init_t); 6.54 6.55 -typedef struct xenoprof_counter_config { 6.56 - unsigned long count; 6.57 - unsigned long enabled; 6.58 - unsigned long event; 6.59 - unsigned long kernel; 6.60 - unsigned long user; 6.61 - unsigned long unit_mask; 6.62 -} xenoprof_counter_config_t; 6.63 -DEFINE_GUEST_HANDLE(xenoprof_counter_config_t); 6.64 +typedef struct xenoprof_counter { 6.65 + uint32_t ind; 6.66 + uint64_t count; 6.67 + uint32_t enabled; 6.68 + uint32_t event; 6.69 + uint32_t hypervisor; 6.70 + uint32_t kernel; 6.71 + uint32_t user; 6.72 + uint64_t unit_mask; 6.73 +} xenoprof_counter_t; 6.74 +DEFINE_GUEST_HANDLE(xenoprof_counter_t); 6.75 + 6.76 6.77 #endif /* __XEN_PUBLIC_XENOPROF_H__ */ 6.78