From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Ingo Molnar <mingo@redhat.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Paul Mackerras <paulus@samba.org>,
Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v1 10/22] powerpc/ftrace: Use CONFIG_FUNCTION_TRACER instead of CONFIG_DYNAMIC_FTRACE
Date: Mon, 18 Apr 2022 12:30:09 +0530 [thread overview]
Message-ID: <1650264297.v44gkh54rc.naveen@linux.ibm.com> (raw)
In-Reply-To: <72070995f96acaa9a387963e3848bd24a436a847.1648131740.git.christophe.leroy@csgroup.eu>
Christophe Leroy wrote:
> Since commit 0c0c52306f47 ("powerpc: Only support DYNAMIC_FTRACE not
> static"), CONFIG_DYNAMIC_FTRACE is always selected when
> CONFIG_FUNCTION_TRACER is selected.
>
> To avoid confusion and have the reader wonder what's happen when
> CONFIG_FUNCTION_TRACER is selected and CONFIG_DYNAMIC_FTRACE is not,
> use CONFIG_FUNCTION_TRACER in ifdefs instead of CONFIG_DYNAMIC_FTRACE.
>
> As CONFIG_FUNCTION_GRAPH_TRACER depends on CONFIG_FUNCTION_TRACER,
> ftrace.o doesn't need to appear for both symbols in Makefile.
>
> Then as ftrace.o is built only when CONFIG_FUNCTION_TRACER is selected
and since it implies CONFIG_DYNAMIC_FTRACE, CONFIG_DYNAMIC_FTRACE is not
needed in ftrace.c
> ifdef CONFIG_FUNCTION_TRACER is not needed in ftrace.c
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> arch/powerpc/include/asm/book3s/32/pgtable.h | 2 +-
> arch/powerpc/include/asm/book3s/64/pgtable.h | 2 +-
> arch/powerpc/include/asm/module.h | 4 ++--
> arch/powerpc/include/asm/nohash/pgtable.h | 2 +-
> arch/powerpc/kernel/module_32.c | 4 ++--
> arch/powerpc/kernel/module_64.c | 6 +++---
> arch/powerpc/kernel/trace/Makefile | 4 +---
> arch/powerpc/kernel/trace/ftrace.c | 4 ----
> 8 files changed, 11 insertions(+), 17 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/book3s/32/pgtable.h b/arch/powerpc/include/asm/book3s/32/pgtable.h
> index 772e00dc4ef1..992aed626eb4 100644
> --- a/arch/powerpc/include/asm/book3s/32/pgtable.h
> +++ b/arch/powerpc/include/asm/book3s/32/pgtable.h
> @@ -124,7 +124,7 @@ static inline bool pte_user(pte_t pte)
> * on platforms where such control is possible.
> */
> #if defined(CONFIG_KGDB) || defined(CONFIG_XMON) || defined(CONFIG_BDI_SWITCH) ||\
> - defined(CONFIG_KPROBES) || defined(CONFIG_DYNAMIC_FTRACE)
> + defined(CONFIG_KPROBES) || defined(CONFIG_FUNCTION_TRACER)
> #define PAGE_KERNEL_TEXT PAGE_KERNEL_X
> #else
> #define PAGE_KERNEL_TEXT PAGE_KERNEL_ROX
> diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h
> index 875730d5af40..cf01b609572f 100644
> --- a/arch/powerpc/include/asm/book3s/64/pgtable.h
> +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
> @@ -169,7 +169,7 @@
> * on platforms where such control is possible.
> */
> #if defined(CONFIG_KGDB) || defined(CONFIG_XMON) || defined(CONFIG_BDI_SWITCH) || \
> - defined(CONFIG_KPROBES) || defined(CONFIG_DYNAMIC_FTRACE)
> + defined(CONFIG_KPROBES) || defined(CONFIG_FUNCTION_TRACER)
> #define PAGE_KERNEL_TEXT PAGE_KERNEL_X
> #else
> #define PAGE_KERNEL_TEXT PAGE_KERNEL_ROX
> diff --git a/arch/powerpc/include/asm/module.h b/arch/powerpc/include/asm/module.h
> index 857d9ff24295..e6f5963fd96e 100644
> --- a/arch/powerpc/include/asm/module.h
> +++ b/arch/powerpc/include/asm/module.h
> @@ -39,7 +39,7 @@ struct mod_arch_specific {
> unsigned int init_plt_section;
> #endif /* powerpc64 */
>
> -#ifdef CONFIG_DYNAMIC_FTRACE
> +#ifdef CONFIG_FUNCTION_TRACER
> unsigned long tramp;
> #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
> unsigned long tramp_regs;
> @@ -68,7 +68,7 @@ struct mod_arch_specific {
> # endif /* MODULE */
> #endif
>
> -#ifdef CONFIG_DYNAMIC_FTRACE
> +#ifdef CONFIG_FUNCTION_TRACER
> # ifdef MODULE
> asm(".section .ftrace.tramp,\"ax\",@nobits; .align 3; .previous");
> # endif /* MODULE */
> diff --git a/arch/powerpc/include/asm/nohash/pgtable.h b/arch/powerpc/include/asm/nohash/pgtable.h
> index ac75f4ab0dba..2e8cf217a191 100644
> --- a/arch/powerpc/include/asm/nohash/pgtable.h
> +++ b/arch/powerpc/include/asm/nohash/pgtable.h
> @@ -23,7 +23,7 @@
> * on platforms where such control is possible.
> */
> #if defined(CONFIG_KGDB) || defined(CONFIG_XMON) || defined(CONFIG_BDI_SWITCH) ||\
> - defined(CONFIG_KPROBES) || defined(CONFIG_DYNAMIC_FTRACE)
> + defined(CONFIG_KPROBES) || defined(CONFIG_FUNCTION_TRACER)
> #define PAGE_KERNEL_TEXT PAGE_KERNEL_X
> #else
> #define PAGE_KERNEL_TEXT PAGE_KERNEL_ROX
> diff --git a/arch/powerpc/kernel/module_32.c b/arch/powerpc/kernel/module_32.c
> index a0432ef46967..2aa368ce21c9 100644
> --- a/arch/powerpc/kernel/module_32.c
> +++ b/arch/powerpc/kernel/module_32.c
> @@ -39,7 +39,7 @@ static unsigned int count_relocs(const Elf32_Rela *rela, unsigned int num)
> r_addend = rela[i].r_addend;
> }
>
> -#ifdef CONFIG_DYNAMIC_FTRACE
> +#ifdef CONFIG_FUNCTION_TRACER
> _count_relocs++; /* add one for ftrace_caller */
> #endif
> return _count_relocs;
> @@ -288,7 +288,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
> return 0;
> }
>
> -#ifdef CONFIG_DYNAMIC_FTRACE
> +#ifdef CONFIG_FUNCTION_TRACER
> int module_trampoline_target(struct module *mod, unsigned long addr,
> unsigned long *target)
> {
> diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
> index 794720530442..b13a72665eee 100644
> --- a/arch/powerpc/kernel/module_64.c
> +++ b/arch/powerpc/kernel/module_64.c
> @@ -207,7 +207,7 @@ static unsigned long get_stubs_size(const Elf64_Ehdr *hdr,
> }
> }
>
> -#ifdef CONFIG_DYNAMIC_FTRACE
> +#ifdef CONFIG_FUNCTION_TRACER
> /* make the trampoline to the ftrace_caller */
> relocs++;
> #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
> @@ -372,7 +372,7 @@ static bool is_mprofile_ftrace_call(const char *name)
> {
> if (!strcmp("_mcount", name))
> return true;
> -#ifdef CONFIG_DYNAMIC_FTRACE
> +#ifdef CONFIG_FUNCTION_TRACER
> if (!strcmp("ftrace_caller", name))
> return true;
> #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
> @@ -740,7 +740,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
> return 0;
> }
>
> -#ifdef CONFIG_DYNAMIC_FTRACE
> +#ifdef CONFIG_FUNCTION_TRACER
> int module_trampoline_target(struct module *mod, unsigned long addr,
> unsigned long *target)
> {
The below two changes to trace/Makefile and trace/ftrace.c make
sense, but I'm not sure the above changes are necessary.
For generic code (outside arch/powerpc/kernel/trace), I think it is good
to retain the actual dependency which is DYNAMIC_FTRACE. In my view,
gating some of the above code on FUNCTION_TRACER is also confusing. The
primary implication of always selecting DYNAMIC_FTRACE is within the
powerpc trace code, and it is good to keep it that way.
> diff --git a/arch/powerpc/kernel/trace/Makefile b/arch/powerpc/kernel/trace/Makefile
> index fc32ec30b297..af8527538fe4 100644
> --- a/arch/powerpc/kernel/trace/Makefile
> +++ b/arch/powerpc/kernel/trace/Makefile
> @@ -14,9 +14,7 @@ obj64-$(CONFIG_FUNCTION_TRACER) += ftrace_mprofile.o
> else
> obj64-$(CONFIG_FUNCTION_TRACER) += ftrace_64_pg.o
> endif
> -obj-$(CONFIG_FUNCTION_TRACER) += ftrace_low.o
> -obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
> -obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
> +obj-$(CONFIG_FUNCTION_TRACER) += ftrace_low.o ftrace.o
> obj-$(CONFIG_TRACING) += trace_clock.o
>
> obj-$(CONFIG_PPC64) += $(obj64-y)
> diff --git a/arch/powerpc/kernel/trace/ftrace.c b/arch/powerpc/kernel/trace/ftrace.c
> index 2c7e42e439bb..188f59f4ee4a 100644
> --- a/arch/powerpc/kernel/trace/ftrace.c
> +++ b/arch/powerpc/kernel/trace/ftrace.c
> @@ -28,9 +28,6 @@
> #include <asm/syscall.h>
> #include <asm/inst.h>
>
> -
> -#ifdef CONFIG_DYNAMIC_FTRACE
> -
> /*
> * We generally only have a single long_branch tramp and at most 2 or 3 plt
> * tramps generated. But, we don't use the plt tramps currently. We also allot
> @@ -783,7 +780,6 @@ int __init ftrace_dyn_arch_init(void)
> return 0;
> }
> #endif
> -#endif /* CONFIG_DYNAMIC_FTRACE */
>
> #ifdef CONFIG_FUNCTION_GRAPH_TRACER
>
> --
> 2.35.1
>
- Naveen
next prev parent reply other threads:[~2022-04-18 7:01 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-24 14:29 [PATCH v1 00/22] powerpc: ftrace optimisation and cleanup and more [v1] Christophe Leroy
2022-03-24 14:29 ` [PATCH v1 01/22] powerpc/ftrace: Refactor prepare_ftrace_return() Christophe Leroy
2022-03-24 14:29 ` [PATCH v1 02/22] powerpc/ftrace: Remove redundant create_branch() calls Christophe Leroy
2022-03-24 14:29 ` [PATCH v1 03/22] powerpc/code-patching: Inline is_offset_in_{cond}_branch_range() Christophe Leroy
2022-03-24 14:29 ` [PATCH v1 04/22] powerpc/ftrace: Use is_offset_in_branch_range() Christophe Leroy
2022-03-24 14:29 ` [PATCH v1 05/22] powerpc/code-patching: Inline create_branch() Christophe Leroy
2022-03-24 14:29 ` [PATCH v1 06/22] powerpc/ftrace: Inline ftrace_modify_code() Christophe Leroy
2022-04-18 6:07 ` Naveen N. Rao
2022-04-22 9:12 ` Michael Ellerman
2022-05-04 11:43 ` Christophe Leroy
2022-03-24 14:29 ` [PATCH v1 07/22] powerpc/ftrace: Use patch_instruction() return directly Christophe Leroy
2022-04-18 6:21 ` Naveen N. Rao
2022-04-18 19:44 ` Steven Rostedt
2022-05-04 12:01 ` Christophe Leroy
2022-03-24 14:29 ` [PATCH v1 08/22] powerpc/ftrace: Make __ftrace_make_{nop/call}() common to PPC32 and PPC64 Christophe Leroy
2022-04-18 6:40 ` Naveen N. Rao
2022-05-04 12:19 ` Christophe Leroy
2022-05-06 11:41 ` Christophe Leroy
2022-03-24 14:29 ` [PATCH v1 09/22] powerpc/ftrace: Don't include ftrace.o for CONFIG_FTRACE_SYSCALLS Christophe Leroy
2022-03-24 14:30 ` [PATCH v1 10/22] powerpc/ftrace: Use CONFIG_FUNCTION_TRACER instead of CONFIG_DYNAMIC_FTRACE Christophe Leroy
2022-04-18 7:00 ` Naveen N. Rao [this message]
2022-05-06 11:41 ` Christophe Leroy
2022-03-24 14:30 ` [PATCH v1 11/22] powerpc/ftrace: Remove ftrace_plt_tramps[] Christophe Leroy
2022-03-24 14:30 ` [PATCH v1 12/22] powerpc/ftrace: Use BRANCH_SET_LINK instead of value 1 Christophe Leroy
2022-03-24 14:30 ` [PATCH v1 13/22] powerpc/ftrace: Use PPC_RAW_xxx() macros instead of opencoding Christophe Leroy
2022-04-18 7:38 ` Naveen N. Rao
2022-05-04 12:39 ` Christophe Leroy
2022-05-05 16:47 ` Christophe Leroy
2022-03-24 14:30 ` [PATCH v1 14/22] powerpc/ftrace: Use size macro " Christophe Leroy
2022-03-24 14:30 ` [PATCH v1 15/22] powerpc/ftrace: Simplify expected_nop_sequence() Christophe Leroy
2022-03-24 14:30 ` [PATCH v1 16/22] powerpc/ftrace: Minimise number of #ifdefs Christophe Leroy
2022-04-18 7:59 ` Naveen N. Rao
2022-05-04 12:44 ` Christophe Leroy
2022-03-24 14:30 ` [PATCH v1 17/22] powerpc/inst: Add __copy_inst_from_kernel_nofault() Christophe Leroy
2022-03-24 14:30 ` [PATCH v1 18/22] powerpc/ftrace: Don't use copy_from_kernel_nofault() in module_trampoline_target() Christophe Leroy
2022-03-24 14:30 ` [PATCH v1 19/22] powerpc/inst: Remove PPC_INST_BRANCH Christophe Leroy
2022-03-24 14:30 ` [PATCH v1 20/22] powerpc/modules: Use PPC_INST_BRANCH_MASK instead of opencoding Christophe Leroy
2022-03-24 14:30 ` [PATCH v1 21/22] powerpc/inst: Remove PPC_INST_BL Christophe Leroy
2022-03-24 14:30 ` [PATCH v1 22/22] powerpc/opcodes: Remove unused PPC_INST_XXX macros Christophe Leroy
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=1650264297.v44gkh54rc.naveen@linux.ibm.com \
--to=naveen.n.rao@linux.vnet.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=christophe.leroy@csgroup.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--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).