git: fa88954fd8f1 - main - hwpmc: remove stub pmd_switch_{in,out} methods
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 06 May 2023 17:49:51 UTC
The branch main has been updated by mhorne:
URL: https://cgit.FreeBSD.org/src/commit/?id=fa88954fd8f16ef60084a73d446a23e791ed22e5
commit fa88954fd8f16ef60084a73d446a23e791ed22e5
Author: Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2023-05-05 21:59:41 +0000
Commit: Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2023-05-06 17:49:19 +0000
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
---
sys/dev/hwpmc/hwpmc_arm64.c | 24 ++----------------------
sys/dev/hwpmc/hwpmc_armv7.c | 24 ++----------------------
sys/dev/hwpmc/hwpmc_mod.c | 7 ++++---
sys/dev/hwpmc/hwpmc_powerpc.c | 17 -----------------
4 files changed, 8 insertions(+), 64 deletions(-)
diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c
index baf05e52b42a..e3fefc96ff8f 100644
--- a/sys/dev/hwpmc/hwpmc_arm64.c
+++ b/sys/dev/hwpmc/hwpmc_arm64.c
@@ -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)
diff --git a/sys/dev/hwpmc/hwpmc_armv7.c b/sys/dev/hwpmc/hwpmc_armv7.c
index 34f3fd009c9d..526f9c59b4c8 100644
--- a/sys/dev/hwpmc/hwpmc_armv7.c
+++ b/sys/dev/hwpmc/hwpmc_armv7.c
@@ -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);
}
diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c
index d5de1874c59b..fd90e62e3f2c 100644
--- a/sys/dev/hwpmc/hwpmc_mod.c
+++ b/sys/dev/hwpmc/hwpmc_mod.c
@@ -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);
}
diff --git a/sys/dev/hwpmc/hwpmc_powerpc.c b/sys/dev/hwpmc/hwpmc_powerpc.c
index 3d65d8753fcb..e2ce979d0ba8 100644
--- a/sys/dev/hwpmc/hwpmc_powerpc.c
+++ b/sys/dev/hwpmc/hwpmc_powerpc.c
@@ -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: