[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Add support for privified mov-from-pmd
ChangeSet 1.1423.5.1, 2005/05/06 11:02:01-06:00, djm@xxxxxxxxxxxxxxx Add support for privified mov-from-pmd Add counters for privified-fc and privified-cpuid Add optional support for counting addresses of privops Remove unnecessary PCI stuff Add optional heartbeat console output Signed-off by: Dan Magenheimer <dan.magenheimer@xxxxxx> arch/ia64/privop.c | 82 +++++++++++++++++++++++++++++++++++++++++++--- arch/ia64/vcpu.c | 41 ++++++++++++----------- arch/ia64/xenmisc.c | 69 -------------------------------------- arch/ia64/xentime.c | 11 ++++++ include/asm-ia64/config.h | 6 --- include/asm-ia64/vcpu.h | 15 ++++++++ 6 files changed, 126 insertions(+), 98 deletions(-) diff -Nru a/xen/arch/ia64/privop.c b/xen/arch/ia64/privop.c --- a/xen/arch/ia64/privop.c 2005-05-11 03:03:38 -04:00 +++ b/xen/arch/ia64/privop.c 2005-05-11 03:03:38 -04:00 @@ -417,10 +417,17 @@ UINT64 val; IA64FAULT fault; - fault = vcpu_get_pmc(vcpu,vcpu_get_gr(vcpu,inst.M43.r3),&val); - if (fault == IA64_NO_FAULT) - return vcpu_set_gr(vcpu, inst.M43.r1, val); - else return fault; + if (inst.M43.r1 > 63) { // privified mov from pmd + fault = vcpu_get_pmd(vcpu,vcpu_get_gr(vcpu,inst.M43.r3),&val); + if (fault == IA64_NO_FAULT) + return vcpu_set_gr(vcpu, inst.M43.r1-64, val); + } + else { + fault = vcpu_get_pmc(vcpu,vcpu_get_gr(vcpu,inst.M43.r3),&val); + if (fault == IA64_NO_FAULT) + return vcpu_set_gr(vcpu, inst.M43.r1, val); + } + return fault; } unsigned long from_cr_cnt[128] = { 0 }; @@ -531,6 +538,8 @@ unsigned long bsw0; unsigned long bsw1; unsigned long cover; + unsigned long fc; + unsigned long cpuid; unsigned long Mpriv_cnt[64]; } privcnt = { 0 }; @@ -631,7 +640,11 @@ else x6 = 0x1a; } } - privcnt.Mpriv_cnt[x6]++; + if (x6 == 52 && inst.M28.r3 > 63) + privcnt.fc++; + else if (x6 == 16 && inst.M43.r3 > 63) + privcnt.cpuid++; + else privcnt.Mpriv_cnt[x6]++; return (*pfunc)(vcpu,inst); break; case B: @@ -826,6 +839,12 @@ if (privcnt.cover) s += sprintf(s,"%10d %s [%d%%]\r\n", privcnt.cover, "cover", (privcnt.cover*100L)/sum); + if (privcnt.fc) + s += sprintf(s,"%10d %s [%d%%]\r\n", privcnt.fc, + "privified-fc", (privcnt.fc*100L)/sum); + if (privcnt.cpuid) + s += sprintf(s,"%10d %s [%d%%]\r\n", privcnt.cpuid, + "privified-getcpuid", (privcnt.cpuid*100L)/sum); for (i=0; i < 64; i++) if (privcnt.Mpriv_cnt[i]) { if (!Mpriv_str[i]) s += sprintf(s,"PRIVSTRING NULL!!\r\n"); else s += sprintf(s,"%10d %s [%d%%]\r\n", privcnt.Mpriv_cnt[i], @@ -864,6 +883,7 @@ privcnt.ssm = 0; privcnt.rsm = 0; privcnt.rfi = 0; privcnt.bsw0 = 0; privcnt.bsw1 = 0; privcnt.cover = 0; + privcnt.fc = 0; privcnt.cpuid = 0; for (i=0; i < 64; i++) privcnt.Mpriv_cnt[i] = 0; for (j=0; j < 128; j++) from_cr_cnt[j] = 0; for (j=0; j < 128; j++) to_cr_cnt[j] = 0; @@ -871,12 +891,61 @@ return s - buf; } +#ifdef PRIVOP_ADDR_COUNT + +extern struct privop_addr_count privop_addr_counter[]; + +void privop_count_addr(unsigned long iip, int inst) +{ + struct privop_addr_count *v = &privop_addr_counter[inst]; + int i; + + for (i = 0; i < PRIVOP_COUNT_NADDRS; i++) { + if (!v->addr[i]) { v->addr[i] = iip; v->count[i]++; return; } + else if (v->addr[i] == iip) { v->count[i]++; return; } + } + v->overflow++;; +} + +int dump_privop_addrs(char *buf) +{ + int i,j; + char *s = buf; + s += sprintf(s,"Privop addresses:\r\n"); + for (i = 0; i < PRIVOP_COUNT_NINSTS; i++) { + struct privop_addr_count *v = &privop_addr_counter[i]; + s += sprintf(s,"%s:\n",v->instname); + for (j = 0; j < PRIVOP_COUNT_NADDRS; j++) { + if (!v->addr[j]) break; + s += sprintf(s," @%p #%ld\n",v->addr[j],v->count[j]); + } + if (v->overflow) + s += sprintf(s," other #%ld\n",v->overflow); + } + return s - buf; +} + +void zero_privop_addrs(void) +{ + int i,j; + for (i = 0; i < PRIVOP_COUNT_NINSTS; i++) { + struct privop_addr_count *v = &privop_addr_counter[i]; + for (j = 0; j < PRIVOP_COUNT_NADDRS; j++) + v->addr[j] = v->count[j] = 0; + v->overflow = 0; + } +} +#endif + #define TMPBUFLEN 8*1024 int dump_privop_counts_to_user(char __user *ubuf, int len) { char buf[TMPBUFLEN]; int n = dump_privop_counts(buf); +#ifdef PRIVOP_ADDR_COUNT + n += dump_privop_addrs(buf + n); +#endif if (len < TMPBUFLEN) return -1; if (__copy_to_user(ubuf,buf,n)) return -1; return n; @@ -887,6 +956,9 @@ char buf[TMPBUFLEN]; int n = zero_privop_counts(buf); +#ifdef PRIVOP_ADDR_COUNT + zero_privop_addrs(); +#endif if (len < TMPBUFLEN) return -1; if (__copy_to_user(ubuf,buf,n)) return -1; return n; diff -Nru a/xen/arch/ia64/vcpu.c b/xen/arch/ia64/vcpu.c --- a/xen/arch/ia64/vcpu.c 2005-05-11 03:03:38 -04:00 +++ b/xen/arch/ia64/vcpu.c 2005-05-11 03:03:38 -04:00 @@ -37,6 +37,17 @@ #define STATIC +#ifdef PRIVOP_ADDR_COUNT +struct privop_addr_count privop_addr_counter[PRIVOP_COUNT_NINSTS] = { + { "rsm", { 0 }, { 0 }, 0 }, + { "ssm", { 0 }, { 0 }, 0 } +}; +extern void privop_count_addr(unsigned long addr, int inst); +#define PRIVOP_COUNT_ADDR(regs,inst) privop_count_addr(regs->cr_iip,inst) +#else +#define PRIVOP_COUNT_ADDR(x,y) do {} while (0) +#endif + unsigned long vcpu_verbose = 0; #define verbose(a...) do {if (vcpu_verbose) printf(a);} while(0) @@ -77,30 +88,20 @@ IA64FAULT vcpu_set_ar(VCPU *vcpu, UINT64 reg, UINT64 val) { if (reg == 44) return (vcpu_set_itc(vcpu,val)); - if (reg == 27) return (IA64_ILLOP_FAULT); - if (reg > 7) return (IA64_ILLOP_FAULT); - PSCB(vcpu,krs[reg]) = val; -#if 0 -// for now, privify kr read's so all kr accesses are privileged - switch (reg) { - case 0: asm volatile ("mov ar.k0=%0" :: "r"(val)); break; - case 1: asm volatile ("mov ar.k1=%0" :: "r"(val)); break; - case 2: asm volatile ("mov ar.k2=%0" :: "r"(val)); break; - case 3: asm volatile ("mov ar.k3=%0" :: "r"(val)); break; - case 4: asm volatile ("mov ar.k4=%0" :: "r"(val)); break; - case 5: asm volatile ("mov ar.k5=%0" :: "r"(val)); break; - case 6: asm volatile ("mov ar.k6=%0" :: "r"(val)); break; - case 7: asm volatile ("mov ar.k7=%0" :: "r"(val)); break; - case 27: asm volatile ("mov ar.cflg=%0" :: "r"(val)); break; - } -#endif + else if (reg == 27) return (IA64_ILLOP_FAULT); + else if (reg == 24) + printf("warning: setting ar.eflg is a no-op; no IA-32 support\n"); + else if (reg > 7) return (IA64_ILLOP_FAULT); + else PSCB(vcpu,krs[reg]) = val; return IA64_NO_FAULT; } IA64FAULT vcpu_get_ar(VCPU *vcpu, UINT64 reg, UINT64 *val) { - if (reg > 7) return (IA64_ILLOP_FAULT); - *val = PSCB(vcpu,krs[reg]); + if (reg == 24) + printf("warning: getting ar.eflg is a no-op; no IA-32 support\n"); + else if (reg > 7) return (IA64_ILLOP_FAULT); + else *val = PSCB(vcpu,krs[reg]); return IA64_NO_FAULT; } @@ -124,6 +125,7 @@ struct ia64_psr psr, imm, *ipsr; REGS *regs = vcpu_regs(vcpu); + PRIVOP_COUNT_ADDR(regs,_RSM); // TODO: All of these bits need to be virtualized // TODO: Only allowed for current vcpu __asm__ __volatile ("mov %0=psr;;" : "=r"(psr) :: "memory"); @@ -158,6 +160,7 @@ REGS *regs = vcpu_regs(vcpu); UINT64 mask, enabling_interrupts = 0; + PRIVOP_COUNT_ADDR(regs,_SSM); // TODO: All of these bits need to be virtualized __asm__ __volatile ("mov %0=psr;;" : "=r"(psr) :: "memory"); imm = *(struct ia64_psr *)&imm24; diff -Nru a/xen/arch/ia64/xenmisc.c b/xen/arch/ia64/xenmisc.c --- a/xen/arch/ia64/xenmisc.c 2005-05-11 03:03:38 -04:00 +++ b/xen/arch/ia64/xenmisc.c 2005-05-11 03:03:38 -04:00 @@ -133,80 +133,13 @@ } /////////////////////////////// -// from arch/x86/pci.c -/////////////////////////////// - -int -pcibios_prep_mwi (struct pci_dev *dev) -{ - dummy(); -} - -/////////////////////////////// -// from arch/x86/pci-irq.c -/////////////////////////////// - -void pcibios_enable_irq(struct pci_dev *dev) -{ - dummy(); -} - -/////////////////////////////// -// from arch/ia64/pci-pc.c -/////////////////////////////// - -#include <xen/pci.h> - -int pcibios_enable_device(struct pci_dev *dev, int mask) -{ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |