From: "Metzger, Markus T" <markus.t.metzger@intel.com>
To: Luis Machado <lgustavo@codesourcery.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH] btrace: preserve call stack on function switch
Date: Tue, 07 Feb 2017 07:27:00 -0000 [thread overview]
Message-ID: <A78C989F6D9628469189715575E55B2340048AFD@IRSMSX104.ger.corp.intel.com> (raw)
In-Reply-To: <826ae22f-eec3-2f4b-756b-a8ecee8defbc@codesourcery.com>
Hello Luis,
Thanks for your review.
> From what i understood, this adds an heuristic where previously there
> was none? We just declared defeat before the patch?
We previously preserved the stack-level but not the caller information. This
left the parts of the trace before and after the switch disconnected at higher
levels.
Regards,
Markus.
> -----Original Message-----
> From: Luis Machado [mailto:lgustavo@codesourcery.com]
> Sent: Tuesday, February 7, 2017 12:56 AM
> To: Metzger, Markus T <markus.t.metzger@intel.com>; gdb-
> patches@sourceware.org
> Subject: Re: [PATCH] btrace: preserve call stack on function switch
>
> On 02/01/2017 03:12 AM, Markus Metzger wrote:
> > On 64-bit FC25, the _dl_runtime_resolve function uses a conditional branch to
> > 'call' a particular variant optimized for that system:
> >
> > (gdb) disas _dl_runtime_resolve_avx_opt
> > Dump of assembler code for function _dl_runtime_resolve_avx_opt:
> > 0x00007ffff7deeb60 <+0>: push %rax
> > 0x00007ffff7deeb61 <+1>: push %rcx
> > 0x00007ffff7deeb62 <+2>: push %rdx
> > 0x00007ffff7deeb63 <+3>: mov $0x1,%ecx
> > 0x00007ffff7deeb68 <+8>: xgetbv
> > 0x00007ffff7deeb6b <+11>: mov %eax,%r11d
> > 0x00007ffff7deeb6e <+14>: pop %rdx
> > 0x00007ffff7deeb6f <+15>: pop %rcx
> > 0x00007ffff7deeb70 <+16>: pop %rax
> > 0x00007ffff7deeb71 <+17>: and $0x4,%r11d
> > 0x00007ffff7deeb75 <+21>: bnd je 0x7ffff7def4a0
> <_dl_runtime_resolve_sse_vex>
> > End of assembler dump.
> >
> > When computing the function-level trace, btrace treats this as a switch from
> > _dl_runtime_resolve_avx_opt to _dl_runtime_resolve_sse_vex. We know
> that we
> > switched functions but we can't really say in which caller/callee relationship
> > those two functions are.
> >
> > In addition to preserving the indentaion level, also preserve the caller
> > information. This is a heuristic since we don't really know. But at least in
> > this case, this seems to be the right thing to do.
> >
> > This fixes a fail in gdb.btrace/rn-dl-bind.exp on 64-bit FC25.
> >
> > 2017-02-01 Markus Metzger <markus.t.metzger@intel.com>
> >
> > * btrace.c (ftrace_new_switch): Preserve up link and flags.
> > ---
> > gdb/btrace.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/gdb/btrace.c b/gdb/btrace.c
> > index 6d621e4..ddf6692 100644
> > --- a/gdb/btrace.c
> > +++ b/gdb/btrace.c
> > @@ -448,9 +448,11 @@ ftrace_new_switch (struct btrace_function *prev,
> > {
> > struct btrace_function *bfun;
> >
> > - /* This is an unexplained function switch. The call stack will likely
> > - be wrong at this point. */
> > + /* This is an unexplained function switch. We can't really be sure about the
> > + call stack, yet the best I can think of right now is to preserve it. */
> > bfun = ftrace_new_function (prev, mfun, fun);
> > + bfun->up = prev->up;
> > + bfun->flags = prev->flags;
> >
> > ftrace_debug (bfun, "new switch");
> >
> >
>
> I don't know much about btrace, but the patch looks reasonable given the
> explanation.
>
> From what i understood, this adds an heuristic where previously there
> was none? We just declared defeat before the patch?
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
prev parent reply other threads:[~2017-02-07 7:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-01 9:12 Markus Metzger
2017-02-06 23:56 ` Luis Machado
2017-02-07 7:27 ` Metzger, Markus T [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=A78C989F6D9628469189715575E55B2340048AFD@IRSMSX104.ger.corp.intel.com \
--to=markus.t.metzger@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=lgustavo@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox