ftrace/x86: Move the mcount/fentry code out of entry_64.S
RFC PATCH 1/1 ftrace/x86: Move the mcount/fentry code out of entry_64.S
As the mcount code gets more complex, it really does not belong in the entry.S file. By moving it into its own file "mcount.S" keeps things a bit cleaner.
---
Note:
With changes to the ftrace infrastructure to help with the current influx of live patching facilities that we are seeing, I'm going to have to make new changes to mcount trampolines. Currently they live in entry*.S. They were only placed there for convenience, but not because that was the proper place to place it. As other architectures have a separate mcount.S file, I think it would be prudent to have x86 do the same. Especially as the trampoline code may start to expand for the live patching work. Currently, only x86_64 is converted, but there's no reason that i386 can't have it as well.
Thoughts?
-- Steve
--- arch/x86/kernel/Makefile | 1 + arch/x86/kernel/entry_64.S | 204 ----------------------------------------- arch/x86/kernel/mcount_64.S | 217 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 218 insertions(+), 204 deletions(-) create mode 100644 arch/x86/kernel/mcount_64.S
arch/x86/kernel/Makefile +1 -0
@@ -26,6 +26,7 @@ obj-$(CONFIG_IRQ_WORK) += irq_work.o obj-y += probe_roms.o obj-$(CONFIG_X86_32) += i386_ksyms_32.o obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o +obj-$(CONFIG_X86_64) += mcount_64.o obj-y += syscall_$(BITS).o vsyscall_gtod.o obj-$(CONFIG_X86_64) += vsyscall_64.o obj-$(CONFIG_X86_64) += vsyscall_emu_64.o
arch/x86/kernel/entry_64.S +0 -204
216 lines not on this page · raw message
arch/x86/kernel/mcount_64.S new file +217 -0
217 lines not on this page · raw message
Signature · 1 line
1.8.1.4
Quoted 19 lines · Steven Rostedt
As the mcount code gets more complex, it really does not belong in the
entry.Sfile. By moving it into its own file "mcount.S" keeps things a bit cleaner.Signed-off-by Steven Rostedt <[email protected]>---
Note:
With changes to the ftrace infrastructure to help with the current influx of live patching facilities that we are seeing, I'm going to have to make new changes to mcount trampolines. Currently they live in entry*.S. They were only placed there for convenience, but not because that was the proper place to place it. As other architectures have a separatemcount.Sfile, I think it would be prudent to have x86 do the same. Especially as the trampoline code may start to expand for the live patching work. Currently, onlyx86_64is converted, but there's no reason that i386 can't have it as well.
Quoted 1 line
Thoughts?
I'm fine with the code move per se. That's a good thing.
The live patcher argumentation for it is more than questionable.
Thanks,
tglx
Quoted 4 lines · On Fri, 9 May 2014 00:21:37 +0200 (CEST) Thomas Gleixner <[email protected]>…
On Thu, 8 May 2014, Steven Rostedt wrote:
I'm fine with the code move per se. That's a good thing.
Great, then I'll add this to my 3.16 queue.
Can I get your Acked-by for it?
Quoted 2 lines
The live patcher argumentation for it is more than questionable.
Well, that was the final motivator. But I've been wanting to optimize the function tracing a bit since it's been getting more and more users. Namely, kprobes and perf. As such, I've been thinking about creating custom trampolines (like what kprobes does today) where if there's two or more users of ftrace, but they are using different functions, they don't need to go through a loop, but instead have their own trampoline that calls their function directly and is called by the functions they trace.
Right now I'm working on getting the function graph tracer trampoline (which is static) called directly if function graph is enabled. Currently, we save regs for function tracing, restore them, and then call function graph tracing. This is a big waste when function graph is running by itself.
-- Steve
Quoted 11 lines · Steven Rostedt
Quoted 4 lines · On Fri, 9 May 2014 00:21:37 +0200 (CEST) Thomas Gleixner <[email protected]>…
On Thu, 8 May 2014, Steven Rostedt wrote:
I'm fine with the code move per se. That's a good thing.
Great, then I'll add this to my 3.16 queue.
Can I get your Acked-by for it?
Sure
Quoted 5 lines · Steven Rostedt
As the mcount code gets more complex, it really does not belong in the
entry.Sfile. By moving it into its own file "mcount.S" keeps things a bit cleaner.Signed-off-by Steven Rostedt <[email protected]>
I am obviously very happy about where this is heading :) hence FWIW
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs