Author: luporl
Date: Tue Sep  1 11:30:39 2020
New Revision: 365032
URL: https://svnweb.freebsd.org/changeset/base/365032

Log:
  [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

Modified:
  head/sys/powerpc/powerpc/interrupt.c

Modified: head/sys/powerpc/powerpc/interrupt.c
==============================================================================
--- head/sys/powerpc/powerpc/interrupt.c        Tue Sep  1 11:02:43 2020        
(r365031)
+++ head/sys/powerpc/powerpc/interrupt.c        Tue Sep  1 11:30:39 2020        
(r365032)
@@ -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
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to