Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Sep 2020 11:30:39 +0000 (UTC)
From:      Leandro Lupori <luporl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r365032 - head/sys/powerpc/powerpc
Message-ID:  <202009011130.081BUdcs052315@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009011130.081BUdcs052315>