aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/sched_ule.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/sched_ule.c')
-rw-r--r--sys/kern/sched_ule.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index 508ec0ab97ec..409439ca34da 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -39,6 +39,7 @@
#include <sys/cdefs.h>
#include "opt_hwpmc_hooks.h"
+#include "opt_hwt_hooks.h"
#include "opt_sched.h"
#include <sys/param.h>
@@ -69,6 +70,10 @@
#include <sys/pmckern.h>
#endif
+#ifdef HWT_HOOKS
+#include <dev/hwt/hwt_hook.h>
+#endif
+
#ifdef KDTRACE_HOOKS
#include <sys/dtrace_bsd.h>
int __read_mostly dtrace_vtime_active;
@@ -2432,6 +2437,12 @@ sched_switch(struct thread *td, int flags)
if (dtrace_vtime_active)
(*dtrace_vtime_switch_func)(newtd);
#endif
+
+#ifdef HWT_HOOKS
+ HWT_CALL_HOOK(td, HWT_SWITCH_OUT, NULL);
+ HWT_CALL_HOOK(newtd, HWT_SWITCH_IN, NULL);
+#endif
+
td->td_oncpu = NOCPU;
cpu_switch(td, newtd, mtx);
cpuid = td->td_oncpu = PCPU_GET(cpuid);
@@ -3252,6 +3263,10 @@ sched_ap_entry(void)
newtd = sched_throw_grab(tdq);
+#ifdef HWT_HOOKS
+ HWT_CALL_HOOK(newtd, HWT_SWITCH_IN, NULL);
+#endif
+
/* doesn't return */
cpu_throw(NULL, newtd);
}
@@ -3278,6 +3293,10 @@ sched_throw(struct thread *td)
newtd = sched_throw_grab(tdq);
+#ifdef HWT_HOOKS
+ HWT_CALL_HOOK(newtd, HWT_SWITCH_IN, NULL);
+#endif
+
/* doesn't return */
cpu_switch(td, newtd, TDQ_LOCKPTR(tdq));
}