ia64/xen-unstable

view xen/arch/ia64/xen/privop_stat.c @ 19848:5839491bbf20

[IA64] replace MAX_VCPUS with d->max_vcpus where necessary.

don't use MAX_VCPUS, and use vcpu::max_vcpus.
The changeset of 2f9e1348aa98 introduced max_vcpus to allow more vcpus
per guest. This patch is ia64 counter part.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Mon Jun 29 11:26:05 2009 +0900 (2009-06-29)
parents 96f167771979
children
line source
1 #include <xen/lib.h>
2 #include <public/xen.h>
3 #include <xen/perfc.h>
4 #include <asm/atomic.h>
5 #include <asm/privop_stat.h>
7 #ifdef CONFIG_PRIVOP_ADDRS
9 struct privop_addr_count {
10 unsigned long addr[PRIVOP_COUNT_NADDRS];
11 unsigned int count[PRIVOP_COUNT_NADDRS];
12 unsigned int overflow;
13 };
15 struct privop_addr_info {
16 enum perfcounter perfc_addr;
17 enum perfcounter perfc_count;
18 enum perfcounter perfc_overflow;
19 };
21 #define PERFCOUNTER(var, name)
22 #define PERFCOUNTER_ARRAY(var, name, size)
24 #define PERFSTATUS(var, name)
25 #define PERFSTATUS_ARRAY(var, name, size)
27 #define PERFPRIVOPADDR(name) \
28 { \
29 PERFC_privop_addr_##name##_addr, \
30 PERFC_privop_addr_##name##_count, \
31 PERFC_privop_addr_##name##_overflow \
32 },
34 static const struct privop_addr_info privop_addr_info[] = {
35 #include <asm/perfc_defn.h>
36 };
38 #define PRIVOP_COUNT_NINSTS \
39 (sizeof(privop_addr_info) / sizeof(privop_addr_info[0]))
41 static DEFINE_PER_CPU(struct privop_addr_count[PRIVOP_COUNT_NINSTS], privop_addr_counter);
43 void privop_count_addr(unsigned long iip, enum privop_inst inst)
44 {
45 struct privop_addr_count *v = this_cpu(privop_addr_counter) + inst;
46 int i;
48 if (inst >= PRIVOP_COUNT_NINSTS)
49 return;
50 for (i = 0; i < PRIVOP_COUNT_NADDRS; i++) {
51 if (!v->addr[i]) {
52 v->addr[i] = iip;
53 v->count[i]++;
54 return;
55 }
56 else if (v->addr[i] == iip) {
57 v->count[i]++;
58 return;
59 }
60 }
61 v->overflow++;;
62 }
64 void gather_privop_addrs(void)
65 {
66 unsigned int cpu;
68 for_each_cpu ( cpu ) {
69 perfc_t *perfcounters = per_cpu(perfcounters, cpu);
70 struct privop_addr_count *s = per_cpu(privop_addr_counter, cpu);
71 int i, j;
73 for (i = 0; i < PRIVOP_COUNT_NINSTS; i++, s++) {
74 perfc_t *d;
76 /* Note: addresses are truncated! */
77 d = perfcounters + privop_addr_info[i].perfc_addr;
78 for (j = 0; j < PRIVOP_COUNT_NADDRS; j++)
79 d[j] = s->addr[j];
81 d = perfcounters + privop_addr_info[i].perfc_count;
82 for (j = 0; j < PRIVOP_COUNT_NADDRS; j++)
83 d[j] = s->count[j];
85 perfcounters[privop_addr_info[i].perfc_overflow] =
86 s->overflow;
87 }
88 }
89 }
91 void reset_privop_addrs(void)
92 {
93 unsigned int cpu;
95 for_each_cpu ( cpu ) {
96 struct privop_addr_count *v = per_cpu(privop_addr_counter, cpu);
97 int i, j;
99 for (i = 0; i < PRIVOP_COUNT_NINSTS; i++, v++) {
100 for (j = 0; j < PRIVOP_COUNT_NADDRS; j++)
101 v->addr[j] = v->count[j] = 0;
102 v->overflow = 0;
103 }
104 }
105 }
106 #endif
108 /**************************************************************************
109 Privileged operation instrumentation routines
110 **************************************************************************/
112 #if 0
113 static const char * const Mpriv_str[64] = {
114 "mov_to_rr", "mov_to_dbr", "mov_to_ibr", "mov_to_pkr",
115 "mov_to_pmc", "mov_to_pmd", "<0x06>", "<0x07>",
116 "<0x08>", "ptc_l", "ptc_g", "ptc_ga",
117 "ptr_d", "ptr_i", "itr_d", "itr_i",
118 "mov_from_rr", "mov_from_dbr", "mov_from_ibr", "mov_from_pkr",
119 "mov_from_pmc", "<0x15>", "<0x16>", "<0x17>",
120 "<0x18>", "<0x19>", "privified-thash", "privified-ttag",
121 "<0x1c>", "<0x1d>", "tpa", "tak",
122 "<0x20>", "<0x21>", "<0x22>", "<0x23>",
123 "mov_from_cr", "mov_from_psr", "<0x26>", "<0x27>",
124 "<0x28>", "<0x29>", "<0x2a>", "<0x2b>",
125 "mov_to_cr", "mov_to_psr", "itc_d", "itc_i",
126 "<0x30>", "<0x31>", "<0x32>", "<0x33>",
127 "ptc_e", "<0x35>", "<0x36>", "<0x37>",
128 "<0x38>", "<0x39>", "<0x3a>", "<0x3b>",
129 "<0x3c>", "<0x3d>", "<0x3e>", "<0x3f>"
130 };
132 #define RS "Rsvd"
133 static const char * const cr_str[128] = {
134 "dcr","itm","iva",RS,RS,RS,RS,RS,
135 "pta",RS,RS,RS,RS,RS,RS,RS,
136 "ipsr","isr",RS,"iip","ifa","itir","iipa","ifs",
137 "iim","iha",RS,RS,RS,RS,RS,RS,
138 RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
139 RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
140 "lid","ivr","tpr","eoi","irr0","irr1","irr2","irr3",
141 "itv","pmv","cmcv",RS,RS,RS,RS,RS,
142 "lrr0","lrr1",RS,RS,RS,RS,RS,RS,
143 RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
144 RS,RS,RS,RS,RS,RS,RS,RS, RS,RS,RS,RS,RS,RS,RS,RS,
145 RS,RS,RS,RS,RS,RS,RS,RS
146 };
148 static const char * const hyperpriv_str[HYPERPRIVOP_MAX+1] = {
149 0, "rfi", "rsm.dt", "ssm.dt", "cover", "itc.d", "itc.i", "ssm.i",
150 "=ivr", "=tpr", "tpr=", "eoi", "itm=", "thash", "ptc.ga", "itr.d",
151 "=rr", "rr=", "kr=", "fc", "=cpuid", "=pmd", "=ar.eflg", "ar.eflg="
152 };
153 #endif