Faster traceback for tracer

281 views
Skip to first unread message

Dmitry Vyukov

unread,
Dec 16, 2014, 4:10:34 AM12/16/14
to Russ Cox, Keith Randall, golang-dev
Russ, Keith,

Currently the main slowdown of the tracer:
https://go-review.googlesource.com/#/c/1450/
is stack unwinding (about 30%). It would be nice to disturb the
execution is little as possible to capture the actual picture. The
trace is interested only in pc values and the traceback is always
synchronous. Is it possible to skip all of the pcsp table traversal
for this case? Especially in the light of:
https://go-review.googlesource.com/#/c/1601/
Is it possible to just use _func.frame? Tracing still can happen in
morestack. So probably it should be something along the lines of:
if pc <= f.morestackpc {
sp = fp + ptrSize
} else {
sp = fp + f.frame
}
?

Keith Randall

unread,
Dec 16, 2014, 12:22:09 PM12/16/14
to Dmitry Vyukov, Russ Cox, Keith Randall, golang-dev
I think stack unwinding needs a general overhaul, it is really slow right now.
It makes sense to separate out the asynchronous lookup (the top frame during interrupts), and maybe add an option to not fetch the argmap if it isn't needed.

Change 1601 (fixed frame sizes) should make the walk faster, as the table of sp sizes should be almost trivial.  I haven't measured it yet, though.

Dmitry Vyukov

unread,
Dec 17, 2014, 2:43:41 AM12/17/14
to Keith Randall, Russ Cox, Keith Randall, golang-dev
On Tue, Dec 16, 2014 at 8:22 PM, Keith Randall <k...@google.com> wrote:
> I think stack unwinding needs a general overhaul, it is really slow right
> now.
> It makes sense to separate out the asynchronous lookup (the top frame during
> interrupts), and maybe add an option to not fetch the argmap if it isn't
> needed.
>
> Change 1601 (fixed frame sizes) should make the walk faster, as the table of
> sp sizes should be almost trivial. I haven't measured it yet, though.

Cool!

It would be good to not fetch argmap for the tracer traceback.

There was also an idea to store _func pointer directly on the stack at
known offset for each frame. That would eliminate func lookup as well.

Daniel Morsing

unread,
Dec 17, 2014, 4:32:50 AM12/17/14
to golan...@googlegroups.com, k...@google.com, r...@golang.org, k...@golang.org
If you're going to store information in the stack frame, consider adding frame pointers instead. This will enable tools which expect the usual x86 ABI to work on go binaries, including perf.

Dmitry Vyukov

unread,
Dec 17, 2014, 4:36:43 AM12/17/14
to Daniel Morsing, golang-dev, Keith Randall, Russ Cox, Keith Randall
Frame pointers would work for tracer which only needs pc values. But
won't work for GC, because it needs argmaps for every function. To
satisfy both we will need to add both frame pointers and func
descriptor pointers.
> --
> You received this message because you are subscribed to the Google Groups
> "golang-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-dev+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages