linux - How to understand "$location" in a Systemtap script? -


the systemtap script:

# array hold list of drop points find global locations  # note when turn monitor on , off probe begin { printf("monitoring dropped packets\n") } probe end { printf("stopping dropped packet monitor\n") }  # increment drop counter every location drop @ #probe kernel.trace("kfree_skb") { locations[$location] <<< 1 }  # every 5 seconds report our drop locations probe timer.sec(5) {         printf("\n")         foreach (l in locations-) {                 printf("%d packets dropped @ location %p\n",                            @count(locations[l]), l)         }         delete locations } 

and source code of kfree_skb() is:

void kfree_skb(struct sk_buff *skb) {     if (unlikely(!skb))         return;     if (likely(atomic_read(&skb->users) == 1))         smp_rmb();     else if (likely(!atomic_dec_and_test(&skb->users)))         return;     trace_kfree_skb(skb, __builtin_return_address(0));     __kfree_skb(skb); } 

i want know $location from? ,
relationship between $location , kfree_skb()?
thank you.

as per stap.1 man page:

   many types of probe points provide context variables,    run-time values, safely extracted kernel or userspace    program being probed.  these pre‐ fixed $    character.  context variables section in stapprobes(3stap)    lists available each type of probe point. 

as per stapprobes.3stap man page:

kernel tracepoints     family of probe points hooks static probing    tracepoints inserted kernel or modules.  [...]     tracepoint probes like: kernel.trace("name").     tracepoint name string, may contain usual wildcard    characters, matched against names defined kernel    developers in tracepoint header files.     handler associated tracepoint-based probe may read    optional parame‐ ters specified @ macro call site.    [...] example, tracepoint probe kernel.trace("sched_switch")    provides parameters $rq, $prev, , $next.  [...]     name of tracepoint available in $$name, , string    of name=value pairs parameters of tracepoint    available in $$vars or $$parms. 

as per linux kernel source code:

% cd net/core % git grep trace_kfree_skb  dev.c: [...] drop_monitor.c: [...] skbuff.c: [...]  % cd ../../include/trace/events % git grep -a5 'trace_event.*kfree_skb'  skb.h:trace_event(kfree_skb, skb.h- skb.h-  tp_proto(struct sk_buff *skb, void *location), skb.h- skb.h-  tp_args(skb, location), skb.h- 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -