This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Fw: Re: [PATCH v2] Tracepoint Tapset for Memory Subsystem
- From: "K.Prasad" <prasad at linux dot vnet dot ibm dot com>
- To: Jim Keniston <jkenisto at us dot ibm dot com>, "Frank Ch. Eigler" <fche at redhat dot com>
- Cc: SystemTap Mailing list <systemtap at sources dot redhat dot com>, Rajasekhar Duddu <rajduddu at linux dot vnet dot ibm dot com>, David Smith <dsmith at redhat dot com>
- Date: Tue, 29 Sep 2009 14:36:15 +0530
- Subject: Fw: Re: [PATCH v2] Tracepoint Tapset for Memory Subsystem
- Reply-to: prasad at linux dot vnet dot ibm dot com
Not sure why the names in the "To" field were dropped by my mail client.
Re-sending the mail again.
----- Forwarded message from "K.Prasad" <prasad@linux.vnet.ibm.com> -----
Date: Tue, 29 Sep 2009 14:28:17 +0530
From: "K.Prasad" <prasad@linux.vnet.ibm.com>
Cc: David Smith <dsmith@redhat.com>,
Rajasekhar Duddu <rajduddu@linux.vnet.ibm.com>,
systemtap@sources.redhat.com
Subject: Re: [PATCH v2] Tracepoint Tapset for Memory Subsystem
Reply-To: prasad@linux.vnet.ibm.com
On Mon, Sep 28, 2009 at 11:12:28AM -0700, Jim Keniston wrote:
>
> On Fri, 2009-09-25 at 14:19 -0500, David Smith wrote:
> ...
> >
> > Sorry to keep finding more things, but...
> >
> > I'm a bit worried about your use of '__builtin_return_address()' here.
> > Jim Keniston reported on it back in 2005 in the following message, but
> > there isn't much context.
> >
> > <http://sourceware.org/ml/systemtap/2005-q2/msg00242.html>
> >
> > Jim, can you remember some context here? Was the use of
> > '__builtin_return_address' considered good/bad/neutral? We don't seem
> > to use it anywhere else.
> >
>
> In case anybody still cares...
>
Yes, your explanation actually helped!
> The context was that we had recently implemented kretprobes, and
> somebody pointed out that hijacking the return address would cause
> __builtin_return_address() to return the wrong value. From my survey of
> the kernel, I concluded that "__builtin_return_address is used entirely
> for tracing (tracing that is disabled by default), profiling, and error
> reporting. I couldn't find any case where normal operation of the OS
> would be affected."
>
> Ironically, soon after that, kprobes itself started using
> __builtin_return_address().
>
> Anyway, there was no controversy as to whether
> __builtin_return_address() was bad or good per se; it was simply
> recognized that it would return invalid results when called from a
> return-probed function.
>
> Jim
>
This means that __builtin_return_address() would return incorrect values
irrespective of whether it is used inside a kprobe or a tracepoint based
probe i.e. "kmem.kfree.kp" or "kmem.kfree.tp".
And since the tracepoints export them (through $call_site parameter),
I think we can continue to use them in the kprobe based fallback probe
too.
Thanks,
K.Prasad
----- End forwarded message -----