svn commit: r282658 - in head/sys: dev/hwpmc sys

John Baldwin jhb at FreeBSD.org
Fri May 8 19:40:03 UTC 2015


Author: jhb
Date: Fri May  8 19:40:00 2015
New Revision: 282658
URL: https://svnweb.freebsd.org/changeset/base/282658

Log:
  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.

Modified:
  head/sys/dev/hwpmc/hwpmc_amd.c
  head/sys/dev/hwpmc/hwpmc_core.c
  head/sys/dev/hwpmc/hwpmc_intel.c
  head/sys/dev/hwpmc/hwpmc_logging.c
  head/sys/dev/hwpmc/hwpmc_mips.c
  head/sys/dev/hwpmc/hwpmc_mips24k.c
  head/sys/dev/hwpmc/hwpmc_mod.c
  head/sys/dev/hwpmc/hwpmc_mpc7xxx.c
  head/sys/dev/hwpmc/hwpmc_octeon.c
  head/sys/dev/hwpmc/hwpmc_piv.c
  head/sys/dev/hwpmc/hwpmc_ppc970.c
  head/sys/dev/hwpmc/hwpmc_ppro.c
  head/sys/dev/hwpmc/hwpmc_soft.c
  head/sys/dev/hwpmc/hwpmc_tsc.c
  head/sys/dev/hwpmc/hwpmc_uncore.c
  head/sys/dev/hwpmc/hwpmc_xscale.c
  head/sys/sys/pmc.h

Modified: head/sys/dev/hwpmc/hwpmc_amd.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_amd.c	Fri May  8 19:17:38 2015	(r282657)
+++ head/sys/dev/hwpmc/hwpmc_amd.c	Fri May  8 19:40:00 2015	(r282658)
@@ -282,7 +282,7 @@ 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	HWPMC_DEBUG
 	KASSERT(pd->pm_descr.pd_class == amd_pmc_class,
@@ -291,7 +291,7 @@ amd_read_pmc(int cpu, int ri, pmc_value_
 #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;
 }
@@ -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;
 }
@@ -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.
@@ -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: head/sys/dev/hwpmc/hwpmc_core.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_core.c	Fri May  8 19:17:38 2015	(r282657)
+++ head/sys/dev/hwpmc/hwpmc_core.c	Fri May  8 19:40:00 2015	(r282658)
@@ -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];
 
@@ -2289,7 +2289,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));
@@ -2368,7 +2368,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);
@@ -2379,7 +2379,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(),
@@ -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
 	    ("[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 
 
 	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,
 	    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,
 		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,
 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: head/sys/dev/hwpmc/hwpmc_intel.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_intel.c	Fri May  8 19:17:38 2015	(r282657)
+++ head/sys/dev/hwpmc/hwpmc_intel.c	Fri May  8 19:40:00 2015	(r282658)
@@ -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: head/sys/dev/hwpmc/hwpmc_logging.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_logging.c	Fri May  8 19:17:38 2015	(r282657)
+++ head/sys/dev/hwpmc/hwpmc_logging.c	Fri May  8 19:40:00 2015	(r282658)
@@ -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
 	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: head/sys/dev/hwpmc/hwpmc_mips.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_mips.c	Fri May  8 19:17:38 2015	(r282657)
+++ head/sys/dev/hwpmc/hwpmc_mips.c	Fri May  8 19:40:00 2015	(r282658)
@@ -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: head/sys/dev/hwpmc/hwpmc_mips24k.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_mips24k.c	Fri May  8 19:17:38 2015	(r282657)
+++ head/sys/dev/hwpmc/hwpmc_mips24k.c	Fri May  8 19:40:00 2015	(r282658)
@@ -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: head/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_mod.c	Fri May  8 19:17:38 2015	(r282657)
+++ head/sys/dev/hwpmc/hwpmc_mod.c	Fri May  8 19:40:00 2015	(r282658)
@@ -651,12 +651,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);
 }
 
 /*
@@ -666,7 +666,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)
@@ -674,7 +674,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");
 }
 
 /*
@@ -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, 
 
 	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
 
 	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
 		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, 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);
 
 	/*
@@ -1040,7 +1040,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);
 
 
@@ -1107,7 +1107,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)
@@ -1157,7 +1157,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)
@@ -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_owne
 	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_owne
 		 * 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 
 			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 pro
 	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 *p
 	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 *p
 			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 *p
 			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);
 

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


More information about the svn-src-all mailing list