hwpmc: remove stub pmd_switch_{in,out} methods

Most platforms (non-x86) don't require these methods and implement stub
versions. If we initialize the pmc_mdep structure to always point to the
generic versions, then we can purge the duplicate stubs.

Reviewed by:	jkoshy
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39913
This commit is contained in:
Mitchell Horne 2023-05-05 18:59:41 -03:00
parent 772b2dc3ab
commit fa88954fd8
4 changed files with 8 additions and 64 deletions

View File

@ -448,23 +448,6 @@ arm64_get_config(int cpu, int ri, struct pmc **ppm)
return (0);
}
/*
* XXX don't know what we should do here.
*/
static int
arm64_switch_in(struct pmc_cpu *pc, struct pmc_process *pp)
{
return (0);
}
static int
arm64_switch_out(struct pmc_cpu *pc, struct pmc_process *pp)
{
return (0);
}
static int
arm64_pcpu_init(struct pmc_mdep *md, int cpu)
{
@ -614,11 +597,8 @@ pmc_arm64_initialize(void)
pcd->pcd_stop_pmc = arm64_stop_pmc;
pcd->pcd_write_pmc = arm64_write_pmc;
pmc_mdep->pmd_intr = arm64_intr;
pmc_mdep->pmd_switch_in = arm64_switch_in;
pmc_mdep->pmd_switch_out = arm64_switch_out;
pmc_mdep->pmd_npmc += arm64_npmcs;
pmc_mdep->pmd_intr = arm64_intr;
pmc_mdep->pmd_npmc += arm64_npmcs;
#ifdef DEV_ACPI
if (pmc_cmn600_nclasses() > 0)

View File

@ -416,23 +416,6 @@ armv7_get_config(int cpu, int ri, struct pmc **ppm)
return 0;
}
/*
* XXX don't know what we should do here.
*/
static int
armv7_switch_in(struct pmc_cpu *pc, struct pmc_process *pp)
{
return 0;
}
static int
armv7_switch_out(struct pmc_cpu *pc, struct pmc_process *pp)
{
return 0;
}
static int
armv7_pcpu_init(struct pmc_mdep *md, int cpu)
{
@ -551,11 +534,8 @@ pmc_armv7_initialize(void)
pcd->pcd_stop_pmc = armv7_stop_pmc;
pcd->pcd_write_pmc = armv7_write_pmc;
pmc_mdep->pmd_intr = armv7_intr;
pmc_mdep->pmd_switch_in = armv7_switch_in;
pmc_mdep->pmd_switch_out = armv7_switch_out;
pmc_mdep->pmd_npmc += armv7_npmcs;
pmc_mdep->pmd_intr = armv7_intr;
pmc_mdep->pmd_npmc += armv7_npmcs;
return (pmc_mdep);
}

View File

@ -5453,6 +5453,10 @@ pmc_mdep_alloc(int nclasses)
sizeof(struct pmc_classdep), M_PMC, M_WAITOK|M_ZERO);
md->pmd_nclass = n;
/* Default methods */
md->pmd_switch_in = generic_switch_in;
md->pmd_switch_out = generic_switch_out;
/* Add base class. */
pmc_soft_initialize(md);
return md;
@ -5490,9 +5494,6 @@ pmc_generic_cpu_initialize(void)
md->pmd_cputype = PMC_CPU_GENERIC;
md->pmd_switch_in = generic_switch_in;
md->pmd_switch_out = generic_switch_out;
return (md);
}

View File

@ -105,20 +105,6 @@ pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples,
return (frames);
}
static int
powerpc_switch_in(struct pmc_cpu *pc, struct pmc_process *pp)
{
return (0);
}
static int
powerpc_switch_out(struct pmc_cpu *pc, struct pmc_process *pp)
{
return (0);
}
int
powerpc_describe(int cpu, int ri, struct pmc_info *pi, struct pmc **ppmc)
{
@ -564,9 +550,6 @@ pmc_md_initialize(void)
vers = mfpvr() >> 16;
pmc_mdep->pmd_switch_in = powerpc_switch_in;
pmc_mdep->pmd_switch_out = powerpc_switch_out;
switch (vers) {
case MPC7447A:
case MPC7448: