From: dave.martin@linaro.org (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] ARM: extract out insn generation code from ftrace
Date: Wed, 23 Nov 2011 11:50:12 +0000 [thread overview]
Message-ID: <20111123115002.GA2050@localhost.localdomain> (raw)
In-Reply-To: <CAH+eYFA2nhwXCU99RWyv1tncdz77dNHKqyX9bzSE31iepTRFYw@mail.gmail.com>
On Tue, Nov 22, 2011 at 11:55:49PM +0530, Rabin Vincent wrote:
> On Tue, Nov 22, 2011 at 19:26, Dave Martin <dave.martin@linaro.org> wrote:
> > On Tue, Nov 22, 2011 at 07:02:13PM +0530, Rabin Vincent wrote:
> >> It's not used on Thumb-2. ?This is only used by the function graph
> >> tracer and that depends on !THUMB2_KERNEL.
> >
> > I assume there's no special reason why this doesn't work with a Thumb-2
> > kernel, other than that it simply hasn't implemented yet?
>
> The function graph tracer expects to get a pointer to the saved return
> address of the function (on the stack). It changes this to its own
> return_hooker function where it records the exit from the function and
> jumps to the real return address.
>
> We do this for ARM (the instruction set) by building with frame pointers,
> and the function prologues always save the registers in the expected
> order and the epilogues restore them out from the saved locations.
>
> However, with Thumb-2, we don't get frame pointers even if we ask for
> them. So to support Thumb-2 we'd probably need a way to find and modify
> the LR without it being at a fixed location (MIPS does something similar
> IIRC). I haven't really looked into it.
The unwind tables contain the information required to find the link
register. This is how the backtracer works in Thumb-2 kernels or with
CONFIG_ARM_UNWIND. This adds some complexity, but it also has some
advantages such as elimiating the runtime stack and instruction overhead
associated with maintaining a framepointer chain.
Really, "find/change frame's stored return address" is a generic
operation which is closely related to stack unwinding, and would best
be implemented along with the unwinder code. Ideally, ftrace should
not need to know or care _how_ this is accomplished. Indeed, at this
level the operation isn't even arch-specific.
I will take a look at the ARM unwind/backtrace code and think about
whether this could be factored out or exposed in a helpful way.
Certainly we shouldn't implement a second unwind table parser in
ftrace...
Are there any other dependencies on framepointers, or is that the only
thing?
Cheers
---Dave
next prev parent reply other threads:[~2011-11-23 11:50 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-21 15:13 [PATCH 1/4] ARM: ftrace: use canonical Thumb-2 wide instruction format Rabin Vincent
2011-11-21 15:13 ` [PATCH 2/4] ARM: extract out insn generation code from ftrace Rabin Vincent
2011-11-22 12:02 ` Dave Martin
2011-11-22 13:32 ` Rabin Vincent
2011-11-22 13:56 ` Dave Martin
2011-11-22 18:25 ` Rabin Vincent
2011-11-23 11:50 ` Dave Martin [this message]
2011-11-24 16:10 ` Rabin Vincent
2011-11-21 15:13 ` [PATCH 3/4] ARM: extract out code patch function from kprobes Rabin Vincent
2011-11-22 8:48 ` Tixy
2011-11-22 18:03 ` Rabin Vincent
2011-11-21 15:13 ` [PATCH 4/4] ARM: add jump label support Rabin Vincent
2011-11-22 19:42 ` Russell King - ARM Linux
2011-11-22 23:02 ` Stephen Boyd
2011-11-22 23:39 ` Jason Baron
2011-11-22 23:50 ` Jason Baron
2011-11-23 14:55 ` Rabin Vincent
2011-11-23 14:55 ` Rabin Vincent
2011-11-23 17:53 ` Russell King - ARM Linux
2011-11-23 17:53 ` Russell King - ARM Linux
2011-11-28 17:04 ` Rabin Vincent
2011-11-28 17:04 ` Rabin Vincent
2012-01-24 15:43 ` Rabin Vincent
2012-01-24 16:05 ` Russell King - ARM Linux
2012-01-24 16:57 ` Rabin Vincent
2011-11-22 12:02 ` [PATCH 1/4] ARM: ftrace: use canonical Thumb-2 wide instruction format Dave Martin
2011-11-22 18:00 ` Rabin Vincent
2011-11-23 14:42 ` Dave Martin
2011-11-24 7:22 ` Bi Junxiao
2011-11-25 10:10 ` Dave Martin
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=20111123115002.GA2050@localhost.localdomain \
--to=dave.martin@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.