From: Michael Ellerman <patch-notifications@ellerman.id.au>
To: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>,
Michael Neuling <mikey@neuling.org>,
Nicholas Piggin <npiggin@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: powerpc/ftrace: Handle large kernel configs
Date: Mon, 22 Oct 2018 20:38:58 +1100 (AEDT) [thread overview]
Message-ID: <42ds0g02cPz9sDF@ozlabs.org> (raw)
In-Reply-To: <20181016202500.28039-1-naveen.n.rao@linux.vnet.ibm.com>
On Tue, 2018-10-16 at 20:25:00 UTC, "Naveen N. Rao" wrote:
> Currently, we expect to be able to reach ftrace_caller() from all
> ftrace-enabled functions through a single relative branch. With large
> kernel configs, we see functions outside of 32MB of ftrace_caller()
> causing ftrace_init() to bail.
>
> In such configurations, gcc/ld emits two types of trampolines for mcount():
> 1. A long_branch, which has a single branch to mcount() for functions that
> are one hop away from mcount():
> c0000000019e8544 <00031b56.long_branch._mcount>:
> c0000000019e8544: 4a 69 3f ac b c00000000007c4f0 <._mcount>
>
> 2. A plt_branch, for functions that are farther away from mcount():
> c0000000051f33f8 <0008ba04.plt_branch._mcount>:
> c0000000051f33f8: 3d 82 ff a4 addis r12,r2,-92
> c0000000051f33fc: e9 8c 04 20 ld r12,1056(r12)
> c0000000051f3400: 7d 89 03 a6 mtctr r12
> c0000000051f3404: 4e 80 04 20 bctr
>
> We can reuse those trampolines for ftrace if we can have those
> trampolines go to ftrace_caller() instead. However, with ABIv2, we
> cannot depend on r2 being valid. As such, we use only the long_branch
> trampolines by patching those to instead branch to ftrace_caller or
> ftrace_regs_caller.
>
> In addition, we add additional trampolines around .text and .init.text
> to catch locations that are covered by the plt branches. This allows
> ftrace to work with most large kernel configurations.
>
> For now, we always patch the trampolines to go to ftrace_regs_caller,
> which is slightly inefficient. This can be optimized further at a later
> point.
>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/67361cf80712867329a9cd3ff0e317
cheers
next prev parent reply other threads:[~2018-10-22 10:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-16 20:25 [PATCH] powerpc/ftrace: Handle large kernel configs Naveen N. Rao
2018-10-22 9:38 ` Michael Ellerman [this message]
2021-11-29 13:09 ` Christophe Leroy
2022-01-07 7:48 ` Naveen N. Rao
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=42ds0g02cPz9sDF@ozlabs.org \
--to=patch-notifications@ellerman.id.au \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
--cc=naveen.n.rao@linux.vnet.ibm.com \
--cc=npiggin@gmail.com \
--cc=rostedt@goodmis.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).