From: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@ozlabs.org, bsingharora@gmail.com, duwe@lst.de,
linux-kernel@vger.kernel.org, rostedt@goodmis.org,
pmladek@suse.com, jeyu@redhat.com, jkosina@suse.cz,
live-patching@vger.kernel.org, mbenes@suse.cz
Subject: Re: [PATCH v2 2/8] powerpc/module: Only try to generate the ftrace_caller() stub once
Date: Tue, 1 Mar 2016 15:37:39 +0530 [thread overview]
Message-ID: <20160301100738.GB13436@linux.vnet.ibm.com> (raw)
In-Reply-To: <1456737989-8755-2-git-send-email-mpe@ellerman.id.au>
* Michael Ellerman <mpe@ellerman.id.au> [2016-02-29 20:26:23]:
> Currently we generate the module stub for ftrace_caller() at the bottom
> of apply_relocate_add(). However apply_relocate_add() is potentially
> called more than once per module, which means we will try to generate
> the ftrace_caller() stub multiple times.
>
> Although the current code deals with that correctly, ie. it only
> generates a stub the first time, it would be clearer to only try to
> generate the stub once.
>
> Note also on first reading it may appear that we generate a different
> stub for each section that requires relocation, but that is not the
> case. The code in stub_for_addr() that searches for an existing stub
> uses sechdrs[me->arch.stubs_section], ie. the single stub section for
> this module.
>
> A cleaner approach is to only generate the ftrace_caller() stub once,
> from module_finalize(). Although the original code didn't check to see
> if the stub was actually generated correctly, it seems prudent to add a
> check, so do that. And an additional benefit is we can clean the ifdefs
> up a little.
>
> Finally we must propagate the const'ness of some of the pointers passed
> to module_finalize(), but that is also an improvement.
>
> Reviewed-by: Balbir Singh <bsingharora@gmail.com>
> Reviewed-by: Torsten Duwe <duwe@suse.de>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
with !CONFIG_DYNAMIC_FTRACE, build breaks
arch/powerpc/kernel/module_64.c:491:13: error: âsquash_toc_save_instâ used but never defined [-Werror]
static void squash_toc_save_inst(const char *name, unsigned long addr);
^
cc1: all warnings being treated as errors
moving squash_toc_save_inst() definition to #else part
of #ifdef CONFIG_DYNAMIC_FTRACE helps.
arch/powerpc/kernel/module_64.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
index c9c75ceb7ed3..def0b9a013c9 100644
--- a/arch/powerpc/kernel/module_64.c
+++ b/arch/powerpc/kernel/module_64.c
@@ -774,8 +774,6 @@ static unsigned long create_ftrace_stub(const Elf64_Shdr *sechdrs, struct module
return (unsigned long)entry;
}
#else
-static void squash_toc_save_inst(const char *name, unsigned long addr) { }
-
static unsigned long create_ftrace_stub(const Elf64_Shdr *sechdrs, struct module *me)
{
return stub_for_addr(sechdrs, (unsigned long)ftrace_caller, me);
@@ -792,4 +790,8 @@ int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sechdrs)
return 0;
}
+
+#else
+static void squash_toc_save_inst(const char *name, unsigned long addr) { }
+
#endif
--
2.6.0.rc1
next prev parent reply other threads:[~2016-03-01 10:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-29 9:26 [PATCH v2 1/8] powerpc: Create a helper for getting the kernel toc value Michael Ellerman
2016-02-29 9:26 ` [PATCH v2 2/8] powerpc/module: Only try to generate the ftrace_caller() stub once Michael Ellerman
2016-03-01 1:40 ` kbuild test robot
2016-03-01 10:07 ` Kamalesh Babulal [this message]
2016-03-01 12:00 ` Torsten Duwe
2016-03-02 1:52 ` Michael Ellerman
2016-02-29 9:26 ` [PATCH v2 3/8] powerpc/module: Mark module stubs with a magic value Michael Ellerman
2016-02-29 9:26 ` [PATCH v2 4/8] powerpc/module: Create a special stub for ftrace_caller() Michael Ellerman
2016-02-29 9:26 ` [PATCH v2 5/8] powerpc/ftrace: Use generic ftrace_modify_all_code() Michael Ellerman
2016-03-01 10:08 ` Kamalesh Babulal
2016-02-29 9:26 ` [PATCH v2 6/8] powerpc/ftrace: Use $(CC_FLAGS_FTRACE) when disabling ftrace Michael Ellerman
2016-02-29 9:26 ` [PATCH v2 7/8] powerpc/ftrace: Add support for -mprofile-kernel ftrace ABI Michael Ellerman
2016-02-29 9:26 ` [PATCH v2 8/8] powerpc/ftrace: Add Kconfig & Make glue for mprofile-kernel Michael Ellerman
2016-03-01 9:56 ` [PATCH v2 1/8] powerpc: Create a helper for getting the kernel toc value Kamalesh Babulal
2016-03-01 11:58 ` Torsten Duwe
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=20160301100738.GB13436@linux.vnet.ibm.com \
--to=kamalesh@linux.vnet.ibm.com \
--cc=bsingharora@gmail.com \
--cc=duwe@lst.de \
--cc=jeyu@redhat.com \
--cc=jkosina@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=mpe@ellerman.id.au \
--cc=pmladek@suse.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.