summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorjkoshy <jkoshy@FreeBSD.org>2008-12-13 13:07:12 +0000
committerjkoshy <jkoshy@FreeBSD.org>2008-12-13 13:07:12 +0000
commit57939c399f73afce189b6e3f815acf369c90e8f2 (patch)
tree83dc6754204d60ec20d93f42fd864d37290d194f /sys/i386
parenteea87ca93f64298bf448aef14d2833d79246936e (diff)
downloadFreeBSD-src-57939c399f73afce189b6e3f815acf369c90e8f2.zip
FreeBSD-src-57939c399f73afce189b6e3f815acf369c90e8f2.tar.gz
- Bug fix: prevent a thread from migrating between CPUs between the
time it is marked for user space callchain capture in the NMI handler and the time the callchain capture callback runs. - Improve code and control flow clarity by invoking hwpmc(4)'s user space callchain capture callback directly from low-level code. Reviewed by: jhb (kern/subr_trap.c) Testing (various patch revisions): gnn, Fabien Thomas <fabien dot thomas at netasq dot com>, Artem Belevich <artemb at gmail dot com>
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/exception.s11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/i386/i386/exception.s b/sys/i386/i386/exception.s
index 0ad2597..1451fa8 100644
--- a/sys/i386/i386/exception.s
+++ b/sys/i386/i386/exception.s
@@ -438,9 +438,18 @@ doreti_nmi:
iret
outofnmi:
/*
- * Clear interrupts and jump to AST handling code.
+ * Call the callchain capture hook after turning interrupts back on.
*/
+ movl pmc_hook,%ecx
+ orl %ecx,%ecx
+ jz doreti_exit
+ pushl %esp /* frame pointer */
+ pushl $PMC_FN_USER_CALLCHAIN /* command */
+ movl PCPU(CURTHREAD),%eax
+ pushl %eax /* curthread */
sti
+ call *%ecx
+ addl $12,%esp
jmp doreti_ast
ENTRY(end_exceptions)
#endif
OpenPOWER on IntegriCloud