svn commit: r300604 - head/sys/kern
Andrew Turner
andrew at FreeBSD.org
Tue May 24 12:06:58 UTC 2016
Author: andrew
Date: Tue May 24 12:06:56 2016
New Revision: 300604
URL: https://svnweb.freebsd.org/changeset/base/300604
Log:
Limit calling pmc_hook to when the interrupt comes while running userspace.
We may enable interrupts from within the callback, e.g. in a data abort
during copyin. If we receive an interrupt at that time pmc_hook will be
called again and, as it is handling userspace stack tracing, will hit a
KASSERT as it checks if the trapframe is from userland.
With this I can run hwpmc with intrng on a ThunderX and have it trace all
CPUs.
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation
Modified:
head/sys/kern/subr_intr.c
Modified: head/sys/kern/subr_intr.c
==============================================================================
--- head/sys/kern/subr_intr.c Tue May 24 11:47:14 2016 (r300603)
+++ head/sys/kern/subr_intr.c Tue May 24 12:06:56 2016 (r300604)
@@ -317,7 +317,8 @@ intr_irq_handler(struct trapframe *tf)
td->td_intr_frame = oldframe;
critical_exit();
#ifdef HWPMC_HOOKS
- if (pmc_hook && (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN))
+ if (pmc_hook && TRAPF_USERMODE(tf) &&
+ (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN))
pmc_hook(PCPU_GET(curthread), PMC_FN_USER_CALLCHAIN, tf);
#endif
}
More information about the svn-src-all
mailing list