summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2012-04-25 14:39:54 -0400
committerSteven Rostedt <rostedt@goodmis.org>2012-05-16 19:58:49 -0400
commitf0cf973a224a3e3c1dec3395af3ba01cf14b1ff4 (patch)
treec8efdfadbf904ce9eaff942156bc3d0608375d7d /kernel
parenta650e02a528ab9d6d6f0b8b57745c32f2a138459 (diff)
downloadop-kernel-dev-f0cf973a224a3e3c1dec3395af3ba01cf14b1ff4.zip
op-kernel-dev-f0cf973a224a3e3c1dec3395af3ba01cf14b1ff4.tar.gz
ftrace: Return record ip addr for ftrace_location()
ftrace_location() is passed an addr, and returns 1 if the addr is on a ftrace nop (or caller to ftrace_caller), and 0 otherwise. To let kprobes know if it should move a breakpoint or not, it must return the actual addr that is the start of the ftrace nop. This way a kprobe placed on the location of a ftrace nop, can instead be placed on the instruction after the nop. Even if the probe addr is on the second or later byte of the nop, it can simply be moved forward. Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/ftrace.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index dd091c8..ef08262 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1393,7 +1393,7 @@ static int ftrace_cmp_recs(const void *a, const void *b)
return 0;
}
-static int ftrace_location_range(unsigned long start, unsigned long end)
+static unsigned long ftrace_location_range(unsigned long start, unsigned long end)
{
struct ftrace_page *pg;
struct dyn_ftrace *rec;
@@ -1410,7 +1410,7 @@ static int ftrace_location_range(unsigned long start, unsigned long end)
sizeof(struct dyn_ftrace),
ftrace_cmp_recs);
if (rec)
- return 1;
+ return rec->ip;
}
return 0;
@@ -1420,12 +1420,12 @@ static int ftrace_location_range(unsigned long start, unsigned long end)
* ftrace_location - return true if the ip giving is a traced location
* @ip: the instruction pointer to check
*
- * Returns 1 if @ip given is a pointer to a ftrace location.
+ * Returns rec->ip if @ip given is a pointer to a ftrace location.
* That is, 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.
*/
-int ftrace_location(unsigned long ip)
+unsigned long ftrace_location(unsigned long ip)
{
return ftrace_location_range(ip, ip);
}
@@ -1442,8 +1442,12 @@ int ftrace_location(unsigned long ip)
*/
int ftrace_text_reserved(void *start, void *end)
{
- return ftrace_location_range((unsigned long)start,
- (unsigned long)end);
+ unsigned long ret;
+
+ ret = ftrace_location_range((unsigned long)start,
+ (unsigned long)end);
+
+ return (int)!!ret;
}
static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
OpenPOWER on IntegriCloud