Bug 10084 - systemtap.examples/network/dropwatch fails on kernels without kfree_skb tracepoint
Summary: systemtap.examples/network/dropwatch fails on kernels without kfree_skb trace...
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: testsuite (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-19 12:48 UTC by Mark Wielaard
Modified: 2009-09-09 10:28 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
draft code (748 bytes, patch)
2009-07-09 07:25 UTC, Wenji Huang
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2009-04-19 12:48:04 UTC
For example on 2.6.27.21-170.2.56.fc10.i686:

attempting command  stap -p4 dropwatch.stp
OUT semantic error: no match while resolving probe point kernel.trace("kfree_skb
")
Pass 2: analysis failed.  Try again with another '--vp 01' option.
child process exited abnormally
RC 1
FAIL: systemtap.examples/network/dropwatch build
attempting command  stap dropwatch.stp -c "sleep 1"
OUT semantic error: no match while resolving probe point kernel.trace("kfree_skb
")
Pass 2: analysis failed.  Try again with another '--vp 01' option.
child process exited abnormally
RC 1
FAIL: systemtap.examples/network/dropwatch run
Comment 1 Frank Ch. Eigler 2009-04-19 16:14:36 UTC
By studying the placement of the tracepoint, one can probably
identify a nearly-equivalent kprobe as a fallback, which could
be listed in the .stp file thusly:

  probe kernel.trace("kfree_skb")!, 
        kernel.function("dev_kfree_skb" /* ? */) { ... }

If parameters are needed, one'd have to split this up into
tapset/alias constructs, like this:

probe kfree_skb_1 = kernel.trace("kfree_skb") { it=$arg1 ... }
probe kfree_skb_2 = kernel.function("dev_kfree_skb") { it=$foo ... }
probe kfree_skb_1 ! , kfree_skb_2 { println (it) }
Comment 2 Wenji Huang 2009-07-03 07:54:11 UTC
See the definition of trace point in  kfree_skb(struct sk_buff *skb)
        ...
        else if (likely(!atomic_dec_and_test(&skb->users)))
                 return;
         trace_kfree_skb(skb, __builtin_return_address(0));
         __kfree_skb(skb);
 }

Maybe we can select __kfree_skb as the probe point. But Not easy to find the
replacement for the parameter __builtin_return_address(0).
 
Comment 3 Frank Ch. Eigler 2009-07-03 13:00:53 UTC
> [...] But Not easy to find the
> replacement for the parameter __builtin_return_address(0).

That number should be available from the backtrace, as in caller*().
... except that doesn't work except from kretprobes.  That should
be fixed.
Comment 4 Wenji Huang 2009-07-09 07:25:15 UTC
Created attachment 4046 [details]
draft code

The return_addr of patch is almost equivalent to __builtin_return_address(0),
except for calling from some modules. For example in i386 machine, 
typical outputs will have
...
19 packets dropped at location 0xc06a9197
1 packets dropped at location 0xd112a392
...

For 0xc06a9197, return_addr() will return the same number. But 
it can't resolve 0xd112a392, will return 0.  Also the implementation 
of return_addr() doesn't depend on architecture, is to extract number 
from backtrace() string.
Comment 5 Wenji Huang 2009-09-09 04:57:44 UTC
See commit	2de206d6b209e5e3b518f38c9991e4434940f72e for PR #10604
Comment 6 Mark Wielaard 2009-09-09 10:28:25 UTC
Thanks, I think marking it UNTESTED when there isn't a kfree_skb tracepoint is fine.