All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/xmon: Exclude all of xmon/ from ftrace
@ 2017-08-02 18:25 Naveen N. Rao
  2017-08-08 10:46 ` Michael Ellerman
  2017-08-16 12:29 ` Michael Ellerman
  0 siblings, 2 replies; 6+ messages in thread
From: Naveen N. Rao @ 2017-08-02 18:25 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Breno Leitao

Exclude core xmon files from ftrace (along with an xmon xive helper
outside of xmon/) to minimize impact of ftrace while within xmon.

Before patch:
  root@ubuntu:/sys/kernel/debug/tracing# cat available_filter_functions | grep -i xmon
  xmon_xive_do_dump
  xmon_dbgfs_get
  xmon_print_symbol
  xmon_show_stack
  xmon_dbgfs_ops_open
  xmon_init.part.2
  xmon_dbgfs_set
  sysrq_handle_xmon
  xmon_fault_handler
  cpus_are_in_xmon
  xmon_core
  xmon
  xmon_irq
  xmon_break_match
  xmon_iabr_match
  xmon_sstep
  xmon_bpt
  xmon_ipi
  xmon_write
  xmon_start_pagination
  xmon_end_pagination
  xmon_set_pagination_lpp
  xmon_putchar
  xmon_gets
  xmon_printf
  xmon_puts
  root@ubuntu:/sys/kernel/debug/tracing#

After patch:
  root@ubuntu:/sys/kernel/debug/tracing# cat available_filter_functions | grep -i xmon
  root@ubuntu:/sys/kernel/debug/tracing#

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
This is in addition to Breno's series to disable tracing while in xmon.
While this patch prevents xmon core functions from being traced,
Breno's series prevents other helpers used by xmon from logging entries
into the trace buffer.

- Naveen

 arch/powerpc/sysdev/xive/common.c |  6 +++---
 arch/powerpc/xmon/Makefile        | 13 +++++++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
index 6595462b1fc8..97e82a33b7be 100644
--- a/arch/powerpc/sysdev/xive/common.c
+++ b/arch/powerpc/sysdev/xive/common.c
@@ -190,7 +190,7 @@ static u32 xive_scan_interrupts(struct xive_cpu *xc, bool just_peek)
  * This is used to perform the magic loads from an ESB
  * described in xive.h
  */
-static u8 xive_poke_esb(struct xive_irq_data *xd, u32 offset)
+static notrace u8 xive_poke_esb(struct xive_irq_data *xd, u32 offset)
 {
 	u64 val;
 
@@ -204,7 +204,7 @@ static u8 xive_poke_esb(struct xive_irq_data *xd, u32 offset)
 }
 
 #ifdef CONFIG_XMON
-static void xive_dump_eq(const char *name, struct xive_q *q)
+static notrace void xive_dump_eq(const char *name, struct xive_q *q)
 {
 	u32 i0, i1, idx;
 
@@ -218,7 +218,7 @@ static void xive_dump_eq(const char *name, struct xive_q *q)
 		    q->toggle, i0, i1);
 }
 
-void xmon_xive_do_dump(int cpu)
+notrace void xmon_xive_do_dump(int cpu)
 {
 	struct xive_cpu *xc = per_cpu(xive_cpu, cpu);
 
diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile
index 0b2f771593eb..5f95af64cb8f 100644
--- a/arch/powerpc/xmon/Makefile
+++ b/arch/powerpc/xmon/Makefile
@@ -7,6 +7,19 @@ UBSAN_SANITIZE := n
 
 ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC)
 
+ifdef CONFIG_FUNCTION_TRACER
+CFLAGS_REMOVE_xmon.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
+CFLAGS_REMOVE_nonstdio.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
+ifdef CONFIG_XMON_DISASSEMBLY
+CFLAGS_REMOVE_ppc-dis.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
+CFLAGS_REMOVE_ppc-opc.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
+ifdef CONFIG_SPU_BASE
+CFLAGS_REMOVE_spu-dis.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
+CFLAGS_REMOVE_spu-opc.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
+endif
+endif
+endif
+
 obj-y			+= xmon.o nonstdio.o spr_access.o
 
 ifdef CONFIG_XMON_DISASSEMBLY
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc/xmon: Exclude all of xmon/ from ftrace
  2017-08-02 18:25 [PATCH] powerpc/xmon: Exclude all of xmon/ from ftrace Naveen N. Rao
