Hello dtrace gurus, Is it possible to put DTRACE_PROBEs in a driver attach routine, and expect to see them show up when running a dtrace script to trigger them (which incidentally causes the driver to be modload-ed)? I''m trying to change all of the funky con_log() calls in the mega_sas driver to use DTRACE_PROBEs, but I''m wondering if this will really work for attach. I do see the probes from other non-attach mega_sas function calls after the driver attaches, but not the probes from during megasas_attach. Maybe I need to retain the logging code for the attach/detach routines? I would appreciate your expert advice. Thanks, -Susan
On Tue, Sep 02, 2008 at 03:47:25PM -0700, Susan Scheufele wrote:> Hello dtrace gurus, > > Is it possible to put DTRACE_PROBEs in a driver attach routine, and > expect to see them show up when running a dtrace script to trigger them > (which incidentally causes the driver to be modload-ed)? > > I''m trying to change all of the funky con_log() calls in the mega_sas > driver to use DTRACE_PROBEs, but I''m wondering if this will really work > for attach. I do see the probes from other non-attach mega_sas function > calls after the driver attaches, but not the probes from during > megasas_attach. Maybe I need to retain the logging code for the > attach/detach routines?What version of Solaris is this? I believe they should show up; dtrace gets notification very early on (before _init is run)[1], which should cause the sdt probes to show up. What happens if you enable fbt::megasas_attach:entry? Cheers, - jonathan [1] Unfortunately, an old linker bug makes instrumenting _init and _fini impossible at the moment.
Hi Jonathan,
I am running snapshot 96. The boot drive is using the mpt driver.
And the same thing happens -- no output, although the driver has been
modloaded via running the dtrace command (and I did wait a bit before
typing <ctrl><c>).
dell690pr# modinfo | grep mpt
46 fffffffff7883000 3c768 169 1 mpt (MPT HBA Driver v1.144)
dell690pr# modinfo | grep mega
dell690pr# dtrace -n fbt:mega_sas:megasas_attach:entry''{
@[probefunc]=count(); }''
dtrace: description ''fbt:mega_sas:megasas_attach:entry''
matched 1 probe
^C
dell690pr# modinfo | grep mega
241 fffffffff8379000 7c10 211 1 mega_sas (LSIv1.26)
dell690pr#
Thanks,
-Susan
Jonathan Adams wrote:> On Tue, Sep 02, 2008 at 03:47:25PM -0700, Susan Scheufele wrote:
>> Hello dtrace gurus,
>>
>> Is it possible to put DTRACE_PROBEs in a driver attach routine, and
>> expect to see them show up when running a dtrace script to trigger them
>> (which incidentally causes the driver to be modload-ed)?
>>
>> I''m trying to change all of the funky con_log() calls in the
mega_sas
>> driver to use DTRACE_PROBEs, but I''m wondering if this will
really work
>> for attach. I do see the probes from other non-attach mega_sas
function
>> calls after the driver attaches, but not the probes from during
>> megasas_attach. Maybe I need to retain the logging code for the
>> attach/detach routines?
>
> What version of Solaris is this?
>
> I believe they should show up; dtrace gets notification very early on
(before
> _init is run)[1], which should cause the sdt probes to show up.
>
> What happens if you enable fbt::megasas_attach:entry?
>
> Cheers,
> - jonathan
>
> [1] Unfortunately, an old linker bug makes instrumenting _init and _fini
> impossible at the moment.
On Tue, Sep 02, 2008 at 04:31:18PM -0700, Susan Scheufele wrote:> Hi Jonathan, > > I am running snapshot 96. The boot drive is using the mpt driver. > And the same thing happens -- no output, although the driver has been > modloaded via running the dtrace command (and I did wait a bit before > typing <ctrl><c>). > > dell690pr# modinfo | grep mpt > 46 fffffffff7883000 3c768 169 1 mpt (MPT HBA Driver v1.144) > dell690pr# modinfo | grep mega > dell690pr# dtrace -n fbt:mega_sas:megasas_attach:entry''{ > @[probefunc]=count(); }'' > dtrace: description ''fbt:mega_sas:megasas_attach:entry'' matched 1 probe > ^C > > dell690pr# modinfo | grep mega > 241 fffffffff8379000 7c10 211 1 mega_sas (LSIv1.26) > dell690pr#Hrm; what about: # dtrace -Fn '' fbt:mega_sas::entry{} fbt:mega_sas::entry/count++ >= 60/{exit(0);} '' Cheers, - jonathan
Dtrace does not like your suggestion:
dell690pr# dtrace -Fn ''\
fbt:mega_sas::entry{}\
fbt:mega_sas::entry/count++ >= 60/{exit(0);}\
''
dtrace: invalid probe specifier
fbt:mega_sas::entry{}
fbt:mega_sas::entry/count++ >= 60/{exit(0);}
: in predicate: aggregating function ''count'' may not be
referenced as scalar
dell690pr#
but if you want to see some dtrace fbt probes that are not in attach, if
I run this command and then type "format" in a different window:
dell690pr# dtrace -n fbt:mega_sas::entry''{ @[probefunc]=count();
}''
dtrace: description ''fbt:mega_sas::entry'' matched 78 probes
^C
megasas_tran_setcap 12
megasas_dma_alloc 25
megasas_tran_destroy_pkt 29
megasas_tran_init_pkt 29
build_cmd 30
get_mfi_pkt 30
intr_ack_ppc 30
issue_cmd_ppc 30
megasas_isr 30
megasas_softintr 30
megasas_tran_start 30
mlist_add 30
mlist_add_tail 30
mlist_splice 30
return_mfi_pkt 30
megasas_tran_getcap 35
__list_add 60
__list_del 60
mlist_del_init 60
mlist_empty 60
megasas_tran_tgt_init 150
dell690pr#
-Susan
Jonathan Adams wrote:> On Tue, Sep 02, 2008 at 04:31:18PM -0700, Susan Scheufele wrote:
>> Hi Jonathan,
>>
>> I am running snapshot 96. The boot drive is using the mpt driver.
>> And the same thing happens -- no output, although the driver has been
>> modloaded via running the dtrace command (and I did wait a bit before
>> typing <ctrl><c>).
>>
>> dell690pr# modinfo | grep mpt
>> 46 fffffffff7883000 3c768 169 1 mpt (MPT HBA Driver v1.144)
>> dell690pr# modinfo | grep mega
>> dell690pr# dtrace -n fbt:mega_sas:megasas_attach:entry''{
>> @[probefunc]=count(); }''
>> dtrace: description
''fbt:mega_sas:megasas_attach:entry'' matched 1 probe
>> ^C
>>
>> dell690pr# modinfo | grep mega
>> 241 fffffffff8379000 7c10 211 1 mega_sas (LSIv1.26)
>> dell690pr#
>
> Hrm; what about:
>
> # dtrace -Fn ''
> fbt:mega_sas::entry{}
> fbt:mega_sas::entry/count++ >= 60/{exit(0);}
> ''
>
> Cheers,
> - jonathan
>