Move PMC hook invocation to cpu_intr. The idea is the same as with ast()
call but there is no reason to implement it in assembler.
This commit is contained in:
parent
a4b7818ee6
commit
a5fbfee1d0
@ -348,7 +348,6 @@ apb_filter(void *arg)
|
|||||||
uint32_t reg, irq;
|
uint32_t reg, irq;
|
||||||
struct thread *td;
|
struct thread *td;
|
||||||
struct trapframe *tf;
|
struct trapframe *tf;
|
||||||
register_t s;
|
|
||||||
|
|
||||||
reg = ATH_READ_REG(AR71XX_MISC_INTR_STATUS);
|
reg = ATH_READ_REG(AR71XX_MISC_INTR_STATUS);
|
||||||
for (irq = 0; irq < APB_NIRQS; irq++) {
|
for (irq = 0; irq < APB_NIRQS; irq++) {
|
||||||
@ -373,28 +372,12 @@ apb_filter(void *arg)
|
|||||||
td = PCPU_GET(curthread);
|
td = PCPU_GET(curthread);
|
||||||
tf = td->td_intr_frame;
|
tf = td->td_intr_frame;
|
||||||
|
|
||||||
s = intr_disable();
|
if (pmc_intr)
|
||||||
|
(*pmc_intr)(PCPU_GET(cpuid), tf);
|
||||||
|
|
||||||
mips_intrcnt_inc(sc->sc_intr_counter[irq]);
|
mips_intrcnt_inc(sc->sc_intr_counter[irq]);
|
||||||
|
|
||||||
if (pmc_intr) {
|
|
||||||
/*
|
|
||||||
* Make sure at least one of counters
|
|
||||||
* generated this interrupt
|
|
||||||
*/
|
|
||||||
if (!(*pmc_intr)(PCPU_GET(cpuid), tf)) {
|
|
||||||
intr_restore(s);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
intr_restore(s);
|
|
||||||
|
|
||||||
if (pmc_hook && (td->td_pflags & TDP_CALLCHAIN))
|
|
||||||
pmc_hook(PCPU_GET(curthread),
|
|
||||||
PMC_FN_USER_CALLCHAIN, tf);
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
/* Ignore timer interrupts */
|
/* Ignore timer interrupts */
|
||||||
if (irq != 0)
|
if (irq != 0)
|
||||||
|
@ -29,10 +29,14 @@
|
|||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__FBSDID("$FreeBSD$");
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
|
#include "opt_hwpmc_hooks.h"
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
#include <sys/bus.h>
|
#include <sys/bus.h>
|
||||||
#include <sys/interrupt.h>
|
#include <sys/interrupt.h>
|
||||||
|
#include <sys/pmc.h>
|
||||||
|
#include <sys/pmckern.h>
|
||||||
|
|
||||||
#include <machine/clock.h>
|
#include <machine/clock.h>
|
||||||
#include <machine/cpu.h>
|
#include <machine/cpu.h>
|
||||||
@ -266,4 +270,9 @@ cpu_intr(struct trapframe *tf)
|
|||||||
KASSERT(i == 0, ("all interrupts handled"));
|
KASSERT(i == 0, ("all interrupts handled"));
|
||||||
|
|
||||||
critical_exit();
|
critical_exit();
|
||||||
|
|
||||||
|
#ifdef HWPMC_HOOKS
|
||||||
|
if (pmc_hook && (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN))
|
||||||
|
pmc_hook(PCPU_GET(curthread), PMC_FN_USER_CALLCHAIN, tf);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user