From owner-svn-src-all@FreeBSD.ORG Tue Dec 8 19:18:32 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87AC810656A6; Tue, 8 Dec 2009 19:18:32 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7639C8FC12; Tue, 8 Dec 2009 19:18:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB8JIWRT097455; Tue, 8 Dec 2009 19:18:32 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB8JIWv9097453; Tue, 8 Dec 2009 19:18:32 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <200912081918.nB8JIWv9097453@svn.freebsd.org> From: Fabien Thomas Date: Tue, 8 Dec 2009 19:18:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200271 - stable/7/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2009 19:18:32 -0000 Author: fabient Date: Tue Dec 8 19:18:32 2009 New Revision: 200271 URL: http://svn.freebsd.org/changeset/base/200271 Log: MFC 198464: Inform hwpmc(4) of a thread's impending demise prior to invoking sched_throw(). Modified: stable/7/sys/kern/kern_thread.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/kern_thread.c ============================================================================== --- stable/7/sys/kern/kern_thread.c Tue Dec 8 19:12:38 2009 (r200270) +++ stable/7/sys/kern/kern_thread.c Tue Dec 8 19:18:32 2009 (r200271) @@ -26,6 +26,8 @@ * DAMAGE. */ +#include "opt_hwpmc_hooks.h" + #include __FBSDID("$FreeBSD$"); @@ -44,6 +46,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef HWPMC_HOOKS +#include +#endif #include @@ -497,6 +502,14 @@ thread_exit(void) panic ("thread_exit: Last thread exiting on its own"); } } +#ifdef HWPMC_HOOKS + /* + * If this thread is part of a process that is being tracked by hwpmc(4), + * inform the module of the thread's impending exit. + */ + if (PMC_PROC_IS_USING_PMCS(td->td_proc)) + PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT); +#endif PROC_UNLOCK(p); thread_lock(td); /* Save our tick information with both the thread and proc locked */