From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Anton Blanchard <anton@samba.org>,
linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 7/8] powerpc/livepatch: Clarify location of mcount call site
Date: Thu, 4 May 2017 10:06:20 +0530 [thread overview]
Message-ID: <def36fbe0eb1c6622ff49f56b3f1c9545e5aef3b.1493831558.git.naveen.n.rao@linux.vnet.ibm.com> (raw)
In-Reply-To: <cover.1493831558.git.naveen.n.rao@linux.vnet.ibm.com>
In-Reply-To: <cover.1493831558.git.naveen.n.rao@linux.vnet.ibm.com>
The existing comment around the location of mcount() call site in a
function is a bit confusing.
Depending on the gcc version, the mcount() call can either be the fourth
(gcc v6 and later) or the fifth instruction (gcc v5 and earlier) into a
function. So, the mcount call is actually within the first _20_ bytes of
a function.
However, ftrace_location_range() does an inclusive search and hence
passing (addr + 16) is still accurate.
Clarify the same by updating comments around this.
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/livepatch.h | 4 ++--
arch/powerpc/kernel/kprobes.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/include/asm/livepatch.h b/arch/powerpc/include/asm/livepatch.h
index 47a03b9b528b..62f98d977f59 100644
--- a/arch/powerpc/include/asm/livepatch.h
+++ b/arch/powerpc/include/asm/livepatch.h
@@ -37,8 +37,8 @@ static inline void klp_arch_set_pc(struct pt_regs *regs, unsigned long ip)
static inline unsigned long klp_get_ftrace_location(unsigned long faddr)
{
/*
- * Live patch works only with -mprofile-kernel on PPC. In this case,
- * the ftrace location is always within the first 16 bytes.
+ * Live patch only works with -mprofile-kernel on PPC. In this case, the
+ * ftrace location always starts within the first 16 bytes (inclusive).
*/
return ftrace_location_range(faddr, faddr + 16);
}
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 562d18f456d7..4398ea60b4e0 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -62,8 +62,8 @@ kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset)
#ifdef CONFIG_KPROBES_ON_FTRACE
unsigned long faddr;
/*
- * Per livepatch.h, ftrace location is always within the first
- * 16 bytes of a function on powerpc with -mprofile-kernel.
+ * Per livepatch.h, ftrace location always starts within the first
+ * 16 bytes (inclusive) of a function with -mprofile-kernel.
*/
faddr = ftrace_location_range((unsigned long)addr,
(unsigned long)addr + 16);
--
2.12.2
next prev parent reply other threads:[~2017-05-04 4:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-04 4:36 [PATCH 0/8] powerpc: Various fixes and enhancements for kprobes and ftrace Naveen N. Rao
2017-05-04 4:36 ` [PATCH 1/8] powerpc/kprobes: Pause function_graph tracing during jprobes handling Naveen N. Rao
[not found] ` <20170503155819.0cbd04e5@gandalf.local.home>
2017-05-04 4:35 ` Naveen N. Rao
2017-05-04 4:36 ` [PATCH 2/8] powerpc/ftrace: Pass the correct stack pointer for DYNAMIC_FTRACE_WITH_REGS Naveen N. Rao
2017-05-04 4:36 ` [PATCH 3/8] powerpc/ftrace: Remove redundant saving of LR in ftrace[_graph]_caller Naveen N. Rao
2017-05-04 4:36 ` [PATCH 4/8] powerpc/kprobes_on_ftrace: Skip livepatch_handler() for jprobes Naveen N. Rao
2017-05-04 4:36 ` [PATCH 5/8] powerpc/ftrace: Eliminate duplicate stack setup for ftrace_graph_caller() Naveen N. Rao
2017-05-04 4:36 ` [PATCH 6/8] powerpc/ftrace: Add support for HAVE_FUNCTION_GRAPH_FP_TEST for -mprofile-kernel Naveen N. Rao
2017-05-04 4:36 ` Naveen N. Rao [this message]
2017-05-04 4:36 ` [PATCH 8/8] powerpc/xmon: Disable function_graph tracing while in xmon Naveen N. Rao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=def36fbe0eb1c6622ff49f56b3f1c9545e5aef3b.1493831558.git.naveen.n.rao@linux.vnet.ibm.com \
--to=naveen.n.rao@linux.vnet.ibm.com \
--cc=ananth@linux.vnet.ibm.com \
--cc=anton@samba.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mhiramat@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).