Convert hwpmc(4) debug printfs over to KTR.
Differential Revision: https://reviews.freebsd.org/D2487 Reviewed by: davide, emaste MFC after: 2 weeks Sponsored by: Norse Corp, Inc.
This commit is contained in:
parent
1ca4eb3acc
commit
4a3690dfa1
@ -282,7 +282,7 @@ amd_read_pmc(int cpu, int ri, pmc_value_t *v)
|
||||
|
||||
mode = PMC_TO_MODE(pm);
|
||||
|
||||
PMCDBG(MDP,REA,1,"amd-read id=%d class=%d", ri, pd->pm_descr.pd_class);
|
||||
PMCDBG2(MDP,REA,1,"amd-read id=%d class=%d", ri, pd->pm_descr.pd_class);
|
||||
|
||||
#ifdef HWPMC_DEBUG
|
||||
KASSERT(pd->pm_descr.pd_class == amd_pmc_class,
|
||||
@ -291,7 +291,7 @@ amd_read_pmc(int cpu, int ri, pmc_value_t *v)
|
||||
#endif
|
||||
|
||||
tmp = rdmsr(pd->pm_perfctr); /* RDMSR serializes */
|
||||
PMCDBG(MDP,REA,2,"amd-read (pre-munge) id=%d -> %jd", ri, tmp);
|
||||
PMCDBG2(MDP,REA,2,"amd-read (pre-munge) id=%d -> %jd", ri, tmp);
|
||||
if (PMC_IS_SAMPLING_MODE(mode)) {
|
||||
/* Sign extend 48 bit value to 64 bits. */
|
||||
tmp = (pmc_value_t) (((int64_t) tmp << 16) >> 16);
|
||||
@ -299,7 +299,7 @@ amd_read_pmc(int cpu, int ri, pmc_value_t *v)
|
||||
}
|
||||
*v = tmp;
|
||||
|
||||
PMCDBG(MDP,REA,2,"amd-read (post-munge) id=%d -> %jd", ri, *v);
|
||||
PMCDBG2(MDP,REA,2,"amd-read (post-munge) id=%d -> %jd", ri, *v);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -339,7 +339,7 @@ amd_write_pmc(int cpu, int ri, pmc_value_t v)
|
||||
if (PMC_IS_SAMPLING_MODE(mode))
|
||||
v = AMD_RELOAD_COUNT_TO_PERFCTR_VALUE(v);
|
||||
|
||||
PMCDBG(MDP,WRI,1,"amd-write cpu=%d ri=%d v=%jx", cpu, ri, v);
|
||||
PMCDBG3(MDP,WRI,1,"amd-write cpu=%d ri=%d v=%jx", cpu, ri, v);
|
||||
|
||||
/* write the PMC value */
|
||||
wrmsr(pd->pm_perfctr, v);
|
||||
@ -356,7 +356,7 @@ amd_config_pmc(int cpu, int ri, struct pmc *pm)
|
||||
{
|
||||
struct pmc_hw *phw;
|
||||
|
||||
PMCDBG(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
PMCDBG3(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[amd,%d] illegal CPU value %d", __LINE__, cpu));
|
||||
@ -395,7 +395,7 @@ amd_switch_in(struct pmc_cpu *pc, struct pmc_process *pp)
|
||||
{
|
||||
(void) pc;
|
||||
|
||||
PMCDBG(MDP,SWI,1, "pc=%p pp=%p enable-msr=%d", pc, pp,
|
||||
PMCDBG3(MDP,SWI,1, "pc=%p pp=%p enable-msr=%d", pc, pp,
|
||||
(pp->pp_flags & PMC_PP_ENABLE_MSR_ACCESS) != 0);
|
||||
|
||||
/* enable the RDPMC instruction if needed */
|
||||
@ -416,7 +416,7 @@ amd_switch_out(struct pmc_cpu *pc, struct pmc_process *pp)
|
||||
(void) pc;
|
||||
(void) pp; /* can be NULL */
|
||||
|
||||
PMCDBG(MDP,SWO,1, "pc=%p pp=%p enable-msr=%d", pc, pp, pp ?
|
||||
PMCDBG3(MDP,SWO,1, "pc=%p pp=%p enable-msr=%d", pc, pp, pp ?
|
||||
(pp->pp_flags & PMC_PP_ENABLE_MSR_ACCESS) == 1 : 0);
|
||||
|
||||
/* always turn off the RDPMC instruction */
|
||||
@ -453,7 +453,7 @@ amd_allocate_pmc(int cpu, int ri, struct pmc *pm,
|
||||
|
||||
caps = pm->pm_caps;
|
||||
|
||||
PMCDBG(MDP,ALL,1,"amd-allocate ri=%d caps=0x%x", ri, caps);
|
||||
PMCDBG2(MDP,ALL,1,"amd-allocate ri=%d caps=0x%x", ri, caps);
|
||||
|
||||
if ((pd->pd_caps & caps) != caps)
|
||||
return EPERM;
|
||||
@ -500,7 +500,7 @@ amd_allocate_pmc(int cpu, int ri, struct pmc *pm,
|
||||
|
||||
pm->pm_md.pm_amd.pm_amd_evsel = config; /* save config value */
|
||||
|
||||
PMCDBG(MDP,ALL,2,"amd-allocate ri=%d -> config=0x%x", ri, config);
|
||||
PMCDBG2(MDP,ALL,2,"amd-allocate ri=%d -> config=0x%x", ri, config);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -567,7 +567,7 @@ amd_start_pmc(int cpu, int ri)
|
||||
("[amd,%d] starting cpu%d,pmc%d with null pmc record", __LINE__,
|
||||
cpu, ri));
|
||||
|
||||
PMCDBG(MDP,STA,1,"amd-start cpu=%d ri=%d", cpu, ri);
|
||||
PMCDBG2(MDP,STA,1,"amd-start cpu=%d ri=%d", cpu, ri);
|
||||
|
||||
KASSERT(AMD_PMC_IS_STOPPED(pd->pm_evsel),
|
||||
("[amd,%d] pmc%d,cpu%d: Starting active PMC \"%s\"", __LINE__,
|
||||
@ -576,7 +576,7 @@ amd_start_pmc(int cpu, int ri)
|
||||
/* turn on the PMC ENABLE bit */
|
||||
config = pm->pm_md.pm_amd.pm_amd_evsel | AMD_PMC_ENABLE;
|
||||
|
||||
PMCDBG(MDP,STA,2,"amd-start config=0x%x", config);
|
||||
PMCDBG1(MDP,STA,2,"amd-start config=0x%x", config);
|
||||
|
||||
wrmsr(pd->pm_evsel, config);
|
||||
return 0;
|
||||
@ -610,7 +610,7 @@ amd_stop_pmc(int cpu, int ri)
|
||||
("[amd,%d] PMC%d, CPU%d \"%s\" already stopped",
|
||||
__LINE__, ri, cpu, pd->pm_descr.pd_name));
|
||||
|
||||
PMCDBG(MDP,STO,1,"amd-stop ri=%d", ri);
|
||||
PMCDBG1(MDP,STO,1,"amd-stop ri=%d", ri);
|
||||
|
||||
/* turn off the PMC ENABLE bit */
|
||||
config = pm->pm_md.pm_amd.pm_amd_evsel & ~AMD_PMC_ENABLE;
|
||||
@ -637,7 +637,7 @@ amd_intr(int cpu, struct trapframe *tf)
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[amd,%d] out of range CPU %d", __LINE__, cpu));
|
||||
|
||||
PMCDBG(MDP,INT,1, "cpu=%d tf=%p um=%d", cpu, (void *) tf,
|
||||
PMCDBG3(MDP,INT,1, "cpu=%d tf=%p um=%d", cpu, (void *) tf,
|
||||
TRAPF_USERMODE(tf));
|
||||
|
||||
retval = 0;
|
||||
@ -769,7 +769,7 @@ amd_pcpu_init(struct pmc_mdep *md, int cpu)
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[amd,%d] insane cpu number %d", __LINE__, cpu));
|
||||
|
||||
PMCDBG(MDP,INI,1,"amd-init cpu=%d", cpu);
|
||||
PMCDBG1(MDP,INI,1,"amd-init cpu=%d", cpu);
|
||||
|
||||
amd_pcpu[cpu] = pac = malloc(sizeof(struct amd_cpu), M_PMC,
|
||||
M_WAITOK|M_ZERO);
|
||||
@ -816,7 +816,7 @@ amd_pcpu_fini(struct pmc_mdep *md, int cpu)
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[amd,%d] insane cpu number (%d)", __LINE__, cpu));
|
||||
|
||||
PMCDBG(MDP,INI,1,"amd-cleanup cpu=%d", cpu);
|
||||
PMCDBG1(MDP,INI,1,"amd-cleanup cpu=%d", cpu);
|
||||
|
||||
/*
|
||||
* First, turn off all PMCs on this CPU.
|
||||
@ -976,7 +976,7 @@ pmc_amd_initialize(void)
|
||||
|
||||
pmc_mdep->pmd_npmc += AMD_NPMCS;
|
||||
|
||||
PMCDBG(MDP,INI,0,"%s","amd-initialize");
|
||||
PMCDBG0(MDP,INI,0,"amd-initialize");
|
||||
|
||||
return (pmc_mdep);
|
||||
|
||||
|
@ -123,7 +123,7 @@ core_pcpu_init(struct pmc_mdep *md, int cpu)
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[iaf,%d] insane cpu number %d", __LINE__, cpu));
|
||||
|
||||
PMCDBG(MDP,INI,1,"core-init cpu=%d", cpu);
|
||||
PMCDBG1(MDP,INI,1,"core-init cpu=%d", cpu);
|
||||
|
||||
core_ri = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_IAP].pcd_ri;
|
||||
npmc = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_IAP].pcd_num;
|
||||
@ -162,7 +162,7 @@ core_pcpu_fini(struct pmc_mdep *md, int cpu)
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[core,%d] insane cpu number (%d)", __LINE__, cpu));
|
||||
|
||||
PMCDBG(MDP,INI,1,"core-pcpu-fini cpu=%d", cpu);
|
||||
PMCDBG1(MDP,INI,1,"core-pcpu-fini cpu=%d", cpu);
|
||||
|
||||
if ((cc = core_pcpu[cpu]) == NULL)
|
||||
return (0);
|
||||
@ -223,7 +223,7 @@ iaf_allocate_pmc(int cpu, int ri, struct pmc *pm,
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[core,%d] illegal CPU %d", __LINE__, cpu));
|
||||
|
||||
PMCDBG(MDP,ALL,1, "iaf-allocate ri=%d reqcaps=0x%x", ri, pm->pm_caps);
|
||||
PMCDBG2(MDP,ALL,1, "iaf-allocate ri=%d reqcaps=0x%x", ri, pm->pm_caps);
|
||||
|
||||
if (ri < 0 || ri > core_iaf_npmc)
|
||||
return (EINVAL);
|
||||
@ -267,7 +267,7 @@ iaf_allocate_pmc(int cpu, int ri, struct pmc *pm,
|
||||
|
||||
pm->pm_md.pm_iaf.pm_iaf_ctrl = (flags << (ri * 4));
|
||||
|
||||
PMCDBG(MDP,ALL,2, "iaf-allocate config=0x%jx",
|
||||
PMCDBG1(MDP,ALL,2, "iaf-allocate config=0x%jx",
|
||||
(uintmax_t) pm->pm_md.pm_iaf.pm_iaf_ctrl);
|
||||
|
||||
return (0);
|
||||
@ -282,7 +282,7 @@ iaf_config_pmc(int cpu, int ri, struct pmc *pm)
|
||||
KASSERT(ri >= 0 && ri < core_iaf_npmc,
|
||||
("[core,%d] illegal row-index %d", __LINE__, ri));
|
||||
|
||||
PMCDBG(MDP,CFG,1, "iaf-config cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
PMCDBG3(MDP,CFG,1, "iaf-config cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
|
||||
KASSERT(core_pcpu[cpu] != NULL, ("[core,%d] null per-cpu %d", __LINE__,
|
||||
cpu));
|
||||
@ -362,7 +362,7 @@ iaf_read_pmc(int cpu, int ri, pmc_value_t *v)
|
||||
else
|
||||
*v = tmp;
|
||||
|
||||
PMCDBG(MDP,REA,1, "iaf-read cpu=%d ri=%d msr=0x%x -> v=%jx", cpu, ri,
|
||||
PMCDBG4(MDP,REA,1, "iaf-read cpu=%d ri=%d msr=0x%x -> v=%jx", cpu, ri,
|
||||
IAF_RI_TO_MSR(ri), *v);
|
||||
|
||||
return (0);
|
||||
@ -371,7 +371,7 @@ iaf_read_pmc(int cpu, int ri, pmc_value_t *v)
|
||||
static int
|
||||
iaf_release_pmc(int cpu, int ri, struct pmc *pmc)
|
||||
{
|
||||
PMCDBG(MDP,REL,1, "iaf-release cpu=%d ri=%d pm=%p", cpu, ri, pmc);
|
||||
PMCDBG3(MDP,REL,1, "iaf-release cpu=%d ri=%d pm=%p", cpu, ri, pmc);
|
||||
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[core,%d] illegal CPU value %d", __LINE__, cpu));
|
||||
@ -396,7 +396,7 @@ iaf_start_pmc(int cpu, int ri)
|
||||
KASSERT(ri >= 0 && ri < core_iaf_npmc,
|
||||
("[core,%d] illegal row-index %d", __LINE__, ri));
|
||||
|
||||
PMCDBG(MDP,STA,1,"iaf-start cpu=%d ri=%d", cpu, ri);
|
||||
PMCDBG2(MDP,STA,1,"iaf-start cpu=%d ri=%d", cpu, ri);
|
||||
|
||||
iafc = core_pcpu[cpu];
|
||||
pm = iafc->pc_corepmcs[ri + core_iaf_ri].phw_pmc;
|
||||
@ -414,7 +414,7 @@ iaf_start_pmc(int cpu, int ri)
|
||||
IAF_GLOBAL_CTRL_MASK));
|
||||
} while (iafc->pc_resync != 0);
|
||||
|
||||
PMCDBG(MDP,STA,1,"iafctrl=%x(%x) globalctrl=%jx(%jx)",
|
||||
PMCDBG4(MDP,STA,1,"iafctrl=%x(%x) globalctrl=%jx(%jx)",
|
||||
iafc->pc_iafctrl, (uint32_t) rdmsr(IAF_CTRL),
|
||||
iafc->pc_globalctrl, rdmsr(IA_GLOBAL_CTRL));
|
||||
|
||||
@ -428,7 +428,7 @@ iaf_stop_pmc(int cpu, int ri)
|
||||
struct core_cpu *iafc;
|
||||
uint64_t msr = 0;
|
||||
|
||||
PMCDBG(MDP,STO,1,"iaf-stop cpu=%d ri=%d", cpu, ri);
|
||||
PMCDBG2(MDP,STO,1,"iaf-stop cpu=%d ri=%d", cpu, ri);
|
||||
|
||||
iafc = core_pcpu[cpu];
|
||||
|
||||
@ -445,7 +445,7 @@ iaf_stop_pmc(int cpu, int ri)
|
||||
|
||||
iafc->pc_iafctrl &= ~fc;
|
||||
|
||||
PMCDBG(MDP,STO,1,"iaf-stop iafctrl=%x", iafc->pc_iafctrl);
|
||||
PMCDBG1(MDP,STO,1,"iaf-stop iafctrl=%x", iafc->pc_iafctrl);
|
||||
msr = rdmsr(IAF_CTRL) & ~IAF_CTRL_MASK;
|
||||
wrmsr(IAF_CTRL, msr | (iafc->pc_iafctrl & IAF_CTRL_MASK));
|
||||
|
||||
@ -457,7 +457,7 @@ iaf_stop_pmc(int cpu, int ri)
|
||||
IAF_GLOBAL_CTRL_MASK));
|
||||
} while (iafc->pc_resync != 0);
|
||||
|
||||
PMCDBG(MDP,STO,1,"iafctrl=%x(%x) globalctrl=%jx(%jx)",
|
||||
PMCDBG4(MDP,STO,1,"iafctrl=%x(%x) globalctrl=%jx(%jx)",
|
||||
iafc->pc_iafctrl, (uint32_t) rdmsr(IAF_CTRL),
|
||||
iafc->pc_globalctrl, rdmsr(IA_GLOBAL_CTRL));
|
||||
|
||||
@ -495,7 +495,7 @@ iaf_write_pmc(int cpu, int ri, pmc_value_t v)
|
||||
msr = rdmsr(IAF_CTRL) & ~IAF_CTRL_MASK;
|
||||
wrmsr(IAF_CTRL, msr | (cc->pc_iafctrl & IAF_CTRL_MASK));
|
||||
|
||||
PMCDBG(MDP,WRI,1, "iaf-write cpu=%d ri=%d msr=0x%x v=%jx iafctrl=%jx "
|
||||
PMCDBG6(MDP,WRI,1, "iaf-write cpu=%d ri=%d msr=0x%x v=%jx iafctrl=%jx "
|
||||
"pmc=%jx", cpu, ri, IAF_RI_TO_MSR(ri), v,
|
||||
(uintmax_t) rdmsr(IAF_CTRL),
|
||||
(uintmax_t) rdpmc(IAF_RI_TO_MSR(ri)));
|
||||
@ -511,7 +511,7 @@ iaf_initialize(struct pmc_mdep *md, int maxcpu, int npmc, int pmcwidth)
|
||||
|
||||
KASSERT(md != NULL, ("[iaf,%d] md is NULL", __LINE__));
|
||||
|
||||
PMCDBG(MDP,INI,1, "%s", "iaf-initialize");
|
||||
PMCDBG0(MDP,INI,1, "iaf-initialize");
|
||||
|
||||
pcd = &md->pmd_classdep[PMC_MDEP_CLASS_INDEX_IAF];
|
||||
|
||||
@ -2289,7 +2289,7 @@ iap_config_pmc(int cpu, int ri, struct pmc *pm)
|
||||
KASSERT(ri >= 0 && ri < core_iap_npmc,
|
||||
("[core,%d] illegal row-index %d", __LINE__, ri));
|
||||
|
||||
PMCDBG(MDP,CFG,1, "iap-config cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
PMCDBG3(MDP,CFG,1, "iap-config cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
|
||||
KASSERT(core_pcpu[cpu] != NULL, ("[core,%d] null per-cpu %d", __LINE__,
|
||||
cpu));
|
||||
@ -2368,7 +2368,7 @@ iap_read_pmc(int cpu, int ri, pmc_value_t *v)
|
||||
else
|
||||
*v = tmp & ((1ULL << core_iap_width) - 1);
|
||||
|
||||
PMCDBG(MDP,REA,1, "iap-read cpu=%d ri=%d msr=0x%x -> v=%jx", cpu, ri,
|
||||
PMCDBG4(MDP,REA,1, "iap-read cpu=%d ri=%d msr=0x%x -> v=%jx", cpu, ri,
|
||||
ri, *v);
|
||||
|
||||
return (0);
|
||||
@ -2379,7 +2379,7 @@ iap_release_pmc(int cpu, int ri, struct pmc *pm)
|
||||
{
|
||||
(void) pm;
|
||||
|
||||
PMCDBG(MDP,REL,1, "iap-release cpu=%d ri=%d pm=%p", cpu, ri,
|
||||
PMCDBG3(MDP,REL,1, "iap-release cpu=%d ri=%d pm=%p", cpu, ri,
|
||||
pm);
|
||||
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
@ -2412,11 +2412,11 @@ iap_start_pmc(int cpu, int ri)
|
||||
("[core,%d] starting cpu%d,ri%d with no pmc configured",
|
||||
__LINE__, cpu, ri));
|
||||
|
||||
PMCDBG(MDP,STA,1, "iap-start cpu=%d ri=%d", cpu, ri);
|
||||
PMCDBG2(MDP,STA,1, "iap-start cpu=%d ri=%d", cpu, ri);
|
||||
|
||||
evsel = pm->pm_md.pm_iap.pm_iap_evsel;
|
||||
|
||||
PMCDBG(MDP,STA,2, "iap-start/2 cpu=%d ri=%d evselmsr=0x%x evsel=0x%x",
|
||||
PMCDBG4(MDP,STA,2, "iap-start/2 cpu=%d ri=%d evselmsr=0x%x evsel=0x%x",
|
||||
cpu, ri, IAP_EVSEL0 + ri, evsel);
|
||||
|
||||
/* Event specific configuration. */
|
||||
@ -2464,7 +2464,7 @@ iap_stop_pmc(int cpu, int ri)
|
||||
("[core,%d] cpu%d ri%d no configured PMC to stop", __LINE__,
|
||||
cpu, ri));
|
||||
|
||||
PMCDBG(MDP,STO,1, "iap-stop cpu=%d ri=%d", cpu, ri);
|
||||
PMCDBG2(MDP,STO,1, "iap-stop cpu=%d ri=%d", cpu, ri);
|
||||
|
||||
msr = rdmsr(IAP_EVSEL0 + ri) & ~IAP_EVSEL_MASK;
|
||||
wrmsr(IAP_EVSEL0 + ri, msr); /* stop hw */
|
||||
@ -2501,7 +2501,7 @@ iap_write_pmc(int cpu, int ri, pmc_value_t v)
|
||||
("[core,%d] cpu%d ri%d no configured PMC to stop", __LINE__,
|
||||
cpu, ri));
|
||||
|
||||
PMCDBG(MDP,WRI,1, "iap-write cpu=%d ri=%d msr=0x%x v=%jx", cpu, ri,
|
||||
PMCDBG4(MDP,WRI,1, "iap-write cpu=%d ri=%d msr=0x%x v=%jx", cpu, ri,
|
||||
IAP_PMC0 + ri, v);
|
||||
|
||||
if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
|
||||
@ -2526,7 +2526,7 @@ iap_initialize(struct pmc_mdep *md, int maxcpu, int npmc, int pmcwidth,
|
||||
|
||||
KASSERT(md != NULL, ("[iap,%d] md is NULL", __LINE__));
|
||||
|
||||
PMCDBG(MDP,INI,1, "%s", "iap-initialize");
|
||||
PMCDBG0(MDP,INI,1, "iap-initialize");
|
||||
|
||||
/* Remember the set of architectural events supported. */
|
||||
core_architectural_events = ~flags;
|
||||
@ -2564,7 +2564,7 @@ core_intr(int cpu, struct trapframe *tf)
|
||||
int error, found_interrupt, ri;
|
||||
uint64_t msr;
|
||||
|
||||
PMCDBG(MDP,INT, 1, "cpu=%d tf=0x%p um=%d", cpu, (void *) tf,
|
||||
PMCDBG3(MDP,INT, 1, "cpu=%d tf=0x%p um=%d", cpu, (void *) tf,
|
||||
TRAPF_USERMODE(tf));
|
||||
|
||||
found_interrupt = 0;
|
||||
@ -2623,7 +2623,7 @@ core2_intr(int cpu, struct trapframe *tf)
|
||||
struct core_cpu *cc;
|
||||
pmc_value_t v;
|
||||
|
||||
PMCDBG(MDP,INT, 1, "cpu=%d tf=0x%p um=%d", cpu, (void *) tf,
|
||||
PMCDBG3(MDP,INT, 1, "cpu=%d tf=0x%p um=%d", cpu, (void *) tf,
|
||||
TRAPF_USERMODE(tf));
|
||||
|
||||
/*
|
||||
@ -2635,7 +2635,7 @@ core2_intr(int cpu, struct trapframe *tf)
|
||||
intrstatus = rdmsr(IA_GLOBAL_STATUS);
|
||||
intrenable = intrstatus & core_pmcmask;
|
||||
|
||||
PMCDBG(MDP,INT, 1, "cpu=%d intrstatus=%jx", cpu,
|
||||
PMCDBG2(MDP,INT, 1, "cpu=%d intrstatus=%jx", cpu,
|
||||
(uintmax_t) intrstatus);
|
||||
|
||||
found_interrupt = 0;
|
||||
@ -2681,7 +2681,7 @@ core2_intr(int cpu, struct trapframe *tf)
|
||||
/* Reload sampling count. */
|
||||
wrmsr(IAF_CTR0 + n, v);
|
||||
|
||||
PMCDBG(MDP,INT, 1, "iaf-intr cpu=%d error=%d v=%jx(%jx)", cpu,
|
||||
PMCDBG4(MDP,INT, 1, "iaf-intr cpu=%d error=%d v=%jx(%jx)", cpu,
|
||||
error, (uintmax_t) v, (uintmax_t) rdpmc(IAF_RI_TO_MSR(n)));
|
||||
}
|
||||
|
||||
@ -2706,7 +2706,7 @@ core2_intr(int cpu, struct trapframe *tf)
|
||||
|
||||
v = iap_reload_count_to_perfctr_value(pm->pm_sc.pm_reloadcount);
|
||||
|
||||
PMCDBG(MDP,INT, 1, "iap-intr cpu=%d error=%d v=%jx", cpu, error,
|
||||
PMCDBG3(MDP,INT, 1, "iap-intr cpu=%d error=%d v=%jx", cpu, error,
|
||||
(uintmax_t) v);
|
||||
|
||||
/* Reload sampling count. */
|
||||
@ -2716,14 +2716,14 @@ core2_intr(int cpu, struct trapframe *tf)
|
||||
/*
|
||||
* Reenable all non-stalled PMCs.
|
||||
*/
|
||||
PMCDBG(MDP,INT, 1, "cpu=%d intrenable=%jx", cpu,
|
||||
PMCDBG2(MDP,INT, 1, "cpu=%d intrenable=%jx", cpu,
|
||||
(uintmax_t) intrenable);
|
||||
|
||||
cc->pc_globalctrl |= intrenable;
|
||||
|
||||
wrmsr(IA_GLOBAL_CTRL, cc->pc_globalctrl & IA_GLOBAL_CTRL_MASK);
|
||||
|
||||
PMCDBG(MDP,INT, 1, "cpu=%d fixedctrl=%jx globalctrl=%jx status=%jx "
|
||||
PMCDBG5(MDP,INT, 1, "cpu=%d fixedctrl=%jx globalctrl=%jx status=%jx "
|
||||
"ovf=%jx", cpu, (uintmax_t) rdmsr(IAF_CTRL),
|
||||
(uintmax_t) rdmsr(IA_GLOBAL_CTRL),
|
||||
(uintmax_t) rdmsr(IA_GLOBAL_STATUS),
|
||||
@ -2750,7 +2750,7 @@ pmc_core_initialize(struct pmc_mdep *md, int maxcpu, int version_override)
|
||||
cpuid[CORE_CPUID_EAX] & 0xFF;
|
||||
core_cputype = md->pmd_cputype;
|
||||
|
||||
PMCDBG(MDP,INI,1,"core-init cputype=%d ncpu=%d ipa-version=%d",
|
||||
PMCDBG3(MDP,INI,1,"core-init cputype=%d ncpu=%d ipa-version=%d",
|
||||
core_cputype, maxcpu, ipa_version);
|
||||
|
||||
if (ipa_version < 1 || ipa_version > 3 ||
|
||||
@ -2788,7 +2788,7 @@ pmc_core_initialize(struct pmc_mdep *md, int maxcpu, int version_override)
|
||||
core_pmcmask |= ((1ULL << core_iaf_npmc) - 1) << IAF_OFFSET;
|
||||
}
|
||||
|
||||
PMCDBG(MDP,INI,1,"core-init pmcmask=0x%jx iafri=%d", core_pmcmask,
|
||||
PMCDBG2(MDP,INI,1,"core-init pmcmask=0x%jx iafri=%d", core_pmcmask,
|
||||
core_iaf_ri);
|
||||
|
||||
core_pcpu = malloc(sizeof(*core_pcpu) * maxcpu, M_PMC,
|
||||
@ -2811,7 +2811,7 @@ pmc_core_initialize(struct pmc_mdep *md, int maxcpu, int version_override)
|
||||
void
|
||||
pmc_core_finalize(struct pmc_mdep *md)
|
||||
{
|
||||
PMCDBG(MDP,INI,1, "%s", "core-finalize");
|
||||
PMCDBG0(MDP,INI,1, "core-finalize");
|
||||
|
||||
free(core_pcpu, M_PMC);
|
||||
core_pcpu = NULL;
|
||||
|
@ -46,14 +46,14 @@ intel_switch_in(struct pmc_cpu *pc, struct pmc_process *pp)
|
||||
{
|
||||
(void) pc;
|
||||
|
||||
PMCDBG(MDP,SWI,1, "pc=%p pp=%p enable-msr=%d", pc, pp,
|
||||
PMCDBG3(MDP,SWI,1, "pc=%p pp=%p enable-msr=%d", pc, pp,
|
||||
pp->pp_flags & PMC_PP_ENABLE_MSR_ACCESS);
|
||||
|
||||
/* allow the RDPMC instruction if needed */
|
||||
if (pp->pp_flags & PMC_PP_ENABLE_MSR_ACCESS)
|
||||
load_cr4(rcr4() | CR4_PCE);
|
||||
|
||||
PMCDBG(MDP,SWI,1, "cr4=0x%jx", (uintmax_t) rcr4());
|
||||
PMCDBG1(MDP,SWI,1, "cr4=0x%jx", (uintmax_t) rcr4());
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -64,7 +64,7 @@ intel_switch_out(struct pmc_cpu *pc, struct pmc_process *pp)
|
||||
(void) pc;
|
||||
(void) pp; /* can be NULL */
|
||||
|
||||
PMCDBG(MDP,SWO,1, "pc=%p pp=%p cr4=0x%jx", pc, pp,
|
||||
PMCDBG3(MDP,SWO,1, "pc=%p pp=%p cr4=0x%jx", pc, pp,
|
||||
(uintmax_t) rcr4());
|
||||
|
||||
/* always turn off the RDPMC instruction */
|
||||
@ -83,7 +83,7 @@ pmc_intel_initialize(void)
|
||||
KASSERT(cpu_vendor_id == CPU_VENDOR_INTEL,
|
||||
("[intel,%d] Initializing non-intel processor", __LINE__));
|
||||
|
||||
PMCDBG(MDP,INI,0, "intel-initialize cpuid=0x%x", cpu_id);
|
||||
PMCDBG1(MDP,INI,0, "intel-initialize cpuid=0x%x", cpu_id);
|
||||
|
||||
cputype = -1;
|
||||
nclasses = 2;
|
||||
|
@ -211,7 +211,7 @@ pmclog_get_buffer(struct pmc_owner *po)
|
||||
TAILQ_REMOVE(&pmc_bufferlist, plb, plb_next);
|
||||
mtx_unlock_spin(&pmc_bufferlist_mtx);
|
||||
|
||||
PMCDBG(LOG,GTB,1, "po=%p plb=%p", po, plb);
|
||||
PMCDBG2(LOG,GTB,1, "po=%p plb=%p", po, plb);
|
||||
|
||||
#ifdef HWPMC_DEBUG
|
||||
if (plb)
|
||||
@ -261,7 +261,7 @@ pmclog_loop(void *arg)
|
||||
ownercred = crhold(p->p_ucred);
|
||||
PROC_UNLOCK(p);
|
||||
|
||||
PMCDBG(LOG,INI,1, "po=%p kt=%p", po, po->po_kthread);
|
||||
PMCDBG2(LOG,INI,1, "po=%p kt=%p", po, po->po_kthread);
|
||||
KASSERT(po->po_kthread == curthread->td_proc,
|
||||
("[pmclog,%d] proc mismatch po=%p po/kt=%p curproc=%p", __LINE__,
|
||||
po, po->po_kthread, curthread->td_proc));
|
||||
@ -312,7 +312,7 @@ pmclog_loop(void *arg)
|
||||
mtx_unlock(&pmc_kthread_mtx);
|
||||
|
||||
/* process the request */
|
||||
PMCDBG(LOG,WRI,2, "po=%p base=%p ptr=%p", po,
|
||||
PMCDBG3(LOG,WRI,2, "po=%p base=%p ptr=%p", po,
|
||||
lb->plb_base, lb->plb_ptr);
|
||||
/* change our thread's credentials before issuing the I/O */
|
||||
|
||||
@ -343,7 +343,7 @@ pmclog_loop(void *arg)
|
||||
|
||||
po->po_error = error; /* save for flush log */
|
||||
|
||||
PMCDBG(LOG,WRI,2, "po=%p error=%d", po, error);
|
||||
PMCDBG2(LOG,WRI,2, "po=%p error=%d", po, error);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -403,7 +403,7 @@ pmclog_release(struct pmc_owner *po)
|
||||
|
||||
mtx_unlock_spin(&po->po_mtx);
|
||||
|
||||
PMCDBG(LOG,REL,1, "po=%p", po);
|
||||
PMCDBG1(LOG,REL,1, "po=%p", po);
|
||||
}
|
||||
|
||||
|
||||
@ -423,7 +423,7 @@ pmclog_reserve(struct pmc_owner *po, int length)
|
||||
uint32_t *lh;
|
||||
struct timespec ts;
|
||||
|
||||
PMCDBG(LOG,ALL,1, "po=%p len=%d", po, length);
|
||||
PMCDBG2(LOG,ALL,1, "po=%p len=%d", po, length);
|
||||
|
||||
KASSERT(length % sizeof(uint32_t) == 0,
|
||||
("[pmclog,%d] length not a multiple of word size", __LINE__));
|
||||
@ -519,7 +519,7 @@ pmclog_schedule_io(struct pmc_owner *po)
|
||||
("[pmclog,%d] buffer invariants po=%p ptr=%p fenc=%p", __LINE__,
|
||||
po, po->po_curbuf->plb_ptr, po->po_curbuf->plb_fence));
|
||||
|
||||
PMCDBG(LOG,SIO, 1, "po=%p", po);
|
||||
PMCDBG1(LOG,SIO, 1, "po=%p", po);
|
||||
|
||||
mtx_assert(&po->po_mtx, MA_OWNED);
|
||||
|
||||
@ -579,7 +579,7 @@ pmclog_configure_log(struct pmc_mdep *md, struct pmc_owner *po, int logfd)
|
||||
* the former is not held here.
|
||||
*/
|
||||
sx_assert(&pmc_sx, SA_UNLOCKED);
|
||||
PMCDBG(LOG,CFG,1, "config po=%p logfd=%d", po, logfd);
|
||||
PMCDBG2(LOG,CFG,1, "config po=%p logfd=%d", po, logfd);
|
||||
|
||||
p = po->po_owner;
|
||||
|
||||
@ -649,7 +649,7 @@ pmclog_deconfigure_log(struct pmc_owner *po)
|
||||
int error;
|
||||
struct pmclog_buffer *lb;
|
||||
|
||||
PMCDBG(LOG,CFG,1, "de-config po=%p", po);
|
||||
PMCDBG1(LOG,CFG,1, "de-config po=%p", po);
|
||||
|
||||
if ((po->po_flags & PMC_PO_OWNS_LOGFILE) == 0)
|
||||
return (EINVAL);
|
||||
@ -700,7 +700,7 @@ pmclog_flush(struct pmc_owner *po)
|
||||
int error;
|
||||
struct pmclog_buffer *lb;
|
||||
|
||||
PMCDBG(LOG,FLS,1, "po=%p", po);
|
||||
PMCDBG1(LOG,FLS,1, "po=%p", po);
|
||||
|
||||
/*
|
||||
* If there is a pending error recorded by the logger thread,
|
||||
@ -741,7 +741,7 @@ int
|
||||
pmclog_close(struct pmc_owner *po)
|
||||
{
|
||||
|
||||
PMCDBG(LOG,CLO,1, "po=%p", po);
|
||||
PMCDBG1(LOG,CLO,1, "po=%p", po);
|
||||
|
||||
mtx_lock(&pmc_kthread_mtx);
|
||||
|
||||
@ -773,7 +773,7 @@ pmclog_process_callchain(struct pmc *pm, struct pmc_sample *ps)
|
||||
uint32_t flags;
|
||||
struct pmc_owner *po;
|
||||
|
||||
PMCDBG(LOG,SAM,1,"pm=%p pid=%d n=%d", pm, ps->ps_pid,
|
||||
PMCDBG3(LOG,SAM,1,"pm=%p pid=%d n=%d", pm, ps->ps_pid,
|
||||
ps->ps_nsamples);
|
||||
|
||||
recordlen = offsetof(struct pmclog_callchain, pl_pc) +
|
||||
@ -843,7 +843,7 @@ pmclog_process_pmcallocate(struct pmc *pm)
|
||||
|
||||
po = pm->pm_owner;
|
||||
|
||||
PMCDBG(LOG,ALL,1, "pm=%p", pm);
|
||||
PMCDBG1(LOG,ALL,1, "pm=%p", pm);
|
||||
|
||||
if (PMC_TO_CLASS(pm) == PMC_CLASS_SOFT) {
|
||||
PMCLOG_RESERVE(po, PMCALLOCATEDYN,
|
||||
@ -874,7 +874,7 @@ pmclog_process_pmcattach(struct pmc *pm, pid_t pid, char *path)
|
||||
int pathlen, recordlen;
|
||||
struct pmc_owner *po;
|
||||
|
||||
PMCDBG(LOG,ATT,1,"pm=%p pid=%d", pm, pid);
|
||||
PMCDBG2(LOG,ATT,1,"pm=%p pid=%d", pm, pid);
|
||||
|
||||
po = pm->pm_owner;
|
||||
|
||||
@ -893,7 +893,7 @@ pmclog_process_pmcdetach(struct pmc *pm, pid_t pid)
|
||||
{
|
||||
struct pmc_owner *po;
|
||||
|
||||
PMCDBG(LOG,ATT,1,"!pm=%p pid=%d", pm, pid);
|
||||
PMCDBG2(LOG,ATT,1,"!pm=%p pid=%d", pm, pid);
|
||||
|
||||
po = pm->pm_owner;
|
||||
|
||||
@ -915,7 +915,7 @@ pmclog_process_proccsw(struct pmc *pm, struct pmc_process *pp, pmc_value_t v)
|
||||
KASSERT(pm->pm_flags & PMC_F_LOG_PROCCSW,
|
||||
("[pmclog,%d] log-process-csw called gratuitously", __LINE__));
|
||||
|
||||
PMCDBG(LOG,SWO,1,"pm=%p pid=%d v=%jx", pm, pp->pp_proc->p_pid,
|
||||
PMCDBG3(LOG,SWO,1,"pm=%p pid=%d v=%jx", pm, pp->pp_proc->p_pid,
|
||||
v);
|
||||
|
||||
po = pm->pm_owner;
|
||||
@ -933,7 +933,7 @@ pmclog_process_procexec(struct pmc_owner *po, pmc_id_t pmid, pid_t pid,
|
||||
{
|
||||
int pathlen, recordlen;
|
||||
|
||||
PMCDBG(LOG,EXC,1,"po=%p pid=%d path=\"%s\"", po, pid, path);
|
||||
PMCDBG3(LOG,EXC,1,"po=%p pid=%d path=\"%s\"", po, pid, path);
|
||||
|
||||
pathlen = strlen(path) + 1; /* #bytes for the path */
|
||||
recordlen = offsetof(struct pmclog_procexec, pl_pathname) + pathlen;
|
||||
@ -957,7 +957,7 @@ pmclog_process_procexit(struct pmc *pm, struct pmc_process *pp)
|
||||
struct pmc_owner *po;
|
||||
|
||||
ri = PMC_TO_ROWINDEX(pm);
|
||||
PMCDBG(LOG,EXT,1,"pm=%p pid=%d v=%jx", pm, pp->pp_proc->p_pid,
|
||||
PMCDBG3(LOG,EXT,1,"pm=%p pid=%d v=%jx", pm, pp->pp_proc->p_pid,
|
||||
pp->pp_pmcs[ri].pp_pmcval);
|
||||
|
||||
po = pm->pm_owner;
|
||||
@ -1003,7 +1003,7 @@ pmclog_process_userlog(struct pmc_owner *po, struct pmc_op_writelog *wl)
|
||||
{
|
||||
int error;
|
||||
|
||||
PMCDBG(LOG,WRI,1, "writelog po=%p ud=0x%x", po, wl->pm_userdata);
|
||||
PMCDBG2(LOG,WRI,1, "writelog po=%p ud=0x%x", po, wl->pm_userdata);
|
||||
|
||||
error = 0;
|
||||
|
||||
|
@ -104,7 +104,7 @@ mips_allocate_pmc(int cpu, int ri, struct pmc *pm,
|
||||
|
||||
pm->pm_md.pm_mips_evsel = config;
|
||||
|
||||
PMCDBG(MDP,ALL,2,"mips-allocate ri=%d -> config=0x%x", ri, config);
|
||||
PMCDBG2(MDP,ALL,2,"mips-allocate ri=%d -> config=0x%x", ri, config);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -123,7 +123,7 @@ mips_read_pmc(int cpu, int ri, pmc_value_t *v)
|
||||
|
||||
pm = mips_pcpu[cpu]->pc_mipspmcs[ri].phw_pmc;
|
||||
tmp = mips_pmcn_read(ri);
|
||||
PMCDBG(MDP,REA,2,"mips-read id=%d -> %jd", ri, tmp);
|
||||
PMCDBG2(MDP,REA,2,"mips-read id=%d -> %jd", ri, tmp);
|
||||
|
||||
if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
|
||||
*v = tmp - (1UL << (mips_pmc_spec.ps_counter_width - 1));
|
||||
@ -148,7 +148,7 @@ mips_write_pmc(int cpu, int ri, pmc_value_t v)
|
||||
if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
|
||||
v = (1UL << (mips_pmc_spec.ps_counter_width - 1)) - v;
|
||||
|
||||
PMCDBG(MDP,WRI,1,"mips-write cpu=%d ri=%d v=%jx", cpu, ri, v);
|
||||
PMCDBG3(MDP,WRI,1,"mips-write cpu=%d ri=%d v=%jx", cpu, ri, v);
|
||||
|
||||
mips_pmcn_write(ri, v);
|
||||
|
||||
@ -160,7 +160,7 @@ mips_config_pmc(int cpu, int ri, struct pmc *pm)
|
||||
{
|
||||
struct pmc_hw *phw;
|
||||
|
||||
PMCDBG(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
PMCDBG3(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[mips,%d] illegal CPU value %d", __LINE__, cpu));
|
||||
@ -376,7 +376,7 @@ mips_pcpu_init(struct pmc_mdep *md, int cpu)
|
||||
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[mips,%d] wrong cpu number %d", __LINE__, cpu));
|
||||
PMCDBG(MDP,INI,1,"mips-init cpu=%d", cpu);
|
||||
PMCDBG1(MDP,INI,1,"mips-init cpu=%d", cpu);
|
||||
|
||||
mips_pcpu[cpu] = pac = malloc(sizeof(struct mips_cpu), M_PMC,
|
||||
M_WAITOK|M_ZERO);
|
||||
@ -421,7 +421,7 @@ pmc_mips_initialize()
|
||||
*/
|
||||
mips_npmcs = 2;
|
||||
|
||||
PMCDBG(MDP,INI,1,"mips-init npmcs=%d", mips_npmcs);
|
||||
PMCDBG1(MDP,INI,1,"mips-init npmcs=%d", mips_npmcs);
|
||||
|
||||
/*
|
||||
* Allocate space for pointers to PMC HW descriptors and for
|
||||
|
@ -223,7 +223,7 @@ mips_get_perfctl(int cpu, int ri, uint32_t event, uint32_t caps)
|
||||
if (caps & PMC_CAP_INTERRUPT)
|
||||
config |= MIPS24K_PMC_INTERRUPT_ENABLE;
|
||||
|
||||
PMCDBG(MDP,ALL,2,"mips24k-get_perfctl ri=%d -> config=0x%x", ri, config);
|
||||
PMCDBG2(MDP,ALL,2,"mips24k-get_perfctl ri=%d -> config=0x%x", ri, config);
|
||||
|
||||
return (config);
|
||||
}
|
||||
|
@ -651,12 +651,12 @@ pmc_ri_to_classdep(struct pmc_mdep *md, int ri, int *adjri)
|
||||
static void
|
||||
pmc_save_cpu_binding(struct pmc_binding *pb)
|
||||
{
|
||||
PMCDBG(CPU,BND,2, "%s", "save-cpu");
|
||||
PMCDBG0(CPU,BND,2, "save-cpu");
|
||||
thread_lock(curthread);
|
||||
pb->pb_bound = sched_is_bound(curthread);
|
||||
pb->pb_cpu = curthread->td_oncpu;
|
||||
thread_unlock(curthread);
|
||||
PMCDBG(CPU,BND,2, "save-cpu cpu=%d", pb->pb_cpu);
|
||||
PMCDBG1(CPU,BND,2, "save-cpu cpu=%d", pb->pb_cpu);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -666,7 +666,7 @@ pmc_save_cpu_binding(struct pmc_binding *pb)
|
||||
static void
|
||||
pmc_restore_cpu_binding(struct pmc_binding *pb)
|
||||
{
|
||||
PMCDBG(CPU,BND,2, "restore-cpu curcpu=%d restore=%d",
|
||||
PMCDBG2(CPU,BND,2, "restore-cpu curcpu=%d restore=%d",
|
||||
curthread->td_oncpu, pb->pb_cpu);
|
||||
thread_lock(curthread);
|
||||
if (pb->pb_bound)
|
||||
@ -674,7 +674,7 @@ pmc_restore_cpu_binding(struct pmc_binding *pb)
|
||||
else
|
||||
sched_unbind(curthread);
|
||||
thread_unlock(curthread);
|
||||
PMCDBG(CPU,BND,2, "%s", "restore-cpu done");
|
||||
PMCDBG0(CPU,BND,2, "restore-cpu done");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -691,7 +691,7 @@ pmc_select_cpu(int cpu)
|
||||
KASSERT(pmc_cpu_is_active(cpu), ("[pmc,%d] selecting inactive "
|
||||
"CPU %d", __LINE__, cpu));
|
||||
|
||||
PMCDBG(CPU,SEL,2, "select-cpu cpu=%d", cpu);
|
||||
PMCDBG1(CPU,SEL,2, "select-cpu cpu=%d", cpu);
|
||||
thread_lock(curthread);
|
||||
sched_bind(curthread, cpu);
|
||||
thread_unlock(curthread);
|
||||
@ -700,7 +700,7 @@ pmc_select_cpu(int cpu)
|
||||
("[pmc,%d] CPU not bound [cpu=%d, curr=%d]", __LINE__,
|
||||
cpu, curthread->td_oncpu));
|
||||
|
||||
PMCDBG(CPU,SEL,2, "select-cpu cpu=%d ok", cpu);
|
||||
PMCDBG1(CPU,SEL,2, "select-cpu cpu=%d ok", cpu);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -742,14 +742,14 @@ pmc_remove_owner(struct pmc_owner *po)
|
||||
|
||||
sx_assert(&pmc_sx, SX_XLOCKED);
|
||||
|
||||
PMCDBG(OWN,ORM,1, "remove-owner po=%p", po);
|
||||
PMCDBG1(OWN,ORM,1, "remove-owner po=%p", po);
|
||||
|
||||
/* Remove descriptor from the owner hash table */
|
||||
LIST_REMOVE(po, po_next);
|
||||
|
||||
/* release all owned PMC descriptors */
|
||||
LIST_FOREACH_SAFE(pm, &po->po_pmcs, pm_next, tmp) {
|
||||
PMCDBG(OWN,ORM,2, "pmc=%p", pm);
|
||||
PMCDBG1(OWN,ORM,2, "pmc=%p", pm);
|
||||
KASSERT(pm->pm_owner == po,
|
||||
("[pmc,%d] owner %p != po %p", __LINE__, pm->pm_owner, po));
|
||||
|
||||
@ -775,7 +775,7 @@ static void
|
||||
pmc_maybe_remove_owner(struct pmc_owner *po)
|
||||
{
|
||||
|
||||
PMCDBG(OWN,OMR,1, "maybe-remove-owner po=%p", po);
|
||||
PMCDBG1(OWN,OMR,1, "maybe-remove-owner po=%p", po);
|
||||
|
||||
/*
|
||||
* Remove owner record if
|
||||
@ -813,7 +813,7 @@ pmc_link_target_process(struct pmc *pm, struct pmc_process *pp)
|
||||
|
||||
ri = PMC_TO_ROWINDEX(pm);
|
||||
|
||||
PMCDBG(PRC,TLK,1, "link-target pmc=%p ri=%d pmc-process=%p",
|
||||
PMCDBG3(PRC,TLK,1, "link-target pmc=%p ri=%d pmc-process=%p",
|
||||
pm, ri, pp);
|
||||
|
||||
#ifdef HWPMC_DEBUG
|
||||
@ -866,7 +866,7 @@ pmc_unlink_target_process(struct pmc *pm, struct pmc_process *pp)
|
||||
|
||||
ri = PMC_TO_ROWINDEX(pm);
|
||||
|
||||
PMCDBG(PRC,TUL,1, "unlink-target pmc=%p ri=%d pmc-process=%p",
|
||||
PMCDBG3(PRC,TUL,1, "unlink-target pmc=%p ri=%d pmc-process=%p",
|
||||
pm, ri, pp);
|
||||
|
||||
KASSERT(pp->pp_pmcs[ri].pp_pmc == pm,
|
||||
@ -902,7 +902,7 @@ pmc_unlink_target_process(struct pmc *pm, struct pmc_process *pp)
|
||||
kern_psignal(p, SIGIO);
|
||||
PROC_UNLOCK(p);
|
||||
|
||||
PMCDBG(PRC,SIG,2, "signalling proc=%p signal=%d", p,
|
||||
PMCDBG2(PRC,SIG,2, "signalling proc=%p signal=%d", p,
|
||||
SIGIO);
|
||||
}
|
||||
}
|
||||
@ -975,7 +975,7 @@ pmc_attach_one_process(struct proc *p, struct pmc *pm)
|
||||
|
||||
sx_assert(&pmc_sx, SX_XLOCKED);
|
||||
|
||||
PMCDBG(PRC,ATT,2, "attach-one pm=%p ri=%d proc=%p (%d, %s)", pm,
|
||||
PMCDBG5(PRC,ATT,2, "attach-one pm=%p ri=%d proc=%p (%d, %s)", pm,
|
||||
PMC_TO_ROWINDEX(pm), p, p->p_pid, p->p_comm);
|
||||
|
||||
/*
|
||||
@ -1040,7 +1040,7 @@ pmc_attach_process(struct proc *p, struct pmc *pm)
|
||||
|
||||
sx_assert(&pmc_sx, SX_XLOCKED);
|
||||
|
||||
PMCDBG(PRC,ATT,1, "attach pm=%p ri=%d proc=%p (%d, %s)", pm,
|
||||
PMCDBG5(PRC,ATT,1, "attach pm=%p ri=%d proc=%p (%d, %s)", pm,
|
||||
PMC_TO_ROWINDEX(pm), p, p->p_pid, p->p_comm);
|
||||
|
||||
|
||||
@ -1107,7 +1107,7 @@ pmc_detach_one_process(struct proc *p, struct pmc *pm, int flags)
|
||||
|
||||
ri = PMC_TO_ROWINDEX(pm);
|
||||
|
||||
PMCDBG(PRC,ATT,2, "detach-one pm=%p ri=%d proc=%p (%d, %s) flags=0x%x",
|
||||
PMCDBG6(PRC,ATT,2, "detach-one pm=%p ri=%d proc=%p (%d, %s) flags=0x%x",
|
||||
pm, ri, p, p->p_pid, p->p_comm, flags);
|
||||
|
||||
if ((pp = pmc_find_process_descriptor(p, 0)) == NULL)
|
||||
@ -1157,7 +1157,7 @@ pmc_detach_process(struct proc *p, struct pmc *pm)
|
||||
|
||||
sx_assert(&pmc_sx, SX_XLOCKED);
|
||||
|
||||
PMCDBG(PRC,ATT,1, "detach pm=%p ri=%d proc=%p (%d, %s)", pm,
|
||||
PMCDBG5(PRC,ATT,1, "detach pm=%p ri=%d proc=%p (%d, %s)", pm,
|
||||
PMC_TO_ROWINDEX(pm), p, p->p_pid, p->p_comm);
|
||||
|
||||
if ((pm->pm_flags & PMC_F_DESCENDANTS) == 0)
|
||||
@ -1228,7 +1228,7 @@ pmc_process_csw_in(struct thread *td)
|
||||
|
||||
cpu = PCPU_GET(cpuid); /* td->td_oncpu is invalid */
|
||||
|
||||
PMCDBG(CSW,SWI,1, "cpu=%d proc=%p (%d, %s) pp=%p", cpu, p,
|
||||
PMCDBG5(CSW,SWI,1, "cpu=%d proc=%p (%d, %s) pp=%p", cpu, p,
|
||||
p->p_pid, p->p_comm, pp);
|
||||
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
@ -1295,7 +1295,7 @@ pmc_process_csw_in(struct thread *td)
|
||||
mtx_pool_unlock_spin(pmc_mtxpool, pm);
|
||||
}
|
||||
|
||||
PMCDBG(CSW,SWI,1,"cpu=%d ri=%d new=%jd", cpu, ri, newvalue);
|
||||
PMCDBG3(CSW,SWI,1,"cpu=%d ri=%d new=%jd", cpu, ri, newvalue);
|
||||
|
||||
pcd->pcd_write_pmc(cpu, adjri, newvalue);
|
||||
pcd->pcd_start_pmc(cpu, adjri);
|
||||
@ -1356,7 +1356,7 @@ pmc_process_csw_out(struct thread *td)
|
||||
|
||||
cpu = PCPU_GET(cpuid); /* td->td_oncpu is invalid */
|
||||
|
||||
PMCDBG(CSW,SWO,1, "cpu=%d proc=%p (%d, %s) pp=%p", cpu, p,
|
||||
PMCDBG5(CSW,SWO,1, "cpu=%d proc=%p (%d, %s) pp=%p", cpu, p,
|
||||
p->p_pid, p->p_comm, pp);
|
||||
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
@ -1418,7 +1418,7 @@ pmc_process_csw_out(struct thread *td)
|
||||
|
||||
tmp = newvalue - PMC_PCPU_SAVED(cpu,ri);
|
||||
|
||||
PMCDBG(CSW,SWO,1,"cpu=%d ri=%d tmp=%jd", cpu, ri,
|
||||
PMCDBG3(CSW,SWO,1,"cpu=%d ri=%d tmp=%jd", cpu, ri,
|
||||
tmp);
|
||||
|
||||
if (mode == PMC_MODE_TS) {
|
||||
@ -1575,7 +1575,7 @@ pmc_log_kernel_mappings(struct pmc *pm)
|
||||
*/
|
||||
kmbase = linker_hwpmc_list_objects();
|
||||
for (km = kmbase; km->pm_file != NULL; km++) {
|
||||
PMCDBG(LOG,REG,1,"%s %p", (char *) km->pm_file,
|
||||
PMCDBG2(LOG,REG,1,"%s %p", (char *) km->pm_file,
|
||||
(void *) km->pm_address);
|
||||
pmclog_process_map_in(po, (pid_t) -1, km->pm_address,
|
||||
km->pm_file);
|
||||
@ -1616,7 +1616,7 @@ pmc_log_process_mappings(struct pmc_owner *po, struct proc *p)
|
||||
for (entry = map->header.next; entry != &map->header; entry = entry->next) {
|
||||
|
||||
if (entry == NULL) {
|
||||
PMCDBG(LOG,OPS,2, "hwpmc: vm_map entry unexpectedly "
|
||||
PMCDBG2(LOG,OPS,2, "hwpmc: vm_map entry unexpectedly "
|
||||
"NULL! pid=%d vm_map=%p\n", p->p_pid, map);
|
||||
break;
|
||||
}
|
||||
@ -1649,7 +1649,7 @@ pmc_log_process_mappings(struct pmc_owner *po, struct proc *p)
|
||||
* At this point lobj is the base vm_object and it is locked.
|
||||
*/
|
||||
if (lobj == NULL) {
|
||||
PMCDBG(LOG,OPS,2, "hwpmc: lobj unexpectedly NULL! pid=%d "
|
||||
PMCDBG3(LOG,OPS,2, "hwpmc: lobj unexpectedly NULL! pid=%d "
|
||||
"vm_map=%p vm_obj=%p\n", p->p_pid, map, obj);
|
||||
VM_OBJECT_RUNLOCK(obj);
|
||||
continue;
|
||||
@ -1806,7 +1806,7 @@ static int
|
||||
pmc_hook_handler(struct thread *td, int function, void *arg)
|
||||
{
|
||||
|
||||
PMCDBG(MOD,PMH,1, "hook td=%p func=%d \"%s\" arg=%p", td, function,
|
||||
PMCDBG4(MOD,PMH,1, "hook td=%p func=%d \"%s\" arg=%p", td, function,
|
||||
pmc_hooknames[function], arg);
|
||||
|
||||
switch (function)
|
||||
@ -1889,7 +1889,7 @@ pmc_hook_handler(struct thread *td, int function, void *arg)
|
||||
free(freepath, M_TEMP);
|
||||
|
||||
|
||||
PMCDBG(PRC,EXC,1, "exec proc=%p (%d, %s) cred-changed=%d",
|
||||
PMCDBG4(PRC,EXC,1, "exec proc=%p (%d, %s) cred-changed=%d",
|
||||
p, p->p_pid, p->p_comm, pk->pm_credentialschanged);
|
||||
|
||||
if (pk->pm_credentialschanged == 0) /* no change */
|
||||
@ -2034,7 +2034,7 @@ pmc_allocate_owner_descriptor(struct proc *p)
|
||||
TAILQ_INIT(&po->po_logbuffers);
|
||||
mtx_init(&po->po_mtx, "pmc-owner-mtx", "pmc-per-proc", MTX_SPIN);
|
||||
|
||||
PMCDBG(OWN,ALL,1, "allocate-owner proc=%p (%d, %s) pmc-owner=%p",
|
||||
PMCDBG4(OWN,ALL,1, "allocate-owner proc=%p (%d, %s) pmc-owner=%p",
|
||||
p, p->p_pid, p->p_comm, po);
|
||||
|
||||
return po;
|
||||
@ -2044,7 +2044,7 @@ static void
|
||||
pmc_destroy_owner_descriptor(struct pmc_owner *po)
|
||||
{
|
||||
|
||||
PMCDBG(OWN,REL,1, "destroy-owner po=%p proc=%p (%d, %s)",
|
||||
PMCDBG4(OWN,REL,1, "destroy-owner po=%p proc=%p (%d, %s)",
|
||||
po, po->po_owner, po->po_owner->p_pid, po->po_owner->p_comm);
|
||||
|
||||
mtx_destroy(&po->po_mtx);
|
||||
@ -2135,7 +2135,7 @@ pmc_find_owner_descriptor(struct proc *p)
|
||||
if (po->po_owner == p)
|
||||
break;
|
||||
|
||||
PMCDBG(OWN,FND,1, "find-owner proc=%p (%d, %s) hindex=0x%x -> "
|
||||
PMCDBG5(OWN,FND,1, "find-owner proc=%p (%d, %s) hindex=0x%x -> "
|
||||
"pmc-owner=%p", p, p->p_pid, p->p_comm, hindex, po);
|
||||
|
||||
return po;
|
||||
@ -2155,7 +2155,7 @@ pmc_allocate_pmc_descriptor(void)
|
||||
|
||||
pmc = malloc(sizeof(struct pmc), M_PMC, M_WAITOK|M_ZERO);
|
||||
|
||||
PMCDBG(PMC,ALL,1, "allocate-pmc -> pmc=%p", pmc);
|
||||
PMCDBG1(PMC,ALL,1, "allocate-pmc -> pmc=%p", pmc);
|
||||
|
||||
return pmc;
|
||||
}
|
||||
@ -2238,7 +2238,7 @@ pmc_release_pmc_descriptor(struct pmc *pm)
|
||||
pcd = pmc_ri_to_classdep(md, ri, &adjri);
|
||||
mode = PMC_TO_MODE(pm);
|
||||
|
||||
PMCDBG(PMC,REL,1, "release-pmc pmc=%p ri=%d mode=%d", pm, ri,
|
||||
PMCDBG3(PMC,REL,1, "release-pmc pmc=%p ri=%d mode=%d", pm, ri,
|
||||
mode);
|
||||
|
||||
/*
|
||||
@ -2266,14 +2266,14 @@ pmc_release_pmc_descriptor(struct pmc *pm)
|
||||
KASSERT(phw->phw_pmc == pm,
|
||||
("[pmc, %d] pmc ptr ri(%d) hw(%p) pm(%p)",
|
||||
__LINE__, ri, phw->phw_pmc, pm));
|
||||
PMCDBG(PMC,REL,2, "stopping cpu=%d ri=%d", cpu, ri);
|
||||
PMCDBG2(PMC,REL,2, "stopping cpu=%d ri=%d", cpu, ri);
|
||||
|
||||
critical_enter();
|
||||
pcd->pcd_stop_pmc(cpu, adjri);
|
||||
critical_exit();
|
||||
}
|
||||
|
||||
PMCDBG(PMC,REL,2, "decfg cpu=%d ri=%d", cpu, ri);
|
||||
PMCDBG2(PMC,REL,2, "decfg cpu=%d ri=%d", cpu, ri);
|
||||
|
||||
critical_enter();
|
||||
pcd->pcd_config_pmc(cpu, adjri, NULL);
|
||||
@ -2329,7 +2329,7 @@ pmc_release_pmc_descriptor(struct pmc *pm)
|
||||
pp = ptgt->pt_process;
|
||||
pmc_unlink_target_process(pm, pp); /* frees 'ptgt' */
|
||||
|
||||
PMCDBG(PMC,REL,3, "pp->refcnt=%d", pp->pp_refcnt);
|
||||
PMCDBG1(PMC,REL,3, "pp->refcnt=%d", pp->pp_refcnt);
|
||||
|
||||
/*
|
||||
* If the target process record shows that no
|
||||
@ -2395,7 +2395,7 @@ pmc_register_owner(struct proc *p, struct pmc *pmc)
|
||||
if (po->po_flags & PMC_PO_OWNS_LOGFILE)
|
||||
pmclog_process_pmcallocate(pmc);
|
||||
|
||||
PMCDBG(PMC,REG,1, "register-owner pmc-owner=%p pmc=%p",
|
||||
PMCDBG2(PMC,REG,1, "register-owner pmc-owner=%p pmc=%p",
|
||||
po, pmc);
|
||||
|
||||
return 0;
|
||||
@ -2433,7 +2433,7 @@ pmc_can_allocate_rowindex(struct proc *p, unsigned int ri, int cpu)
|
||||
struct pmc_owner *po;
|
||||
struct pmc_process *pp;
|
||||
|
||||
PMCDBG(PMC,ALR,1, "can-allocate-rowindex proc=%p (%d, %s) ri=%d "
|
||||
PMCDBG5(PMC,ALR,1, "can-allocate-rowindex proc=%p (%d, %s) ri=%d "
|
||||
"cpu=%d", p, p->p_pid, p->p_comm, ri, cpu);
|
||||
|
||||
/*
|
||||
@ -2463,7 +2463,7 @@ pmc_can_allocate_rowindex(struct proc *p, unsigned int ri, int cpu)
|
||||
if (pp->pp_pmcs[ri].pp_pmc)
|
||||
return EEXIST;
|
||||
|
||||
PMCDBG(PMC,ALR,2, "can-allocate-rowindex proc=%p (%d, %s) ri=%d ok",
|
||||
PMCDBG4(PMC,ALR,2, "can-allocate-rowindex proc=%p (%d, %s) ri=%d ok",
|
||||
p, p->p_pid, p->p_comm, ri);
|
||||
|
||||
return 0;
|
||||
@ -2481,7 +2481,7 @@ pmc_can_allocate_row(int ri, enum pmc_mode mode)
|
||||
|
||||
sx_assert(&pmc_sx, SX_XLOCKED);
|
||||
|
||||
PMCDBG(PMC,ALR,1, "can-allocate-row ri=%d mode=%d", ri, mode);
|
||||
PMCDBG2(PMC,ALR,1, "can-allocate-row ri=%d mode=%d", ri, mode);
|
||||
|
||||
if (PMC_IS_SYSTEM_MODE(mode))
|
||||
disp = PMC_DISP_STANDALONE;
|
||||
@ -2508,7 +2508,7 @@ pmc_can_allocate_row(int ri, enum pmc_mode mode)
|
||||
* All OK
|
||||
*/
|
||||
|
||||
PMCDBG(PMC,ALR,2, "can-allocate-row ri=%d mode=%d ok", ri, mode);
|
||||
PMCDBG2(PMC,ALR,2, "can-allocate-row ri=%d mode=%d ok", ri, mode);
|
||||
|
||||
return 0;
|
||||
|
||||
@ -2541,7 +2541,7 @@ pmc_find_pmc(pmc_id_t pmcid, struct pmc **pmc)
|
||||
struct pmc *pm;
|
||||
struct pmc_owner *po;
|
||||
|
||||
PMCDBG(PMC,FND,1, "find-pmc id=%d", pmcid);
|
||||
PMCDBG1(PMC,FND,1, "find-pmc id=%d", pmcid);
|
||||
|
||||
if ((po = pmc_find_owner_descriptor(curthread->td_proc)) == NULL)
|
||||
return ESRCH;
|
||||
@ -2549,7 +2549,7 @@ pmc_find_pmc(pmc_id_t pmcid, struct pmc **pmc)
|
||||
if ((pm = pmc_find_pmc_descriptor_in_process(po, pmcid)) == NULL)
|
||||
return EINVAL;
|
||||
|
||||
PMCDBG(PMC,FND,2, "find-pmc id=%d -> pmc=%p", pmcid, pm);
|
||||
PMCDBG2(PMC,FND,2, "find-pmc id=%d -> pmc=%p", pmcid, pm);
|
||||
|
||||
*pmc = pm;
|
||||
return 0;
|
||||
@ -2577,7 +2577,7 @@ pmc_start(struct pmc *pm)
|
||||
|
||||
error = 0;
|
||||
|
||||
PMCDBG(PMC,OPS,1, "start pmc=%p mode=%d ri=%d", pm, mode, ri);
|
||||
PMCDBG3(PMC,OPS,1, "start pmc=%p mode=%d ri=%d", pm, mode, ri);
|
||||
|
||||
po = pm->pm_owner;
|
||||
|
||||
@ -2633,7 +2633,7 @@ pmc_start(struct pmc *pm)
|
||||
if (po->po_sscount == 0) {
|
||||
LIST_INSERT_HEAD(&pmc_ss_owners, po, po_ssnext);
|
||||
atomic_add_rel_int(&pmc_ss_count, 1);
|
||||
PMCDBG(PMC,OPS,1, "po=%p in global list", po);
|
||||
PMCDBG1(PMC,OPS,1, "po=%p in global list", po);
|
||||
}
|
||||
po->po_sscount++;
|
||||
|
||||
@ -2696,7 +2696,7 @@ pmc_stop(struct pmc *pm)
|
||||
|
||||
KASSERT(pm != NULL, ("[pmc,%d] null pmc", __LINE__));
|
||||
|
||||
PMCDBG(PMC,OPS,1, "stop pmc=%p mode=%d ri=%d", pm,
|
||||
PMCDBG3(PMC,OPS,1, "stop pmc=%p mode=%d ri=%d", pm,
|
||||
PMC_TO_MODE(pm), PMC_TO_ROWINDEX(pm));
|
||||
|
||||
pm->pm_state = PMC_STATE_STOPPED;
|
||||
@ -2751,7 +2751,7 @@ pmc_stop(struct pmc *pm)
|
||||
if (po->po_sscount == 0) {
|
||||
atomic_subtract_rel_int(&pmc_ss_count, 1);
|
||||
LIST_REMOVE(po, po_ssnext);
|
||||
PMCDBG(PMC,OPS,2,"po=%p removed from global list", po);
|
||||
PMCDBG1(PMC,OPS,2,"po=%p removed from global list", po);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2804,7 +2804,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
|
||||
op = c->pmop_code;
|
||||
arg = c->pmop_data;
|
||||
|
||||
PMCDBG(MOD,PMS,1, "syscall op=%d \"%s\" arg=%p", op,
|
||||
PMCDBG3(MOD,PMS,1, "syscall op=%d \"%s\" arg=%p", op,
|
||||
pmc_op_to_name[op], arg);
|
||||
|
||||
error = 0;
|
||||
@ -3317,7 +3317,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
|
||||
break;
|
||||
}
|
||||
|
||||
PMCDBG(PMC,ALL,2, "event=%d caps=0x%x mode=%d cpu=%d",
|
||||
PMCDBG4(PMC,ALL,2, "event=%d caps=0x%x mode=%d cpu=%d",
|
||||
pa.pm_ev, caps, mode, cpu);
|
||||
|
||||
pmc = pmc_allocate_pmc_descriptor();
|
||||
@ -3379,7 +3379,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
|
||||
/* Fill in the correct value in the ID field */
|
||||
pmc->pm_id = PMC_ID_MAKE_ID(cpu,mode,pa.pm_class,n);
|
||||
|
||||
PMCDBG(PMC,ALL,2, "ev=%d class=%d mode=%d n=%d -> pmcid=%x",
|
||||
PMCDBG5(PMC,ALL,2, "ev=%d class=%d mode=%d n=%d -> pmcid=%x",
|
||||
pmc->pm_event, pa.pm_class, mode, n, pmc->pm_id);
|
||||
|
||||
/* Process mode PMCs with logging enabled need log files */
|
||||
@ -3702,7 +3702,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
|
||||
break;
|
||||
|
||||
ri = 0;
|
||||
PMCDBG(PMC,OPS,1, "rw id=%d flags=0x%x", prw.pm_pmcid,
|
||||
PMCDBG2(PMC,OPS,1, "rw id=%d flags=0x%x", prw.pm_pmcid,
|
||||
prw.pm_flags);
|
||||
|
||||
/* must have at least one flag set */
|
||||
@ -3800,10 +3800,10 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
|
||||
|
||||
#ifdef HWPMC_DEBUG
|
||||
if (prw.pm_flags & PMC_F_NEWVALUE)
|
||||
PMCDBG(PMC,OPS,2, "rw id=%d new %jx -> old %jx",
|
||||
PMCDBG3(PMC,OPS,2, "rw id=%d new %jx -> old %jx",
|
||||
ri, prw.pm_value, oldvalue);
|
||||
else if (prw.pm_flags & PMC_F_OLDVALUE)
|
||||
PMCDBG(PMC,OPS,2, "rw id=%d -> old %jx", ri, oldvalue);
|
||||
PMCDBG2(PMC,OPS,2, "rw id=%d -> old %jx", ri, oldvalue);
|
||||
#endif
|
||||
|
||||
/* return old value if requested */
|
||||
@ -4046,7 +4046,7 @@ pmc_process_interrupt(int cpu, int ring, struct pmc *pm, struct trapframe *tf,
|
||||
if (ps->ps_nsamples) { /* in use, reader hasn't caught up */
|
||||
pm->pm_stalled = 1;
|
||||
atomic_add_int(&pmc_stats.pm_intr_bufferfull, 1);
|
||||
PMCDBG(SAM,INT,1,"(spc) cpu=%d pm=%p tf=%p um=%d wr=%d rd=%d",
|
||||
PMCDBG6(SAM,INT,1,"(spc) cpu=%d pm=%p tf=%p um=%d wr=%d rd=%d",
|
||||
cpu, pm, (void *) tf, inuserspace,
|
||||
(int) (psb->ps_write - psb->ps_samples),
|
||||
(int) (psb->ps_read - psb->ps_samples));
|
||||
@ -4056,7 +4056,7 @@ pmc_process_interrupt(int cpu, int ring, struct pmc *pm, struct trapframe *tf,
|
||||
|
||||
|
||||
/* Fill in entry. */
|
||||
PMCDBG(SAM,INT,1,"cpu=%d pm=%p tf=%p um=%d wr=%d rd=%d", cpu, pm,
|
||||
PMCDBG6(SAM,INT,1,"cpu=%d pm=%p tf=%p um=%d wr=%d rd=%d", cpu, pm,
|
||||
(void *) tf, inuserspace,
|
||||
(int) (psb->ps_write - psb->ps_samples),
|
||||
(int) (psb->ps_read - psb->ps_samples));
|
||||
@ -4239,7 +4239,7 @@ pmc_process_samples(int cpu, int ring)
|
||||
break;
|
||||
}
|
||||
|
||||
PMCDBG(SAM,OPS,1,"cpu=%d pm=%p n=%d fl=%x wr=%d rd=%d", cpu,
|
||||
PMCDBG6(SAM,OPS,1,"cpu=%d pm=%p n=%d fl=%x wr=%d rd=%d", cpu,
|
||||
pm, ps->ps_nsamples, ps->ps_flags,
|
||||
(int) (psb->ps_write - psb->ps_samples),
|
||||
(int) (psb->ps_read - psb->ps_samples));
|
||||
@ -4355,7 +4355,7 @@ pmc_process_exit(void *arg __unused, struct proc *p)
|
||||
return;
|
||||
|
||||
PMC_GET_SX_XLOCK();
|
||||
PMCDBG(PRC,EXT,1,"process-exit proc=%p (%d, %s)", p, p->p_pid,
|
||||
PMCDBG3(PRC,EXT,1,"process-exit proc=%p (%d, %s)", p, p->p_pid,
|
||||
p->p_comm);
|
||||
|
||||
/*
|
||||
@ -4370,7 +4370,7 @@ pmc_process_exit(void *arg __unused, struct proc *p)
|
||||
* entry from our target process hash table, using
|
||||
* PMC_FLAG_REMOVE.
|
||||
*/
|
||||
PMCDBG(PRC,EXT,1, "process-exit proc=%p (%d, %s)", p, p->p_pid,
|
||||
PMCDBG3(PRC,EXT,1, "process-exit proc=%p (%d, %s)", p, p->p_pid,
|
||||
p->p_comm);
|
||||
|
||||
critical_enter(); /* no preemption */
|
||||
@ -4380,7 +4380,7 @@ pmc_process_exit(void *arg __unused, struct proc *p)
|
||||
if ((pp = pmc_find_process_descriptor(p,
|
||||
PMC_FLAG_REMOVE)) != NULL) {
|
||||
|
||||
PMCDBG(PRC,EXT,2,
|
||||
PMCDBG2(PRC,EXT,2,
|
||||
"process-exit proc=%p pmc-process=%p", p, pp);
|
||||
|
||||
/*
|
||||
@ -4403,13 +4403,13 @@ pmc_process_exit(void *arg __unused, struct proc *p)
|
||||
|
||||
(void) (*pcd->pcd_get_config)(cpu, adjri, &pm);
|
||||
|
||||
PMCDBG(PRC,EXT,2, "ri=%d pm=%p", ri, pm);
|
||||
PMCDBG2(PRC,EXT,2, "ri=%d pm=%p", ri, pm);
|
||||
|
||||
if (pm == NULL ||
|
||||
!PMC_IS_VIRTUAL_MODE(PMC_TO_MODE(pm)))
|
||||
continue;
|
||||
|
||||
PMCDBG(PRC,EXT,2, "ppmcs[%d]=%p pm=%p "
|
||||
PMCDBG4(PRC,EXT,2, "ppmcs[%d]=%p pm=%p "
|
||||
"state=%d", ri, pp->pp_pmcs[ri].pp_pmc,
|
||||
pm, pm->pm_state);
|
||||
|
||||
@ -4525,7 +4525,7 @@ pmc_process_fork(void *arg __unused, struct proc *p1, struct proc *newproc,
|
||||
return;
|
||||
|
||||
PMC_GET_SX_XLOCK();
|
||||
PMCDBG(PMC,FRK,1, "process-fork proc=%p (%d, %s) -> %p", p1,
|
||||
PMCDBG4(PMC,FRK,1, "process-fork proc=%p (%d, %s) -> %p", p1,
|
||||
p1->p_pid, p1->p_comm, newproc);
|
||||
|
||||
/*
|
||||
@ -4720,7 +4720,7 @@ pmc_initialize(void)
|
||||
pmc_debugstr+strlen(pmc_debugstr));
|
||||
#endif
|
||||
|
||||
PMCDBG(MOD,INI,0, "PMC Initialize (version %x)", PMC_VERSION);
|
||||
PMCDBG1(MOD,INI,0, "PMC Initialize (version %x)", PMC_VERSION);
|
||||
|
||||
/* check kernel version */
|
||||
if (pmc_kernel_version != PMC_VERSION) {
|
||||
@ -4881,7 +4881,7 @@ pmc_initialize(void)
|
||||
pmc_mtxpool = mtx_pool_create("pmc-leaf", pmc_mtxpool_size,
|
||||
MTX_SPIN);
|
||||
|
||||
PMCDBG(MOD,INI,1, "pmc_ownerhash=%p, mask=0x%lx "
|
||||
PMCDBG4(MOD,INI,1, "pmc_ownerhash=%p, mask=0x%lx "
|
||||
"targethash=%p mask=0x%lx", pmc_ownerhash, pmc_ownerhashmask,
|
||||
pmc_processhash, pmc_processhashmask);
|
||||
|
||||
@ -4937,7 +4937,7 @@ pmc_cleanup(void)
|
||||
struct pmc_processhash *prh;
|
||||
#endif
|
||||
|
||||
PMCDBG(MOD,INI,0, "%s", "cleanup");
|
||||
PMCDBG0(MOD,INI,0, "cleanup");
|
||||
|
||||
/* switch off sampling */
|
||||
CPU_ZERO(&pmc_cpumask);
|
||||
@ -4966,7 +4966,7 @@ pmc_cleanup(void)
|
||||
pmc_remove_owner(po);
|
||||
|
||||
/* send SIGBUS to owner processes */
|
||||
PMCDBG(MOD,INI,2, "cleanup signal proc=%p "
|
||||
PMCDBG3(MOD,INI,2, "cleanup signal proc=%p "
|
||||
"(%d, %s)", po->po_owner,
|
||||
po->po_owner->p_pid,
|
||||
po->po_owner->p_comm);
|
||||
@ -4988,12 +4988,12 @@ pmc_cleanup(void)
|
||||
#ifdef HWPMC_DEBUG
|
||||
struct pmc_process *pp;
|
||||
|
||||
PMCDBG(MOD,INI,3, "%s", "destroy process hash");
|
||||
PMCDBG0(MOD,INI,3, "destroy process hash");
|
||||
for (prh = pmc_processhash;
|
||||
prh <= &pmc_processhash[pmc_processhashmask];
|
||||
prh++)
|
||||
LIST_FOREACH(pp, prh, pp_next)
|
||||
PMCDBG(MOD,INI,3, "pid=%d", pp->pp_proc->p_pid);
|
||||
PMCDBG1(MOD,INI,3, "pid=%d", pp->pp_proc->p_pid);
|
||||
#endif
|
||||
|
||||
hashdestroy(pmc_processhash, M_PMC, pmc_processhashmask);
|
||||
@ -5001,7 +5001,7 @@ pmc_cleanup(void)
|
||||
}
|
||||
|
||||
if (pmc_ownerhash) {
|
||||
PMCDBG(MOD,INI,3, "%s", "destroy owner hash");
|
||||
PMCDBG0(MOD,INI,3, "destroy owner hash");
|
||||
hashdestroy(pmc_ownerhash, M_PMC, pmc_ownerhashmask);
|
||||
pmc_ownerhash = NULL;
|
||||
}
|
||||
@ -5014,11 +5014,11 @@ pmc_cleanup(void)
|
||||
/* do processor and pmc-class dependent cleanup */
|
||||
maxcpu = pmc_cpu_max();
|
||||
|
||||
PMCDBG(MOD,INI,3, "%s", "md cleanup");
|
||||
PMCDBG0(MOD,INI,3, "md cleanup");
|
||||
if (md) {
|
||||
pmc_save_cpu_binding(&pb);
|
||||
for (cpu = 0; cpu < maxcpu; cpu++) {
|
||||
PMCDBG(MOD,INI,1,"pmc-cleanup cpu=%d pcs=%p",
|
||||
PMCDBG2(MOD,INI,1,"pmc-cleanup cpu=%d pcs=%p",
|
||||
cpu, pmc_pcpu[cpu]);
|
||||
if (!pmc_cpu_is_active(cpu) || pmc_pcpu[cpu] == NULL)
|
||||
continue;
|
||||
@ -5094,7 +5094,7 @@ load (struct module *module __unused, int cmd, void *arg __unused)
|
||||
error = pmc_initialize();
|
||||
if (error != 0)
|
||||
break;
|
||||
PMCDBG(MOD,INI,1, "syscall=%d maxcpu=%d",
|
||||
PMCDBG2(MOD,INI,1, "syscall=%d maxcpu=%d",
|
||||
pmc_syscall_num, pmc_cpu_max());
|
||||
break;
|
||||
|
||||
@ -5102,7 +5102,7 @@ load (struct module *module __unused, int cmd, void *arg __unused)
|
||||
case MOD_UNLOAD :
|
||||
case MOD_SHUTDOWN:
|
||||
pmc_cleanup();
|
||||
PMCDBG(MOD,INI,1, "%s", "unloaded");
|
||||
PMCDBG0(MOD,INI,1, "unloaded");
|
||||
break;
|
||||
|
||||
default :
|
||||
|
@ -384,7 +384,7 @@ mpc7xxx_read_pmc(int cpu, int ri, pmc_value_t *v)
|
||||
ri));
|
||||
|
||||
tmp = mpc7xxx_pmcn_read(ri);
|
||||
PMCDBG(MDP,REA,2,"ppc-read id=%d -> %jd", ri, tmp);
|
||||
PMCDBG2(MDP,REA,2,"ppc-read id=%d -> %jd", ri, tmp);
|
||||
if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
|
||||
*v = POWERPC_PERFCTR_VALUE_TO_RELOAD_COUNT(tmp);
|
||||
else
|
||||
@ -408,7 +408,7 @@ mpc7xxx_write_pmc(int cpu, int ri, pmc_value_t v)
|
||||
if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
|
||||
v = POWERPC_RELOAD_COUNT_TO_PERFCTR_VALUE(v);
|
||||
|
||||
PMCDBG(MDP,WRI,1,"powerpc-write cpu=%d ri=%d v=%jx", cpu, ri, v);
|
||||
PMCDBG3(MDP,WRI,1,"powerpc-write cpu=%d ri=%d v=%jx", cpu, ri, v);
|
||||
|
||||
mpc7xxx_pmcn_write(ri, v);
|
||||
|
||||
@ -420,7 +420,7 @@ mpc7xxx_config_pmc(int cpu, int ri, struct pmc *pm)
|
||||
{
|
||||
struct pmc_hw *phw;
|
||||
|
||||
PMCDBG(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
PMCDBG3(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[powerpc,%d] illegal CPU value %d", __LINE__, cpu));
|
||||
@ -559,7 +559,7 @@ mpc7xxx_pcpu_init(struct pmc_mdep *md, int cpu)
|
||||
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[powerpc,%d] wrong cpu number %d", __LINE__, cpu));
|
||||
PMCDBG(MDP,INI,1,"powerpc-init cpu=%d", cpu);
|
||||
PMCDBG1(MDP,INI,1,"powerpc-init cpu=%d", cpu);
|
||||
|
||||
powerpc_pcpu[cpu] = pac = malloc(sizeof(struct powerpc_cpu), M_PMC,
|
||||
M_WAITOK|M_ZERO);
|
||||
@ -638,7 +638,7 @@ mpc7xxx_allocate_pmc(int cpu, int ri, struct pmc *pm,
|
||||
|
||||
pm->pm_md.pm_powerpc.pm_powerpc_evsel = config;
|
||||
|
||||
PMCDBG(MDP,ALL,2,"powerpc-allocate ri=%d -> config=0x%x", ri, config);
|
||||
PMCDBG2(MDP,ALL,2,"powerpc-allocate ri=%d -> config=0x%x", ri, config);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -671,7 +671,7 @@ mpc7xxx_intr(int cpu, struct trapframe *tf)
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[powerpc,%d] out of range CPU %d", __LINE__, cpu));
|
||||
|
||||
PMCDBG(MDP,INT,1, "cpu=%d tf=%p um=%d", cpu, (void *) tf,
|
||||
PMCDBG3(MDP,INT,1, "cpu=%d tf=%p um=%d", cpu, (void *) tf,
|
||||
TRAPF_USERMODE(tf));
|
||||
|
||||
retval = 0;
|
||||
|
@ -189,7 +189,8 @@ mips_get_perfctl(int cpu, int ri, uint32_t event, uint32_t caps)
|
||||
if (caps & PMC_CAP_INTERRUPT)
|
||||
control.s.ie = 1;
|
||||
|
||||
PMCDBG(MDP,ALL,2,"mips-allocate ri=%d -> config=0x%x", ri, control.u32);
|
||||
PMCDBG2(MDP,ALL,2,"mips-allocate ri=%d -> config=0x%x", ri,
|
||||
control.u32);
|
||||
|
||||
return (control.u32);
|
||||
}
|
||||
|
@ -563,7 +563,7 @@ p4_pcpu_init(struct pmc_mdep *md, int cpu)
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[p4,%d] insane cpu number %d", __LINE__, cpu));
|
||||
|
||||
PMCDBG(MDP,INI,0, "p4-init cpu=%d is-primary=%d", cpu,
|
||||
PMCDBG2(MDP,INI,0, "p4-init cpu=%d is-primary=%d", cpu,
|
||||
pmc_cpu_is_primary(cpu) != 0);
|
||||
|
||||
first_ri = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_P4].pcd_ri;
|
||||
@ -590,7 +590,7 @@ p4_pcpu_init(struct pmc_mdep *md, int cpu)
|
||||
|
||||
KASSERT(plc != pc, ("[p4,%d] per-cpu config error", __LINE__));
|
||||
|
||||
PMCDBG(MDP,INI,1, "p4-init cpu=%d phycpu=%d pc=%p", cpu,
|
||||
PMCDBG3(MDP,INI,1, "p4-init cpu=%d phycpu=%d pc=%p", cpu,
|
||||
phycpu, pc);
|
||||
KASSERT(pc, ("[p4,%d] Null Per-Cpu state cpu=%d phycpu=%d",
|
||||
__LINE__, cpu, phycpu));
|
||||
@ -642,7 +642,7 @@ p4_pcpu_fini(struct pmc_mdep *md, int cpu)
|
||||
struct p4_cpu *p4c;
|
||||
struct pmc_cpu *pc;
|
||||
|
||||
PMCDBG(MDP,INI,0, "p4-cleanup cpu=%d", cpu);
|
||||
PMCDBG1(MDP,INI,0, "p4-cleanup cpu=%d", cpu);
|
||||
|
||||
pc = pmc_pcpu[cpu];
|
||||
first_ri = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_P4].pcd_ri;
|
||||
@ -702,7 +702,7 @@ p4_read_pmc(int cpu, int ri, pmc_value_t *v)
|
||||
|
||||
mode = PMC_TO_MODE(pm);
|
||||
|
||||
PMCDBG(MDP,REA,1, "p4-read cpu=%d ri=%d mode=%d", cpu, ri, mode);
|
||||
PMCDBG3(MDP,REA,1, "p4-read cpu=%d ri=%d mode=%d", cpu, ri, mode);
|
||||
|
||||
KASSERT(pd->pm_descr.pd_class == PMC_CLASS_P4,
|
||||
("[p4,%d] unknown PMC class %d", __LINE__, pd->pm_descr.pd_class));
|
||||
@ -723,7 +723,7 @@ p4_read_pmc(int cpu, int ri, pmc_value_t *v)
|
||||
else
|
||||
*v = tmp;
|
||||
|
||||
PMCDBG(MDP,REA,2, "p4-read -> %jx", *v);
|
||||
PMCDBG1(MDP,REA,2, "p4-read -> %jx", *v);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -757,7 +757,7 @@ p4_write_pmc(int cpu, int ri, pmc_value_t v)
|
||||
|
||||
mode = PMC_TO_MODE(pm);
|
||||
|
||||
PMCDBG(MDP,WRI,1, "p4-write cpu=%d ri=%d mode=%d v=%jx", cpu, ri,
|
||||
PMCDBG4(MDP,WRI,1, "p4-write cpu=%d ri=%d mode=%d v=%jx", cpu, ri,
|
||||
mode, v);
|
||||
|
||||
/*
|
||||
@ -800,7 +800,7 @@ p4_config_pmc(int cpu, int ri, struct pmc *pm)
|
||||
KASSERT(ri >= 0 && ri < P4_NPMCS,
|
||||
("[p4,%d] illegal row-index %d", __LINE__, ri));
|
||||
|
||||
PMCDBG(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
PMCDBG3(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
|
||||
pc = p4_pcpu[P4_TO_HTT_PRIMARY(cpu)];
|
||||
phw = &pc->pc_p4pmcs[ri];
|
||||
@ -930,7 +930,7 @@ p4_allocate_pmc(int cpu, int ri, struct pmc *pm,
|
||||
|
||||
pd = &p4_pmcdesc[ri];
|
||||
|
||||
PMCDBG(MDP,ALL,1, "p4-allocate ri=%d class=%d pmccaps=0x%x "
|
||||
PMCDBG4(MDP,ALL,1, "p4-allocate ri=%d class=%d pmccaps=0x%x "
|
||||
"reqcaps=0x%x", ri, pd->pm_descr.pd_class, pd->pm_descr.pd_caps,
|
||||
pm->pm_caps);
|
||||
|
||||
@ -965,7 +965,7 @@ p4_allocate_pmc(int cpu, int ri, struct pmc *pm,
|
||||
if ((pevent = p4_find_event(pm->pm_event)) == NULL)
|
||||
return (ESRCH);
|
||||
|
||||
PMCDBG(MDP,ALL,2, "pevent={ev=%d,escrsel=0x%x,cccrsel=0x%x,isti=%d}",
|
||||
PMCDBG4(MDP,ALL,2, "pevent={ev=%d,escrsel=0x%x,cccrsel=0x%x,isti=%d}",
|
||||
pevent->pm_event, pevent->pm_escr_eventselect,
|
||||
pevent->pm_cccr_select, pevent->pm_is_ti_event);
|
||||
|
||||
@ -1105,7 +1105,7 @@ p4_allocate_pmc(int cpu, int ri, struct pmc *pm,
|
||||
pm->pm_md.pm_p4.pm_p4_cccrvalue = cccrvalue;
|
||||
pm->pm_md.pm_p4.pm_p4_escrvalue = escrvalue;
|
||||
|
||||
PMCDBG(MDP,ALL,2, "p4-allocate cccrsel=0x%x cccrval=0x%x "
|
||||
PMCDBG5(MDP,ALL,2, "p4-allocate cccrsel=0x%x cccrval=0x%x "
|
||||
"escr=%d escrmsr=0x%x escrval=0x%x", pevent->pm_cccr_select,
|
||||
cccrvalue, escr, pm->pm_md.pm_p4.pm_p4_escrmsr, escrvalue);
|
||||
|
||||
@ -1127,7 +1127,7 @@ p4_release_pmc(int cpu, int ri, struct pmc *pm)
|
||||
|
||||
escr = pm->pm_md.pm_p4.pm_p4_escr;
|
||||
|
||||
PMCDBG(MDP,REL,1, "p4-release cpu=%d ri=%d escr=%d", cpu, ri, escr);
|
||||
PMCDBG3(MDP,REL,1, "p4-release cpu=%d ri=%d escr=%d", cpu, ri, escr);
|
||||
|
||||
if (PMC_IS_SYSTEM_MODE(PMC_TO_MODE(pm))) {
|
||||
pc = p4_pcpu[P4_TO_HTT_PRIMARY(cpu)];
|
||||
@ -1171,7 +1171,7 @@ p4_start_pmc(int cpu, int ri)
|
||||
KASSERT(pm != NULL,
|
||||
("[p4,%d] starting cpu%d,pmc%d with null pmc", __LINE__, cpu, ri));
|
||||
|
||||
PMCDBG(MDP,STA,1, "p4-start cpu=%d ri=%d", cpu, ri);
|
||||
PMCDBG2(MDP,STA,1, "p4-start cpu=%d ri=%d", cpu, ri);
|
||||
|
||||
KASSERT(pd->pm_descr.pd_class == PMC_CLASS_P4,
|
||||
("[p4,%d] wrong PMC class %d", __LINE__,
|
||||
@ -1283,9 +1283,10 @@ p4_start_pmc(int cpu, int ri)
|
||||
|
||||
mtx_unlock_spin(&pc->pc_mtx);
|
||||
|
||||
PMCDBG(MDP,STA,2,"p4-start cpu=%d rc=%d ri=%d escr=%d "
|
||||
"escrmsr=0x%x escrvalue=0x%x cccr_config=0x%x v=%jx", cpu, rc,
|
||||
ri, pm->pm_md.pm_p4.pm_p4_escr, escrmsr, escrvalue,
|
||||
PMCDBG6(MDP,STA,2,"p4-start cpu=%d rc=%d ri=%d escr=%d "
|
||||
"escrmsr=0x%x escrvalue=0x%x", cpu, rc,
|
||||
ri, pm->pm_md.pm_p4.pm_p4_escr, escrmsr, escrvalue);
|
||||
PMCDBG2(MDP,STA,2,"cccr_config=0x%x v=%jx",
|
||||
cccrvalue, P4_PCPU_HW_VALUE(pc,ri,cpu));
|
||||
|
||||
return (0);
|
||||
@ -1317,7 +1318,7 @@ p4_stop_pmc(int cpu, int ri)
|
||||
KASSERT(pm != NULL,
|
||||
("[p4,%d] null pmc for cpu%d, ri%d", __LINE__, cpu, ri));
|
||||
|
||||
PMCDBG(MDP,STO,1, "p4-stop cpu=%d ri=%d", cpu, ri);
|
||||
PMCDBG2(MDP,STO,1, "p4-stop cpu=%d ri=%d", cpu, ri);
|
||||
|
||||
if (PMC_IS_SYSTEM_MODE(PMC_TO_MODE(pm))) {
|
||||
wrmsr(pd->pm_cccr_msr,
|
||||
@ -1385,9 +1386,9 @@ p4_stop_pmc(int cpu, int ri)
|
||||
|
||||
mtx_unlock_spin(&pc->pc_mtx);
|
||||
|
||||
PMCDBG(MDP,STO,2, "p4-stop cpu=%d rc=%d ri=%d escrmsr=0x%x "
|
||||
"escrval=0x%x cccrval=0x%x v=%jx", cpu, rc, ri, escrmsr,
|
||||
escrvalue, cccrvalue, tmp);
|
||||
PMCDBG5(MDP,STO,2, "p4-stop cpu=%d rc=%d ri=%d escrmsr=0x%x "
|
||||
"escrval=0x%x", cpu, rc, ri, escrmsr, escrvalue);
|
||||
PMCDBG2(MDP,STO,2, "cccrval=0x%x v=%jx", cccrvalue, tmp);
|
||||
|
||||
if (tmp < P4_PCPU_HW_VALUE(pc,ri,cpu)) /* 40 bit counter overflow */
|
||||
tmp += (P4_PERFCTR_MASK + 1) - P4_PCPU_HW_VALUE(pc,ri,cpu);
|
||||
@ -1422,7 +1423,7 @@ p4_intr(int cpu, struct trapframe *tf)
|
||||
struct pmc *pm;
|
||||
pmc_value_t v;
|
||||
|
||||
PMCDBG(MDP,INT, 1, "cpu=%d tf=0x%p um=%d", cpu, (void *) tf,
|
||||
PMCDBG3(MDP,INT, 1, "cpu=%d tf=0x%p um=%d", cpu, (void *) tf,
|
||||
TRAPF_USERMODE(tf));
|
||||
|
||||
pc = p4_pcpu[P4_TO_HTT_PRIMARY(cpu)];
|
||||
@ -1492,7 +1493,7 @@ p4_intr(int cpu, struct trapframe *tf)
|
||||
|
||||
v = rdmsr(P4_PERFCTR_MSR_FIRST + ri);
|
||||
|
||||
PMCDBG(MDP,INT, 2, "ri=%d v=%jx", ri, v);
|
||||
PMCDBG2(MDP,INT, 2, "ri=%d v=%jx", ri, v);
|
||||
|
||||
/* Stop the counter, and reset the overflow bit */
|
||||
cccrval &= ~(P4_CCCR_OVF | P4_CCCR_ENABLE);
|
||||
@ -1568,7 +1569,7 @@ p4_describe(int cpu, int ri, struct pmc_info *pi,
|
||||
KASSERT(ri >= 0 && ri < P4_NPMCS,
|
||||
("[p4,%d] row-index %d out of range", __LINE__, ri));
|
||||
|
||||
PMCDBG(MDP,OPS,1,"p4-describe cpu=%d ri=%d", cpu, ri);
|
||||
PMCDBG2(MDP,OPS,1,"p4-describe cpu=%d ri=%d", cpu, ri);
|
||||
|
||||
if (P4_CPU_IS_HTT_SECONDARY(cpu))
|
||||
return (EINVAL);
|
||||
@ -1604,7 +1605,7 @@ p4_get_msr(int ri, uint32_t *msr)
|
||||
|
||||
*msr = p4_pmcdesc[ri].pm_pmc_msr - P4_PERFCTR_MSR_FIRST;
|
||||
|
||||
PMCDBG(MDP,OPS, 1, "ri=%d getmsr=0x%x", ri, *msr);
|
||||
PMCDBG2(MDP,OPS, 1, "ri=%d getmsr=0x%x", ri, *msr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1620,7 +1621,7 @@ pmc_p4_initialize(struct pmc_mdep *md, int ncpus)
|
||||
KASSERT(cpu_vendor_id == CPU_VENDOR_INTEL,
|
||||
("[p4,%d] Initializing non-intel processor", __LINE__));
|
||||
|
||||
PMCDBG(MDP,INI,1, "%s", "p4-initialize");
|
||||
PMCDBG0(MDP,INI,1, "p4-initialize");
|
||||
|
||||
/* Allocate space for pointers to per-cpu descriptors. */
|
||||
p4_pcpu = malloc(sizeof(*p4_pcpu) * ncpus, M_PMC, M_ZERO | M_WAITOK);
|
||||
|
@ -342,7 +342,7 @@ ppc970_config_pmc(int cpu, int ri, struct pmc *pm)
|
||||
{
|
||||
struct pmc_hw *phw;
|
||||
|
||||
PMCDBG(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
PMCDBG3(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[powerpc,%d] illegal CPU value %d", __LINE__, cpu));
|
||||
@ -445,7 +445,7 @@ ppc970_read_pmc(int cpu, int ri, pmc_value_t *v)
|
||||
ri));
|
||||
|
||||
tmp = ppc970_pmcn_read(ri);
|
||||
PMCDBG(MDP,REA,2,"ppc-read id=%d -> %jd", ri, tmp);
|
||||
PMCDBG2(MDP,REA,2,"ppc-read id=%d -> %jd", ri, tmp);
|
||||
if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
|
||||
*v = POWERPC_PERFCTR_VALUE_TO_RELOAD_COUNT(tmp);
|
||||
else
|
||||
@ -469,7 +469,7 @@ ppc970_write_pmc(int cpu, int ri, pmc_value_t v)
|
||||
if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
|
||||
v = POWERPC_RELOAD_COUNT_TO_PERFCTR_VALUE(v);
|
||||
|
||||
PMCDBG(MDP,WRI,1,"powerpc-write cpu=%d ri=%d v=%jx", cpu, ri, v);
|
||||
PMCDBG3(MDP,WRI,1,"powerpc-write cpu=%d ri=%d v=%jx", cpu, ri, v);
|
||||
|
||||
ppc970_pmcn_write(ri, v);
|
||||
|
||||
@ -487,7 +487,7 @@ ppc970_intr(int cpu, struct trapframe *tf)
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[powerpc,%d] out of range CPU %d", __LINE__, cpu));
|
||||
|
||||
PMCDBG(MDP,INT,1, "cpu=%d tf=%p um=%d", cpu, (void *) tf,
|
||||
PMCDBG3(MDP,INT,1, "cpu=%d tf=%p um=%d", cpu, (void *) tf,
|
||||
TRAPF_USERMODE(tf));
|
||||
|
||||
retval = 0;
|
||||
@ -546,7 +546,7 @@ ppc970_pcpu_init(struct pmc_mdep *md, int cpu)
|
||||
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[powerpc,%d] wrong cpu number %d", __LINE__, cpu));
|
||||
PMCDBG(MDP,INI,1,"powerpc-init cpu=%d", cpu);
|
||||
PMCDBG1(MDP,INI,1,"powerpc-init cpu=%d", cpu);
|
||||
|
||||
powerpc_pcpu[cpu] = pac = malloc(sizeof(struct powerpc_cpu), M_PMC,
|
||||
M_WAITOK|M_ZERO);
|
||||
@ -632,7 +632,7 @@ ppc970_allocate_pmc(int cpu, int ri, struct pmc *pm,
|
||||
|
||||
pm->pm_md.pm_powerpc.pm_powerpc_evsel = config;
|
||||
|
||||
PMCDBG(MDP,ALL,2,"powerpc-allocate ri=%d -> config=0x%x", ri, config);
|
||||
PMCDBG2(MDP,ALL,2,"powerpc-allocate ri=%d -> config=0x%x", ri, config);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ p6_pcpu_init(struct pmc_mdep *md, int cpu)
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[p6,%d] bad cpu %d", __LINE__, cpu));
|
||||
|
||||
PMCDBG(MDP,INI,0,"p6-init cpu=%d", cpu);
|
||||
PMCDBG1(MDP,INI,0,"p6-init cpu=%d", cpu);
|
||||
|
||||
p6c = malloc(sizeof (struct p6_cpu), M_PMC, M_WAITOK|M_ZERO);
|
||||
pc = pmc_pcpu[cpu];
|
||||
@ -371,7 +371,7 @@ p6_pcpu_fini(struct pmc_mdep *md, int cpu)
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[p6,%d] bad cpu %d", __LINE__, cpu));
|
||||
|
||||
PMCDBG(MDP,INI,0,"p6-cleanup cpu=%d", cpu);
|
||||
PMCDBG1(MDP,INI,0,"p6-cleanup cpu=%d", cpu);
|
||||
|
||||
p6c = p6_pcpu[cpu];
|
||||
p6_pcpu[cpu] = NULL;
|
||||
@ -412,7 +412,7 @@ p6_read_pmc(int cpu, int ri, pmc_value_t *v)
|
||||
else
|
||||
*v = tmp;
|
||||
|
||||
PMCDBG(MDP,REA,1, "p6-read cpu=%d ri=%d msr=0x%x -> v=%jx", cpu, ri,
|
||||
PMCDBG4(MDP,REA,1, "p6-read cpu=%d ri=%d msr=0x%x -> v=%jx", cpu, ri,
|
||||
pd->pm_pmc_msr, *v);
|
||||
|
||||
return (0);
|
||||
@ -435,7 +435,7 @@ p6_write_pmc(int cpu, int ri, pmc_value_t v)
|
||||
KASSERT(pm,
|
||||
("[p6,%d] cpu %d ri %d pmc not configured", __LINE__, cpu, ri));
|
||||
|
||||
PMCDBG(MDP,WRI,1, "p6-write cpu=%d ri=%d msr=0x%x v=%jx", cpu, ri,
|
||||
PMCDBG4(MDP,WRI,1, "p6-write cpu=%d ri=%d msr=0x%x v=%jx", cpu, ri,
|
||||
pd->pm_pmc_msr, v);
|
||||
|
||||
if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
|
||||
@ -455,7 +455,7 @@ p6_config_pmc(int cpu, int ri, struct pmc *pm)
|
||||
KASSERT(ri >= 0 && ri < P6_NPMCS,
|
||||
("[p6,%d] illegal row-index %d", __LINE__, ri));
|
||||
|
||||
PMCDBG(MDP,CFG,1, "p6-config cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
PMCDBG3(MDP,CFG,1, "p6-config cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
|
||||
KASSERT(p6_pcpu[cpu] != NULL, ("[p6,%d] null per-cpu %d", __LINE__,
|
||||
cpu));
|
||||
@ -508,7 +508,7 @@ p6_allocate_pmc(int cpu, int ri, struct pmc *pm,
|
||||
|
||||
pd = &p6_pmcdesc[ri];
|
||||
|
||||
PMCDBG(MDP,ALL,1, "p6-allocate ri=%d class=%d pmccaps=0x%x "
|
||||
PMCDBG4(MDP,ALL,1, "p6-allocate ri=%d class=%d pmccaps=0x%x "
|
||||
"reqcaps=0x%x", ri, pd->pm_descr.pd_class, pd->pm_descr.pd_caps,
|
||||
pm->pm_caps);
|
||||
|
||||
@ -579,7 +579,7 @@ p6_allocate_pmc(int cpu, int ri, struct pmc *pm,
|
||||
|
||||
pm->pm_md.pm_ppro.pm_ppro_evsel = config;
|
||||
|
||||
PMCDBG(MDP,ALL,2, "p6-allocate config=0x%x", config);
|
||||
PMCDBG1(MDP,ALL,2, "p6-allocate config=0x%x", config);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -589,7 +589,7 @@ p6_release_pmc(int cpu, int ri, struct pmc *pm)
|
||||
{
|
||||
(void) pm;
|
||||
|
||||
PMCDBG(MDP,REL,1, "p6-release cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
PMCDBG3(MDP,REL,1, "p6-release cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[p6,%d] illegal CPU value %d", __LINE__, cpu));
|
||||
@ -623,11 +623,11 @@ p6_start_pmc(int cpu, int ri)
|
||||
("[p6,%d] starting cpu%d,ri%d with no pmc configured",
|
||||
__LINE__, cpu, ri));
|
||||
|
||||
PMCDBG(MDP,STA,1, "p6-start cpu=%d ri=%d", cpu, ri);
|
||||
PMCDBG2(MDP,STA,1, "p6-start cpu=%d ri=%d", cpu, ri);
|
||||
|
||||
config = pm->pm_md.pm_ppro.pm_ppro_evsel;
|
||||
|
||||
PMCDBG(MDP,STA,2, "p6-start/2 cpu=%d ri=%d evselmsr=0x%x config=0x%x",
|
||||
PMCDBG4(MDP,STA,2, "p6-start/2 cpu=%d ri=%d evselmsr=0x%x config=0x%x",
|
||||
cpu, ri, pd->pm_evsel_msr, config);
|
||||
|
||||
P6_MARK_STARTED(pc, ri);
|
||||
@ -658,14 +658,14 @@ p6_stop_pmc(int cpu, int ri)
|
||||
("[p6,%d] cpu%d ri%d no configured PMC to stop", __LINE__,
|
||||
cpu, ri));
|
||||
|
||||
PMCDBG(MDP,STO,1, "p6-stop cpu=%d ri=%d", cpu, ri);
|
||||
PMCDBG2(MDP,STO,1, "p6-stop cpu=%d ri=%d", cpu, ri);
|
||||
|
||||
wrmsr(pd->pm_evsel_msr, 0); /* stop hw */
|
||||
P6_MARK_STOPPED(pc, ri); /* update software state */
|
||||
|
||||
P6_SYNC_CTR_STATE(pc); /* restart CTR1 if need be */
|
||||
|
||||
PMCDBG(MDP,STO,2, "p6-stop/2 cpu=%d ri=%d", cpu, ri);
|
||||
PMCDBG2(MDP,STO,2, "p6-stop/2 cpu=%d ri=%d", cpu, ri);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -788,7 +788,7 @@ pmc_p6_initialize(struct pmc_mdep *md, int ncpus)
|
||||
KASSERT(cpu_vendor_id == CPU_VENDOR_INTEL,
|
||||
("[p6,%d] Initializing non-intel processor", __LINE__));
|
||||
|
||||
PMCDBG(MDP,INI,1, "%s", "p6-initialize");
|
||||
PMCDBG0(MDP,INI,1, "p6-initialize");
|
||||
|
||||
/* Allocate space for pointers to per-cpu descriptors. */
|
||||
p6_pcpu = malloc(sizeof(struct p6_cpu **) * ncpus, M_PMC,
|
||||
|
@ -136,7 +136,7 @@ soft_config_pmc(int cpu, int ri, struct pmc *pm)
|
||||
{
|
||||
struct pmc_hw *phw;
|
||||
|
||||
PMCDBG(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
PMCDBG3(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[soft,%d] illegal CPU value %d", __LINE__, cpu));
|
||||
@ -276,7 +276,7 @@ soft_read_pmc(int cpu, int ri, pmc_value_t *v)
|
||||
KASSERT(pm != NULL,
|
||||
("[soft,%d] no owner for PHW [cpu%d,pmc%d]", __LINE__, cpu, ri));
|
||||
|
||||
PMCDBG(MDP,REA,1,"soft-read id=%d", ri);
|
||||
PMCDBG1(MDP,REA,1,"soft-read id=%d", ri);
|
||||
|
||||
*v = soft_pcpu[cpu]->soft_values[ri];
|
||||
|
||||
@ -300,7 +300,7 @@ soft_write_pmc(int cpu, int ri, pmc_value_t v)
|
||||
KASSERT(pm,
|
||||
("[soft,%d] cpu %d ri %d pmc not configured", __LINE__, cpu, ri));
|
||||
|
||||
PMCDBG(MDP,WRI,1, "soft-write cpu=%d ri=%d v=%jx", cpu, ri, v);
|
||||
PMCDBG3(MDP,WRI,1, "soft-write cpu=%d ri=%d v=%jx", cpu, ri, v);
|
||||
|
||||
soft_pcpu[cpu]->soft_values[ri] = v;
|
||||
|
||||
|
@ -99,7 +99,7 @@ tsc_config_pmc(int cpu, int ri, struct pmc *pm)
|
||||
{
|
||||
struct pmc_hw *phw;
|
||||
|
||||
PMCDBG(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
PMCDBG3(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[tsc,%d] illegal CPU value %d", __LINE__, cpu));
|
||||
@ -253,7 +253,7 @@ tsc_read_pmc(int cpu, int ri, pmc_value_t *v)
|
||||
KASSERT(mode == PMC_MODE_SC,
|
||||
("[tsc,%d] illegal pmc mode %d", __LINE__, mode));
|
||||
|
||||
PMCDBG(MDP,REA,1,"tsc-read id=%d", ri);
|
||||
PMCDBG1(MDP,REA,1,"tsc-read id=%d", ri);
|
||||
|
||||
*v = rdtsc();
|
||||
|
||||
|
@ -101,7 +101,7 @@ uncore_pcpu_init(struct pmc_mdep *md, int cpu)
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[ucf,%d] insane cpu number %d", __LINE__, cpu));
|
||||
|
||||
PMCDBG(MDP,INI,1,"uncore-init cpu=%d", cpu);
|
||||
PMCDBG1(MDP,INI,1,"uncore-init cpu=%d", cpu);
|
||||
|
||||
uncore_ri = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_UCP].pcd_ri;
|
||||
npmc = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_UCP].pcd_num;
|
||||
@ -137,7 +137,7 @@ uncore_pcpu_fini(struct pmc_mdep *md, int cpu)
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[uncore,%d] insane cpu number (%d)", __LINE__, cpu));
|
||||
|
||||
PMCDBG(MDP,INI,1,"uncore-pcpu-fini cpu=%d", cpu);
|
||||
PMCDBG1(MDP,INI,1,"uncore-pcpu-fini cpu=%d", cpu);
|
||||
|
||||
if ((cc = uncore_pcpu[cpu]) == NULL)
|
||||
return (0);
|
||||
@ -193,7 +193,7 @@ ucf_allocate_pmc(int cpu, int ri, struct pmc *pm,
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[uncore,%d] illegal CPU %d", __LINE__, cpu));
|
||||
|
||||
PMCDBG(MDP,ALL,1, "ucf-allocate ri=%d reqcaps=0x%x", ri, pm->pm_caps);
|
||||
PMCDBG2(MDP,ALL,1, "ucf-allocate ri=%d reqcaps=0x%x", ri, pm->pm_caps);
|
||||
|
||||
if (ri < 0 || ri > uncore_ucf_npmc)
|
||||
return (EINVAL);
|
||||
@ -212,7 +212,7 @@ ucf_allocate_pmc(int cpu, int ri, struct pmc *pm,
|
||||
|
||||
pm->pm_md.pm_ucf.pm_ucf_ctrl = (flags << (ri * 4));
|
||||
|
||||
PMCDBG(MDP,ALL,2, "ucf-allocate config=0x%jx",
|
||||
PMCDBG1(MDP,ALL,2, "ucf-allocate config=0x%jx",
|
||||
(uintmax_t) pm->pm_md.pm_ucf.pm_ucf_ctrl);
|
||||
|
||||
return (0);
|
||||
@ -227,7 +227,7 @@ ucf_config_pmc(int cpu, int ri, struct pmc *pm)
|
||||
KASSERT(ri >= 0 && ri < uncore_ucf_npmc,
|
||||
("[uncore,%d] illegal row-index %d", __LINE__, ri));
|
||||
|
||||
PMCDBG(MDP,CFG,1, "ucf-config cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
PMCDBG3(MDP,CFG,1, "ucf-config cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
|
||||
KASSERT(uncore_pcpu[cpu] != NULL, ("[uncore,%d] null per-cpu %d", __LINE__,
|
||||
cpu));
|
||||
@ -296,7 +296,7 @@ ucf_read_pmc(int cpu, int ri, pmc_value_t *v)
|
||||
else
|
||||
*v = tmp;
|
||||
|
||||
PMCDBG(MDP,REA,1, "ucf-read cpu=%d ri=%d -> v=%jx", cpu, ri, *v);
|
||||
PMCDBG3(MDP,REA,1, "ucf-read cpu=%d ri=%d -> v=%jx", cpu, ri, *v);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -304,7 +304,7 @@ ucf_read_pmc(int cpu, int ri, pmc_value_t *v)
|
||||
static int
|
||||
ucf_release_pmc(int cpu, int ri, struct pmc *pmc)
|
||||
{
|
||||
PMCDBG(MDP,REL,1, "ucf-release cpu=%d ri=%d pm=%p", cpu, ri, pmc);
|
||||
PMCDBG3(MDP,REL,1, "ucf-release cpu=%d ri=%d pm=%p", cpu, ri, pmc);
|
||||
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[uncore,%d] illegal CPU value %d", __LINE__, cpu));
|
||||
@ -328,7 +328,7 @@ ucf_start_pmc(int cpu, int ri)
|
||||
KASSERT(ri >= 0 && ri < uncore_ucf_npmc,
|
||||
("[uncore,%d] illegal row-index %d", __LINE__, ri));
|
||||
|
||||
PMCDBG(MDP,STA,1,"ucf-start cpu=%d ri=%d", cpu, ri);
|
||||
PMCDBG2(MDP,STA,1,"ucf-start cpu=%d ri=%d", cpu, ri);
|
||||
|
||||
ucfc = uncore_pcpu[cpu];
|
||||
pm = ucfc->pc_uncorepmcs[ri + uncore_ucf_ri].phw_pmc;
|
||||
@ -343,7 +343,7 @@ ucf_start_pmc(int cpu, int ri)
|
||||
wrmsr(UC_GLOBAL_CTRL, ucfc->pc_globalctrl);
|
||||
} while (ucfc->pc_resync != 0);
|
||||
|
||||
PMCDBG(MDP,STA,1,"ucfctrl=%x(%x) globalctrl=%jx(%jx)",
|
||||
PMCDBG4(MDP,STA,1,"ucfctrl=%x(%x) globalctrl=%jx(%jx)",
|
||||
ucfc->pc_ucfctrl, (uint32_t) rdmsr(UCF_CTRL),
|
||||
ucfc->pc_globalctrl, rdmsr(UC_GLOBAL_CTRL));
|
||||
|
||||
@ -356,7 +356,7 @@ ucf_stop_pmc(int cpu, int ri)
|
||||
uint32_t fc;
|
||||
struct uncore_cpu *ucfc;
|
||||
|
||||
PMCDBG(MDP,STO,1,"ucf-stop cpu=%d ri=%d", cpu, ri);
|
||||
PMCDBG2(MDP,STO,1,"ucf-stop cpu=%d ri=%d", cpu, ri);
|
||||
|
||||
ucfc = uncore_pcpu[cpu];
|
||||
|
||||
@ -369,7 +369,7 @@ ucf_stop_pmc(int cpu, int ri)
|
||||
|
||||
ucfc->pc_ucfctrl &= ~fc;
|
||||
|
||||
PMCDBG(MDP,STO,1,"ucf-stop ucfctrl=%x", ucfc->pc_ucfctrl);
|
||||
PMCDBG1(MDP,STO,1,"ucf-stop ucfctrl=%x", ucfc->pc_ucfctrl);
|
||||
wrmsr(UCF_CTRL, ucfc->pc_ucfctrl);
|
||||
|
||||
do {
|
||||
@ -378,7 +378,7 @@ ucf_stop_pmc(int cpu, int ri)
|
||||
wrmsr(UC_GLOBAL_CTRL, ucfc->pc_globalctrl);
|
||||
} while (ucfc->pc_resync != 0);
|
||||
|
||||
PMCDBG(MDP,STO,1,"ucfctrl=%x(%x) globalctrl=%jx(%jx)",
|
||||
PMCDBG4(MDP,STO,1,"ucfctrl=%x(%x) globalctrl=%jx(%jx)",
|
||||
ucfc->pc_ucfctrl, (uint32_t) rdmsr(UCF_CTRL),
|
||||
ucfc->pc_globalctrl, rdmsr(UC_GLOBAL_CTRL));
|
||||
|
||||
@ -409,7 +409,7 @@ ucf_write_pmc(int cpu, int ri, pmc_value_t v)
|
||||
wrmsr(UCF_CTR0 + ri, v);
|
||||
wrmsr(UCF_CTRL, cc->pc_ucfctrl);
|
||||
|
||||
PMCDBG(MDP,WRI,1, "ucf-write cpu=%d ri=%d v=%jx ucfctrl=%jx ",
|
||||
PMCDBG4(MDP,WRI,1, "ucf-write cpu=%d ri=%d v=%jx ucfctrl=%jx ",
|
||||
cpu, ri, v, (uintmax_t) rdmsr(UCF_CTRL));
|
||||
|
||||
return (0);
|
||||
@ -423,7 +423,7 @@ ucf_initialize(struct pmc_mdep *md, int maxcpu, int npmc, int pmcwidth)
|
||||
|
||||
KASSERT(md != NULL, ("[ucf,%d] md is NULL", __LINE__));
|
||||
|
||||
PMCDBG(MDP,INI,1, "%s", "ucf-initialize");
|
||||
PMCDBG0(MDP,INI,1, "ucf-initialize");
|
||||
|
||||
pcd = &md->pmd_classdep[PMC_MDEP_CLASS_INDEX_UCF];
|
||||
|
||||
@ -933,7 +933,7 @@ ucp_config_pmc(int cpu, int ri, struct pmc *pm)
|
||||
KASSERT(ri >= 0 && ri < uncore_ucp_npmc,
|
||||
("[uncore,%d] illegal row-index %d", __LINE__, ri));
|
||||
|
||||
PMCDBG(MDP,CFG,1, "ucp-config cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
PMCDBG3(MDP,CFG,1, "ucp-config cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
|
||||
KASSERT(uncore_pcpu[cpu] != NULL, ("[uncore,%d] null per-cpu %d", __LINE__,
|
||||
cpu));
|
||||
@ -1001,7 +1001,7 @@ ucp_read_pmc(int cpu, int ri, pmc_value_t *v)
|
||||
else
|
||||
*v = tmp;
|
||||
|
||||
PMCDBG(MDP,REA,1, "ucp-read cpu=%d ri=%d msr=0x%x -> v=%jx", cpu, ri,
|
||||
PMCDBG4(MDP,REA,1, "ucp-read cpu=%d ri=%d msr=0x%x -> v=%jx", cpu, ri,
|
||||
ri, *v);
|
||||
|
||||
return (0);
|
||||
@ -1012,7 +1012,7 @@ ucp_release_pmc(int cpu, int ri, struct pmc *pm)
|
||||
{
|
||||
(void) pm;
|
||||
|
||||
PMCDBG(MDP,REL,1, "ucp-release cpu=%d ri=%d pm=%p", cpu, ri,
|
||||
PMCDBG3(MDP,REL,1, "ucp-release cpu=%d ri=%d pm=%p", cpu, ri,
|
||||
pm);
|
||||
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
@ -1045,11 +1045,11 @@ ucp_start_pmc(int cpu, int ri)
|
||||
("[uncore,%d] starting cpu%d,ri%d with no pmc configured",
|
||||
__LINE__, cpu, ri));
|
||||
|
||||
PMCDBG(MDP,STA,1, "ucp-start cpu=%d ri=%d", cpu, ri);
|
||||
PMCDBG2(MDP,STA,1, "ucp-start cpu=%d ri=%d", cpu, ri);
|
||||
|
||||
evsel = pm->pm_md.pm_ucp.pm_ucp_evsel;
|
||||
|
||||
PMCDBG(MDP,STA,2,
|
||||
PMCDBG4(MDP,STA,2,
|
||||
"ucp-start/2 cpu=%d ri=%d evselmsr=0x%x evsel=0x%x",
|
||||
cpu, ri, SELECTSEL(uncore_cputype) + ri, evsel);
|
||||
|
||||
@ -1104,7 +1104,7 @@ ucp_stop_pmc(int cpu, int ri)
|
||||
("[uncore,%d] cpu%d ri%d no configured PMC to stop", __LINE__,
|
||||
cpu, ri));
|
||||
|
||||
PMCDBG(MDP,STO,1, "ucp-stop cpu=%d ri=%d", cpu, ri);
|
||||
PMCDBG2(MDP,STO,1, "ucp-stop cpu=%d ri=%d", cpu, ri);
|
||||
|
||||
/* stop hw. */
|
||||
wrmsr(SELECTSEL(uncore_cputype) + ri, 0);
|
||||
@ -1136,7 +1136,7 @@ ucp_write_pmc(int cpu, int ri, pmc_value_t v)
|
||||
("[uncore,%d] cpu%d ri%d no configured PMC to stop", __LINE__,
|
||||
cpu, ri));
|
||||
|
||||
PMCDBG(MDP,WRI,1, "ucp-write cpu=%d ri=%d msr=0x%x v=%jx", cpu, ri,
|
||||
PMCDBG4(MDP,WRI,1, "ucp-write cpu=%d ri=%d msr=0x%x v=%jx", cpu, ri,
|
||||
UCP_PMC0 + ri, v);
|
||||
|
||||
if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
|
||||
@ -1160,7 +1160,7 @@ ucp_initialize(struct pmc_mdep *md, int maxcpu, int npmc, int pmcwidth)
|
||||
|
||||
KASSERT(md != NULL, ("[ucp,%d] md is NULL", __LINE__));
|
||||
|
||||
PMCDBG(MDP,INI,1, "%s", "ucp-initialize");
|
||||
PMCDBG0(MDP,INI,1, "ucp-initialize");
|
||||
|
||||
pcd = &md->pmd_classdep[PMC_MDEP_CLASS_INDEX_UCP];
|
||||
|
||||
@ -1213,7 +1213,7 @@ pmc_uncore_initialize(struct pmc_mdep *md, int maxcpu)
|
||||
ucf_initialize(md, maxcpu, uncore_ucf_npmc, uncore_ucf_width);
|
||||
uncore_pmcmask |= ((1ULL << uncore_ucf_npmc) - 1) << SELECTOFF(uncore_cputype);
|
||||
|
||||
PMCDBG(MDP,INI,1,"uncore-init pmcmask=0x%jx ucfri=%d", uncore_pmcmask,
|
||||
PMCDBG2(MDP,INI,1,"uncore-init pmcmask=0x%jx ucfri=%d", uncore_pmcmask,
|
||||
uncore_ucf_ri);
|
||||
|
||||
uncore_pcpu = malloc(sizeof(*uncore_pcpu) * maxcpu, M_PMC,
|
||||
@ -1225,7 +1225,7 @@ pmc_uncore_initialize(struct pmc_mdep *md, int maxcpu)
|
||||
void
|
||||
pmc_uncore_finalize(struct pmc_mdep *md)
|
||||
{
|
||||
PMCDBG(MDP,INI,1, "%s", "uncore-finalize");
|
||||
PMCDBG0(MDP,INI,1, "uncore-finalize");
|
||||
|
||||
free(uncore_pcpu, M_PMC);
|
||||
uncore_pcpu = NULL;
|
||||
|
@ -277,7 +277,7 @@ xscale_allocate_pmc(int cpu, int ri, struct pmc *pm,
|
||||
return EINVAL;
|
||||
pm->pm_md.pm_xscale.pm_xscale_evsel = config;
|
||||
|
||||
PMCDBG(MDP,ALL,2,"xscale-allocate ri=%d -> config=0x%x", ri, config);
|
||||
PMCDBG2(MDP,ALL,2,"xscale-allocate ri=%d -> config=0x%x", ri, config);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -296,7 +296,7 @@ xscale_read_pmc(int cpu, int ri, pmc_value_t *v)
|
||||
|
||||
pm = xscale_pcpu[cpu]->pc_xscalepmcs[ri].phw_pmc;
|
||||
tmp = xscale_pmcn_read(ri);
|
||||
PMCDBG(MDP,REA,2,"xscale-read id=%d -> %jd", ri, tmp);
|
||||
PMCDBG2(MDP,REA,2,"xscale-read id=%d -> %jd", ri, tmp);
|
||||
if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
|
||||
*v = XSCALE_PERFCTR_VALUE_TO_RELOAD_COUNT(tmp);
|
||||
else
|
||||
@ -320,7 +320,7 @@ xscale_write_pmc(int cpu, int ri, pmc_value_t v)
|
||||
if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
|
||||
v = XSCALE_RELOAD_COUNT_TO_PERFCTR_VALUE(v);
|
||||
|
||||
PMCDBG(MDP,WRI,1,"xscale-write cpu=%d ri=%d v=%jx", cpu, ri, v);
|
||||
PMCDBG3(MDP,WRI,1,"xscale-write cpu=%d ri=%d v=%jx", cpu, ri, v);
|
||||
|
||||
xscale_pmcn_write(ri, v);
|
||||
|
||||
@ -332,7 +332,7 @@ xscale_config_pmc(int cpu, int ri, struct pmc *pm)
|
||||
{
|
||||
struct pmc_hw *phw;
|
||||
|
||||
PMCDBG(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
PMCDBG3(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
|
||||
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[xscale,%d] illegal CPU value %d", __LINE__, cpu));
|
||||
@ -568,7 +568,7 @@ xscale_pcpu_init(struct pmc_mdep *md, int cpu)
|
||||
|
||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
|
||||
("[xscale,%d] wrong cpu number %d", __LINE__, cpu));
|
||||
PMCDBG(MDP,INI,1,"xscale-init cpu=%d", cpu);
|
||||
PMCDBG1(MDP,INI,1,"xscale-init cpu=%d", cpu);
|
||||
|
||||
xscale_pcpu[cpu] = pac = malloc(sizeof(struct xscale_cpu), M_PMC,
|
||||
M_WAITOK|M_ZERO);
|
||||
@ -628,7 +628,7 @@ pmc_xscale_initialize()
|
||||
printf("%s: unknown XScale core generation\n", __func__);
|
||||
return (NULL);
|
||||
}
|
||||
PMCDBG(MDP,INI,1,"xscale-init npmcs=%d", xscale_npmcs);
|
||||
PMCDBG1(MDP,INI,1,"xscale-init npmcs=%d", xscale_npmcs);
|
||||
|
||||
/*
|
||||
* Allocate space for pointers to PMC HW descriptors and for
|
||||
|
@ -999,6 +999,7 @@ extern struct pmc_cpu **pmc_pcpu;
|
||||
extern struct pmc_op_getdriverstats pmc_stats;
|
||||
|
||||
#if defined(HWPMC_DEBUG)
|
||||
#include <sys/ktr.h>
|
||||
|
||||
/* debug flags, major flag groups */
|
||||
struct pmc_debugflags {
|
||||
@ -1015,12 +1016,40 @@ struct pmc_debugflags {
|
||||
|
||||
extern struct pmc_debugflags pmc_debugflags;
|
||||
|
||||
#define KTR_PMC KTR_SUBSYS
|
||||
|
||||
#define PMC_DEBUG_STRSIZE 128
|
||||
#define PMC_DEBUG_DEFAULT_FLAGS { 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
|
||||
#define PMCDBG(M,N,L,F,...) do { \
|
||||
#define PMCDBG0(M, N, L, F) do { \
|
||||
if (pmc_debugflags.pdb_ ## M & (1 << PMC_DEBUG_MIN_ ## N)) \
|
||||
printf(#M ":" #N ":" #L ": " F "\n", __VA_ARGS__); \
|
||||
CTR0(KTR_PMC, #M ":" #N ":" #L ": " F); \
|
||||
} while (0)
|
||||
#define PMCDBG1(M, N, L, F, p1) do { \
|
||||
if (pmc_debugflags.pdb_ ## M & (1 << PMC_DEBUG_MIN_ ## N)) \
|
||||
CTR1(KTR_PMC, #M ":" #N ":" #L ": " F, p1); \
|
||||
} while (0)
|
||||
#define PMCDBG2(M, N, L, F, p1, p2) do { \
|
||||
if (pmc_debugflags.pdb_ ## M & (1 << PMC_DEBUG_MIN_ ## N)) \
|
||||
CTR2(KTR_PMC, #M ":" #N ":" #L ": " F, p1, p2); \
|
||||
} while (0)
|
||||
#define PMCDBG3(M, N, L, F, p1, p2, p3) do { \
|
||||
if (pmc_debugflags.pdb_ ## M & (1 << PMC_DEBUG_MIN_ ## N)) \
|
||||
CTR3(KTR_PMC, #M ":" #N ":" #L ": " F, p1, p2, p3); \
|
||||
} while (0)
|
||||
#define PMCDBG4(M, N, L, F, p1, p2, p3, p4) do { \
|
||||
if (pmc_debugflags.pdb_ ## M & (1 << PMC_DEBUG_MIN_ ## N)) \
|
||||
CTR4(KTR_PMC, #M ":" #N ":" #L ": " F, p1, p2, p3, p4);\
|
||||
} while (0)
|
||||
#define PMCDBG5(M, N, L, F, p1, p2, p3, p4, p5) do { \
|
||||
if (pmc_debugflags.pdb_ ## M & (1 << PMC_DEBUG_MIN_ ## N)) \
|
||||
CTR5(KTR_PMC, #M ":" #N ":" #L ": " F, p1, p2, p3, p4, \
|
||||
p5); \
|
||||
} while (0)
|
||||
#define PMCDBG6(M, N, L, F, p1, p2, p3, p4, p5, p6) do { \
|
||||
if (pmc_debugflags.pdb_ ## M & (1 << PMC_DEBUG_MIN_ ## N)) \
|
||||
CTR6(KTR_PMC, #M ":" #N ":" #L ": " F, p1, p2, p3, p4, \
|
||||
p5, p6); \
|
||||
} while (0)
|
||||
|
||||
/* Major numbers */
|
||||
@ -1088,7 +1117,13 @@ extern struct pmc_debugflags pmc_debugflags;
|
||||
#define PMC_DEBUG_MIN_CLO 12 /* close */
|
||||
|
||||
#else
|
||||
#define PMCDBG(M,N,L,F,...) /* nothing */
|
||||
#define PMCDBG0(M, N, L, F) /* nothing */
|
||||
#define PMCDBG1(M, N, L, F, p1)
|
||||
#define PMCDBG2(M, N, L, F, p1, p2)
|
||||
#define PMCDBG3(M, N, L, F, p1, p2, p3)
|
||||
#define PMCDBG4(M, N, L, F, p1, p2, p3, p4)
|
||||
#define PMCDBG5(M, N, L, F, p1, p2, p3, p4, p5)
|
||||
#define PMCDBG6(M, N, L, F, p1, p2, p3, p4, p5, p6)
|
||||
#endif
|
||||
|
||||
/* declare a dedicated memory pool */
|
||||
|
Loading…
Reference in New Issue
Block a user