@ 2017-08-08 10:46 ` Michael Ellerman
  2017-08-15 10:04   ` Michael Ellerman
  2017-08-16 12:29 ` Michael Ellerman
  1 sibling, 1 reply; 6+ messages in thread
From: Michael Ellerman @ 2017-08-08 10:46 UTC (permalink / raw)
  To: Naveen N. Rao; +Cc: linuxppc-dev, Breno Leitao

"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> writes:

> diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile
> index 0b2f771593eb..5f95af64cb8f 100644
> --- a/arch/powerpc/xmon/Makefile
> +++ b/arch/powerpc/xmon/Makefile
> @@ -7,6 +7,19 @@ UBSAN_SANITIZE := n
>  
>  ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC)
>  
> +ifdef CONFIG_FUNCTION_TRACER
> +CFLAGS_REMOVE_xmon.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
> +CFLAGS_REMOVE_nonstdio.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
> +ifdef CONFIG_XMON_DISASSEMBLY
> +CFLAGS_REMOVE_ppc-dis.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
> +CFLAGS_REMOVE_ppc-opc.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
> +ifdef CONFIG_SPU_BASE
> +CFLAGS_REMOVE_spu-dis.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
> +CFLAGS_REMOVE_spu-opc.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
> +endif
> +endif
> +endif

Urk.

We want to disable it for everything in the directory, so can you do
something like:

  ORIG_CFLAGS := $(KBUILD_CFLAGS)
  KBUILD_CFLAGS = $(subst $(CC_FLAGS_FTRACE),,$(ORIG_CFLAGS))

cheers

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc/xmon: Exclude all of xmon/ from ftrace
  2017-08-08 10:46 ` Michael Ellerman
@ 2017-08-15 10:04   ` Michael Ellerman
  2017-08-16 14:13     ` Naveen N. Rao
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Ellerman @ 2017-08-15 10:04 UTC (permalink / raw)
  To: Naveen N. Rao; +Cc: Breno Leitao, linuxppc-dev

Michael Ellerman <mpe@ellerman.id.au> writes:

> "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> writes:
>
>> diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile
>> index 0b2f771593eb..5f95af64cb8f 100644
>> --- a/arch/powerpc/xmon/Makefile
>> +++ b/arch/powerpc/xmon/Makefile
>> @@ -7,6 +7,19 @@ UBSAN_SANITIZE := n
>>  
>>  ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC)
>>  
>> +ifdef CONFIG_FUNCTION_TRACER
>> +CFLAGS_REMOVE_xmon.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
>> +CFLAGS_REMOVE_nonstdio.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
>> +ifdef CONFIG_XMON_DISASSEMBLY
>> +CFLAGS_REMOVE_ppc-dis.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
>> +CFLAGS_REMOVE_ppc-opc.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
>> +ifdef CONFIG_SPU_BASE
>> +CFLAGS_REMOVE_spu-dis.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
>> +CFLAGS_REMOVE_spu-opc.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
>> +endif
>> +endif
>> +endif
>
> Urk.
>
> We want to disable it for everything in the directory, so can you do
> something like:
>
>   ORIG_CFLAGS := $(KBUILD_CFLAGS)
>   KBUILD_CFLAGS = $(subst $(CC_FLAGS_FTRACE),,$(ORIG_CFLAGS))

Yes:

  # Disable ftrace for the entire directory
  ORIG_CFLAGS := $(KBUILD_CFLAGS)
  KBUILD_CFLAGS = $(subst -mno-sched-epilog,,$(subst $(CC_FLAGS_FTRACE),,$(ORIG_CFLAGS)))

Seems to work.

cheers

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: powerpc/xmon: Exclude all of xmon/ from ftrace
  2017-08-02 18:25 [PATCH] powerpc/xmon: Exclude all of xmon/ from ftrace Naveen N. Rao
  2017-08-08 10:46 ` Michael Ellerman
@ 2017-08-16 12:29 ` Michael Ellerman
  1 sibling, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2017-08-16 12:29 UTC (permalink / raw)
  To: Naveen N. Rao; +Cc: Breno Leitao, linuxppc-dev

On Wed, 2017-08-02 at 18:25:38 UTC, "Naveen N. Rao" wrote:
> Exclude core xmon files from ftrace (along with an xmon xive helper
> outside of xmon/) to minimize impact of ftrace while within xmon.
> 
> Before patch:
>   root@ubuntu:/sys/kernel/debug/tracing# cat available_filter_functions | grep -i xmon
>   xmon_xive_do_dump
>   xmon_dbgfs_get
>   xmon_print_symbol
>   xmon_show_stack
>   xmon_dbgfs_ops_open
>   xmon_init.part.2
>   xmon_dbgfs_set
>   sysrq_handle_xmon
>   xmon_fault_handler
>   cpus_are_in_xmon
>   xmon_core
>   xmon
>   xmon_irq
>   xmon_break_match
>   xmon_iabr_match
>   xmon_sstep
>   xmon_bpt
>   xmon_ipi
>   xmon_write
>   xmon_start_pagination
>   xmon_end_pagination
>   xmon_set_pagination_lpp
>   xmon_putchar
>   xmon_gets
>   xmon_printf
>   xmon_puts
>   root@ubuntu:/sys/kernel/debug/tracing#
> 
> After patch:
>   root@ubuntu:/sys/kernel/debug/tracing# cat available_filter_functions | grep -i xmon
>   root@ubuntu:/sys/kernel/debug/tracing#
> 
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/e12d94f80614475b07d046eb095e6b

cheers

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc/xmon: Exclude all of xmon/ from ftrace
  2017-08-15 10:04   ` Michael Ellerman
@ 2017-08-16 14:13     ` Naveen N. Rao
  2017-08-17 12:54       ` Michael Ellerman
  0 siblings, 1 reply; 6+ messages in thread
From: Naveen N. Rao @ 2017-08-16 14:13 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: Breno Leitao, linuxppc-dev

Hi Michael,
Sorry -- was off since last week.

On 2017/08/15 08:04PM, Michael Ellerman wrote:
> Michael Ellerman <mpe@ellerman.id.au> writes:
> 
> > "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> writes:
> >
> >> diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile
> >> index 0b2f771593eb..5f95af64cb8f 100644
> >> --- a/arch/powerpc/xmon/Makefile
> >> +++ b/arch/powerpc/xmon/Makefile
> >> @@ -7,6 +7,19 @@ UBSAN_SANITIZE := n
> >>  
> >>  ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC)
> >>  
> >> +ifdef CONFIG_FUNCTION_TRACER
> >> +CFLAGS_REMOVE_xmon.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
> >> +CFLAGS_REMOVE_nonstdio.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
> >> +ifdef CONFIG_XMON_DISASSEMBLY
> >> +CFLAGS_REMOVE_ppc-dis.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
> >> +CFLAGS_REMOVE_ppc-opc.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
> >> +ifdef CONFIG_SPU_BASE
> >> +CFLAGS_REMOVE_spu-dis.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
> >> +CFLAGS_REMOVE_spu-opc.o	= -mno-sched-epilog $(CC_FLAGS_FTRACE)
> >> +endif
> >> +endif
> >> +endif
> >
> > Urk.
> >
> > We want to disable it for everything in the directory, so can you do
> > something like:
> >
> >   ORIG_CFLAGS := $(KBUILD_CFLAGS)
> >   KBUILD_CFLAGS = $(subst $(CC_FLAGS_FTRACE),,$(ORIG_CFLAGS))
> 
> Yes:
> 
>   # Disable ftrace for the entire directory
>   ORIG_CFLAGS := $(KBUILD_CFLAGS)
>   KBUILD_CFLAGS = $(subst -mno-sched-epilog,,$(subst $(CC_FLAGS_FTRACE),,$(ORIG_CFLAGS)))
> 
> Seems to work.

Nice -- I had looked for a generic CFLAGS_REMOVE variant, but didn't 
find that. This is much nicer.

Thanks,
Naveen

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc/xmon: Exclude all of xmon/ from ftrace
  2017-08-16 14:13     ` Naveen N. Rao
@ 2017-08-17 12:54       ` Michael Ellerman
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2017-08-17 12:54 UTC (permalink / raw)
  To: Naveen N. Rao; +Cc: Breno Leitao, linuxppc-dev

"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> writes:

> Hi Michael,
> Sorry -- was off since last week.

No worries.

cheers

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-08-17 12:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-02 18:25 [PATCH] powerpc/xmon: Exclude all of xmon/ from ftrace Naveen N. Rao
2017-08-08 10:46 ` Michael Ellerman
2017-08-15 10:04   ` Michael Ellerman
2017-08-16 14:13     ` Naveen N. Rao
2017-08-17 12:54       ` Michael Ellerman
2017-08-16 12:29 ` Michael Ellerman

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.