svn commit: r283884 - in stable/10/sys: conf dev/hwpmc sys

John Baldwin jhb at FreeBSD.org
Mon Jun 1 17:57:09 UTC 2015


Author: jhb
Date: Mon Jun  1 17:57:05 2015
New Revision: 283884
URL: https://svnweb.freebsd.org/changeset/base/283884

Log:
  MFC 282641,282658:
  - Move hwpmc(4) debugging code under a new HWPMC_DEBUG option instead of
    the broader DEBUG option.
  - Convert hwpmc(4) debug printfs over to KTR.
  
  Sponsored by:	Norse Corp, Inc.

Modified:
  stable/10/sys/conf/NOTES
  stable/10/sys/conf/options
  stable/10/sys/dev/hwpmc/hwpmc_amd.c
  stable/10/sys/dev/hwpmc/hwpmc_core.c
  stable/10/sys/dev/hwpmc/hwpmc_intel.c
  stable/10/sys/dev/hwpmc/hwpmc_logging.c
  stable/10/sys/dev/hwpmc/hwpmc_mips.c
  stable/10/sys/dev/hwpmc/hwpmc_mips24k.c
  stable/10/sys/dev/hwpmc/hwpmc_mod.c
  stable/10/sys/dev/hwpmc/hwpmc_mpc7xxx.c
  stable/10/sys/dev/hwpmc/hwpmc_octeon.c
  stable/10/sys/dev/hwpmc/hwpmc_piv.c
  stable/10/sys/dev/hwpmc/hwpmc_ppc970.c
  stable/10/sys/dev/hwpmc/hwpmc_ppro.c
  stable/10/sys/dev/hwpmc/hwpmc_soft.c
  stable/10/sys/dev/hwpmc/hwpmc_tsc.c
  stable/10/sys/dev/hwpmc/hwpmc_uncore.c
  stable/10/sys/dev/hwpmc/hwpmc_xscale.c
  stable/10/sys/sys/pmc.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/conf/NOTES
==============================================================================
--- stable/10/sys/conf/NOTES	Mon Jun  1 17:43:34 2015	(r283883)
+++ stable/10/sys/conf/NOTES	Mon Jun  1 17:57:05 2015	(r283884)
@@ -561,6 +561,7 @@ options 	STACK
 # please see hwpmc(4).
 
 device		hwpmc			# Driver (also a loadable module)
+options 	HWPMC_DEBUG
 options 	HWPMC_HOOKS		# Other necessary kernel hooks
 
 


Modified: stable/10/sys/conf/options
==============================================================================
--- stable/10/sys/conf/options	Mon Jun  1 17:43:34 2015	(r283883)
+++ stable/10/sys/conf/options	Mon Jun  1 17:57:05 2015	(r283884)
@@ -858,6 +858,7 @@ DCONS_FORCE_CONSOLE	opt_dcons.h
 DCONS_FORCE_GDB		opt_dcons.h
 
 # HWPMC options
+HWPMC_DEBUG		opt_global.h
 HWPMC_HOOKS
 HWPMC_MIPS_BACKTRACE 	opt_hwpmc_hooks.h
 

Modified: stable/10/sys/dev/hwpmc/hwpmc_amd.c
==============================================================================
--- stable/10/sys/dev/hwpmc/hwpmc_amd.c	Mon Jun  1 17:43:34 2015	(r283883)
+++ stable/10/sys/dev/hwpmc/hwpmc_amd.c	Mon Jun  1 17:57:05 2015	(r283884)
@@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$");
 #include <machine/md_var.h>
 #include <machine/specialreg.h>
 
-#ifdef	DEBUG
+#ifdef	HWPMC_DEBUG
 enum pmc_class	amd_pmc_class;
 #endif
 
@@ -282,16 +282,16 @@ amd_read_pmc(int cpu, int ri, pmc_value_
 
 	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	DEBUG
+#ifdef	HWPMC_DEBUG
 	KASSERT(pd->pm_descr.pd_class == amd_pmc_class,
 	    ("[amd,%d] unknown PMC class (%d)", __LINE__,
 		pd->pm_descr.pd_class));
 #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_
 	}
 	*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;
 }
