[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190715101231.GB3419@hirez.programming.kicks-ass.net>
Date: Mon, 15 Jul 2019 12:12:31 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Will Deacon <will@...nel.org>
Cc: Changbin Du <changbin.du@...il.com>, rostedt@...dmis.org,
mingo@...hat.com, corbet@....net, linux@...linux.org.uk,
catalin.marinas@....com, tglx@...utronix.de, bp@...en8.de,
hpa@...or.com, x86@...nel.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] tracing/fgraph: support recording function return values
On Mon, Jul 15, 2019 at 09:29:30AM +0100, Will Deacon wrote:
> On Sat, Jul 13, 2019 at 08:10:26PM +0800, Changbin Du wrote:
> > This patch adds a new trace option 'funcgraph-retval' and is disabled by
> > default. When this option is enabled, fgraph tracer will show the return
> > value of each function. This is useful to find/analyze a original error
> > source in a call graph.
> >
> > One limitation is that the kernel doesn't know the prototype of functions.
> > So fgraph assumes all functions have a retvalue of type int. You must ignore
> > the value of *void* function. And if the retvalue looks like an error code
> > then both hexadecimal and decimal number are displayed.
>
> This seems like quite a significant drawback and I think it could be pretty
> confusing if you have to filter out bogus return values from the trace.
>
> For example, in your snippet:
>
> > 3) | kvm_vm_ioctl() {
> > 3) | mutex_lock() {
> > 3) | _cond_resched() {
> > 3) 0.234 us | rcu_all_qs(); /* ret=0x80000000 */
> > 3) 0.704 us | } /* ret=0x0 */
> > 3) 1.226 us | } /* ret=0x0 */
> > 3) 0.247 us | mutex_unlock(); /* ret=0xffff8880738ed040 */
>
> mutex_unlock() is wrongly listed as returning something.
>
> How much of this could be achieved from userspace by placing kretprobes on
> non-void functions instead?
Alternatively, we can have recordmcount (or objtool) mark all functions
with a return value when the build has DEBUG_INFO on. The dwarves know
the function signature.
Powered by blists - more mailing lists