This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [Bug translator/1276] support more timer varieties


Roland McGrath wrote:
> the closest to "dangerous" places would be inside context switching
> and inside interrupt handling. 

In an effort to stress as many of these cases as I could think of, I
wrote the script included below.  I was unable to get this to fail, even
under heavy system load.  I did my testing on RHEL4U2 x86_64, on a P4
w/HT enabled.  My stress test was a full kernel build with 'make -j20',
while also interacting with the desktop (login/out of gdm, load
openoffice & firefox, etc.).

When I was writing the test script, I did find a couple of probes that
failed, but it was unrelated to "current" dereferencing.  I will follow
up in another email...

If anyone feels this is not representative, please let me know how I can
improve the test and/or load.

It may be a good idea to add this sort of test to the pass-5 suite.
Perhaps a new directory is needed - systemtap.stress?

Thanks,

Josh


current.stp
===================================================================
#!/usr/bin/stap -g

global length
function execlen:long () %{ THIS->__retvalue = strlen(current->comm); %}
probe begin { log("systemtap starting probe") }
probe
    timer.profile,
    kernel.function("__switch_to"),
    %( kernel_vr == "2.6.9-22.ELsmp" %?
       %( arch == "x86_64" %?
          /* the lines before, at, and after the update of pcurrent */
 
kernel.statement("__switch_to@arch/x86_64/kernel/process.c:508"),
 
kernel.statement("__switch_to@arch/x86_64/kernel/process.c:509"),
 
kernel.statement("__switch_to@arch/x86_64/kernel/process.c:510"),
       %)
    %)
    kernel.function("*@kernel/sched.c"),
    kernel.function("*@kernel/sched.c").return,
    module("*").function("*interrupt*"),
    module("*").function("*interrupt*").return
{ length <<< execlen() }
probe end {
    log("systemtap ending probe")
    printf("count=%d\n", @count(length))
    printf("sum=%d\n", @sum(length))
    printf("min=%d\n", @min(length))
    printf("max=%d\n", @max(length))
    printf("avg=%d\n", @avg(length))

    /*
     * Check that the min & max lengths look reasonable.  If any string
was
     * either empty or too big, then the current pointer probably wasn't
     * valid, even though it dereferenced without crashing.
     */
    if (@min(length) > 0) {
        log("systemtap test success")
    } else {
        log("unexpected minimum length")
        log("systemtap test failure")
    }
    if (@max(length) < %( kernel_v >= "2.6.11" %? TASK_COMM_LEN %: 16
%)) {
        log("systemtap test success")
    } else {
        log("unexpected maximum length")
        log("systemtap test failure")
    }
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]