Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sys/cddl/dev/dtrace/aarch64/dtrace_subr.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
extern dtrace_id_t dtrace_probeid_error;
extern int (*dtrace_invop_jump_addr)(struct trapframe *);
extern void dtrace_getnanotime(struct timespec *tsp);
extern void dtrace_getnanouptime(struct timespec *tsp);

int dtrace_invop(uintptr_t, struct trapframe *, uintptr_t);
void dtrace_invop_init(void);
Expand Down Expand Up @@ -163,7 +164,7 @@ dtrace_gethrtime()
{
struct timespec curtime;

nanouptime(&curtime);
dtrace_getnanouptime(&curtime);

return (curtime.tv_sec * 1000000000UL + curtime.tv_nsec);

Expand Down
3 changes: 2 additions & 1 deletion sys/cddl/dev/dtrace/arm/dtrace_subr.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
extern dtrace_id_t dtrace_probeid_error;
extern int (*dtrace_invop_jump_addr)(struct trapframe *);
extern void dtrace_getnanotime(struct timespec *tsp);
extern void dtrace_getnanouptime(struct timespec *tsp);

int dtrace_invop(uintptr_t, struct trapframe *, uintptr_t);
void dtrace_invop_init(void);
Expand Down Expand Up @@ -174,7 +175,7 @@ dtrace_gethrtime()
{
struct timespec curtime;

nanouptime(&curtime);
dtrace_getnanouptime(&curtime);

return (curtime.tv_sec * 1000000000UL + curtime.tv_nsec);

Expand Down
3 changes: 2 additions & 1 deletion sys/cddl/dev/dtrace/riscv/dtrace_subr.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
extern dtrace_id_t dtrace_probeid_error;
extern int (*dtrace_invop_jump_addr)(struct trapframe *);
extern void dtrace_getnanotime(struct timespec *tsp);
extern void dtrace_getnanouptime(struct timespec *tsp);

int dtrace_invop(uintptr_t, struct trapframe *);
void dtrace_invop_init(void);
Expand Down Expand Up @@ -165,7 +166,7 @@ dtrace_gethrtime()
{
struct timespec curtime;

nanouptime(&curtime);
dtrace_getnanouptime(&curtime);

return (curtime.tv_sec * 1000000000UL + curtime.tv_nsec);

Expand Down
26 changes: 26 additions & 0 deletions sys/cddl/dev/fbt/fbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ fbt_excluded(const char *name)
return (1);
}

/*
* Omit instrumentation of functions that are probably in DDB. It
* makes it too hard to debug broken FBT.
*/
if (strncmp(name, "db_", 3) == 0)
return (1);

/*
* Lock owner methods may be called from probe context.
*/
Expand All @@ -136,6 +143,15 @@ fbt_excluded(const char *name)
strcmp(name, "owner_sx") == 0)
return (1);

/*
* The compiler will sometimes replace memcpy()-like code with calls
* to memcpy() (or similar), which can occur in the DTrace code
* itself. For now, rather than prevent that in the build, just don't
* instrument at run time.
*/
if (strcmp(name, "memcpy") == 0)
return (1);

/*
* Stack unwinders may be called from probe context on some
* platforms.
Expand All @@ -145,6 +161,16 @@ fbt_excluded(const char *name)
return (1);
#endif

/*
* Some assembly-language exception handlers are not suitable for
* instrumentation.
*/
#if defined(__aarch64__)
if (strcmp(name, "handle_el1h_sync") == 0 ||
strcmp(name, "do_el1h_sync") == 0)
return (1);
#endif

/*
* When DTrace is built into the kernel we need to exclude
* the FBT functions from instrumentation.
Expand Down
15 changes: 15 additions & 0 deletions sys/kern/kern_tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ static void tc_windup(struct bintime *new_boottimebin);
static void cpu_tick_calibrate(int);

void dtrace_getnanotime(struct timespec *tsp);
void dtrace_getnanouptime(struct timespec *tsp);

static int
sysctl_kern_boottime(SYSCTL_HANDLER_ARGS)
Expand Down Expand Up @@ -997,6 +998,20 @@ dtrace_getnanotime(struct timespec *tsp)
GETTHMEMBER(tsp, th_nanotime);
}

/*
* This is a clone of getnanouptime used for time since boot.
* The dtrace_ prefix prevents fbt from creating probes for
* it so an uptime that can be safely used in all fbt probes.
*/
void
dtrace_getnanouptime(struct timespec *tsp)
{
struct bintime bt;

GETTHMEMBER(&bt, th_offset);
bintime2timespec(&bt, tsp);
}

/*
* System clock currently providing time to the system. Modifiable via sysctl
* when the FFCLOCK option is defined.
Expand Down