* [PATCH 1/2] powerpc/xmon: Dump ftrace buffers for the current CPU
@ 2017-08-02 14:58 Breno Leitao
2017-08-02 14:58 ` [PATCH 2/2] powerpc/xmon: Disable tracing when entering xmon Breno Leitao
2017-08-02 16:21 ` [PATCH 1/2] powerpc/xmon: Dump ftrace buffers for the current CPU Naveen N. Rao
0 siblings, 2 replies; 4+ messages in thread
From: Breno Leitao @ 2017-08-02 14:58 UTC (permalink / raw)
To: linuxppc-dev; +Cc: naveen.n.rao, Breno Leitao
Current xmon 'dt' command dumps the tracing buffer for all the CPUs,
which makes it very hard to read due to the fact that most of
powerpc machines currently have many CPUs. Other than that, the CPU
lines are interleaved in the ftrace log.
This new option just dumps the ftrace buffer for the current CPU.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
arch/powerpc/xmon/xmon.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 08e367e3e8c3..0cbd910193fa 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -234,6 +234,7 @@ Commands:\n\
"\
dr dump stream of raw bytes\n\
dt dump the tracing buffers (uses printk)\n\
+ dtc dump the tracing buffers for current CPU (uses printk)\n\
"
#ifdef CONFIG_PPC_POWERNV
" dx# dump xive on CPU #\n\
@@ -2342,6 +2343,19 @@ static void dump_one_paca(int cpu)
sync();
}
+static void dump_tracing(void)
+{
+ int c;
+
+ c = inchar();
+ if (c == 'c')
+ ftrace_dump(DUMP_ORIG);
+ else
+ ftrace_dump(DUMP_ALL);
+
+ tracing_on();
+}
+
static void dump_all_pacas(void)
{
int cpu;
@@ -2507,6 +2521,11 @@ dump(void)
}
#endif
+ if (c == 't') {
+ dump_tracing();
+ return;
+ }
+
if (c == '\n')
termch = c;
@@ -2525,9 +2544,6 @@ dump(void)
dump_log_buf();
} else if (c == 'o') {
dump_opal_msglog();
- } else if (c == 't') {
- ftrace_dump(DUMP_ALL);
- tracing_on();
} else if (c == 'r') {
scanhex(&ndump);
if (ndump == 0)
--
2.13.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] powerpc/xmon: Disable tracing when entering xmon
2017-08-02 14:58 [PATCH 1/2] powerpc/xmon: Dump ftrace buffers for the current CPU Breno Leitao
@ 2017-08-02 14:58 ` Breno Leitao
2017-08-02 16:23 ` Naveen N. Rao
2017-08-02 16:21 ` [PATCH 1/2] powerpc/xmon: Dump ftrace buffers for the current CPU Naveen N. Rao
1 sibling, 1 reply; 4+ messages in thread
From: Breno Leitao @ 2017-08-02 14:58 UTC (permalink / raw)
To: linuxppc-dev; +Cc: naveen.n.rao, Breno Leitao
If tracing is enabled and you get into xmon, the tracing buffer
continues to be updated, causing possible loss of data and unnecessary
tracing information coming from xmon functions.
This patch simple disables tracing when entering xmon, and reenables it
if the kernel is resumed (with 'x').
Signed-off-by: Breno Leitao <leitao@debian.org>
---
arch/powerpc/xmon/xmon.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 0cbd910193fa..0b766d7780fa 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -89,6 +89,7 @@ static unsigned long nidump = 16;
static unsigned long ncsum = 4096;
static int termch;
static char tmpstr[128];
+static char tracing_enabled;
static long bus_error_jmp[JMP_BUF_LEN];
static int catch_memory_errors;
@@ -462,6 +463,9 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
local_irq_save(flags);
hard_irq_disable();
+ tracing_enabled = tracing_is_on();
+ tracing_off();
+
bp = in_breakpoint_table(regs->nip, &offset);
if (bp != NULL) {
regs->nip = bp->address + offset;
@@ -982,6 +986,8 @@ cmds(struct pt_regs *excp)
break;
case 'x':
case 'X':
+ if (tracing_enabled)
+ tracing_on();
return cmd;
case EOF:
printf(" <no input ...>\n");
@@ -2353,7 +2359,6 @@ static void dump_tracing(void)
else
ftrace_dump(DUMP_ALL);
- tracing_on();
}
static void dump_all_pacas(void)
--
2.13.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] powerpc/xmon: Disable tracing when entering xmon
2017-08-02 14:58 ` [PATCH 2/2] powerpc/xmon: Disable tracing when entering xmon Breno Leitao
@ 2017-08-02 16:23 ` Naveen N. Rao
0 siblings, 0 replies; 4+ messages in thread
From: Naveen N. Rao @ 2017-08-02 16:23 UTC (permalink / raw)
To: Breno Leitao; +Cc: linuxppc-dev
On 2017/08/02 11:58AM, Breno Leitao wrote:
> If tracing is enabled and you get into xmon, the tracing buffer
> continues to be updated, causing possible loss of data and unnecessary
> tracing information coming from xmon functions.
>
> This patch simple disables tracing when entering xmon, and reenables it
> if the kernel is resumed (with 'x').
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
Two minor nits...
> ---
> arch/powerpc/xmon/xmon.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> index 0cbd910193fa..0b766d7780fa 100644
> --- a/arch/powerpc/xmon/xmon.c
> +++ b/arch/powerpc/xmon/xmon.c
> @@ -89,6 +89,7 @@ static unsigned long nidump = 16;
> static unsigned long ncsum = 4096;
> static int termch;
> static char tmpstr[128];
> +static char tracing_enabled;
^^^^
int
>
> static long bus_error_jmp[JMP_BUF_LEN];
> static int catch_memory_errors;
> @@ -462,6 +463,9 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
> local_irq_save(flags);
> hard_irq_disable();
>
> + tracing_enabled = tracing_is_on();
> + tracing_off();
> +
> bp = in_breakpoint_table(regs->nip, &offset);
> if (bp != NULL) {
> regs->nip = bp->address + offset;
> @@ -982,6 +986,8 @@ cmds(struct pt_regs *excp)
> break;
> case 'x':
> case 'X':
> + if (tracing_enabled)
> + tracing_on();
> return cmd;
> case EOF:
> printf(" <no input ...>\n");
> @@ -2353,7 +2359,6 @@ static void dump_tracing(void)
> else
> ftrace_dump(DUMP_ALL);
>
> - tracing_on();
> }
I'd also remove the extra blank line there.
Apart from those:
Acked-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Thanks,
Naveen
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] powerpc/xmon: Dump ftrace buffers for the current CPU
2017-08-02 14:58 [PATCH 1/2] powerpc/xmon: Dump ftrace buffers for the current CPU Breno Leitao
2017-08-02 14:58 ` [PATCH 2/2] powerpc/xmon: Disable tracing when entering xmon Breno Leitao
@ 2017-08-02 16:21 ` Naveen N. Rao
1 sibling, 0 replies; 4+ messages in thread
From: Naveen N. Rao @ 2017-08-02 16:21 UTC (permalink / raw)
To: Breno Leitao; +Cc: linuxppc-dev
On 2017/08/02 11:58AM, Breno Leitao wrote:
> Current xmon 'dt' command dumps the tracing buffer for all the CPUs,
> which makes it very hard to read due to the fact that most of
> powerpc machines currently have many CPUs. Other than that, the CPU
> lines are interleaved in the ftrace log.
>
> This new option just dumps the ftrace buffer for the current CPU.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
LGTM.
Acked-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> ---
> arch/powerpc/xmon/xmon.c | 22 +++++++++++++++++++---
> 1 file changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> index 08e367e3e8c3..0cbd910193fa 100644
> --- a/arch/powerpc/xmon/xmon.c
> +++ b/arch/powerpc/xmon/xmon.c
> @@ -234,6 +234,7 @@ Commands:\n\
> "\
> dr dump stream of raw bytes\n\
> dt dump the tracing buffers (uses printk)\n\
> + dtc dump the tracing buffers for current CPU (uses printk)\n\
> "
> #ifdef CONFIG_PPC_POWERNV
> " dx# dump xive on CPU #\n\
> @@ -2342,6 +2343,19 @@ static void dump_one_paca(int cpu)
> sync();
> }
>
> +static void dump_tracing(void)
> +{
> + int c;
> +
> + c = inchar();
> + if (c == 'c')
> + ftrace_dump(DUMP_ORIG);
> + else
> + ftrace_dump(DUMP_ALL);
> +
> + tracing_on();
> +}
> +
> static void dump_all_pacas(void)
> {
> int cpu;
> @@ -2507,6 +2521,11 @@ dump(void)
> }
> #endif
>
> + if (c == 't') {
> + dump_tracing();
> + return;
> + }
> +
> if (c == '\n')
> termch = c;
>
> @@ -2525,9 +2544,6 @@ dump(void)
> dump_log_buf();
> } else if (c == 'o') {
> dump_opal_msglog();
> - } else if (c == 't') {
> - ftrace_dump(DUMP_ALL);
> - tracing_on();
> } else if (c == 'r') {
> scanhex(&ndump);
> if (ndump == 0)
> --
> 2.13.2
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-08-02 16:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-02 14:58 [PATCH 1/2] powerpc/xmon: Dump ftrace buffers for the current CPU Breno Leitao
2017-08-02 14:58 ` [PATCH 2/2] powerpc/xmon: Disable tracing when entering xmon Breno Leitao
2017-08-02 16:23 ` Naveen N. Rao
2017-08-02 16:21 ` [PATCH 1/2] powerpc/xmon: Dump ftrace buffers for the current CPU Naveen N. Rao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox