Skip to content

Commit

Permalink
ftrace: do not process freed records
Browse files Browse the repository at this point in the history
Impact: keep from converting freed records

When the tracer is started or stopped, it converts all code pointed
to by the saved records into callers to ftrace or nops. When modules
are unloaded, their records are freed, but they still exist within
the record pages.

This patch changes the code to skip over freed records.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Steven Rostedt authored and Ingo Molnar committed Nov 16, 2008
1 parent b17e8a3 commit 918c115
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,12 @@ static void ftrace_replace_code(int enable)
for (i = 0; i < pg->index; i++) {
rec = &pg->records[i];

/* don't modify code that has already faulted */
if (rec->flags & FTRACE_FL_FAILED)
/*
* Skip over free records and records that have
* failed.
*/
if (rec->flags & FTRACE_FL_FREE ||
rec->flags & FTRACE_FL_FAILED)
continue;

/* ignore updates to this record's mcount site */
Expand Down

0 comments on commit 918c115

Please sign in to comment.