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
This commit is contained in:
parent
b5994a5c26
commit
974692e3bf
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user