diff options
author | Matt Macy <mmacy@FreeBSD.org> | 2018-06-08 04:58:03 +0000 |
---|---|---|
committer | Matt Macy <mmacy@FreeBSD.org> | 2018-06-08 04:58:03 +0000 |
commit | eb7c901995d407fa177d99270a2684f844db3921 (patch) | |
tree | c79e0ccbd28364293728029537d164a76ebddd86 /sys/dev/hwpmc/hwpmc_armv7.c | |
parent | dfa5753e0937b7b5b249ce129036d10dbad78496 (diff) | |
download | src-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_armv7.c')
-rw-r--r-- | sys/dev/hwpmc/hwpmc_armv7.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/hwpmc/hwpmc_armv7.c b/sys/dev/hwpmc/hwpmc_armv7.c index 2b0f28f27691..0a601145f8de 100644 --- a/sys/dev/hwpmc/hwpmc_armv7.c +++ b/sys/dev/hwpmc/hwpmc_armv7.c @@ -307,18 +307,19 @@ armv7_release_pmc(int cpu, int ri, struct pmc *pmc) } static int -armv7_intr(int cpu, struct trapframe *tf) +armv7_intr(struct trapframe *tf) { struct armv7_cpu *pc; int retval, ri; struct pmc *pm; int error; - int reg; + int reg, cpu; KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[armv7,%d] CPU %d out of range", __LINE__, cpu)); retval = 0; + cpu = curcpu; pc = armv7_pcpu[cpu]; for (ri = 0; ri < armv7_npmcs; ri++) { @@ -348,8 +349,7 @@ armv7_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) armv7_stop_pmc(cpu, ri); |