diff options
author | jkoshy <jkoshy@FreeBSD.org> | 2009-10-25 04:34:47 +0000 |
---|---|---|
committer | jkoshy <jkoshy@FreeBSD.org> | 2009-10-25 04:34:47 +0000 |
commit | 3ea92572021d963ee1df65e032ceeba2d34f4607 (patch) | |
tree | dbaafc73654e70983c9028cf91838a5dc8251eb0 | |
parent | b4400267f9f6362457f90fba5085a278079cf29d (diff) | |
download | FreeBSD-src-3ea92572021d963ee1df65e032ceeba2d34f4607.zip FreeBSD-src-3ea92572021d963ee1df65e032ceeba2d34f4607.tar.gz |
Inform hwpmc(4) of a thread's impending demise prior to invoking sched_throw().
Debugging help: fabient
Review and testing by: fabient
-rw-r--r-- | sys/kern/kern_thread.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 4f3b32c..9be4c2f3e 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -27,6 +27,7 @@ */ #include "opt_witness.h" +#include "opt_hwpmc_hooks.h" #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); @@ -47,6 +48,9 @@ __FBSDID("$FreeBSD$"); #include <sys/ktr.h> #include <sys/umtx.h> #include <sys/cpuset.h> +#ifdef HWPMC_HOOKS +#include <sys/pmckern.h> +#endif #include <security/audit/audit.h> @@ -417,6 +421,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 */ |