提交 b7b348c6 编写于 作者: M Michael Ellerman 提交者: Benjamin Herrenschmidt

powerpc/ftrace: Fix inverted check of create_branch()

In commit 24a1bdc3, "Fix ABIv2 issues with __ftrace_make_call", Anton
changed the logic that creates and patches the branch, and added a
thinko in the check of create_branch(). create_branch() returns the
instruction that was generated, so if we get zero then it succeeded.

The result is we can't ftrace modules:

  Branch out of range
  WARNING: at ../kernel/trace/ftrace.c:1638
  ftrace failed to modify [<d000000004ba001c>] fuse_req_init_context+0x1c/0x90 [fuse]

We should probably fix patch_instruction() to do that check and make the
API saner, but that's a separate patch. For now just invert the test.
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
上级 dfc382a1
...@@ -320,7 +320,7 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) ...@@ -320,7 +320,7 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
} }
/* Ensure branch is within 24 bits */ /* Ensure branch is within 24 bits */
if (create_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) { if (!create_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) {
printk(KERN_ERR "Branch out of range"); printk(KERN_ERR "Branch out of range");
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册