* [PATCH] powerpc/xmon: Allow limiting the size of the paca display
@ 2015-08-12 6:57 Michael Ellerman
2015-08-12 7:54 ` Anshuman Khandual
2015-08-12 11:55 ` [PATCH v2] " Michael Ellerman
0 siblings, 2 replies; 5+ messages in thread
From: Michael Ellerman @ 2015-08-12 6:57 UTC (permalink / raw)
To: linuxppc-dev; +Cc: khandual
The paca display is already more than 24 lines, which can be problematic
if you have an old school 80x24 terminal, or more likely you are on a
virtual terminal which does not scroll for whatever reason.
We'd like to expand the paca display even more, so add a way to limit
the number of lines that are displayed.
This adds a third form of 'dp' which is 'dp # #', where the first number
is the cpu, and the second is the number of lines to display.
Example output:
5:mon> dp 3 6
paca for cpu 0x3 @ c00000000fdc0d80:
possible = yes
present = yes
online = yes
lock_token = 0x8000 (0xa)
paca_index = 0x3 (0x8)
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/xmon/xmon.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index e599259d84fc..6f44e9c07f34 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -205,6 +205,7 @@ Commands:\n\
#ifdef CONFIG_PPC64
"\
dp[#] dump paca for current cpu, or cpu #\n\
+ dp## dump paca for cpu #, only # lines\n\
dpa dump paca for all possible cpus\n"
#endif
"\
@@ -2070,9 +2071,10 @@ static void xmon_rawdump (unsigned long adrs, long ndump)
}
#ifdef CONFIG_PPC64
-static void dump_one_paca(int cpu)
+static void dump_one_paca(int cpu, int num_lines)
{
struct paca_struct *p;
+ int i;
if (setjmp(bus_error_jmp) != 0) {
printf("*** Error dumping paca for cpu 0x%x!\n", cpu);
@@ -2090,9 +2092,12 @@ static void dump_one_paca(int cpu)
printf(" %-*s = %s\n", 16, "present", cpu_present(cpu) ? "yes" : "no");
printf(" %-*s = %s\n", 16, "online", cpu_online(cpu) ? "yes" : "no");
+ i = 4; /* We always print the first four lines */
+
#define DUMP(paca, name, format) \
- printf(" %-*s = %#-*"format"\t(0x%lx)\n", 16, #name, 18, paca->name, \
- offsetof(struct paca_struct, name));
+ if (!num_lines || i++ < num_lines) \
+ printf(" %-*s = %#-*"format"\t(0x%lx)\n", 16, #name, 18, \
+ paca->name, offsetof(struct paca_struct, name));
DUMP(p, lock_token, "x");
DUMP(p, paca_index, "x");
@@ -2135,7 +2140,7 @@ static void dump_all_pacas(void)
}
for_each_possible_cpu(cpu)
- dump_one_paca(cpu);
+ dump_one_paca(cpu, 0);
}
static void dump_pacas(void)
@@ -2151,10 +2156,12 @@ static void dump_pacas(void)
termch = c; /* Put c back, it wasn't 'a' */
- if (scanhex(&num))
- dump_one_paca(num);
- else
- dump_one_paca(xmon_owner);
+ if (scanhex(&num)) {
+ unsigned long lines = 0;
+ scanhex(&lines);
+ dump_one_paca(num, lines);
+ } else
+ dump_one_paca(xmon_owner, 0);
}
#endif
--
2.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc/xmon: Allow limiting the size of the paca display
2015-08-12 6:57 [PATCH] powerpc/xmon: Allow limiting the size of the paca display Michael Ellerman
@ 2015-08-12 7:54 ` Anshuman Khandual
2015-08-12 9:47 ` Michael Ellerman
2015-08-12 11:55 ` [PATCH v2] " Michael Ellerman
1 sibling, 1 reply; 5+ messages in thread
From: Anshuman Khandual @ 2015-08-12 7:54 UTC (permalink / raw)
To: Michael Ellerman, linuxppc-dev
On 08/12/2015 12:27 PM, Michael Ellerman wrote:
> The paca display is already more than 24 lines, which can be problematic
> if you have an old school 80x24 terminal, or more likely you are on a
> virtual terminal which does not scroll for whatever reason.
>
> We'd like to expand the paca display even more, so add a way to limit
> the number of lines that are displayed.
>
> This adds a third form of 'dp' which is 'dp # #', where the first number
> is the cpu, and the second is the number of lines to display.
>
> Example output:
>
> 5:mon> dp 3 6
> paca for cpu 0x3 @ c00000000fdc0d80:
> possible = yes
> present = yes
> online = yes
> lock_token = 0x8000 (0xa)
> paca_index = 0x3 (0x8)
>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
> arch/powerpc/xmon/xmon.c | 23 +++++++++++++++--------
> 1 file changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> index e599259d84fc..6f44e9c07f34 100644
> --- a/arch/powerpc/xmon/xmon.c
> +++ b/arch/powerpc/xmon/xmon.c
> @@ -205,6 +205,7 @@ Commands:\n\
> #ifdef CONFIG_PPC64
> "\
> dp[#] dump paca for current cpu, or cpu #\n\
> + dp## dump paca for cpu #, only # lines\n\
> dpa dump paca for all possible cpus\n"
> #endif
> "\
> @@ -2070,9 +2071,10 @@ static void xmon_rawdump (unsigned long adrs, long ndump)
> }
>
> #ifdef CONFIG_PPC64
> -static void dump_one_paca(int cpu)
> +static void dump_one_paca(int cpu, int num_lines)
> {
> struct paca_struct *p;
> + int i;
>
> if (setjmp(bus_error_jmp) != 0) {
> printf("*** Error dumping paca for cpu 0x%x!\n", cpu);
> @@ -2090,9 +2092,12 @@ static void dump_one_paca(int cpu)
> printf(" %-*s = %s\n", 16, "present", cpu_present(cpu) ? "yes" : "no");
> printf(" %-*s = %s\n", 16, "online", cpu_online(cpu) ? "yes" : "no");
>
> + i = 4; /* We always print the first four lines */
> +
> #define DUMP(paca, name, format) \
> - printf(" %-*s = %#-*"format"\t(0x%lx)\n", 16, #name, 18, paca->name, \
> - offsetof(struct paca_struct, name));
> + if (!num_lines || i++ < num_lines)
All look good except the fact that we are using 0 to signify that
there is no limit to the number of lines. Is not it bit confusing ?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc/xmon: Allow limiting the size of the paca display
2015-08-12 7:54 ` Anshuman Khandual
@ 2015-08-12 9:47 ` Michael Ellerman
0 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2015-08-12 9:47 UTC (permalink / raw)
To: Anshuman Khandual; +Cc: linuxppc-dev
On Wed, 2015-08-12 at 13:24 +0530, Anshuman Khandual wrote:
> On 08/12/2015 12:27 PM, Michael Ellerman wrote:
> > @@ -2090,9 +2092,12 @@ static void dump_one_paca(int cpu)
> > printf(" %-*s = %s\n", 16, "present", cpu_present(cpu) ? "yes" : "no");
> > printf(" %-*s = %s\n", 16, "online", cpu_online(cpu) ? "yes" : "no");
> >
> > + i = 4; /* We always print the first four lines */
> > +
> > #define DUMP(paca, name, format) \
> > - printf(" %-*s = %#-*"format"\t(0x%lx)\n", 16, #name, 18, paca->name, \
> > - offsetof(struct paca_struct, name));
> > + if (!num_lines || i++ < num_lines)
>
> All look good except the fact that we are using 0 to signify that
> there is no limit to the number of lines. Is not it bit confusing ?
Maybe a bit, but it's the simplest option, and it's not uncommon for zero to
mean "no limit". chage(1) springs to mind as an example.
And in terms of xmon it's hardly the most confusing part :)
cheers
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] powerpc/xmon: Allow limiting the size of the paca display
2015-08-12 6:57 [PATCH] powerpc/xmon: Allow limiting the size of the paca display Michael Ellerman
2015-08-12 7:54 ` Anshuman Khandual
@ 2015-08-12 11:55 ` Michael Ellerman
2015-08-14 1:52 ` Sam Bobroff
1 sibling, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2015-08-12 11:55 UTC (permalink / raw)
To: linuxppc-dev; +Cc: khandual
The paca display is already more than 24 lines, which can be problematic
if you have an old school 80x24 terminal, or more likely you are on a
virtual terminal which does not scroll for whatever reason.
We'd like to expand the paca display even more, so add a way to limit
the number of lines that are displayed.
This adds a third form of 'dp' which is 'dp # #', where the first number
is the cpu, and the second is the number of lines to display.
Example output:
5:mon> dp 3 6
paca for cpu 0x3 @ c00000000fe00c00:
possible = yes
present = yes
online = yes
lock_token = 0x8000 (0xa)
paca_index = 0x3 (0x8)
kernel_toc = 0xc000000001230300 (0x10)
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
v2: Honour the limit even for the initial lines, and change the
implementation to use goto to bail out early rather than checking
continuously.
arch/powerpc/xmon/xmon.c | 40 +++++++++++++++++++++++++++++-----------
1 file changed, 29 insertions(+), 11 deletions(-)
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index e599259d84fc..2950c6aface4 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -205,6 +205,7 @@ Commands:\n\
#ifdef CONFIG_PPC64
"\
dp[#] dump paca for current cpu, or cpu #\n\
+ dp## dump paca for cpu #, only # lines\n\
dpa dump paca for all possible cpus\n"
#endif
"\
@@ -2070,9 +2071,10 @@ static void xmon_rawdump (unsigned long adrs, long ndump)
}
#ifdef CONFIG_PPC64
-static void dump_one_paca(int cpu)
+static void dump_one_paca(int cpu, int num_lines)
{
struct paca_struct *p;
+ int line;
if (setjmp(bus_error_jmp) != 0) {
printf("*** Error dumping paca for cpu 0x%x!\n", cpu);
@@ -2082,17 +2084,28 @@ static void dump_one_paca(int cpu)
catch_memory_errors = 1;
sync();
+#define CHECK_LINE() \
+ if (num_lines && line++ >= num_lines) \
+ goto out; \
+
+#define DUMP(paca, name, format) \
+ printf(" %-*s = %#-*"format"\t(0x%lx)\n", 16, #name, 18, \
+ paca->name, offsetof(struct paca_struct, name)); \
+ CHECK_LINE();
+
p = &paca[cpu];
+ line = 0;
+
printf("paca for cpu 0x%x @ %p:\n", cpu, p);
+ CHECK_LINE();
printf(" %-*s = %s\n", 16, "possible", cpu_possible(cpu) ? "yes" : "no");
+ CHECK_LINE();
printf(" %-*s = %s\n", 16, "present", cpu_present(cpu) ? "yes" : "no");
+ CHECK_LINE();
printf(" %-*s = %s\n", 16, "online", cpu_online(cpu) ? "yes" : "no");
-
-#define DUMP(paca, name, format) \
- printf(" %-*s = %#-*"format"\t(0x%lx)\n", 16, #name, 18, paca->name, \
- offsetof(struct paca_struct, name));
+ CHECK_LINE();
DUMP(p, lock_token, "x");
DUMP(p, paca_index, "x");
@@ -2119,8 +2132,10 @@ static void dump_one_paca(int cpu)
DUMP(p, irq_work_pending, "x");
DUMP(p, nap_state_lost, "x");
+#undef CHECK_LINE
#undef DUMP
+out:
catch_memory_errors = 0;
sync();
}
@@ -2135,12 +2150,12 @@ static void dump_all_pacas(void)
}
for_each_possible_cpu(cpu)
- dump_one_paca(cpu);
+ dump_one_paca(cpu, 0);
}
static void dump_pacas(void)
{
- unsigned long num;
+ unsigned long num, lines;
int c;
c = inchar();
@@ -2151,10 +2166,13 @@ static void dump_pacas(void)
termch = c; /* Put c back, it wasn't 'a' */
- if (scanhex(&num))
- dump_one_paca(num);
- else
- dump_one_paca(xmon_owner);
+ num = xmon_owner;
+ scanhex(&num);
+
+ lines = 0;
+ scanhex(&lines);
+
+ dump_one_paca(num, lines);
}
#endif
--
2.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] powerpc/xmon: Allow limiting the size of the paca display
2015-08-12 11:55 ` [PATCH v2] " Michael Ellerman
@ 2015-08-14 1:52 ` Sam Bobroff
0 siblings, 0 replies; 5+ messages in thread
From: Sam Bobroff @ 2015-08-14 1:52 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, khandual
On Wed, Aug 12, 2015 at 09:55:25PM +1000, Michael Ellerman wrote:
> The paca display is already more than 24 lines, which can be problematic
> if you have an old school 80x24 terminal, or more likely you are on a
> virtual terminal which does not scroll for whatever reason.
>
> We'd like to expand the paca display even more, so add a way to limit
> the number of lines that are displayed.
>
> This adds a third form of 'dp' which is 'dp # #', where the first number
> is the cpu, and the second is the number of lines to display.
>
> Example output:
>
> 5:mon> dp 3 6
> paca for cpu 0x3 @ c00000000fe00c00:
> possible = yes
> present = yes
> online = yes
> lock_token = 0x8000 (0xa)
> paca_index = 0x3 (0x8)
Michael,
This patch inspired me to do the additional work to make the output paged, more
like the memory dump commands.
I'll post it shortly as "powerpc/xmon: Paged output for paca display".
Cheers,
Sam.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-08-14 1:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-12 6:57 [PATCH] powerpc/xmon: Allow limiting the size of the paca display Michael Ellerman
2015-08-12 7:54 ` Anshuman Khandual
2015-08-12 9:47 ` Michael Ellerman
2015-08-12 11:55 ` [PATCH v2] " Michael Ellerman
2015-08-14 1:52 ` Sam Bobroff
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).