* [PATCH] powerpc/xmon: Deindent the SLB dumping logic
@ 2017-04-24 0:35 Michael Ellerman
2017-04-24 4:54 ` Rashmica Gupta
2017-04-24 22:47 ` Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Michael Ellerman @ 2017-04-24 0:35 UTC (permalink / raw)
To: linuxppc-dev
Currently the code that dumps SLB entries uses a double-nested if. This
means the actual dumping logic is a bit squashed. Deindent it by using
continue.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/xmon/xmon.c | 39 ++++++++++++++++++++++-----------------
1 file changed, 22 insertions(+), 17 deletions(-)
Found lying around in an old tree of mine :}
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 16321ad9e70c..199ba2663f21 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -3070,23 +3070,28 @@ void dump_segments(void)
for (i = 0; i < mmu_slb_size; i++) {
asm volatile("slbmfee %0,%1" : "=r" (esid) : "r" (i));
asm volatile("slbmfev %0,%1" : "=r" (vsid) : "r" (i));
- if (esid || vsid) {
- printf("%02d %016lx %016lx", i, esid, vsid);
- if (esid & SLB_ESID_V) {
- llp = vsid & SLB_VSID_LLP;
- if (vsid & SLB_VSID_B_1T) {
- printf(" 1T ESID=%9lx VSID=%13lx LLP:%3lx \n",
- GET_ESID_1T(esid),
- (vsid & ~SLB_VSID_B) >> SLB_VSID_SHIFT_1T,
- llp);
- } else {
- printf(" 256M ESID=%9lx VSID=%13lx LLP:%3lx \n",
- GET_ESID(esid),
- (vsid & ~SLB_VSID_B) >> SLB_VSID_SHIFT,
- llp);
- }
- } else
- printf("\n");
+
+ if (!esid && !vsid)
+ continue;
+
+ printf("%02d %016lx %016lx", i, esid, vsid);
+
+ if (!(esid & SLB_ESID_V)) {
+ printf("\n");
+ continue;
+ }
+
+ llp = vsid & SLB_VSID_LLP;
+ if (vsid & SLB_VSID_B_1T) {
+ printf(" 1T ESID=%9lx VSID=%13lx LLP:%3lx \n",
+ GET_ESID_1T(esid),
+ (vsid & ~SLB_VSID_B) >> SLB_VSID_SHIFT_1T,
+ llp);
+ } else {
+ printf(" 256M ESID=%9lx VSID=%13lx LLP:%3lx \n",
+ GET_ESID(esid),
+ (vsid & ~SLB_VSID_B) >> SLB_VSID_SHIFT,
+ llp);
}
}
}
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/xmon: Deindent the SLB dumping logic
2017-04-24 0:35 [PATCH] powerpc/xmon: Deindent the SLB dumping logic Michael Ellerman
@ 2017-04-24 4:54 ` Rashmica Gupta
2017-04-24 22:47 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Rashmica Gupta @ 2017-04-24 4:54 UTC (permalink / raw)
To: linuxppc-dev
On 24/04/17 10:35, Michael Ellerman wrote:
> Currently the code that dumps SLB entries uses a double-nested if. This
> means the actual dumping logic is a bit squashed. Deindent it by using
> continue.
>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Rashmica Gupta <rashmica.g@gmail.com>
> ---
> arch/powerpc/xmon/xmon.c | 39 ++++++++++++++++++++++-----------------
> 1 file changed, 22 insertions(+), 17 deletions(-)
>
> Found lying around in an old tree of mine :}
>
> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> index 16321ad9e70c..199ba2663f21 100644
> --- a/arch/powerpc/xmon/xmon.c
> +++ b/arch/powerpc/xmon/xmon.c
> @@ -3070,23 +3070,28 @@ void dump_segments(void)
> for (i = 0; i < mmu_slb_size; i++) {
> asm volatile("slbmfee %0,%1" : "=r" (esid) : "r" (i));
> asm volatile("slbmfev %0,%1" : "=r" (vsid) : "r" (i));
> - if (esid || vsid) {
> - printf("%02d %016lx %016lx", i, esid, vsid);
> - if (esid & SLB_ESID_V) {
> - llp = vsid & SLB_VSID_LLP;
> - if (vsid & SLB_VSID_B_1T) {
> - printf(" 1T ESID=%9lx VSID=%13lx LLP:%3lx \n",
> - GET_ESID_1T(esid),
> - (vsid & ~SLB_VSID_B) >> SLB_VSID_SHIFT_1T,
> - llp);
> - } else {
> - printf(" 256M ESID=%9lx VSID=%13lx LLP:%3lx \n",
> - GET_ESID(esid),
> - (vsid & ~SLB_VSID_B) >> SLB_VSID_SHIFT,
> - llp);
> - }
> - } else
> - printf("\n");
> +
> + if (!esid && !vsid)
> + continue;
> +
> + printf("%02d %016lx %016lx", i, esid, vsid);
> +
> + if (!(esid & SLB_ESID_V)) {
> + printf("\n");
> + continue;
> + }
> +
> + llp = vsid & SLB_VSID_LLP;
> + if (vsid & SLB_VSID_B_1T) {
> + printf(" 1T ESID=%9lx VSID=%13lx LLP:%3lx \n",
> + GET_ESID_1T(esid),
> + (vsid & ~SLB_VSID_B) >> SLB_VSID_SHIFT_1T,
> + llp);
> + } else {
> + printf(" 256M ESID=%9lx VSID=%13lx LLP:%3lx \n",
> + GET_ESID(esid),
> + (vsid & ~SLB_VSID_B) >> SLB_VSID_SHIFT,
> + llp);
> }
> }
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: powerpc/xmon: Deindent the SLB dumping logic
2017-04-24 0:35 [PATCH] powerpc/xmon: Deindent the SLB dumping logic Michael Ellerman
2017-04-24 4:54 ` Rashmica Gupta
@ 2017-04-24 22:47 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2017-04-24 22:47 UTC (permalink / raw)
To: Michael Ellerman, linuxppc-dev
On Mon, 2017-04-24 at 00:35:14 UTC, Michael Ellerman wrote:
> Currently the code that dumps SLB entries uses a double-nested if. This
> means the actual dumping logic is a bit squashed. Deindent it by using
> continue.
>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> Reviewed-by: Rashmica Gupta <rashmica.g@gmail.com>
Applied to powerpc next.
https://git.kernel.org/powerpc/c/856736466806ceb72c7402eb0f06be
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-24 22:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-24 0:35 [PATCH] powerpc/xmon: Deindent the SLB dumping logic Michael Ellerman
2017-04-24 4:54 ` Rashmica Gupta
2017-04-24 22:47 ` Michael Ellerman
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).