aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/hwpmc/hwpmc_arm64.c
diff options
context:
space:
mode:
authorMatt Macy <mmacy@FreeBSD.org>2018-06-08 04:58:03 +0000
committerMatt Macy <mmacy@FreeBSD.org>2018-06-08 04:58:03 +0000
commiteb7c901995d407fa177d99270a2684f844db3921 (patch)
treec79e0ccbd28364293728029537d164a76ebddd86 /sys/dev/hwpmc/hwpmc_arm64.c
parentdfa5753e0937b7b5b249ce129036d10dbad78496 (diff)
downloadsrc-eb7c901995d407fa177d99270a2684f844db3921.tar.gz
src-eb7c901995d407fa177d99270a2684f844db3921.zip
hwpmc: simplify calling convention for hwpmc interrupt handling
pmc_process_interrupt takes 5 arguments when only 3 are needed. cpu is always available in curcpu and inuserspace can always be derived from the passed trapframe. While facially a reasonable cleanup this change was motivated by the need to workaround a compiler bug. core2_intr(cpu, tf) -> pmc_process_interrupt(cpu, ring, pmc, tf, inuserspace) -> pmc_add_sample(cpu, ring, pm, tf, inuserspace) In the process of optimizing the tail call the tf pointer was getting clobbered: (kgdb) up at /storage/mmacy/devel/freebsd/sys/dev/hwpmc/hwpmc_mod.c:4709 4709 pmc_save_kernel_callchain(ps->ps_pc, (kgdb) up 1205 error = pmc_process_interrupt(cpu, PMC_HR, pm, tf, resulting in a crash in pmc_save_kernel_callchain.
Notes
Notes: svn path=/head/; revision=334827
Diffstat (limited to 'sys/dev/hwpmc/hwpmc_arm64.c')
-rw-r--r--sys/dev/hwpmc/hwpmc_arm64.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c
index 2e54e3870ba2..6fa319f99e82 100644
--- a/sys/dev/hwpmc/hwpmc_arm64.c
+++ b/sys/dev/hwpmc/hwpmc_arm64.c
@@ -323,18 +323,19 @@ arm64_release_pmc(int cpu, int ri, struct pmc *pmc)
}
static int
-arm64_intr(int cpu, struct trapframe *tf)
+arm64_intr(struct trapframe *tf)
{
struct arm64_cpu *pc;
int retval, ri;
struct pmc *pm;
int error;
- int reg;
+ int reg, cpu;
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
("[arm64,%d] CPU %d out of range", __LINE__, cpu));
retval = 0;
+ cpu = curcpu;
pc = arm64_pcpu[cpu];
for (ri = 0; ri < arm64_npmcs; ri++) {
@@ -357,8 +358,7 @@ arm64_intr(int cpu, struct trapframe *tf)
if (pm->pm_state != PMC_STATE_RUNNING)
continue;
- error = pmc_process_interrupt(cpu, PMC_HR, pm, tf,
- TRAPF_USERMODE(tf));
+ error = pmc_process_interrupt(PMC_HR, pm, tf);
if (error)
arm64_stop_pmc(cpu, ri);