summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_exec.c5
-rw-r--r--sys/kern/kern_pmc.c9
2 files changed, 11 insertions, 3 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 78d86ce..2a4c9ab 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -670,14 +670,15 @@ interpret:
#ifdef HWPMC_HOOKS
/*
- * Check if the process is using PMCs and if so do exec() time
+ * Check if system-wide sampling is in effect or if the
+ * current process is using PMCs. If so, do exec() time
* processing. This processing needs to happen AFTER the
* P_INEXEC flag is cleared.
*
* The proc lock needs to be released before taking the PMC
* SX.
*/
- if (PMC_PROC_IS_USING_PMCS(p)) {
+ if (PMC_SYSTEM_SAMPLING_ACTIVE() || PMC_PROC_IS_USING_PMCS(p)) {
PROC_UNLOCK(p);
PMC_CALL_HOOK_X(td, PMC_FN_PROCESS_EXEC,
(void *) &credential_changing);
diff --git a/sys/kern/kern_pmc.c b/sys/kern/kern_pmc.c
index ee0f8ec..43059cc 100644
--- a/sys/kern/kern_pmc.c
+++ b/sys/kern/kern_pmc.c
@@ -37,7 +37,14 @@ int (*pmc_hook)(struct thread *td, int function, void *arg) = NULL;
/* Interrupt handler */
int (*pmc_intr)(int cpu, uintptr_t pc, int usermode) = NULL;
-cpumask_t pmc_cpumask;
+volatile cpumask_t pmc_cpumask;
+
+/*
+ * A global count of SS mode PMCs. When non-zero, this means that
+ * we have processes that are sampling the system as a whole.
+ */
+
+volatile int pmc_ss_count;
/*
* Since PMC(4) may not be loaded in the current kernel, the
OpenPOWER on IntegriCloud