瀏覽代碼

ftrace: Revert 8ab2b7efd ftrace: Remove unnecessary disabling of irqs

Revert the commit that removed the disabling of interrupts around
the initial modifying of mcount callers to nops, and update the comment.

The original comment was outdated and stated that the interrupts were
being disabled to prevent kstop machine, which was required with the
old ftrace daemon, but was no longer the case.

What the comment failed to mention was that interrupts needed to be
disabled to keep interrupts from preempting the modifying of the code
and then executing the code that was partially modified.

Revert the commit and update the comment.

Reported-by: Richard W.M. Jones <rjones@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Steven Rostedt 14 年之前
父節點
當前提交
a4f18ed11a
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      kernel/trace/ftrace.c

+ 7 - 0
kernel/trace/ftrace.c

@@ -3330,6 +3330,7 @@ static int ftrace_process_locs(struct module *mod,
 {
 {
 	unsigned long *p;
 	unsigned long *p;
 	unsigned long addr;
 	unsigned long addr;
+	unsigned long flags;
 
 
 	mutex_lock(&ftrace_lock);
 	mutex_lock(&ftrace_lock);
 	p = start;
 	p = start;
@@ -3346,7 +3347,13 @@ static int ftrace_process_locs(struct module *mod,
 		ftrace_record_ip(addr);
 		ftrace_record_ip(addr);
 	}
 	}
 
 
+	/*
+	 * Disable interrupts to prevent interrupts from executing
+	 * code that is being modified.
+	 */
+	local_irq_save(flags);
 	ftrace_update_code(mod);
 	ftrace_update_code(mod);
+	local_irq_restore(flags);
 	mutex_unlock(&ftrace_lock);
 	mutex_unlock(&ftrace_lock);
 
 
 	return 0;
 	return 0;