From: Frederic Weisbecker <fweisbec@gmail.com>
To: Jan Beulich <JBeulich@novell.com>
Cc: "H. Peter Anvin" <a.p.zijlstra@chello.nl>,
Ingo Molnar <mingo@elte.hu>,
Stephane Eranian <eranian@google.com>,
Thomas Gleixner <tglx@linutronix.de>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Soeren Sandmann Pedersen <sandmann@redhat.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH 1/2] x86: Fix rbp saving in pt_regs on irq entry
Date: Thu, 6 Jan 2011 18:24:02 +0100 [thread overview]
Message-ID: <20110106172355.GE2308@nowhere> (raw)
In-Reply-To: <20110106171231.GD2308@nowhere>
On Thu, Jan 06, 2011 at 06:12:33PM +0100, Frederic Weisbecker wrote:
> On Thu, Jan 06, 2011 at 04:58:54PM +0000, Jan Beulich wrote:
> > >>> On 06.01.11 at 17:54, Frederic Weisbecker <fweisbec@gmail.com> wrote:
> > > On Thu, Jan 06, 2011 at 04:39:39PM +0000, Jan Beulich wrote:
> > >> >>> On 06.01.11 at 17:22, Frederic Weisbecker <fweisbec@gmail.com> wrote:
> > >> > On Thu, Jan 06, 2011 at 04:10:55PM +0000, Jan Beulich wrote:
> > >> >> >>> On 06.01.11 at 16:45, Frederic Weisbecker <fweisbec@gmail.com> wrote:
> > >> >> > Before we had:
> > >> >> >
> > >> >> >
> > >> >> > leaveq
> > >> >> >
> > >> >> > CFI_RESTORE rbp
> > >> >> > CFI_DEF_CFA_REGISTER rsp
> > >> >> > CFI_ADJUST_CFA_OFFSET -8
> > >> >> >
> > >> >> > So CFI_RESTORE means rbp has now the value of the base frame of
> > >> >> > the calling frame (the base frame pointer of the interrupted proc) ?
> > >> >>
> > >> >> No - all it means is that %rbp now has its original (caller or
> > >> >> interrupted procedure) value again (i.e. an unwinder should not
> > >> >> try to read it from the stack [or other previously recorded
> > >> >> location] anymore).
> > >> >>
> > >> >> > And what follows means that rsp-8 points to the return address?
> > >> >>
> > >> >> No - .cfi_def_cfa_register says which register serves as the frame
> > >> >> pointer, and .cfi_adjust_cfa_offset says to adjust the offset from
> > >> >> the frame pointer to the top [or bottom] of frame. At any time
> > >> >>
> > >> >> CFA = cfa_register + cfa_offset
> > >> >>
> > >> >> with CFA being what all locations on the stack are expressed
> > >> >> relative to.
> > >> >
> > >> > Ok.
> > >> >
> > >> > So here rsp points to pt_regs::r11
> > >> >
> > >> > I don't understand why locations relative to the stack must be
> > >> > expressed here by taking rsp - 8 as a base.
> > >>
> > >> Nothing says rsp-8. The annotations merely say to set the base
> > >> register to rsp and to *adjust* the offset by -8 (after all, that's
> > >> what the leaveq instruction does).
> > >
> > > Ah! So CFA acts like a virtual frame base pointer right?
> >
> > Correct.
>
> Ah great. I was starting to prepare for the case you come to stab me :)
>
> So what do you think about that:
>
> leaveq
>
> CFI_RESTORE rbp
> CFI_DEF_CFA_REGISTER rsp
> CFI_ADJUST_CFA_OFFSET -8
>
> /* we did not save rbx, restore only from ARGOFFSET */
> addq $8, %rsp
> CFI_ADJUST_CFA_OFFSET -16
Or if CFI_ADJUST_CFA_OFFSET is already relative to its previous value,
it should be CFI_ADJUST_CFA_OFFSET -8
next prev parent reply other threads:[~2011-01-06 17:24 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-06 14:51 [RFC GIT PULL] perf updates Frederic Weisbecker
2011-01-06 14:51 ` [PATCH 2/2] perf: Build tools with frame pointer Frederic Weisbecker
2011-01-07 15:31 ` [tip:perf/core] perf tools: Build " tip-bot for Frederic Weisbecker
[not found] ` <1294325513-14276-2-git-send-email-fweisbec@gmail.com>
2011-01-06 15:18 ` [RFC PATCH 1/2] x86: Fix rbp saving in pt_regs on irq entry Jan Beulich
2011-01-06 15:45 ` Frederic Weisbecker
2011-01-06 16:10 ` Jan Beulich
2011-01-06 16:22 ` Frederic Weisbecker
2011-01-06 16:39 ` Jan Beulich
2011-01-06 16:54 ` Frederic Weisbecker
2011-01-06 16:58 ` Jan Beulich
2011-01-06 17:12 ` Frederic Weisbecker
2011-01-06 17:24 ` Frederic Weisbecker [this message]
2011-01-07 7:45 ` Jan Beulich
2011-01-07 12:31 ` Ingo Molnar
2011-01-07 16:05 ` Frederic Weisbecker
2011-01-07 16:13 ` Jan Beulich
2011-01-07 16:27 ` Frederic Weisbecker
2011-01-07 16:58 ` Ingo Molnar
2011-01-07 17:17 ` Frederic Weisbecker
2011-01-07 16:33 ` Frederic Weisbecker
2011-01-07 14:26 ` Frederic Weisbecker
2011-01-07 12:23 ` [RFC GIT PULL] perf updates Ingo Molnar
2011-01-07 15:24 ` Frederic Weisbecker
2011-01-07 15:37 ` Ingo Molnar
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=20110106172355.GE2308@nowhere \
--to=fweisbec@gmail.com \
--cc=JBeulich@novell.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=sandmann@redhat.com \
--cc=tglx@linutronix.de \
/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