Skip to content

Commit

Permalink
ftrace: Revert 8ab2b7e ftrace: Remove unnecessary disabling of irqs
Browse files Browse the repository at this point in the history
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 <[email protected]>
Tested-by: Richard W.M. Jones <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
  • Loading branch information
Steven Rostedt authored and rostedt committed Jun 7, 2011
1 parent 265a5b7 commit a4f18ed
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -3330,6 +3330,7 @@ static int ftrace_process_locs(struct module *mod,
{
unsigned long *p;
unsigned long addr;
unsigned long flags;

mutex_lock(&ftrace_lock);
p = start;
Expand All @@ -3346,7 +3347,13 @@ static int ftrace_process_locs(struct module *mod,
ftrace_record_ip(addr);
}

/*
* Disable interrupts to prevent interrupts from executing
* code that is being modified.
*/
local_irq_save(flags);
ftrace_update_code(mod);
local_irq_restore(flags);
mutex_unlock(&ftrace_lock);

return 0;
Expand Down

0 comments on commit a4f18ed

Please sign in to comment.