Changeset View
Standalone View
sys/cddl/dev/fbt/fbt.c
Show First 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | static dtrace_pops_t fbt_pops = { | ||||
NULL, | NULL, | ||||
fbt_destroy | fbt_destroy | ||||
}; | }; | ||||
static struct cdev *fbt_cdev; | static struct cdev *fbt_cdev; | ||||
static int fbt_probetab_size; | static int fbt_probetab_size; | ||||
static int fbt_verbose = 0; | static int fbt_verbose = 0; | ||||
int | |||||
fbt_excluded(const char *name) | |||||
{ | |||||
if (strncmp(name, "dtrace_", 7) == 0 && | |||||
strncmp(name, "dtrace_safe_", 12) != 0) { | |||||
/* | |||||
* Anything beginning with "dtrace_" may be called | |||||
* from probe context unless it explicitly indicates | |||||
* that it won't be called from probe context by | |||||
* using the prefix "dtrace_safe_". | |||||
*/ | |||||
return (1); | |||||
} | |||||
/* Exclude some internal functions */ | |||||
if (name[0] == '_' && name[1] == '_') | |||||
emaste: A comment perhaps? | |||||
return (1); | |||||
/* | |||||
* When DTrace is built into the kernel we need to exclude | |||||
Not Done Inline ActionsHow about something like the following? When DTrace is built into the kernel we need to exclude the FBT functions from instrumentation. andrew: How about something like the following?
When DTrace is built into the kernel we need to… | |||||
* the FBT functions from instrumentation. | |||||
*/ | |||||
#ifndef _KLD_MODULE | |||||
Not Done Inline ActionsShould this be limited to arm/arm64, or apply to all archs? emaste: Should this be limited to arm/arm64, or apply to all archs? | |||||
Not Done Inline ActionsThis will apply to all archs. andrew: This will apply to all archs. | |||||
Not Done Inline ActionsThis isn't foolproof: what if one enables both fbt::systrace_probe:entry and a syscall probe? I think we've discussed this problem before, but there isn't an obvious/straightforward solution. It seems to me that fixing this properly will involve something along the lines of: identify object files we want to avoid tracing, modify the build to dump their symbols and generate a table that's linked into fbt.ko or the kernel, and use the table to do lookups in fbt_excluded(). I don't object to this change, but it doesn't seem like the right approach to me. Perhaps it should at least be conditionalized on #ifndef _KLD_MODULE? markj: This isn't foolproof: what if one enables both fbt::systrace_probe:entry and a syscall probe? | |||||
Not Done Inline Actions
Seems like that would be a reasonable interim solution. emaste: > Perhaps it should at least be conditionalized on #ifndef _KLD_MODULE?
Seems like that would… | |||||
if (strncmp(name, "fbt_", 4) == 0) | |||||
return (1); | |||||
#endif | |||||
return (0); | |||||
} | |||||
static void | static void | ||||
fbt_doubletrap(void) | fbt_doubletrap(void) | ||||
{ | { | ||||
fbt_probe_t *fbt; | fbt_probe_t *fbt; | ||||
int i; | int i; | ||||
for (i = 0; i < fbt_probetab_size; i++) { | for (i = 0; i < fbt_probetab_size; i++) { | ||||
fbt = fbt_probetab[i]; | fbt = fbt_probetab[i]; | ||||
▲ Show 20 Lines • Show All 1,018 Lines • Show Last 20 Lines |
A comment perhaps?