summaryrefslogtreecommitdiffstats
path: root/sys/dev/hwpmc
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2008-10-23 15:53:51 +0000
committerdes <des@FreeBSD.org>2008-10-23 15:53:51 +0000
commit66f807ed8b3634dc73d9f7526c484e43f094c0ee (patch)
tree21e792ce590e1bcf9b343890605a1b4c6a9016b3 /sys/dev/hwpmc
parenta779c60ce0a41cd14710a8a12cfa22955108b27a (diff)
downloadFreeBSD-src-66f807ed8b3634dc73d9f7526c484e43f094c0ee.zip
FreeBSD-src-66f807ed8b3634dc73d9f7526c484e43f094c0ee.tar.gz
Retire the MALLOC and FREE macros. They are an abomination unto style(9).
MFC after: 3 months
Diffstat (limited to 'sys/dev/hwpmc')
-rw-r--r--sys/dev/hwpmc/hwpmc_amd.c6
-rw-r--r--sys/dev/hwpmc/hwpmc_logging.c4
-rw-r--r--sys/dev/hwpmc/hwpmc_mod.c78
-rw-r--r--sys/dev/hwpmc/hwpmc_piv.c9
-rw-r--r--sys/dev/hwpmc/hwpmc_ppro.c4
-rw-r--r--sys/dev/hwpmc/hwpmc_x86.c4
6 files changed, 50 insertions, 55 deletions
diff --git a/sys/dev/hwpmc/hwpmc_amd.c b/sys/dev/hwpmc/hwpmc_amd.c
index 4477173..fd4c5bc 100644
--- a/sys/dev/hwpmc/hwpmc_amd.c
+++ b/sys/dev/hwpmc/hwpmc_amd.c
@@ -838,7 +838,7 @@ amd_init(int cpu)
PMCDBG(MDP,INI,1,"amd-init cpu=%d", cpu);
- MALLOC(pcs, struct amd_cpu *, sizeof(struct amd_cpu), M_PMC,
+ pcs = malloc(sizeof(struct amd_cpu), M_PMC,
M_WAITOK|M_ZERO);
phw = &pcs->pc_amdpmcs[0];
@@ -911,7 +911,7 @@ amd_cleanup(int cpu)
#endif
pmc_pcpu[cpu] = NULL;
- FREE(pcs, M_PMC);
+ free(pcs, M_PMC);
return 0;
}
@@ -960,7 +960,7 @@ pmc_amd_initialize(void)
amd_pmc_class = class;
#endif
- MALLOC(pmc_mdep, struct pmc_mdep *, sizeof(struct pmc_mdep),
+ pmc_mdep = malloc(sizeof(struct pmc_mdep),
M_PMC, M_WAITOK|M_ZERO);
pmc_mdep->pmd_cputype = cputype;
diff --git a/sys/dev/hwpmc/hwpmc_logging.c b/sys/dev/hwpmc/hwpmc_logging.c
index 77417af..8f1ca01 100644
--- a/sys/dev/hwpmc/hwpmc_logging.c
+++ b/sys/dev/hwpmc/hwpmc_logging.c
@@ -973,7 +973,7 @@ pmclog_initialize()
/* create global pool of log buffers */
for (n = 0; n < pmc_nlogbuffers; n++) {
- MALLOC(plb, struct pmclog_buffer *, 1024 * pmclog_buffer_size,
+ plb = malloc(1024 * pmclog_buffer_size,
M_PMC, M_ZERO|M_WAITOK);
PMCLOG_INIT_BUFFER_DESCRIPTOR(plb);
TAILQ_INSERT_HEAD(&pmc_bufferlist, plb, plb_next);
@@ -999,6 +999,6 @@ pmclog_shutdown()
while ((plb = TAILQ_FIRST(&pmc_bufferlist)) != NULL) {
TAILQ_REMOVE(&pmc_bufferlist, plb, plb_next);
- FREE(plb, M_PMC);
+ free(plb, M_PMC);
}
}
diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c
index dbf732b..3bda5ba 100644
--- a/sys/dev/hwpmc/hwpmc_mod.c
+++ b/sys/dev/hwpmc/hwpmc_mod.c
@@ -331,7 +331,7 @@ pmc_debugflags_parse(char *newstr, char *fence)
int error, found, *newbits, tmp;
size_t kwlen;
- MALLOC(tmpflags, struct pmc_debugflags *, sizeof(*tmpflags),
+ tmpflags = malloc(sizeof(*tmpflags),
M_PMC, M_WAITOK|M_ZERO);
p = newstr;
@@ -450,7 +450,7 @@ pmc_debugflags_parse(char *newstr, char *fence)
bcopy(tmpflags, &pmc_debugflags, sizeof(pmc_debugflags));
done:
- FREE(tmpflags, M_PMC);
+ free(tmpflags, M_PMC);
return error;
}
@@ -464,7 +464,7 @@ pmc_debugflags_sysctl_handler(SYSCTL_HANDLER_ARGS)
(void) arg1; (void) arg2; /* unused parameters */
n = sizeof(pmc_debugstr);
- MALLOC(newstr, char *, n, M_PMC, M_ZERO|M_WAITOK);
+ newstr = malloc(n, M_PMC, M_ZERO|M_WAITOK);
(void) strlcpy(newstr, pmc_debugstr, n);
error = sysctl_handle_string(oidp, newstr, n, req);
@@ -477,7 +477,7 @@ pmc_debugflags_sysctl_handler(SYSCTL_HANDLER_ARGS)
sizeof(pmc_debugstr));
}
- FREE(newstr, M_PMC);
+ free(newstr, M_PMC);
return error;
}
@@ -777,7 +777,7 @@ pmc_link_target_process(struct pmc *pm, struct pmc_process *pp)
__LINE__, pp, pm));
#endif
- MALLOC(pt, struct pmc_target *, sizeof(struct pmc_target),
+ pt = malloc(sizeof(struct pmc_target),
M_PMC, M_ZERO|M_WAITOK);
pt->pt_process = pp;
@@ -849,7 +849,7 @@ pmc_unlink_target_process(struct pmc *pm, struct pmc_process *pp)
"in pmc %p", __LINE__, pp->pp_proc, pp, pm));
LIST_REMOVE(ptgt, pt_next);
- FREE(ptgt, M_PMC);
+ free(ptgt, M_PMC);
/* if the PMC now lacks targets, send the owner a SIGIO */
if (LIST_EMPTY(&pm->pm_targets)) {
@@ -972,7 +972,7 @@ pmc_attach_one_process(struct proc *p, struct pmc *pm)
} else
pmclog_process_pmcattach(pm, p->p_pid, fullpath);
if (freepath)
- FREE(freepath, M_TEMP);
+ free(freepath, M_TEMP);
if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
pmc_log_process_mappings(pm->pm_owner, p);
}
@@ -1093,7 +1093,7 @@ pmc_detach_one_process(struct proc *p, struct pmc *pm, int flags)
pmc_remove_process_descriptor(pp);
if (flags & PMC_FLAG_REMOVE)
- FREE(pp, M_PMC);
+ free(pp, M_PMC);
PROC_LOCK(p);
p->p_flag &= ~P_HWPMC;
@@ -1511,7 +1511,7 @@ pmc_process_mmap(struct thread *td, struct pmckern_map_in *pkm)
done:
if (freepath)
- FREE(freepath, M_TEMP);
+ free(freepath, M_TEMP);
}
@@ -1575,7 +1575,7 @@ pmc_log_kernel_mappings(struct pmc *pm)
pmclog_process_map_in(po, (pid_t) -1, km->pm_address,
km->pm_file);
}
- FREE(kmbase, M_LINKER);
+ free(kmbase, M_LINKER);
po->po_flags |= PMC_PO_INITIAL_MAPPINGS_DONE;
}
@@ -1692,7 +1692,7 @@ pmc_hook_handler(struct thread *td, int function, void *arg)
if (!is_using_hwpmcs) {
if (freepath)
- FREE(freepath, M_TEMP);
+ free(freepath, M_TEMP);
break;
}
@@ -1712,7 +1712,7 @@ pmc_hook_handler(struct thread *td, int function, void *arg)
*/
if ((pp = pmc_find_process_descriptor(p, 0)) == NULL) {
if (freepath)
- FREE(freepath, M_TEMP);
+ free(freepath, M_TEMP);
break;
}
@@ -1732,7 +1732,7 @@ pmc_hook_handler(struct thread *td, int function, void *arg)
}
if (freepath)
- FREE(freepath, M_TEMP);
+ free(freepath, M_TEMP);
PMCDBG(PRC,EXC,1, "exec proc=%p (%d, %s) cred-changed=%d",
@@ -1765,7 +1765,7 @@ pmc_hook_handler(struct thread *td, int function, void *arg)
if (pp->pp_refcnt == 0) {
pmc_remove_process_descriptor(pp);
- FREE(pp, M_PMC);
+ free(pp, M_PMC);
break;
}
@@ -1861,7 +1861,7 @@ pmc_allocate_owner_descriptor(struct proc *p)
poh = &pmc_ownerhash[hindex];
/* allocate space for N pointers and one descriptor struct */
- MALLOC(po, struct pmc_owner *, sizeof(struct pmc_owner),
+ po = malloc(sizeof(struct pmc_owner),
M_PMC, M_ZERO|M_WAITOK);
po->po_sscount = po->po_error = po->po_flags = 0;
@@ -1888,7 +1888,7 @@ pmc_destroy_owner_descriptor(struct pmc_owner *po)
po, po->po_owner, po->po_owner->p_pid, po->po_owner->p_comm);
mtx_destroy(&po->po_mtx);
- FREE(po, M_PMC);
+ free(po, M_PMC);
}
/*
@@ -1915,8 +1915,7 @@ pmc_find_process_descriptor(struct proc *p, uint32_t mode)
if (mode & PMC_FLAG_ALLOCATE) {
/* allocate additional space for 'n' pmc pointers */
- MALLOC(ppnew, struct pmc_process *,
- sizeof(struct pmc_process) + md->pmd_npmc *
+ ppnew = malloc( sizeof(struct pmc_process) + md->pmd_npmc *
sizeof(struct pmc_targetstate), M_PMC, M_ZERO|M_WAITOK);
}
@@ -1938,7 +1937,7 @@ pmc_find_process_descriptor(struct proc *p, uint32_t mode)
mtx_unlock_spin(&pmc_processhash_mtx);
if (pp != NULL && ppnew != NULL)
- FREE(ppnew, M_PMC);
+ free(ppnew, M_PMC);
return pp;
}
@@ -1997,7 +1996,7 @@ pmc_allocate_pmc_descriptor(void)
{
struct pmc *pmc;
- MALLOC(pmc, struct pmc *, sizeof(struct pmc), M_PMC, M_ZERO|M_WAITOK);
+ pmc = malloc(sizeof(struct pmc), M_PMC, M_ZERO|M_WAITOK);
if (pmc != NULL) {
pmc->pm_owner = NULL;
@@ -2187,7 +2186,7 @@ pmc_release_pmc_descriptor(struct pmc *pm)
if (pp->pp_refcnt == 0) {
pmc_remove_process_descriptor(pp);
- FREE(pp, M_PMC);
+ free(pp, M_PMC);
}
}
@@ -2819,7 +2818,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
npmc = md->pmd_npmc;
pmcinfo_size = npmc * sizeof(struct pmc_info);
- MALLOC(pmcinfo, struct pmc_info *, pmcinfo_size, M_PMC,
+ pmcinfo = malloc(pmcinfo_size, M_PMC,
M_WAITOK);
p = pmcinfo;
@@ -2863,7 +2862,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
if (error == 0)
error = copyout(pmcinfo, &gpi->pm_pmcs, pmcinfo_size);
- FREE(pmcinfo, M_PMC);
+ free(pmcinfo, M_PMC);
}
break;
@@ -3127,7 +3126,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
if (n == (int) md->pmd_npmc) {
pmc_destroy_pmc_descriptor(pmc);
- FREE(pmc, M_PMC);
+ free(pmc, M_PMC);
pmc = NULL;
error = EINVAL;
break;
@@ -3162,7 +3161,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
(error = md->pmd_config_pmc(cpu, n, pmc)) != 0) {
(void) md->pmd_release_pmc(cpu, n, pmc);
pmc_destroy_pmc_descriptor(pmc);
- FREE(pmc, M_PMC);
+ free(pmc, M_PMC);
pmc = NULL;
pmc_restore_cpu_binding(&pb);
error = EPERM;
@@ -3190,7 +3189,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
if ((error =
pmc_register_owner(curthread->td_proc, pmc)) != 0) {
pmc_release_pmc_descriptor(pmc);
- FREE(pmc, M_PMC);
+ free(pmc, M_PMC);
pmc = NULL;
break;
}
@@ -3432,7 +3431,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
pmc_release_pmc_descriptor(pm);
pmc_maybe_remove_owner(po);
- FREE(pm, M_PMC);
+ free(pm, M_PMC);
}
break;
@@ -4167,7 +4166,7 @@ pmc_process_exit(void *arg __unused, struct proc *p)
pmclog_process_procexit(pm, pp);
pmc_unlink_target_process(pm, pp);
}
- FREE(pp, M_PMC);
+ free(pp, M_PMC);
} else
critical_exit(); /* pp == NULL */
@@ -4353,12 +4352,11 @@ pmc_initialize(void)
maxcpu = pmc_cpu_max();
/* allocate space for the per-cpu array */
- MALLOC(pmc_pcpu, struct pmc_cpu **, maxcpu * sizeof(struct pmc_cpu *),
+ pmc_pcpu = malloc(maxcpu * sizeof(struct pmc_cpu *),
M_PMC, M_WAITOK|M_ZERO);
/* per-cpu 'saved values' for managing process-mode PMCs */
- MALLOC(pmc_pcpu_saved, pmc_value_t *,
- sizeof(pmc_value_t) * maxcpu * md->pmd_npmc, M_PMC, M_WAITOK);
+ pmc_pcpu_saved = malloc( sizeof(pmc_value_t) * maxcpu * md->pmd_npmc, M_PMC, M_WAITOK);
/* Perform CPU-dependent initialization. */
pmc_save_cpu_binding(&pb);
@@ -4378,8 +4376,7 @@ pmc_initialize(void)
for (cpu = 0; cpu < maxcpu; cpu++) {
if (!pmc_cpu_is_active(cpu))
continue;
- MALLOC(sb, struct pmc_samplebuffer *,
- sizeof(struct pmc_samplebuffer) +
+ sb = malloc( sizeof(struct pmc_samplebuffer) +
pmc_nsamples * sizeof(struct pmc_sample), M_PMC,
M_WAITOK|M_ZERO);
@@ -4388,8 +4385,7 @@ pmc_initialize(void)
KASSERT(pmc_pcpu[cpu] != NULL,
("[pmc,%d] cpu=%d Null per-cpu data", __LINE__, cpu));
- MALLOC(sb->ps_callchains, uintptr_t *,
- pmc_callchaindepth * pmc_nsamples * sizeof(uintptr_t),
+ sb->ps_callchains = malloc( pmc_callchaindepth * pmc_nsamples * sizeof(uintptr_t),
M_PMC, M_WAITOK|M_ZERO);
for (n = 0, ps = sb->ps_samples; n < pmc_nsamples; n++, ps++)
@@ -4554,8 +4550,8 @@ pmc_cleanup(void)
KASSERT(pmc_pcpu[cpu]->pc_sb != NULL,
("[pmc,%d] Null cpu sample buffer cpu=%d", __LINE__,
cpu));
- FREE(pmc_pcpu[cpu]->pc_sb->ps_callchains, M_PMC);
- FREE(pmc_pcpu[cpu]->pc_sb, M_PMC);
+ free(pmc_pcpu[cpu]->pc_sb->ps_callchains, M_PMC);
+ free(pmc_pcpu[cpu]->pc_sb, M_PMC);
pmc_pcpu[cpu]->pc_sb = NULL;
}
@@ -4572,20 +4568,20 @@ pmc_cleanup(void)
if (md->pmd_cleanup)
md->pmd_cleanup(cpu);
}
- FREE(md, M_PMC);
+ free(md, M_PMC);
md = NULL;
pmc_restore_cpu_binding(&pb);
}
/* deallocate per-cpu structures */
- FREE(pmc_pcpu, M_PMC);
+ free(pmc_pcpu, M_PMC);
pmc_pcpu = NULL;
- FREE(pmc_pcpu_saved, M_PMC);
+ free(pmc_pcpu_saved, M_PMC);
pmc_pcpu_saved = NULL;
if (pmc_pmcdisp) {
- FREE(pmc_pmcdisp, M_PMC);
+ free(pmc_pmcdisp, M_PMC);
pmc_pmcdisp = NULL;
}
diff --git a/sys/dev/hwpmc/hwpmc_piv.c b/sys/dev/hwpmc/hwpmc_piv.c
index 5a22cc9..01de68c 100644
--- a/sys/dev/hwpmc/hwpmc_piv.c
+++ b/sys/dev/hwpmc/hwpmc_piv.c
@@ -628,8 +628,7 @@ p4_init(int cpu)
if (pcs == NULL) /* decline to init */
return ENXIO;
- MALLOC(plcs, struct p4_logicalcpu *,
- sizeof(struct p4_logicalcpu), M_PMC, M_WAITOK|M_ZERO);
+ plcs = malloc( sizeof(struct p4_logicalcpu), M_PMC, M_WAITOK|M_ZERO);
/* The TSC is architectural state and is not shared */
plcs->pc_hwpmcs[0] = &plcs->pc_tsc;
@@ -645,7 +644,7 @@ p4_init(int cpu)
return 0;
}
- MALLOC(pcs, struct p4_cpu *, sizeof(struct p4_cpu), M_PMC,
+ pcs = malloc(sizeof(struct p4_cpu), M_PMC,
M_WAITOK|M_ZERO);
if (pcs == NULL)
@@ -699,7 +698,7 @@ p4_cleanup(int cpu)
if (!P4_CPU_IS_HTT_SECONDARY(cpu))
mtx_destroy(&pcs->pc_mtx);
- FREE(pcs, M_PMC);
+ free(pcs, M_PMC);
pmc_pcpu[cpu] = NULL;
@@ -1081,7 +1080,7 @@ p4_allocate_pmc(int cpu, int ri, struct pmc *pm,
/*
* If the system has HTT enabled, and the desired allocation
* mode is process-private, and the PMC row disposition is not
- * FREE (0), decline the allocation.
+ * free (0), decline the allocation.
*/
if (p4_system_has_htt &&
diff --git a/sys/dev/hwpmc/hwpmc_ppro.c b/sys/dev/hwpmc/hwpmc_ppro.c
index 9289e90..fc40e19 100644
--- a/sys/dev/hwpmc/hwpmc_ppro.c
+++ b/sys/dev/hwpmc/hwpmc_ppro.c
@@ -349,7 +349,7 @@ p6_init(int cpu)
PMCDBG(MDP,INI,0,"p6-init cpu=%d", cpu);
- MALLOC(pcs, struct p6_cpu *, sizeof(struct p6_cpu), M_PMC,
+ pcs = malloc(sizeof(struct p6_cpu), M_PMC,
M_WAITOK|M_ZERO);
phw = pcs->pc_p6pmcs;
@@ -380,7 +380,7 @@ p6_cleanup(int cpu)
PMCDBG(MDP,INI,0,"p6-cleanup cpu=%d", cpu);
if ((pcs = pmc_pcpu[cpu]) != NULL)
- FREE(pcs, M_PMC);
+ free(pcs, M_PMC);
pmc_pcpu[cpu] = NULL;
return 0;
diff --git a/sys/dev/hwpmc/hwpmc_x86.c b/sys/dev/hwpmc/hwpmc_x86.c
index 8720c0e..66bf8dd 100644
--- a/sys/dev/hwpmc/hwpmc_x86.c
+++ b/sys/dev/hwpmc/hwpmc_x86.c
@@ -293,7 +293,7 @@ pmc_intel_initialize(void)
return NULL;
}
- MALLOC(pmc_mdep, struct pmc_mdep *, sizeof(struct pmc_mdep),
+ pmc_mdep = malloc(sizeof(struct pmc_mdep),
M_PMC, M_WAITOK|M_ZERO);
pmc_mdep->pmd_cputype = cputype;
@@ -346,7 +346,7 @@ pmc_intel_initialize(void)
}
if (error) {
- FREE(pmc_mdep, M_PMC);
+ free(pmc_mdep, M_PMC);
pmc_mdep = NULL;
}
OpenPOWER on IntegriCloud