Re: [PATCH] powerpc/xmon: Exclude all of xmon/ from ftrace

2017-08-17 Thread Michael Ellerman
"Naveen N. Rao"  writes:

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

No worries.

cheers


Re: [PATCH] powerpc/xmon: Exclude all of xmon/ from ftrace

2017-08-16 Thread Naveen N. Rao
Hi Michael,
Sorry -- was off since last week.

On 2017/08/15 08:04PM, Michael Ellerman wrote:
> Michael Ellerman  writes:
> 
> > "Naveen N. Rao"  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



Re: powerpc/xmon: Exclude all of xmon/ from ftrace

2017-08-16 Thread Michael Ellerman
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 

Applied to powerpc next, thanks.

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

cheers


Re: [PATCH] powerpc/xmon: Exclude all of xmon/ from ftrace

2017-08-15 Thread Michael Ellerman
Michael Ellerman  writes:

> "Naveen N. Rao"  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


Re: [PATCH] powerpc/xmon: Exclude all of xmon/ from ftrace

2017-08-08 Thread Michael Ellerman
"Naveen N. Rao"  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


[PATCH] powerpc/xmon: Exclude all of xmon/ from ftrace

2017-08-02 Thread Naveen N. Rao
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 
---
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