ia64/xen-unstable

annotate xen/arch/ia64/xen/privop_stat.c @ 16785:af3550f53874

[IA64] domheap: Don't pin xenheap down. Now it's unnecessary.

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