@@ -329,7 +329,7 @@ amd_write_pmc(int cpu, int ri, pmc_value
 
 	mode = PMC_TO_MODE(pm);
 
-#ifdef	DEBUG
+#ifdef	HWPMC_DEBUG
 	KASSERT(pd->pm_descr.pd_class == amd_pmc_class,
 	    ("[amd,%d] unknown PMC class (%d)", __LINE__,
 		pd->pm_descr.pd_class));
@@ -339,7 +339,7 @@ amd_write_pmc(int cpu, int ri, pmc_value
 	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 p
 {
 	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
 {
 	(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, struc
 	(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
 
 	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
 
 	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;
 }
@@ -515,7 +515,7 @@ amd_allocate_pmc(int cpu, int ri, struct
 static int
 amd_release_pmc(int cpu, int ri, struct pmc *pmc)
 {
-#ifdef	DEBUG
+#ifdef	HWPMC_DEBUG
 	const struct amd_descr *pd;
 #endif
 	struct pmc_hw *phw;
@@ -532,7 +532,7 @@ amd_release_pmc(int cpu, int ri, struct 
 	KASSERT(phw->phw_pmc == NULL,
 	    ("[amd,%d] PHW pmc %p non-NULL", __LINE__, phw->phw_pmc));
 
-#ifdef	DEBUG
+#ifdef	HWPMC_DEBUG
 	pd = &amd_pmcdesc[ri];
 	if (pd->pm_descr.pd_class == amd_pmc_class)
 		KASSERT(AMD_PMC_IS_STOPPED(pd->pm_evsel),
@@ -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 c
 	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 c
 	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.
@@ -835,7 +835,7 @@ amd_pcpu_fini(struct pmc_mdep *md, int c
 
 	amd_pcpu[cpu] = NULL;
 
-#ifdef	DEBUG
+#ifdef	HWPMC_DEBUG
 	for (i = 0; i < AMD_NPMCS; i++) {
 		KASSERT(pac->pc_amdpmcs[i].phw_pmc == NULL,
 		    ("[amd,%d] CPU%d/PMC%d in use", __LINE__, cpu, i));
@@ -912,7 +912,7 @@ pmc_amd_initialize(void)
 		return NULL;
 	}
 
-#ifdef	DEBUG
+#ifdef	HWPMC_DEBUG
 	amd_pmc_class = class;
 #endif
 
@@ -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);
 

Modified: stable/10/sys/dev/hwpmc/hwpmc_core.c
==============================================================================
--- stable/10/sys/dev/hwpmc/hwpmc_core.c	Mon Jun  1 17:43:34 2015	(r283883)
+++ stable/10/sys/dev/hwpmc/hwpmc_core.c	Mon Jun  1 17:57:05 2015	(r283884)
@@ -123,7 +123,7 @@ core_pcpu_init(struct pmc_mdep *md, int 
 	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 
 	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
 	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
 
 	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 p
 	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_
 	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_
 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
 	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 
 
 	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];
 
@@ -2265,7 +2265,7 @@ iap_config_pmc(int cpu, int ri, struct p
 	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));
@@ -2344,7 +2344,7 @@ iap_read_pmc(int cpu, int ri, pmc_value_
 	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);
@@ -2355,7 +2355,7 @@ iap_release_pmc(int cpu, int ri, struct 
 {
 	(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(),
@@ -2388,11 +2388,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. */
@@ -2440,7 +2440,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 */
@@ -2477,7 +2477,7 @@ iap_write_pmc(int cpu, int ri, pmc_value
 	    ("[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)))
@@ -2502,7 +2502,7 @@ iap_initialize(struct pmc_mdep *md, int 
 
 	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;
@@ -2540,7 +2540,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;
@@ -2599,7 +2599,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));
 
 	/*
@@ -2611,7 +2611,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;
@@ -2657,7 +2657,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)));
 	}
 
@@ -2682,7 +2682,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. */
@@ -2692,14 +2692,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),
@@ -2724,7 +2724,7 @@ pmc_core_initialize(struct pmc_mdep *md,
 
 	ipa_version = cpuid[CORE_CPUID_EAX] & 0xFF;
 
-	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",
 	    md->pmd_cputype, maxcpu, ipa_version);
 
 	if (ipa_version < 1 || ipa_version > 3) {
@@ -2770,7 +2770,7 @@ pmc_core_initialize(struct pmc_mdep *md,
 		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(struct core_cpu **) * maxcpu, M_PMC,
@@ -2793,7 +2793,7 @@ pmc_core_initialize(struct pmc_mdep *md,
 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;

Modified: stable/10/sys/dev/hwpmc/hwpmc_intel.c
==============================================================================
--- stable/10/sys/dev/hwpmc/hwpmc_intel.c	Mon Jun  1 17:43:34 2015	(r283883)
+++ stable/10/sys/dev/hwpmc/hwpmc_intel.c	Mon Jun  1 17:57:05 2015	(r283884)
@@ -46,14 +46,14 @@ intel_switch_in(struct pmc_cpu *pc, stru
 {
 	(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, str
 	(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;

Modified: stable/10/sys/dev/hwpmc/hwpmc_logging.c
==============================================================================
--- stable/10/sys/dev/hwpmc/hwpmc_logging.c	Mon Jun  1 17:43:34 2015	(r283883)
+++ stable/10/sys/dev/hwpmc/hwpmc_logging.c	Mon Jun  1 17:57:05 2015	(r283884)
@@ -211,9 +211,9 @@ 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	DEBUG
+#ifdef	HWPMC_DEBUG
 	if (plb)
 		KASSERT(plb->plb_ptr == plb->plb_base &&
 		    plb->plb_base < plb->plb_fence,
@@ -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
 	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
 	 * 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 
 	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,
 	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 *p
 
 	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,
 	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,
 {
 	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, s
 	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
 {
 	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_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 
 {
 	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;
 

Modified: stable/10/sys/dev/hwpmc/hwpmc_mips.c
==============================================================================
--- stable/10/sys/dev/hwpmc/hwpmc_mips.c	Mon Jun  1 17:43:34 2015	(r283883)
+++ stable/10/sys/dev/hwpmc/hwpmc_mips.c	Mon Jun  1 17:57:05 2015	(r283884)
@@ -104,7 +104,7 @@ mips_allocate_pmc(int cpu, int ri, struc
 
 	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
 
 	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_valu
 	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 
 {
 	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 
 
 	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

Modified: stable/10/sys/dev/hwpmc/hwpmc_mips24k.c
==============================================================================
--- stable/10/sys/dev/hwpmc/hwpmc_mips24k.c	Mon Jun  1 17:43:34 2015	(r283883)
+++ stable/10/sys/dev/hwpmc/hwpmc_mips24k.c	Mon Jun  1 17:57:05 2015	(r283884)
@@ -223,7 +223,7 @@ mips_get_perfctl(int cpu, int ri, uint32
 	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);
 }

Modified: stable/10/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- stable/10/sys/dev/hwpmc/hwpmc_mod.c	Mon Jun  1 17:43:34 2015	(r283883)
+++ stable/10/sys/dev/hwpmc/hwpmc_mod.c	Mon Jun  1 17:57:05 2015	(r283884)
@@ -173,7 +173,7 @@ static struct pmc_classdep **pmc_rowinde
  * Prototypes
  */
 
-#ifdef	DEBUG
+#ifdef	HWPMC_DEBUG
 static int	pmc_debugflags_sysctl_handler(SYSCTL_HANDLER_ARGS);
 static int	pmc_debugflags_parse(char *newstr, char *fence);
 #endif
@@ -239,7 +239,7 @@ TUNABLE_INT(PMC_SYSCTL_NAME_PREFIX "call
 SYSCTL_INT(_kern_hwpmc, OID_AUTO, callchaindepth, CTLFLAG_TUN|CTLFLAG_RD,
     &pmc_callchaindepth, 0, "depth of call chain records");
 
-#ifdef	DEBUG
+#ifdef	HWPMC_DEBUG
 struct pmc_debugflags pmc_debugflags = PMC_DEBUG_DEFAULT_FLAGS;
 char	pmc_debugstr[PMC_DEBUG_STRSIZE];
 TUNABLE_STR(PMC_SYSCTL_NAME_PREFIX "debugflags", pmc_debugstr,
@@ -342,7 +342,7 @@ static moduledata_t pmc_mod = {
 DECLARE_MODULE(pmc, pmc_mod, SI_SUB_SMP, SI_ORDER_ANY);
 MODULE_VERSION(pmc, PMC_VERSION);
 
-#ifdef	DEBUG
+#ifdef	HWPMC_DEBUG
 enum pmc_dbgparse_state {
 	PMCDS_WS,		/* in whitespace */
 	PMCDS_MAJOR,		/* seen a major keyword */
@@ -656,12 +656,12 @@ pmc_ri_to_classdep(struct pmc_mdep *md, 
 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);
 }
 
 /*
@@ -671,7 +671,7 @@ pmc_save_cpu_binding(struct pmc_binding 
 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)
@@ -679,7 +679,7 @@ pmc_restore_cpu_binding(struct pmc_bindi
 	else
 		sched_unbind(curthread);
 	thread_unlock(curthread);
-	PMCDBG(CPU,BND,2, "%s", "restore-cpu done");
+	PMCDBG0(CPU,BND,2, "restore-cpu done");
 }
 
 /*
@@ -696,7 +696,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);
@@ -705,7 +705,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);
 }
 
 /*
@@ -747,14 +747,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));
 
@@ -780,7 +780,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
@@ -818,10 +818,10 @@ pmc_link_target_process(struct pmc *pm, 
 
 	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	DEBUG
+#ifdef	HWPMC_DEBUG
 	LIST_FOREACH(pt, &pm->pm_targets, pt_next)
 	    if (pt->pt_process == pp)
 		    KASSERT(0, ("[pmc,%d] pp %p already in pmc %p targets",
@@ -871,7 +871,7 @@ pmc_unlink_target_process(struct pmc *pm
 
 	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,
@@ -907,7 +907,7 @@ pmc_unlink_target_process(struct pmc *pm
 		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);
 	}
 }
@@ -980,7 +980,7 @@ pmc_attach_one_process(struct proc *p, s
 
 	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);
 
 	/*
@@ -1045,7 +1045,7 @@ pmc_attach_process(struct proc *p, struc
 
 	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);
 
 
@@ -1112,7 +1112,7 @@ pmc_detach_one_process(struct proc *p, s
 
 	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)
@@ -1162,7 +1162,7 @@ pmc_detach_process(struct proc *p, struc
 
 	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)
@@ -1233,7 +1233,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(),
@@ -1300,7 +1300,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);
@@ -1361,7 +1361,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(),
@@ -1423,7 +1423,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) {
@@ -1580,7 +1580,7 @@ pmc_log_kernel_mappings(struct pmc *pm)
 	 */
 	kmbase = linker_hwpmc_list_objects();
 	for (km = kmbase; km->pm_file != NULL; km++) {

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-stable-10 mailing list