Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177555489
D61524.1794709240.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D61524.1794709240.diff
View Options
diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c
--- a/sys/compat/linux/linux_fork.c
+++ b/sys/compat/linux/linux_fork.c
@@ -28,10 +28,15 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "opt_hwpmc_hooks.h"
+
#include <sys/param.h>
#include <sys/ktr.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#ifdef HWPMC_HOOKS
+#include <sys/pmckern.h>
+#endif
#include <sys/proc.h>
#include <sys/ptrace.h>
#include <sys/racct.h>
@@ -318,6 +323,12 @@
if (p->p_ptevents & PTRACE_LWP)
newtd->td_dbgflags |= TDB_BORN;
PROC_UNLOCK(p);
+#ifdef HWPMC_HOOKS
+ if (PMC_PROC_IS_USING_PMCS(p))
+ PMC_CALL_HOOK(newtd, PMC_FN_THR_CREATE, NULL);
+ else if (PMC_SYSTEM_SAMPLING_ACTIVE())
+ PMC_CALL_HOOK_UNLOCKED(newtd, PMC_FN_THR_CREATE_LOG, NULL);
+#endif
tidhash_add(newtd);
diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c
--- a/sys/kern/kern_kthread.c
+++ b/sys/kern/kern_kthread.c
@@ -26,12 +26,17 @@
* SUCH DAMAGE.
*/
+#include "opt_hwpmc_hooks.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/cpuset.h>
#include <sys/kthread.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#ifdef HWPMC_HOOKS
+#include <sys/pmckern.h>
+#endif
#include <sys/proc.h>
#include <sys/resourcevar.h>
#include <sys/rwlock.h>
@@ -329,8 +334,10 @@
/* Avoid inheriting affinity from a random parent. */
cpuset_kernthread(newtd);
#ifdef HWPMC_HOOKS
- if (PMC_SYSTEM_SAMPLING_ACTIVE())
- PMC_CALL_HOOK_UNLOCKED(td, PMC_FN_THR_CREATE_LOG, NULL);
+ if (PMC_PROC_IS_USING_PMCS(p))
+ PMC_CALL_HOOK(newtd, PMC_FN_THR_CREATE, NULL);
+ else if (PMC_SYSTEM_SAMPLING_ACTIVE())
+ PMC_CALL_HOOK_UNLOCKED(newtd, PMC_FN_THR_CREATE_LOG, NULL);
#endif
/* Delay putting it on the run queue until now. */
if ((flags & RFSTOPPED) == 0) {
@@ -366,10 +373,6 @@
td = curthread;
p = td->td_proc;
-#ifdef HWPMC_HOOKS
- if (PMC_SYSTEM_SAMPLING_ACTIVE())
- PMC_CALL_HOOK_UNLOCKED(td, PMC_FN_THR_EXIT_LOG, NULL);
-#endif
/* A module may be waiting for us to exit. */
wakeup(td);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 15, 2:20 AM (15 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41734296
Default Alt Text
D61524.1794709240.diff (2 KB)
Attached To
Mode
D61524: hwpmc: call the thread-create hook for Linux and kernel threads
Attached
Detach File
Event Timeline