]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
hwpmc: simplify calling convention for hwpmc interrupt handling
authormmacy <mmacy@FreeBSD.org>
Fri, 8 Jun 2018 04:58:03 +0000 (04:58 +0000)
committermmacy <mmacy@FreeBSD.org>
Fri, 8 Jun 2018 04:58:03 +0000 (04:58 +0000)
commit33d22ed3f88c08b2bfd647fa78700fd7ce7f9139
treec79e0ccbd28364293728029537d164a76ebddd86
parent5e26c51e6db17f5d99c2ed483f512ec5b1569bdd
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.
18 files changed:
sys/amd64/amd64/trap.c
sys/arm/arm/pmu.c
sys/dev/hwpmc/hwpmc_amd.c
sys/dev/hwpmc/hwpmc_arm64.c
sys/dev/hwpmc/hwpmc_armv7.c
sys/dev/hwpmc/hwpmc_core.c
sys/dev/hwpmc/hwpmc_mips.c
sys/dev/hwpmc/hwpmc_mod.c
sys/dev/hwpmc/hwpmc_mpc7xxx.c
sys/dev/hwpmc/hwpmc_ppc970.c
sys/dev/hwpmc/hwpmc_soft.c
sys/i386/i386/trap.c
sys/kern/kern_pmc.c
sys/mips/atheros/apb.c
sys/mips/cavium/octeon_pmc.c
sys/powerpc/powerpc/interrupt.c
sys/sys/pmc.h
sys/sys/pmckern.h