git: 7d35b389729e - main - dtrace/profile: Set t_dtrace_trapframe for profile probes
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 07 Jan 2024 16:46:26 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=7d35b389729ef5a3efcac75ad265139ada3f8e69
commit 7d35b389729ef5a3efcac75ad265139ada3f8e69
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-01-07 16:35:06 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-01-07 16:46:13 +0000
dtrace/profile: Set t_dtrace_trapframe for profile probes
profile provider probes fire in the context of a timer interrupt. Thus,
the "regs" action can make use of the interrupt trap frame to get
register values when the interrupt happened in kernel mode. Make that
trap frame available when possible so that "regs" works more or less as
it already does with the fbt and kinst providers.
MFC after: 1 week
---
sys/cddl/dev/profile/profile.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sys/cddl/dev/profile/profile.c b/sys/cddl/dev/profile/profile.c
index 42753393a33d..677c7543795f 100644
--- a/sys/cddl/dev/profile/profile.c
+++ b/sys/cddl/dev/profile/profile.c
@@ -57,6 +57,8 @@
#include <sys/dtrace.h>
#include <sys/dtrace_bsd.h>
+#include <cddl/dev/dtrace/dtrace_cddl.h>
+
#define PROF_NAMELEN 15
#define PROF_PROFILE 0
@@ -245,12 +247,15 @@ profile_probe(profile_probe_t *prof, hrtime_t late)
if (frame != NULL) {
if (TRAPF_USERMODE(frame))
upc = TRAPF_PC(frame);
- else
+ else {
pc = TRAPF_PC(frame);
+ td->t_dtrace_trapframe = frame;
+ }
} else if (TD_IS_IDLETHREAD(td))
pc = (uintfptr_t)&cpu_idle;
dtrace_probe(prof->prof_id, pc, upc, late, 0, 0);
+ td->t_dtrace_trapframe = NULL;
}
static void