aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/ftrace.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index fdf913dfc7e8..72316d9647bd 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -585,6 +585,24 @@ ftrace_code_disable(struct module *mod, struct dyn_ftrace *rec)
585 return 1; 585 return 1;
586} 586}
587 587
588/*
589 * archs can override this function if they must do something
590 * before the modifying code is performed.
591 */
592int __weak ftrace_arch_code_modify_prepare(void)
593{
594 return 0;
595}
596
597/*
598 * archs can override this function if they must do something
599 * after the modifying code is performed.
600 */
601int __weak ftrace_arch_code_modify_post_process(void)
602{
603 return 0;
604}
605
588static int __ftrace_modify_code(void *data) 606static int __ftrace_modify_code(void *data)
589{ 607{
590 int *command = data; 608 int *command = data;
@@ -607,7 +625,17 @@ static int __ftrace_modify_code(void *data)
607 625
608static void ftrace_run_update_code(int command) 626static void ftrace_run_update_code(int command)
609{ 627{
628 int ret;
629
630 ret = ftrace_arch_code_modify_prepare();
631 FTRACE_WARN_ON(ret);
632 if (ret)
633 return;
634
610 stop_machine(__ftrace_modify_code, &command, NULL); 635 stop_machine(__ftrace_modify_code, &command, NULL);
636
637 ret = ftrace_arch_code_modify_post_process();
638 FTRACE_WARN_ON(ret);
611} 639}
612 640
613static ftrace_func_t saved_ftrace_func; 641static ftrace_func_t saved_ftrace_func;