Page MenuHomeFreeBSD

D61524.1794708951.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D61524.1794708951.diff

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

Mime Type
text/plain
Expires
Sun, Nov 15, 2:15 AM (14 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41734296
Default Alt Text
D61524.1794708951.diff (2 KB)

Event Timeline