mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-04-07 23:04:55 +00:00
tracing: Add -mcount-nop option support
-mcount-nop gcc option generates the calls to the profiling functions as nops which allows to avoid patching mcount jump with NOP instructions initially. -mcount-nop gcc option will be activated if platform selects HAVE_NOP_MCOUNT and gcc actually supports it. In addition to that CC_USING_NOP_MCOUNT is defined and could be used by architectures to adapt ftrace patching behavior. Link: http://lkml.kernel.org/r/patch-3.thread-aa7b8d.git-e02ed2dc082b.your-ad-here.call-01533557518-ext-9465@work.hours Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
parent
07d0408120
commit
2f4df0017b
3 changed files with 13 additions and 0 deletions
6
Makefile
6
Makefile
|
@ -749,6 +749,12 @@ ifdef CONFIG_FTRACE_MCOUNT_RECORD
|
||||||
CC_FLAGS_FTRACE += -mrecord-mcount
|
CC_FLAGS_FTRACE += -mrecord-mcount
|
||||||
export CC_USING_RECORD_MCOUNT := 1
|
export CC_USING_RECORD_MCOUNT := 1
|
||||||
endif
|
endif
|
||||||
|
ifdef CONFIG_HAVE_NOP_MCOUNT
|
||||||
|
ifeq ($(call cc-option-yn, -mnop-mcount),y)
|
||||||
|
CC_FLAGS_FTRACE += -mnop-mcount
|
||||||
|
CC_FLAGS_USING += -DCC_USING_NOP_MCOUNT
|
||||||
|
endif
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
ifdef CONFIG_HAVE_FENTRY
|
ifdef CONFIG_HAVE_FENTRY
|
||||||
ifeq ($(call cc-option-yn, -mfentry),y)
|
ifeq ($(call cc-option-yn, -mfentry),y)
|
||||||
|
|
|
@ -47,6 +47,11 @@ config HAVE_FENTRY
|
||||||
help
|
help
|
||||||
Arch supports the gcc options -pg with -mfentry
|
Arch supports the gcc options -pg with -mfentry
|
||||||
|
|
||||||
|
config HAVE_NOP_MCOUNT
|
||||||
|
bool
|
||||||
|
help
|
||||||
|
Arch supports the gcc options -pg with -mrecord-mcount and -nop-mcount
|
||||||
|
|
||||||
config HAVE_C_RECORDMCOUNT
|
config HAVE_C_RECORDMCOUNT
|
||||||
bool
|
bool
|
||||||
help
|
help
|
||||||
|
|
|
@ -2950,12 +2950,14 @@ static int ftrace_update_code(struct module *mod, struct ftrace_page *new_pgs)
|
||||||
p = &pg->records[i];
|
p = &pg->records[i];
|
||||||
p->flags = rec_flags;
|
p->flags = rec_flags;
|
||||||
|
|
||||||
|
#ifndef CC_USING_NOP_MCOUNT
|
||||||
/*
|
/*
|
||||||
* Do the initial record conversion from mcount jump
|
* Do the initial record conversion from mcount jump
|
||||||
* to the NOP instructions.
|
* to the NOP instructions.
|
||||||
*/
|
*/
|
||||||
if (!ftrace_code_disable(mod, p))
|
if (!ftrace_code_disable(mod, p))
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
update_cnt++;
|
update_cnt++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue