Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 182451
b: refs/heads/master
c: 2cfa197
h: refs/heads/master
i:
  182449: 76bc3b7
  182447: 808fa5f
v: v3
  • Loading branch information
Masami Hiramatsu authored and Ingo Molnar committed Feb 4, 2010
1 parent 087d48d commit 7c95382
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 615d0ebbc782b67296e3226c293f520f93f93515
refs/heads/master: 2cfa19780d61740f65790c5bae363b759d7c96fa
5 changes: 5 additions & 0 deletions trunk/arch/x86/include/asm/alternative.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,17 @@ extern void alternatives_smp_module_add(struct module *mod, char *name,
void *text, void *text_end);
extern void alternatives_smp_module_del(struct module *mod);
extern void alternatives_smp_switch(int smp);
extern int alternatives_text_reserved(void *start, void *end);
#else
static inline void alternatives_smp_module_add(struct module *mod, char *name,
void *locks, void *locks_end,
void *text, void *text_end) {}
static inline void alternatives_smp_module_del(struct module *mod) {}
static inline void alternatives_smp_switch(int smp) {}
static inline int alternatives_text_reserved(void *start, void *end)
{
return 0;
}
#endif /* CONFIG_SMP */

/* alternative assembly primitive: */
Expand Down
16 changes: 16 additions & 0 deletions trunk/arch/x86/kernel/alternative.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,22 @@ void alternatives_smp_switch(int smp)
mutex_unlock(&smp_alt);
}

/* Return 1 if the address range is reserved for smp-alternatives */
int alternatives_text_reserved(void *start, void *end)
{
struct smp_alt_module *mod;
u8 **ptr;

list_for_each_entry(mod, &smp_alt_modules, next) {
if (mod->text > end || mod->text_end < start)
continue;
for (ptr = mod->locks; ptr < mod->locks_end; ptr++)
if (start <= *ptr && end >= *ptr)
return 1;
}

return 0;
}
#endif

#ifdef CONFIG_PARAVIRT
Expand Down
6 changes: 6 additions & 0 deletions trunk/include/linux/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ extern void
unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops);
extern void unregister_ftrace_function_probe_all(char *glob);

extern int ftrace_text_reserved(void *start, void *end);

enum {
FTRACE_FL_FREE = (1 << 0),
FTRACE_FL_FAILED = (1 << 1),
Expand Down Expand Up @@ -250,6 +252,10 @@ static inline int unregister_ftrace_command(char *cmd_name)
{
return -EINVAL;
}
static inline int ftrace_text_reserved(void *start, void *end)
{
return 0;
}
#endif /* CONFIG_DYNAMIC_FTRACE */

/* totally disable ftrace - can not re-enable after this */
Expand Down
15 changes: 15 additions & 0 deletions trunk/kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,21 @@ static void ftrace_bug(int failed, unsigned long ip)
}


/* Return 1 if the address range is reserved for ftrace */
int ftrace_text_reserved(void *start, void *end)
{
struct dyn_ftrace *rec;
struct ftrace_page *pg;

do_for_each_ftrace_rec(pg, rec) {
if (rec->ip <= (unsigned long)end &&
rec->ip + MCOUNT_INSN_SIZE > (unsigned long)start)
return 1;
} while_for_each_ftrace_rec();
return 0;
}


static int
__ftrace_replace_code(struct dyn_ftrace *rec, int enable)
{
Expand Down

0 comments on commit 7c95382

Please sign in to comment.