Message ID | 1458817445-5855-2-git-send-email-mpe@ellerman.id.au (mailing list archive) |
---|---|
State | RFC |
Headers | show |
On Thu, 24 Mar 2016 22:04:01 +1100 Michael Ellerman <mpe@ellerman.id.au> wrote: > In order to support live patching on powerpc we would like to call > ftrace_location_range(), so make it global. Do you want me to try to get this into this merge window? -- Steve
On Thu, 24 Mar 2016, Steven Rostedt wrote: > > In order to support live patching on powerpc we would like to call > > ftrace_location_range(), so make it global. > > Do you want me to try to get this into this merge window? I don't think that's necessary. The dependency (rest of livepatching bits for ppc64le) will not go in before 4.7 merge window anyway. Thanks,
On Thu, 2016-03-24 at 11:20 -0400, Steven Rostedt wrote: > On Thu, 24 Mar 2016 22:04:01 +1100 > Michael Ellerman <mpe@ellerman.id.au> wrote: > > > In order to support live patching on powerpc we would like to call > > ftrace_location_range(), so make it global. > > Do you want me to try to get this into this merge window? Nah, we can just take it next window with the whole series. If you're happy to ack it. cheers
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 6d9df3f7e334..93230e97e897 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -455,6 +455,7 @@ int ftrace_update_record(struct dyn_ftrace *rec, int enable); int ftrace_test_record(struct dyn_ftrace *rec, int enable); void ftrace_run_stop_machine(int command); unsigned long ftrace_location(unsigned long ip); +unsigned long ftrace_location_range(unsigned long start, unsigned long end); unsigned long ftrace_get_addr_new(struct dyn_ftrace *rec); unsigned long ftrace_get_addr_curr(struct dyn_ftrace *rec); diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 57a6eea84694..f4e6aae6ebe7 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -1533,7 +1533,19 @@ static int ftrace_cmp_recs(const void *a, const void *b) return 0; } -static unsigned long ftrace_location_range(unsigned long start, unsigned long end) +/** + * ftrace_location_range - return the first address of a traced location + * if it touches the given ip range + * @start: start of range to search. + * @end: end of range to search (inclusive). @end points to the last byte + * to check. + * + * Returns rec->ip if the related ftrace location is a least partly within + * the given address range. That is, the first address of the instruction + * that is either a NOP or call to the function tracer. It checks the ftrace + * internal tables to determine if the address belongs or not. + */ +unsigned long ftrace_location_range(unsigned long start, unsigned long end) { struct ftrace_page *pg; struct dyn_ftrace *rec;