From owner-svn-src-head@FreeBSD.ORG Tue Oct 15 14:52:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id BDBF280; Tue, 15 Oct 2013 14:52:45 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9219C2B1A; Tue, 15 Oct 2013 14:52:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9FEqjuJ078167; Tue, 15 Oct 2013 14:52:45 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9FEqj7e078165; Tue, 15 Oct 2013 14:52:45 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201310151452.r9FEqj7e078165@svn.freebsd.org> From: Justin Hibbits Date: Tue, 15 Oct 2013 14:52:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r256542 - head/sys/powerpc/aim X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2013 14:52:45 -0000 Author: jhibbits Date: Tue Oct 15 14:52:44 2013 New Revision: 256542 URL: http://svnweb.freebsd.org/changeset/base/256542 Log: Move the PMC handling to the first level interrupt handler where it belongs. Also add the pmc_hook use, to handle callchain tracing. MFC after: 1 week Modified: head/sys/powerpc/aim/interrupt.c head/sys/powerpc/aim/trap.c Modified: head/sys/powerpc/aim/interrupt.c ============================================================================== --- head/sys/powerpc/aim/interrupt.c Tue Oct 15 14:46:37 2013 (r256541) +++ head/sys/powerpc/aim/interrupt.c Tue Oct 15 14:52:44 2013 (r256542) @@ -31,6 +31,8 @@ * Interrupts are dispatched to here from locore asm */ +#include "opt_hwpmc_hooks.h" + #include /* RCS ID & Copyright macro defns */ #include @@ -43,6 +45,9 @@ #include #include #include +#ifdef HWPMC_HOOKS +#include +#endif #include #include #include @@ -96,6 +101,17 @@ powerpc_interrupt(struct trapframe *fram atomic_subtract_int(&td->td_intr_nesting_level, 1); critical_exit(); break; + case EXC_PERF: + critical_enter(); + KASSERT(pmc_intr != NULL, ("Performance exception, but no handler!")); + (*pmc_intr)(PCPU_GET(cpuid), framep); + critical_enter(); +#ifdef HWPMC_HOOKS + if (pmc_hook && (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN)) + pmc_hook(PCPU_GET(curthread), PMC_FN_USER_CALLCHAIN, framep); +#endif + critical_exit(); + break; default: /* Re-enable interrupts if applicable. */ Modified: head/sys/powerpc/aim/trap.c ============================================================================== --- head/sys/powerpc/aim/trap.c Tue Oct 15 14:46:37 2013 (r256541) +++ head/sys/powerpc/aim/trap.c Tue Oct 15 14:52:44 2013 (r256542) @@ -34,7 +34,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_hwpmc_hooks.h" #include "opt_kdtrace.h" #include @@ -52,9 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef HWPMC_HOOKS -#include -#endif #include @@ -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