forked from torvalds/linux
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
powerpc/ftrace: Reserve instructions from function entry for ftrace
On some architectures, enabling function tracing results in multiple instructions being emitted at function entry. As an example, on powerpc64 with -mprofile-kernel, two instructions are emitted at function entry: mflr r0 bl _mcount It is desirable to nop out both these instructions when ftrace is not active. For that purpose, it is essential to mark both these instructions as belonging to ftrace so that other kernel subsystems (such as kprobes) do not modify these instructions. Add support for this by allowing architectures to override ftrace_cmp_recs() and to match against address ranges over and above a single MCOUNT_INSN_SIZE. For powerpc32, we mark the two instructions preceding the call to _mcount() as belonging to ftrace. For powerpc64, an additional aspect to consider is that functions can have a global entry point for setting up the TOC when invoked from other modules. If present, global entry point always involves two instructions (addis/lis and addi). To handle this, we provide a custom ftrace_init_nop() for powerpc64 where we identify functions having a global entry point and record this information in the LSB of dyn_ftrace->arch.mod. This information is used in ftrace_cmp_recs() to reserve instructions from the global entry point. Suggested-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
- Loading branch information
1 parent
1b43a74
commit 6a18913
Showing
3 changed files
with
117 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters