[PowerPC] Move pmc_hook out of critical section

Calling pmc_hook inside a critical section may result in a panic.

This happens when the user callchain is fetched, because it uses
pmap_map_user_ptr, that tries to get the (sleepable) pmap lock when the
needed vsid is not found.

Judging by the implementation in other platforms, intr_irq_handler in
kern/subr_intr.c and what pmc_hook do, it seems safe to move pmc_hook
outside the critical section.

Sponsored by:	Eldorado Research Institute (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D26111
This commit is contained in:
Leandro Lupori 2020-09-01 11:30:39 +00:00
parent 21f81763b3
commit 9b23e3845b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=365032

View File

@ -118,9 +118,9 @@ powerpc_interrupt(struct trapframe *framep)
critical_enter();
KASSERT(pmc_intr != NULL, ("Performance exception, but no handler!"));
(*pmc_intr)(framep);
critical_exit();
if (pmc_hook && (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN))
pmc_hook(PCPU_GET(curthread), PMC_FN_USER_CALLCHAIN, framep);
critical_exit();
break;
#endif