Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Jan 2014 04:16:45 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r260667 - stable/10/sys/powerpc/aim
Message-ID:  <201401150416.s0F4GjKQ034248@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhibbits
Date: Wed Jan 15 04:16:45 2014
New Revision: 260667
URL: http://svnweb.freebsd.org/changeset/base/260667

Log:
  MFC r256542,r256581
  
  Move the PMC handling to the first level interrupt handler where it belongs.
  Also add the pmc_hook use, to handle callchain tracing.

Modified:
  stable/10/sys/powerpc/aim/interrupt.c
  stable/10/sys/powerpc/aim/trap.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/powerpc/aim/interrupt.c
==============================================================================
--- stable/10/sys/powerpc/aim/interrupt.c	Wed Jan 15 03:57:41 2014	(r260666)
+++ stable/10/sys/powerpc/aim/interrupt.c	Wed Jan 15 04:16:45 2014	(r260667)
@@ -31,6 +31,8 @@
  * Interrupts are dispatched to here from locore asm
  */
 
+#include "opt_hwpmc_hooks.h"
+
 #include <sys/cdefs.h>                  /* RCS ID & Copyright macro defns */
 
 #include <sys/param.h>
@@ -43,6 +45,9 @@
 #include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/mutex.h>
+#ifdef HWPMC_HOOKS
+#include <sys/pmckern.h>
+#endif
 #include <sys/proc.h>
 #include <sys/smp.h>
 #include <sys/unistd.h>
@@ -96,6 +101,16 @@ powerpc_interrupt(struct trapframe *fram
 		atomic_subtract_int(&td->td_intr_nesting_level, 1);
 		critical_exit();
 		break;
+#ifdef HWPMC_HOOKS
+	case EXC_PERF:
+		critical_enter();
+		KASSERT(pmc_intr != NULL, ("Performance exception, but no handler!"));
+		(*pmc_intr)(PCPU_GET(cpuid), framep);
+		if (pmc_hook && (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN))
+			pmc_hook(PCPU_GET(curthread), PMC_FN_USER_CALLCHAIN, framep);
+		critical_exit();
+		break;
+#endif
 
 	default:
 		/* Re-enable interrupts if applicable. */

Modified: stable/10/sys/powerpc/aim/trap.c
==============================================================================
--- stable/10/sys/powerpc/aim/trap.c	Wed Jan 15 03:57:41 2014	(r260666)
+++ stable/10/sys/powerpc/aim/trap.c	Wed Jan 15 04:16:45 2014	(r260667)
@@ -34,7 +34,6 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include "opt_hwpmc_hooks.h"
 #include "opt_kdtrace.h"
 
 #include <sys/param.h>
@@ -52,9 +51,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/uio.h>
 #include <sys/signalvar.h>
 #include <sys/vmmeter.h>
-#ifdef HWPMC_HOOKS
-#include <sys/pmckern.h>
-#endif
 
 #include <security/audit/audit.h>
 
@@ -195,14 +191,6 @@ trap(struct trapframe *frame)
 	CTR3(KTR_TRAP, "trap: %s type=%s (%s)", td->td_name,
 	    trapname(type), user ? "user" : "kernel");
 
-#ifdef HWPMC_HOOKS
-	if (type == EXC_PERF && (pmc_intr != NULL)) {
-		(*pmc_intr)(PCPU_GET(cpuid), frame);
-		if (user)
-			userret(td, frame);
-		return;
-	}
-#endif
 #ifdef KDTRACE_HOOKS
 	/*
 	 * A trap can occur while DTrace executes a probe. Before
@@ -292,7 +280,7 @@ trap(struct trapframe *frame)
 		case EXC_PGM:
 			/* Identify the trap reason */
 			if (frame->srr1 & EXC_PGM_TRAP)
-				sig = SIGTRAP;
+ 				sig = SIGTRAP;
 			else if (ppc_instr_emulate(frame) == 0)
 				frame->srr0 += 4;
 			else



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