ia64/xen-unstable

view tools/xenmon/setmask.c @ 8609:85d693e6f61a

Arch-specific per-vcpu info should be initialised to zero
when allocating a new vcpu structure, not copied from
CPU0's idle VCPU. Especially now that the idle VCPU itself
is dynamically allocated.

This should fix assertions people have been seeing in
getdomain_info_ctxt() relation to IOPL in eflags.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Sat Jan 14 21:26:40 2006 +0100 (2006-01-14)
parents 394390f6ff85
children 86d26e6ec89b
line source
1 /******************************************************************************
2 * tools/xenmon/setmask.c
3 *
4 * Simple utility for getting/setting the event mask
5 *
6 * Copyright (C) 2005 by Hewlett-Packard, Palo Alto and Fort Collins
7 *
8 * Authors: Lucy Cherkasova, lucy.cherkasova.hp.com
9 * Rob Gardner, rob.gardner@hp.com
10 * Diwaker Gupta, diwaker.gupta@hp.com
11 * Date: August, 2005
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; under version 2 of the License.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */
27 #include <stdlib.h>
28 #include <stdio.h>
29 #include <sys/types.h>
30 #include <fcntl.h>
31 #include <unistd.h>
32 #include <errno.h>
33 #include <getopt.h>
34 #include <xenctrl.h>
35 #include <xen/xen.h>
36 typedef struct { int counter; } atomic_t;
37 #include <xen/trace.h>
39 #define XENMON (TRC_SCHED_DOM_ADD | TRC_SCHED_DOM_REM | TRC_SCHED_SWITCH_INFPREV | TRC_SCHED_SWITCH_INFNEXT | TRC_SCHED_BLOCK | TRC_SCHED_SLEEP | TRC_SCHED_WAKE | TRC_MEM_PAGE_GRANT_TRANSFER)
41 int main(int argc, char * argv[])
42 {
44 dom0_op_t op;
45 int ret;
47 int xc_handle = xc_interface_open();
48 op.cmd = DOM0_TBUFCONTROL;
49 op.interface_version = DOM0_INTERFACE_VERSION;
50 op.u.tbufcontrol.op = DOM0_TBUF_GET_INFO;
51 ret = xc_dom0_op(xc_handle, &op);
52 if ( ret != 0 )
53 {
54 perror("Failure to get event mask from Xen");
55 exit(1);
56 }
57 else
58 {
59 printf("Current event mask: 0x%.8x\n", op.u.tbufcontrol.evt_mask);
60 }
62 op.cmd = DOM0_TBUFCONTROL;
63 op.interface_version = DOM0_INTERFACE_VERSION;
64 op.u.tbufcontrol.op = DOM0_TBUF_SET_EVT_MASK;
65 op.u.tbufcontrol.evt_mask = XENMON;
67 ret = xc_dom0_op(xc_handle, &op);
68 printf("Setting mask to 0x%.8x\n", op.u.tbufcontrol.evt_mask);
69 if ( ret != 0 )
70 {
71 perror("Failure to get scheduler ID from Xen");
72 exit(1);
73 }
75 op.cmd = DOM0_TBUFCONTROL;
76 op.interface_version = DOM0_INTERFACE_VERSION;
77 op.u.tbufcontrol.op = DOM0_TBUF_GET_INFO;
78 ret = xc_dom0_op(xc_handle, &op);
79 if ( ret != 0 )
80 {
81 perror("Failure to get event mask from Xen");
82 exit(1);
83 }
84 else
85 {
86 printf("Current event mask: 0x%.8x\n", op.u.tbufcontrol.evt_mask);
87 }
88 xc_interface_close(xc_handle);
89 return 0;
90 }