LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 02/19] ppc32: change %x into %lx
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

  CC      arch/powerpc/xmon/xmon.o
../arch/powerpc/xmon/xmon.c: In function ‘memdiffs’:
../arch/powerpc/xmon/xmon.c:2866:17: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘unsigned char *’ [-Werror=format=]
     printf("%.16x %.2x # %.16x %.2x\n", p1 - 1,
                 ^
../arch/powerpc/xmon/xmon.c:2866:30: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘unsigned char *’ [-Werror=format=]
     printf("%.16x %.2x # %.16x %.2x\n", p1 - 1,
                              ^
cc1: all warnings being treated as errors

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/xmon/xmon.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index ee113a6e008c..ee7a8c9a042b 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1671,7 +1671,7 @@ static void prregs(struct pt_regs *fp)
 	}
 #else
 	for (n = 0; n < 32; ++n) {
-		printf("R%.2d = %.8x%s", n, fp->gpr[n],
+		printf("R%.2d = %.8lx%s", n, fp->gpr[n],
 		       (n & 3) == 3? "\n": "   ");
 		if (n == 12 && !FULL_REGS(fp)) {
 			printf("\n");
@@ -2728,7 +2728,7 @@ generic_inst_dump(unsigned long adr, long count, int praddr,
 		dotted = 0;
 		last_inst = inst;
 		if (praddr)
-			printf(REG"  %.8x", adr, inst);
+			printf(REG"  %.8lx", adr, inst);
 		printf("\t");
 		dump_func(inst, adr);
 		printf("\n");
@@ -2920,13 +2920,13 @@ memzcan(void)
 		if (ok && !ook) {
 			printf("%.8x .. ", a);
 		} else if (!ok && ook)
-			printf("%.8x\n", a - mskip);
+			printf("%.8lx\n", a - mskip);
 		ook = ok;
 		if (a + mskip < a)
 			break;
 	}
 	if (ook)
-		printf("%.8x\n", a - mskip);
+		printf("%.8lx\n", a - mskip);
 }
 
 static void show_task(struct task_struct *tsk)
-- 
2.11.0

^ permalink raw reply related

* [PATCH 03/19] ppc32: Change %.16x into %p
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

  CC      arch/powerpc/xmon/xmon.o
arch/powerpc/xmon/xmon.c: In function ‘memdiffs’:
arch/powerpc/xmon/xmon.c:2863:17: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘unsigned char *’ [-Werror=format=]
     printf("%.16x %.2x # %.16x %.2x\n", p1 - 1,
                 ^
arch/powerpc/xmon/xmon.c:2863:30: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘unsigned char *’ [-Werror=format=]
     printf("%.16x %.2x # %.16x %.2x\n", p1 - 1,
                              ^
cc1: all warnings being treated as errors

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/xmon/xmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index ee7a8c9a042b..f155f030550f 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -2860,7 +2860,7 @@ memdiffs(unsigned char *p1, unsigned char *p2, unsigned nb, unsigned maxpr)
 	for( n = nb; n > 0; --n )
 		if( *p1++ != *p2++ )
 			if( ++prt <= maxpr )
-				printf("%.16x %.2x # %.16x %.2x\n", p1 - 1,
+				printf("%p %.2x # %p %.2x\n", p1 - 1,
 					p1[-1], p2 - 1, p2[-1]);
 	if( prt > maxpr )
 		printf("Total of %d differences\n", prt);
-- 
2.11.0

^ permalink raw reply related

* [PATCH 01/19] xmon: Use __printf markup to silence compiler
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

Update also the other prototype declaration in asm/xmon.h.

Silence warnings (triggered at W=1) by adding relevant __printf attribute.
Move #define at bottom of the file to prevent conflict with gcc attribute.

  CC      arch/powerpc/xmon/nonstdio.o
arch/powerpc/xmon/nonstdio.c: In function ‘xmon_printf’:
arch/powerpc/xmon/nonstdio.c:178:2: error: function might be possible candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
  n = vsnprintf(xmon_outbuf, sizeof(xmon_outbuf), format, args);
  ^
cc1: all warnings being treated as errors

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/include/asm/xmon.h | 2 +-
 arch/powerpc/xmon/nonstdio.h    | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/xmon.h b/arch/powerpc/include/asm/xmon.h
index eb42a0c6e1d9..30ff69bd8f43 100644
--- a/arch/powerpc/include/asm/xmon.h
+++ b/arch/powerpc/include/asm/xmon.h
@@ -29,7 +29,7 @@ static inline void xmon_register_spus(struct list_head *list) { };
 extern int cpus_are_in_xmon(void);
 #endif
 
-extern void xmon_printf(const char *format, ...);
+extern __printf(1, 2) void xmon_printf(const char *format, ...);
 
 #endif /* __KERNEL __ */
 #endif /* __ASM_POWERPC_XMON_H */
diff --git a/arch/powerpc/xmon/nonstdio.h b/arch/powerpc/xmon/nonstdio.h
index 2202ec61972c..e8deac6c84e2 100644
--- a/arch/powerpc/xmon/nonstdio.h
+++ b/arch/powerpc/xmon/nonstdio.h
@@ -1,13 +1,13 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #define EOF	(-1)
 
-#define printf	xmon_printf
-#define putchar	xmon_putchar
-
 extern void xmon_set_pagination_lpp(unsigned long lpp);
 extern void xmon_start_pagination(void);
 extern void xmon_end_pagination(void);
 extern int xmon_putchar(int c);
 extern void xmon_puts(const char *);
 extern char *xmon_gets(char *, int);
-extern void xmon_printf(const char *, ...);
+extern __printf(1, 2) void xmon_printf(const char *fmt, ...);
+
+#define printf	xmon_printf
+#define putchar	xmon_putchar
-- 
2.11.0

^ permalink raw reply related

* [PATCH 00/19] Start using __printf attribute (single commit series)
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre

This series is part of my warning fixes branch. When preparing the patch, I
figured that sending it as single patch would make the reviewing task fairly
difficult. I decided to split it into fake commits and group them by warning
types to make reviewing much easier. Obviously this series is not meant to be
applied as-is but squashed into a single commit (maybe two if I move the gcc
attribute as second patch). I saw that my previous patches were applied with a
trimmed warning context to reduce the level of noise, I'll keep that in mind
when preparing the squashed commit.

This series has only been compiled tested using ppc32_defconfig and
ppc64_defconfig, hopefully those two cover all combinations for this piece of
code. I am not sure what (if anything?) I am going to break when replacing
%016lx with %p on 32 bits arch, the other changes seems more direct. I am open
for suggestion for the last commit (maybe combine the two function-like macros
DUMP & DUMPPTR into a single one with an extra parameter).

Mathieu Malaterre (19):
  xmon: Use __printf markup to silence compiler
  ppc32: change %x into %lx
  ppc32: Change %.16x into %p
  ppc32: change %lx into %p
  ppc32: change %lx into %tx (ptrdiff_t)
  ppc64: change %lx into %llx
  ppc64: change %ld into %d
  ppc64: change %x into %lx
  ppc64: change %016lx into %p
  ppc64: change %lx into %p
  ppc64: change %lx into %x
  ppc64: change %lx into %llx
  ppc64: change %llx into %lx
  ppc64: change %p into %llx
  ppc64: change %d into %ld
  ppc64: Change %d into %lu
  ppc64: change %d into %llu
  ppc64: change %ld into %d
  ppc64: Handle %p format in DUMPPTR() function-like macro

 arch/powerpc/include/asm/xmon.h |   2 +-
 arch/powerpc/xmon/nonstdio.h    |   8 +--
 arch/powerpc/xmon/spu-dis.c     |  18 +++---
 arch/powerpc/xmon/xmon.c        | 133 ++++++++++++++++++++--------------------
 4 files changed, 82 insertions(+), 79 deletions(-)

-- 
2.11.0

^ permalink raw reply

* [PATCH 04/19] ppc32: change %lx into %p
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

also remove extra fp->link since no formatter associated.

  CC      arch/powerpc/xmon/xmon.o
../arch/powerpc/xmon/xmon.c: In function ‘excprint’:
../arch/powerpc/xmon/xmon.c:1607:31: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘struct pt_regs *’ [-Werror=format=]
  printf("Vector: %lx %s at [%lx]\n", fp->trap, getvecname(trap), fp);
                               ^
../arch/powerpc/xmon/xmon.c:1611:9: error: too many arguments for format [-Werror=format-extra-args]
  printf("    lr: ", fp->link);
         ^~~~~~~~~~
../arch/powerpc/xmon/xmon.c:1623:26: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘struct task_struct *’ [-Werror=format=]
  printf("  current = 0x%lx\n", current);
                          ^
cc1: all warnings being treated as errors

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/xmon/xmon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index f155f030550f..15011be7a051 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1604,11 +1604,11 @@ static void excprint(struct pt_regs *fp)
 #endif /* CONFIG_SMP */
 
 	trap = TRAP(fp);
-	printf("Vector: %lx %s at [%lx]\n", fp->trap, getvecname(trap), fp);
+	printf("Vector: %lx %s at [%p]\n", fp->trap, getvecname(trap), fp);
 	printf("    pc: ");
 	xmon_print_symbol(fp->nip, ": ", "\n");
 
-	printf("    lr: ", fp->link);
+	printf("    lr: ");
 	xmon_print_symbol(fp->link, ": ", "\n");
 
 	printf("    sp: %lx\n", fp->gpr[1]);
@@ -1620,7 +1620,7 @@ static void excprint(struct pt_regs *fp)
 			printf(" dsisr: %lx\n", fp->dsisr);
 	}
 
-	printf("  current = 0x%lx\n", current);
+	printf("  current = 0x%p\n", current);
 #ifdef CONFIG_PPC64
 	printf("  paca    = 0x%lx\t softe: %d\t irq_happened: 0x%02x\n",
 	       local_paca, local_paca->irq_soft_mask, local_paca->irq_happened);
-- 
2.11.0

^ permalink raw reply related

* [PATCH 05/19] ppc32: change %lx into %tx (ptrdiff_t)
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

  CC      arch/powerpc/xmon/xmon.o
arch/powerpc/xmon/xmon.c: In function ‘xmon_core’:
arch/powerpc/xmon/xmon.c:630:36: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘int’ [-Werror=format=]
    printf("Stopped at breakpoint %lx (", BP_NUM(bp));
                                    ^
arch/powerpc/xmon/xmon.c: In function ‘bpt_cmds’:
arch/powerpc/xmon/xmon.c:1365:32: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘int’ [-Werror=format=]
   printf("Cleared breakpoint %lx (", BP_NUM(bp));
                                ^
cc1: all warnings being treated as errors

and

  CC      arch/powerpc/xmon/xmon.o
../arch/powerpc/xmon/xmon.c: In function ‘bpt_cmds’:
../arch/powerpc/xmon/xmon.c:1392:15: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘long int’ [-Werror=format=]
     printf("%2x %s   ", BP_NUM(bp),
               ^
cc1: all warnings being treated as errors

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/xmon/xmon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 15011be7a051..0d74c0d1a0bf 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -627,7 +627,7 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
 		excprint(regs);
 		bp = at_breakpoint(regs->nip);
 		if (bp) {
-			printf("Stopped at breakpoint %lx (", BP_NUM(bp));
+			printf("Stopped at breakpoint %tx (", BP_NUM(bp));
 			xmon_print_symbol(regs->nip, " ", ")\n");
 		}
 		if (unrecoverable_excp(regs))
@@ -1362,7 +1362,7 @@ bpt_cmds(void)
 			}
 		}
 
-		printf("Cleared breakpoint %lx (", BP_NUM(bp));
+		printf("Cleared breakpoint %tx (", BP_NUM(bp));
 		xmon_print_symbol(bp->address, " ", ")\n");
 		bp->enabled = 0;
 		break;
@@ -1389,7 +1389,7 @@ bpt_cmds(void)
 			for (bp = bpts; bp < &bpts[NBPTS]; ++bp) {
 				if (!bp->enabled)
 					continue;
-				printf("%2x %s   ", BP_NUM(bp),
+				printf("%tx %s   ", BP_NUM(bp),
 				    (bp->enabled & BP_CIABR) ? "inst": "trap");
 				xmon_print_symbol(bp->address, "  ", "\n");
 			}
-- 
2.11.0

^ permalink raw reply related

* [PATCH 06/19] ppc64: change %lx into %llx
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

  CC      arch/powerpc/xmon/xmon.o
../arch/powerpc/xmon/xmon.c: In function ‘dump_by_size’:
../arch/powerpc/xmon/xmon.c:2570:16: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘u64 {aka long long unsigned int}’ [-Werror=format=]
    printf("%0*lx", size * 2, val);
                ^
cc1: all warnings being treated as errors

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/xmon/xmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 0d74c0d1a0bf..738888e6a927 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -2564,7 +2564,7 @@ static void dump_by_size(unsigned long addr, long count, int size)
 			default: val = 0;
 			}
 
-			printf("%0*lx", size * 2, val);
+			printf("%0*llx", size * 2, val);
 		}
 		printf("\n");
 	}
-- 
2.11.0

^ permalink raw reply related

* [PATCH 07/19] ppc64: change %ld into %d
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

  CC      arch/powerpc/xmon/xmon.o
../arch/powerpc/xmon/xmon.c: In function ‘excprint’:
../arch/powerpc/xmon/xmon.c:1629:25: error: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘pid_t {aka int}’ [-Werror=format=]
   printf("    pid   = %ld, comm = %s\n",
                         ^
cc1: all warnings being treated as errors

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/xmon/xmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 738888e6a927..6117164cb5ba 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1626,7 +1626,7 @@ static void excprint(struct pt_regs *fp)
 	       local_paca, local_paca->irq_soft_mask, local_paca->irq_happened);
 #endif
 	if (current) {
-		printf("    pid   = %ld, comm = %s\n",
+		printf("    pid   = %d, comm = %s\n",
 		       current->pid, current->comm);
 	}
 
-- 
2.11.0

^ permalink raw reply related

* [PATCH 09/19] ppc64: change %016lx into %p
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

  CC      arch/powerpc/xmon/xmon.o
../arch/powerpc/xmon/xmon.c: In function ‘show_pte’:
../arch/powerpc/xmon/xmon.c:3016:24: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘pgd_t * {aka struct <anonymous> *}’ [-Werror=format=]
  printf("pgd  @ 0x%016lx\n", pgdir);
                        ^
../arch/powerpc/xmon/xmon.c:3022:24: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘pgd_t * {aka struct <anonymous> *}’ [-Werror=format=]
  printf("pgdp @ 0x%016lx = 0x%016lx\n", pgdp, pgd_val(*pgdp));
                        ^
../arch/powerpc/xmon/xmon.c:3036:24: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘pud_t * {aka struct <anonymous> *}’ [-Werror=format=]
  printf("pudp @ 0x%016lx = 0x%016lx\n", pudp, pud_val(*pudp));
                        ^
../arch/powerpc/xmon/xmon.c:3049:24: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘pmd_t * {aka struct <anonymous> *}’ [-Werror=format=]
  printf("pmdp @ 0x%016lx = 0x%016lx\n", pmdp, pmd_val(*pmdp));
                        ^
cc1: all warnings being treated as errors

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/xmon/xmon.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 0e4dcdf12f9e..69152f00d3fc 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -3010,13 +3010,13 @@ static void show_pte(unsigned long addr)
 		return;
 	}
 
-	printf("pgd  @ 0x%016lx\n", pgdir);
+	printf("pgd  @ 0x%p\n", pgdir);
 
 	if (pgd_huge(*pgdp)) {
 		format_pte(pgdp, pgd_val(*pgdp));
 		return;
 	}
-	printf("pgdp @ 0x%016lx = 0x%016lx\n", pgdp, pgd_val(*pgdp));
+	printf("pgdp @ 0x%p = 0x%016lx\n", pgdp, pgd_val(*pgdp));
 
 	pudp = pud_offset(pgdp, addr);
 
@@ -3030,7 +3030,7 @@ static void show_pte(unsigned long addr)
 		return;
 	}
 
-	printf("pudp @ 0x%016lx = 0x%016lx\n", pudp, pud_val(*pudp));
+	printf("pudp @ 0x%p = 0x%016lx\n", pudp, pud_val(*pudp));
 
 	pmdp = pmd_offset(pudp, addr);
 
@@ -3043,7 +3043,7 @@ static void show_pte(unsigned long addr)
 		format_pte(pmdp, pmd_val(*pmdp));
 		return;
 	}
-	printf("pmdp @ 0x%016lx = 0x%016lx\n", pmdp, pmd_val(*pmdp));
+	printf("pmdp @ 0x%p = 0x%016lx\n", pmdp, pmd_val(*pmdp));
 
 	ptep = pte_offset_map(pmdp, addr);
 	if (pte_none(*ptep)) {
-- 
2.11.0

^ permalink raw reply related

* [PATCH 10/19] ppc64: change %lx into %p
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

  CC      arch/powerpc/xmon/xmon.o
../arch/powerpc/xmon/xmon.c: In function ‘excprint’:
../arch/powerpc/xmon/xmon.c:1625:26: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘struct paca_struct *’ [-Werror=format=]
  printf("  paca    = 0x%lx\t softe: %d\t irq_happened: 0x%02x\n",
                          ^
cc1: all warnings being treated as errors

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/xmon/xmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 69152f00d3fc..e706139030ad 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1622,7 +1622,7 @@ static void excprint(struct pt_regs *fp)
 
 	printf("  current = 0x%p\n", current);
 #ifdef CONFIG_PPC64
-	printf("  paca    = 0x%lx\t softe: %d\t irq_happened: 0x%02x\n",
+	printf("  paca    = 0x%p\t softe: %d\t irq_happened: 0x%02x\n",
 	       local_paca, local_paca->irq_soft_mask, local_paca->irq_happened);
 #endif
 	if (current) {
-- 
2.11.0

^ permalink raw reply related

* [PATCH 08/19] ppc64: change %x into %lx
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

  CC      arch/powerpc/xmon/xmon.o
../arch/powerpc/xmon/xmon.c: In function ‘cpu_cmd’:
../arch/powerpc/xmon/xmon.c:1168:18: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=]
   printf("cpu 0x%x isn't in xmon\n", cpu);
                  ^
../arch/powerpc/xmon/xmon.c:1182:19: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=]
    printf("cpu 0x%x didn't take control\n", cpu);
                   ^
../arch/powerpc/xmon/xmon.c: In function ‘dump_206_sprs’:
../arch/powerpc/xmon/xmon.c:1778:54: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Werror=format=]
  printf("srr0   = %.16lx  srr1  = %.16lx dsisr  = %.8x\n",
                                                      ^
../arch/powerpc/xmon/xmon.c:1780:54: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Werror=format=]
  printf("dscr   = %.16lx  ppr   = %.16lx pir    = %.8x\n",
                                                      ^
../arch/powerpc/xmon/xmon.c:1788:54: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Werror=format=]
  printf("sdr1   = %.16lx  hdar  = %.16lx hdsisr = %.8x\n",
                                                      ^
../arch/powerpc/xmon/xmon.c:1792:54: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Werror=format=]
  printf("lpcr   = %.16lx  pcr   = %.16lx lpidr  = %.8x\n",
                                                      ^
../arch/powerpc/xmon/xmon.c: In function ‘dump_207_sprs’:
../arch/powerpc/xmon/xmon.c:1809:54: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Werror=format=]
  printf("dpdes  = %.16lx  tir   = %.16lx cir    = %.8x\n",
                                                      ^
../arch/powerpc/xmon/xmon.c:1812:54: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Werror=format=]
  printf("fscr   = %.16lx  tar   = %.16lx pspb   = %.8x\n",
                                                      ^
../arch/powerpc/xmon/xmon.c:1825:22: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=]
  printf("pmc1   = %.8x pmc2 = %.8x  pmc3 = %.8x  pmc4   = %.8x\n",
                      ^
../arch/powerpc/xmon/xmon.c:1825:34: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long unsigned int’ [-Werror=format=]
  printf("pmc1   = %.8x pmc2 = %.8x  pmc3 = %.8x  pmc4   = %.8x\n",
                                  ^
../arch/powerpc/xmon/xmon.c:1825:47: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Werror=format=]
  printf("pmc1   = %.8x pmc2 = %.8x  pmc3 = %.8x  pmc4   = %.8x\n",
                                               ^
../arch/powerpc/xmon/xmon.c:1825:62: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 5 has type ‘long unsigned int’ [-Werror=format=]
  printf("pmc1   = %.8x pmc2 = %.8x  pmc3 = %.8x  pmc4   = %.8x\n",
                                                              ^
../arch/powerpc/xmon/xmon.c:1828:54: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Werror=format=]
  printf("mmcra  = %.16lx   siar = %.16lx pmc5   = %.8x\n",
                                                      ^
../arch/powerpc/xmon/xmon.c:1830:54: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Werror=format=]
  printf("sdar   = %.16lx   sier = %.16lx pmc6   = %.8x\n",
                                                      ^
cc1: all warnings being treated as errors

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/xmon/spu-dis.c |  2 +-
 arch/powerpc/xmon/xmon.c    | 22 +++++++++++-----------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/xmon/spu-dis.c b/arch/powerpc/xmon/spu-dis.c
index e5f89837c82e..6b83b680b9f6 100644
--- a/arch/powerpc/xmon/spu-dis.c
+++ b/arch/powerpc/xmon/spu-dis.c
@@ -102,7 +102,7 @@ print_insn_spu (unsigned long insn, unsigned long memaddr)
 
   if (index == 0)
     {
-      printf(".long 0x%x", insn);
+      printf(".long 0x%lx", insn);
     }
   else
     {
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 6117164cb5ba..0e4dcdf12f9e 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1165,7 +1165,7 @@ static int cpu_cmd(void)
 	}
 	/* try to switch to cpu specified */
 	if (!cpumask_test_cpu(cpu, &cpus_in_xmon)) {
-		printf("cpu 0x%x isn't in xmon\n", cpu);
+		printf("cpu 0x%lx isn't in xmon\n", cpu);
 		return 0;
 	}
 	xmon_taken = 0;
@@ -1179,7 +1179,7 @@ static int cpu_cmd(void)
 			/* take control back */
 			mb();
 			xmon_owner = smp_processor_id();
-			printf("cpu 0x%x didn't take control\n", cpu);
+			printf("cpu 0x%lx didn't take control\n", cpu);
 			return 0;
 		}
 		barrier();
@@ -1775,9 +1775,9 @@ static void dump_206_sprs(void)
 
 	/* Actually some of these pre-date 2.06, but whatevs */
 
-	printf("srr0   = %.16lx  srr1  = %.16lx dsisr  = %.8x\n",
+	printf("srr0   = %.16lx  srr1  = %.16lx dsisr  = %.8lx\n",
 		mfspr(SPRN_SRR0), mfspr(SPRN_SRR1), mfspr(SPRN_DSISR));
-	printf("dscr   = %.16lx  ppr   = %.16lx pir    = %.8x\n",
+	printf("dscr   = %.16lx  ppr   = %.16lx pir    = %.8lx\n",
 		mfspr(SPRN_DSCR), mfspr(SPRN_PPR), mfspr(SPRN_PIR));
 	printf("amr    = %.16lx  uamor = %.16lx\n",
 		mfspr(SPRN_AMR), mfspr(SPRN_UAMOR));
@@ -1785,11 +1785,11 @@ static void dump_206_sprs(void)
 	if (!(mfmsr() & MSR_HV))
 		return;
 
-	printf("sdr1   = %.16lx  hdar  = %.16lx hdsisr = %.8x\n",
+	printf("sdr1   = %.16lx  hdar  = %.16lx hdsisr = %.8lx\n",
 		mfspr(SPRN_SDR1), mfspr(SPRN_HDAR), mfspr(SPRN_HDSISR));
 	printf("hsrr0  = %.16lx hsrr1  = %.16lx hdec   = %.16lx\n",
 		mfspr(SPRN_HSRR0), mfspr(SPRN_HSRR1), mfspr(SPRN_HDEC));
-	printf("lpcr   = %.16lx  pcr   = %.16lx lpidr  = %.8x\n",
+	printf("lpcr   = %.16lx  pcr   = %.16lx lpidr  = %.8lx\n",
 		mfspr(SPRN_LPCR), mfspr(SPRN_PCR), mfspr(SPRN_LPID));
 	printf("hsprg0 = %.16lx hsprg1 = %.16lx amor   = %.16lx\n",
 		mfspr(SPRN_HSPRG0), mfspr(SPRN_HSPRG1), mfspr(SPRN_AMOR));
@@ -1806,10 +1806,10 @@ static void dump_207_sprs(void)
 	if (!cpu_has_feature(CPU_FTR_ARCH_207S))
 		return;
 
-	printf("dpdes  = %.16lx  tir   = %.16lx cir    = %.8x\n",
+	printf("dpdes  = %.16lx  tir   = %.16lx cir    = %.8lx\n",
 		mfspr(SPRN_DPDES), mfspr(SPRN_TIR), mfspr(SPRN_CIR));
 
-	printf("fscr   = %.16lx  tar   = %.16lx pspb   = %.8x\n",
+	printf("fscr   = %.16lx  tar   = %.16lx pspb   = %.8lx\n",
 		mfspr(SPRN_FSCR), mfspr(SPRN_TAR), mfspr(SPRN_PSPB));
 
 	msr = mfmsr();
@@ -1822,12 +1822,12 @@ static void dump_207_sprs(void)
 
 	printf("mmcr0  = %.16lx  mmcr1 = %.16lx mmcr2  = %.16lx\n",
 		mfspr(SPRN_MMCR0), mfspr(SPRN_MMCR1), mfspr(SPRN_MMCR2));
-	printf("pmc1   = %.8x pmc2 = %.8x  pmc3 = %.8x  pmc4   = %.8x\n",
+	printf("pmc1   = %.8lx pmc2 = %.8lx  pmc3 = %.8lx  pmc4   = %.8lx\n",
 		mfspr(SPRN_PMC1), mfspr(SPRN_PMC2),
 		mfspr(SPRN_PMC3), mfspr(SPRN_PMC4));
-	printf("mmcra  = %.16lx   siar = %.16lx pmc5   = %.8x\n",
+	printf("mmcra  = %.16lx   siar = %.16lx pmc5   = %.8lx\n",
 		mfspr(SPRN_MMCRA), mfspr(SPRN_SIAR), mfspr(SPRN_PMC5));
-	printf("sdar   = %.16lx   sier = %.16lx pmc6   = %.8x\n",
+	printf("sdar   = %.16lx   sier = %.16lx pmc6   = %.8lx\n",
 		mfspr(SPRN_SDAR), mfspr(SPRN_SIER), mfspr(SPRN_PMC6));
 	printf("ebbhr  = %.16lx  ebbrr = %.16lx bescr  = %.16lx\n",
 		mfspr(SPRN_EBBHR), mfspr(SPRN_EBBRR), mfspr(SPRN_BESCR));
-- 
2.11.0

^ permalink raw reply related

* [PATCH 11/19] ppc64: change %lx into %x
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

  CC      arch/powerpc/xmon/xmon.o
../arch/powerpc/xmon/xmon.c: In function ‘dump_one_paca’:
../arch/powerpc/xmon/xmon.c:2380:43: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘u32 {aka unsigned int}’ [-Werror=format=]
   printf(" slb_cache[%d]:        = 0x%016lx\n", i, p->slb_cache[i]);
                                           ^
cc1: all warnings being treated as errors

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/xmon/xmon.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index e706139030ad..7eb656274ea7 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -2374,7 +2374,7 @@ static void dump_one_paca(int cpu)
 	DUMP(p, vmalloc_sllp, "x");
 	DUMP(p, slb_cache_ptr, "x");
 	for (i = 0; i < SLB_CACHE_ENTRIES; i++)
-		printf(" slb_cache[%d]:        = 0x%016lx\n", i, p->slb_cache[i]);
+		printf(" slb_cache[%d]:        = 0x%016x\n", i, p->slb_cache[i]);
 
 	DUMP(p, rfi_flush_fallback_area, "px");
 #endif
@@ -3851,9 +3851,9 @@ static void dump_spu_fields(struct spu *spu)
 	DUMP_FIELD(spu, "0x%lx", class_0_dar);
 	DUMP_FIELD(spu, "0x%lx", class_1_dar);
 	DUMP_FIELD(spu, "0x%lx", class_1_dsisr);
-	DUMP_FIELD(spu, "0x%lx", irqs[0]);
-	DUMP_FIELD(spu, "0x%lx", irqs[1]);
-	DUMP_FIELD(spu, "0x%lx", irqs[2]);
+	DUMP_FIELD(spu, "0x%x", irqs[0]);
+	DUMP_FIELD(spu, "0x%x", irqs[1]);
+	DUMP_FIELD(spu, "0x%x", irqs[2]);
 	DUMP_FIELD(spu, "0x%x", slb_replace);
 	DUMP_FIELD(spu, "%d", pid);
 	DUMP_FIELD(spu, "0x%p", mm);
-- 
2.11.0

^ permalink raw reply related

* [PATCH 14/19] ppc64: change %p into %llx
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

  CC      arch/powerpc/xmon/xmon.o
../arch/powerpc/xmon/xmon.c: In function ‘dump_spu_fields’:
../arch/powerpc/xmon/xmon.c:3827:10: error: format ‘%p’ expects argument of type ‘void *’, but argument 4 has type ‘long long unsigned int’ [-Werror=format=]
   printf("  %-*s = "format"\n", DUMP_WIDTH,  \
          ^
../arch/powerpc/xmon/xmon.c:3840:2: note: in expansion of macro ‘DUMP_VALUE’
  DUMP_VALUE(format, field, obj->field)
  ^~~~~~~~~~
../arch/powerpc/xmon/xmon.c:3865:2: note: in expansion of macro ‘DUMP_FIELD’
  DUMP_FIELD(spu, "0x%p", timestamp);
  ^~~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/xmon/xmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 61f5e09367d0..6b5b5318099d 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -3859,7 +3859,7 @@ static void dump_spu_fields(struct spu *spu)
 	DUMP_FIELD(spu, "0x%p", mm);
 	DUMP_FIELD(spu, "0x%p", ctx);
 	DUMP_FIELD(spu, "0x%p", rq);
-	DUMP_FIELD(spu, "0x%p", timestamp);
+	DUMP_FIELD(spu, "0x%llx", timestamp);
 	DUMP_FIELD(spu, "0x%lx", problem_phys);
 	DUMP_FIELD(spu, "0x%p", problem);
 	DUMP_VALUE("0x%x", problem->spu_runcntl_RW,
-- 
2.11.0

^ permalink raw reply related

* [PATCH 12/19] ppc64: change %lx into %llx
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

  CC      arch/powerpc/xmon/xmon.o
../arch/powerpc/xmon/xmon.c: In function ‘dump_one_paca’:
../arch/powerpc/xmon/xmon.c:2339:9: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘u64 {aka long long unsigned int}’ [-Werror=format=]
  printf(" %-*s = %#-*"format"\t(0x%lx)\n", 20, #name, 18, paca->name, \
         ^
../arch/powerpc/xmon/xmon.c:2347:2: note: in expansion of macro ‘DUMP’
  DUMP(p, kernel_toc, "lx");
  ^~~~
cc1: all warnings being treated as errors

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/xmon/xmon.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 7eb656274ea7..96247ac91a86 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -2341,9 +2341,9 @@ static void dump_one_paca(int cpu)
 
 	DUMP(p, lock_token, "x");
 	DUMP(p, paca_index, "x");
-	DUMP(p, kernel_toc, "lx");
-	DUMP(p, kernelbase, "lx");
-	DUMP(p, kernel_msr, "lx");
+	DUMP(p, kernel_toc, "llx");
+	DUMP(p, kernelbase, "llx");
+	DUMP(p, kernel_msr, "llx");
 	DUMP(p, emergency_sp, "px");
 #ifdef CONFIG_PPC_BOOK3S_64
 	DUMP(p, nmi_emergency_sp, "px");
@@ -2352,7 +2352,7 @@ static void dump_one_paca(int cpu)
 	DUMP(p, in_mce, "x");
 	DUMP(p, hmi_event_available, "x");
 #endif
-	DUMP(p, data_offset, "lx");
+	DUMP(p, data_offset, "llx");
 	DUMP(p, hw_cpu_id, "x");
 	DUMP(p, cpu_start, "x");
 	DUMP(p, kexec_state, "x");
@@ -2367,7 +2367,7 @@ static void dump_one_paca(int cpu)
 		vsid = be64_to_cpu(p->slb_shadow_ptr->save_area[i].vsid);
 
 		if (esid || vsid) {
-			printf(" slb_shadow[%d]:       = 0x%016lx 0x%016lx\n",
+			printf(" slb_shadow[%d]:       = 0x%016llx 0x%016llx\n",
 				i, esid, vsid);
 		}
 	}
@@ -2388,10 +2388,10 @@ static void dump_one_paca(int cpu)
 	DUMP(p, dbg_kstack, "px");
 #endif
 	DUMP(p, __current, "px");
-	DUMP(p, kstack, "lx");
-	printf(" kstack_base          = 0x%016lx\n", p->kstack & ~(THREAD_SIZE - 1));
-	DUMP(p, stab_rr, "lx");
-	DUMP(p, saved_r1, "lx");
+	DUMP(p, kstack, "llx");
+	printf(" kstack_base          = 0x%016llx\n", p->kstack & ~(THREAD_SIZE - 1));
+	DUMP(p, stab_rr, "llx");
+	DUMP(p, saved_r1, "llx");
 	DUMP(p, trap_save, "x");
 	DUMP(p, irq_soft_mask, "x");
 	DUMP(p, irq_happened, "x");
@@ -3848,9 +3848,9 @@ static void dump_spu_fields(struct spu *spu)
 	DUMP_FIELD(spu, "0x%x", node);
 	DUMP_FIELD(spu, "0x%lx", flags);
 	DUMP_FIELD(spu, "%d", class_0_pending);
-	DUMP_FIELD(spu, "0x%lx", class_0_dar);
-	DUMP_FIELD(spu, "0x%lx", class_1_dar);
-	DUMP_FIELD(spu, "0x%lx", class_1_dsisr);
+	DUMP_FIELD(spu, "0x%llx", class_0_dar);
+	DUMP_FIELD(spu, "0x%llx", class_1_dar);
+	DUMP_FIELD(spu, "0x%llx", class_1_dsisr);
 	DUMP_FIELD(spu, "0x%x", irqs[0]);
 	DUMP_FIELD(spu, "0x%x", irqs[1]);
 	DUMP_FIELD(spu, "0x%x", irqs[2]);
-- 
2.11.0

^ permalink raw reply related

* [PATCH 15/19] ppc64: change %d into %ld
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

  CC      arch/powerpc/xmon/xmon.o
../arch/powerpc/xmon/xmon.c: In function ‘dump_spu_ls’:
../arch/powerpc/xmon/xmon.c:3896:50: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=]
   printf("*** Error: accessing spu info for spu %d\n", num);
                                                  ^
cc1: all warnings being treated as errors

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/xmon/xmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 6b5b5318099d..c9a44962d3c9 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -3890,7 +3890,7 @@ static void dump_spu_ls(unsigned long num, int subcmd)
 		__delay(200);
 	} else {
 		catch_memory_errors = 0;
-		printf("*** Error: accessing spu info for spu %d\n", num);
+		printf("*** Error: accessing spu info for spu %ld\n", num);
 		return;
 	}
 	catch_memory_errors = 0;
-- 
2.11.0

^ permalink raw reply related

* [PATCH 13/19] ppc64: change %llx into %lx
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

  CC      arch/powerpc/xmon/xmon.o
../arch/powerpc/xmon/xmon.c: In function ‘dump_one_paca’:
../arch/powerpc/xmon/xmon.c:2339:9: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘long unsigned int’ [-Werror=format=]
  printf(" %-*s = %#-*"format"\t(0x%lx)\n", 20, #name, 18, paca->name, \
         ^
../arch/powerpc/xmon/xmon.c:2417:2: note: in expansion of macro ‘DUMP’
  DUMP(p, accounting.utime, "llx");
  ^~~~
../arch/powerpc/xmon/xmon.c:2339:9: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘long unsigned int’ [-Werror=format=]
  printf(" %-*s = %#-*"format"\t(0x%lx)\n", 20, #name, 18, paca->name, \
         ^
../arch/powerpc/xmon/xmon.c:2418:2: note: in expansion of macro ‘DUMP’
  DUMP(p, accounting.stime, "llx");
  ^~~~
../arch/powerpc/xmon/xmon.c:2339:9: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘long unsigned int’ [-Werror=format=]
  printf(" %-*s = %#-*"format"\t(0x%lx)\n", 20, #name, 18, paca->name, \
         ^
../arch/powerpc/xmon/xmon.c:2419:2: note: in expansion of macro ‘DUMP’
  DUMP(p, accounting.utime_scaled, "llx");
  ^~~~
../arch/powerpc/xmon/xmon.c:2339:9: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘long unsigned int’ [-Werror=format=]
  printf(" %-*s = %#-*"format"\t(0x%lx)\n", 20, #name, 18, paca->name, \
         ^
../arch/powerpc/xmon/xmon.c:2420:2: note: in expansion of macro ‘DUMP’
  DUMP(p, accounting.starttime, "llx");
  ^~~~
../arch/powerpc/xmon/xmon.c:2339:9: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘long unsigned int’ [-Werror=format=]
  printf(" %-*s = %#-*"format"\t(0x%lx)\n", 20, #name, 18, paca->name, \
         ^
../arch/powerpc/xmon/xmon.c:2421:2: note: in expansion of macro ‘DUMP’
  DUMP(p, accounting.starttime_user, "llx");
  ^~~~
../arch/powerpc/xmon/xmon.c:2339:9: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘long unsigned int’ [-Werror=format=]
  printf(" %-*s = %#-*"format"\t(0x%lx)\n", 20, #name, 18, paca->name, \
         ^
../arch/powerpc/xmon/xmon.c:2422:2: note: in expansion of macro ‘DUMP’
  DUMP(p, accounting.startspurr, "llx");
  ^~~~
../arch/powerpc/xmon/xmon.c:2339:9: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘long unsigned int’ [-Werror=format=]
  printf(" %-*s = %#-*"format"\t(0x%lx)\n", 20, #name, 18, paca->name, \
         ^
../arch/powerpc/xmon/xmon.c:2423:2: note: in expansion of macro ‘DUMP’
  DUMP(p, accounting.utime_sspurr, "llx");
  ^~~~
../arch/powerpc/xmon/xmon.c:2339:9: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘long unsigned int’ [-Werror=format=]
  printf(" %-*s = %#-*"format"\t(0x%lx)\n", 20, #name, 18, paca->name, \
         ^
../arch/powerpc/xmon/xmon.c:2424:2: note: in expansion of macro ‘DUMP’
  DUMP(p, accounting.steal_time, "llx");
  ^~~~
cc1: all warnings being treated as errors

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/xmon/xmon.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 96247ac91a86..61f5e09367d0 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -2411,14 +2411,14 @@ static void dump_one_paca(int cpu)
 	DUMP(p, subcore_sibling_mask, "x");
 #endif
 
-	DUMP(p, accounting.utime, "llx");
-	DUMP(p, accounting.stime, "llx");
-	DUMP(p, accounting.utime_scaled, "llx");
-	DUMP(p, accounting.starttime, "llx");
-	DUMP(p, accounting.starttime_user, "llx");
-	DUMP(p, accounting.startspurr, "llx");
-	DUMP(p, accounting.utime_sspurr, "llx");
-	DUMP(p, accounting.steal_time, "llx");
+	DUMP(p, accounting.utime, "lx");
+	DUMP(p, accounting.stime, "lx");
+	DUMP(p, accounting.utime_scaled, "lx");
+	DUMP(p, accounting.starttime, "lx");
+	DUMP(p, accounting.starttime_user, "lx");
+	DUMP(p, accounting.startspurr, "lx");
+	DUMP(p, accounting.utime_sspurr, "lx");
+	DUMP(p, accounting.steal_time, "lx");
 #undef DUMP
 
 	catch_memory_errors = 0;
-- 
2.11.0

^ permalink raw reply related

* [PATCH 17/19] ppc64: change %d into %llu
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

  CC      arch/powerpc/xmon/xmon.o
../arch/powerpc/xmon/xmon.c: In function ‘dump_spu_fields’:
../arch/powerpc/xmon/xmon.c:3827:10: error: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘u64 {aka long long unsigned int}’ [-Werror=format=]
   printf("  %-*s = "format"\n", DUMP_WIDTH,  \
          ^
../arch/powerpc/xmon/xmon.c:3840:2: note: in expansion of macro ‘DUMP_VALUE’
  DUMP_VALUE(format, field, obj->field)
  ^~~~~~~~~~
../arch/powerpc/xmon/xmon.c:3853:2: note: in expansion of macro ‘DUMP_FIELD’
  DUMP_FIELD(spu, "%d", class_0_pending);
  ^~~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/xmon/xmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index c9a44962d3c9..4479245c6361 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -3847,7 +3847,7 @@ static void dump_spu_fields(struct spu *spu)
 	DUMP_FIELD(spu, "0x%lx", ls_size);
 	DUMP_FIELD(spu, "0x%x", node);
 	DUMP_FIELD(spu, "0x%lx", flags);
-	DUMP_FIELD(spu, "%d", class_0_pending);
+	DUMP_FIELD(spu, "%llu", class_0_pending);
 	DUMP_FIELD(spu, "0x%llx", class_0_dar);
 	DUMP_FIELD(spu, "0x%llx", class_1_dar);
 	DUMP_FIELD(spu, "0x%llx", class_1_dsisr);
-- 
2.11.0

^ permalink raw reply related

* [PATCH 19/19] ppc64: Handle %p format in DUMPPTR() function-like macro
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

  CC      arch/powerpc/xmon/xmon.o
../arch/powerpc/xmon/xmon.c: In function ‘dump_one_paca’:
../arch/powerpc/xmon/xmon.c:2339:9: error: '#' flag used with ‘%p’ gnu_printf format [-Werror=format=]
  printf(" %-*s = %#-*"format"\t(0x%lx)\n", 20, #name, 18, paca->name, \
         ^
../arch/powerpc/xmon/xmon.c:2347:2: note: in expansion of macro ‘DUMP’
  DUMP(p, emergency_sp, "px");

while at it fix warning reported by checkpatch:

WARNING: macros should not use a trailing semicolon

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/xmon/xmon.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index a87f14a24849..edd7ea85272f 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -2337,17 +2337,20 @@ static void dump_one_paca(int cpu)
 
 #define DUMP(paca, name, format) \
 	printf(" %-*s = %#-*"format"\t(0x%lx)\n", 20, #name, 18, paca->name, \
-		offsetof(struct paca_struct, name));
+		offsetof(struct paca_struct, name))
+#define DUMPPTR(paca, name, format) \
+	printf(" %-*s = %-*"format"\t(0x%lx)\n", 20, #name, 18, paca->name, \
+		offsetof(struct paca_struct, name))
 
 	DUMP(p, lock_token, "x");
 	DUMP(p, paca_index, "x");
 	DUMP(p, kernel_toc, "llx");
 	DUMP(p, kernelbase, "llx");
 	DUMP(p, kernel_msr, "llx");
-	DUMP(p, emergency_sp, "px");
+	DUMPPTR(p, emergency_sp, "p");
 #ifdef CONFIG_PPC_BOOK3S_64
-	DUMP(p, nmi_emergency_sp, "px");
-	DUMP(p, mc_emergency_sp, "px");
+	DUMPPTR(p, nmi_emergency_sp, "p");
+	DUMPPTR(p, mc_emergency_sp, "p");
 	DUMP(p, in_nmi, "x");
 	DUMP(p, in_mce, "x");
 	DUMP(p, hmi_event_available, "x");
@@ -2376,7 +2379,7 @@ static void dump_one_paca(int cpu)
 	for (i = 0; i < SLB_CACHE_ENTRIES; i++)
 		printf(" slb_cache[%d]:        = 0x%016x\n", i, p->slb_cache[i]);
 
-	DUMP(p, rfi_flush_fallback_area, "px");
+	DUMPPTR(p, rfi_flush_fallback_area, "p");
 #endif
 	DUMP(p, dscr_default, "llx");
 #ifdef CONFIG_PPC_BOOK3E
@@ -2387,7 +2390,7 @@ static void dump_one_paca(int cpu)
 	DUMP(p, crit_kstack, "px");
 	DUMP(p, dbg_kstack, "px");
 #endif
-	DUMP(p, __current, "px");
+	DUMPPTR(p, __current, "p");
 	DUMP(p, kstack, "llx");
 	printf(" kstack_base          = 0x%016llx\n", p->kstack & ~(THREAD_SIZE - 1));
 	DUMP(p, stab_rr, "llx");
@@ -2405,7 +2408,7 @@ static void dump_one_paca(int cpu)
 #endif
 
 #ifdef CONFIG_PPC_POWERNV
-	DUMP(p, core_idle_state_ptr, "px");
+	DUMPPTR(p, core_idle_state_ptr, "p");
 	DUMP(p, thread_idle_state, "x");
 	DUMP(p, thread_mask, "x");
 	DUMP(p, subcore_sibling_mask, "x");
-- 
2.11.0

^ permalink raw reply related

* [PATCH 18/19] ppc64: change %ld into %d
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

  CC      arch/powerpc/xmon/xmon.o
../arch/powerpc/xmon/xmon.c: In function ‘prregs’:
../arch/powerpc/xmon/xmon.c:1665:17: error: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘int’ [-Werror=format=]
    printf("R%.2ld = "REG"   R%.2ld = "REG"\n",
                 ^
../arch/powerpc/xmon/xmon.c:1665:11: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘int’ [-Werror=format=]
    printf("R%.2ld = "REG"   R%.2ld = "REG"\n",
           ^~~~~~~~~~~
../arch/powerpc/xmon/xmon.c:1669:17: error: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘int’ [-Werror=format=]
    printf("R%.2ld = "REG"   R%.2ld = "REG"\n",
                 ^
../arch/powerpc/xmon/xmon.c:1669:11: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘int’ [-Werror=format=]
    printf("R%.2ld = "REG"   R%.2ld = "REG"\n",
           ^~~~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/xmon/xmon.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 4479245c6361..a87f14a24849 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1662,11 +1662,11 @@ static void prregs(struct pt_regs *fp)
 #ifdef CONFIG_PPC64
 	if (FULL_REGS(fp)) {
 		for (n = 0; n < 16; ++n)
-			printf("R%.2ld = "REG"   R%.2ld = "REG"\n",
+			printf("R%.2d = "REG"   R%.2d = "REG"\n",
 			       n, fp->gpr[n], n+16, fp->gpr[n+16]);
 	} else {
 		for (n = 0; n < 7; ++n)
-			printf("R%.2ld = "REG"   R%.2ld = "REG"\n",
+			printf("R%.2d = "REG"   R%.2d = "REG"\n",
 			       n, fp->gpr[n], n+7, fp->gpr[n+7]);
 	}
 #else
-- 
2.11.0

^ permalink raw reply related

* [PATCH 16/19] ppc64: Change %d into %lu
From: Mathieu Malaterre @ 2018-03-16 11:02 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev,
	Mathieu Malaterre
In-Reply-To: <20180316110224.12260-1-malat@debian.org>

  CC      arch/powerpc/xmon/spu-dis.o
../arch/powerpc/xmon/spu-dis.c: In function ‘print_insn_spu’:
../arch/powerpc/xmon/spu-dis.c:137:18: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=]
        printf("$%d",
                  ^
../arch/powerpc/xmon/spu-dis.c:141:18: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=]
        printf("$%d",
                  ^
../arch/powerpc/xmon/spu-dis.c:145:18: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=]
        printf("$%d",
                  ^
../arch/powerpc/xmon/spu-dis.c:149:18: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=]
        printf("$%d",
                  ^
../arch/powerpc/xmon/spu-dis.c:153:20: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=]
        printf("$sp%d",
                    ^
../arch/powerpc/xmon/spu-dis.c:157:20: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=]
        printf("$ch%d",
                    ^
../arch/powerpc/xmon/spu-dis.c:165:17: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=]
        printf("%d",
                 ^
../arch/powerpc/xmon/spu-dis.c:169:17: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=]
        printf("%d",
                 ^
cc1: all warnings being treated as errors

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/xmon/spu-dis.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/xmon/spu-dis.c b/arch/powerpc/xmon/spu-dis.c
index 6b83b680b9f6..4cbc7da88524 100644
--- a/arch/powerpc/xmon/spu-dis.c
+++ b/arch/powerpc/xmon/spu-dis.c
@@ -134,27 +134,27 @@ print_insn_spu (unsigned long insn, unsigned long memaddr)
 	  switch (arg)
 	    {
 	    case A_T:
-	      printf("$%d",
+	      printf("$%lu",
 				     DECODE_INSN_RT (insn));
 	      break;
 	    case A_A:
-	      printf("$%d",
+	      printf("$%lu",
 				     DECODE_INSN_RA (insn));
 	      break;
 	    case A_B:
-	      printf("$%d",
+	      printf("$%lu",
 				     DECODE_INSN_RB (insn));
 	      break;
 	    case A_C:
-	      printf("$%d",
+	      printf("$%lu",
 				     DECODE_INSN_RC (insn));
 	      break;
 	    case A_S:
-	      printf("$sp%d",
+	      printf("$sp%lu",
 				     DECODE_INSN_RA (insn));
 	      break;
 	    case A_H:
-	      printf("$ch%d",
+	      printf("$ch%lu",
 				     DECODE_INSN_RA (insn));
 	      break;
 	    case A_P:
@@ -162,11 +162,11 @@ print_insn_spu (unsigned long insn, unsigned long memaddr)
 	      printf("(");
 	      break;
 	    case A_U7A:
-	      printf("%d",
+	      printf("%lu",
 				     173 - DECODE_INSN_U8 (insn));
 	      break;
 	    case A_U7B:
-	      printf("%d",
+	      printf("%lu",
 				     155 - DECODE_INSN_U8 (insn));
 	      break;
 	    case A_S3:
-- 
2.11.0

^ permalink raw reply related

* [PATCH 0/1] PCI set flag PCI_SCAN_ALL_PCIE_DEVS for P.A. Semi boards
From: Christian Zigotzky @ 2018-03-16 12:10 UTC (permalink / raw)
  To: Bjorn Helgaas, Bjorn Helgaas, linux-pci, linuxppc-dev,
	Olof Johansson
In-Reply-To: <20171201232716.GA18780@bhelgaas-glaptop.roam.corp.google.com>

On 02 December 2017 at 00:27PM, Bjorn Helgaas wrote:
 > On Fri, Dec 01, 2017 at 11:08:46PM +0100, Christian Zigotzky wrote:
 >> On 30.11.2017 23:42, Bjorn Helgaas wrote:
 >>>
 >>> 00:11.0 claims to be a PCIe Root Port leading to [bus 05-06]. That
 >>> means there's a Link (presumably this A-Link II Express thing), and the
 >>> downstream end of the Link *should* be a PCIe Upstream Port on bus 05,
 >>> but no such device is visible.  I suppose the SB600 does implement
 >>> some sort of PCIe Port there, but keeps it invisible to software, and
 >>> at the same time, contains an invisible bridge that connects the Link
 >>> to all the conventional PCI devices on bus 05.
 >>>
 >>> When we scan bus 05, we do this:
 >>>
 >>>    pci_scan_child_bus_extend(bus=05)
 >>>      for (devfn = 0; devfn < 0x100; devfn += 8)
 >>>        pci_scan_slot(05, 00.0)
 >>>          pci_scan_single_device
 >>>            pci_scan_device(05, 00.0)           # fails; no 05:00.0
 >>>        pci_scan_slot(05, 01.0)
 >>>          only_one_child(bus=05)
 >>>            parent = 00:11.0
 >>>            pci_pcie_type(00:11.0) == ROOT_PORT # returns true
 >>>
 >>> Since only_one_child() sees that 00:11.0 is a Root Port, we give up
 >>> before we even get to the PCI_SCAN_ALL_PCIE_DEVS test.
 >>>
 >>> I *think* something like the patch below should make this work if you
 >>> use the "pci=pcie_scan_all" parameter.  We have some x86 DMI quirks
 >>> that set PCI_SCAN_ALL_PCIE_DEVS automatically.  I don't know how to do
 >>> something similar on powerpc, but maybe you do?
 >>>
 >>
 >> Hi Bjorn,
 >>
 >> I tested your new patch today. It boots with the boot argument
 >> "pci=pcie_scan_all". Well done! :-)
 >>
 >> It doesn't boot without the boot argument "pci=pcie_scan_all".
 >
 > Thanks for testing that.  I'll merge a similar patch for v4.16.
 >
 > I don't think using "pci=pcie_scan_all" is really an acceptable
 > long-term answer for you, though.  Is there some way we can identify
 > at run-time whether we're on a Nemo system?  If so, we can make this
 > happen automatically.
 >
 > Bjorn
 >

Hi Bjorn,
Hi All,

Olof Johansson has created a patch for us. With this patch, 
"pci=pcie_scan_all" executes automatically on P.A. Semi boards. We don't 
need to add 'pci=pcie_scan_all' to the
kernel boot arguments anymore. Could you please add Olof's patch to the 
official kernel source code?

arch/powerpc/platforms/pasemi/pci.c | 2 ++
  1 file changed, 2 insertions(+)

Thanks,
Christian

^ permalink raw reply

* [PATCH 1/1] PCI set flag PCI_SCAN_ALL_PCIE_DEVS for P.A. Semi boards
From: Christian Zigotzky @ 2018-03-16 12:55 UTC (permalink / raw)
  To: Bjorn Helgaas, Bjorn Helgaas, linux-pci, linuxppc-dev,
	Olof Johansson
In-Reply-To: <dc228918-652a-e24c-ce7b-8d1b30153d3b@xenosoft.de>

Bjorn Helgaas created a patch for making PCI_SCAN_ALL_PCIE_DEVS work for 
Root Ports as well as Downstream. Previously PCI_SCAN_ALL_PCIE_DEVS (set 
by quirks or the "pci=pcie_scan_all"
kernel parameter) only affected Switch Downstream Ports, not Root Ports. 
The problem is, that we have to add always the boot argument 
"pci=pcie_scan_all" for using Bjorn's improvements. Without the boot 
argument "pci=pcie_scan_all", the kernel doesn't boot on P.A. Semi 
boards with SB600 chipset (SB600 chipset is connected via PCIe x4 to the 
P.A. Semi’s PA6T-1682M System-on-a-Chip) because the kernel can't find 
any drives connected to the SB600 anymore. Olof Johansson has created a 
patch for executing "pci=pcie_scan_all" automatically on P.A. Semi 
boards. With his patch, we don't need to add 'pci=pcie_scan_all' to the 
kernel boot arguments anymore.

---

arch/powerpc/platforms/pasemi/pci.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/platforms/pasemi/pci.c 
b/arch/powerpc/platforms/pasemi/pci.c
index 5ff6108..ea54ed2 100644
--- a/arch/powerpc/platforms/pasemi/pci.c
+++ b/arch/powerpc/platforms/pasemi/pci.c
@@ -224,6 +224,8 @@ void __init pas_pci_init(void)
          return;
      }

+    pci_set_flags(PCI_SCAN_ALL_PCIE_DEVS);
+
      for (np = NULL; (np = of_get_next_child(root, np)) != NULL;)
          if (np->name && !strcmp(np->name, "pxp") && !pas_add_bridge(np))
              of_node_get(np);

--

^ permalink raw reply related

* Re: [PATCH RFC rebase 2/9] powerpc: Use barrier_nospec in copy_from_user
From: Michael Ellerman @ 2018-03-16 13:22 UTC (permalink / raw)
  To: Linus Torvalds, Michal Suchanek
  Cc: Kate Stewart, Madhavan Srinivasan, Mahesh Salgaonkar,
	Paul Mackerras, Michael Neuling, Bryant G. Ly, Naveen N. Rao,
	Daniel Axtens, Nicholas Piggin, Cédric Le Goater,
	David Gibson, Greg Kroah-Hartman, Linux Kernel Mailing List,
	Sergey Senozhatsky, Masami Hiramatsu, Andrew Donnellan,
	Philippe Ombredanne, Joe Perches, Oliver O'Halloran,
	Andrew Morton, Tobin C. Harding, ppc-dev, Al Viro
In-Reply-To: <CA+55aFw8LJ7T_4jTe4q5q0d2JuP0iBWdwcTXZULKe-c4w7QrPA@mail.gmail.com>

Linus Torvalds <torvalds@linux-foundation.org> writes:

> On Thu, Mar 15, 2018 at 12:15 PM, Michal Suchanek <msuchanek@suse.de> wrote:
>> This is based on x86 patch doing the same.
>>
>> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
>> ---
>> --- a/arch/powerpc/include/asm/uaccess.h
>> +++ b/arch/powerpc/include/asm/uaccess.h
>> @@ -258,8 +259,10 @@ do {                                                               \
>>         long __gu_err = -EFAULT;                                        \
>>         unsigned long  __gu_val = 0;                                    \
>>         const __typeof__(*(ptr)) __user *__gu_addr = (ptr);             \
>> +       int can_access = access_ok(VERIFY_READ, __gu_addr, (size));     \
>>         might_fault();                                                  \
>> -       if (access_ok(VERIFY_READ, __gu_addr, (size)))                  \
>> +       barrier_nospec();                                               \
>> +       if (can_access)                                                 \
>>                 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
>>         (x) = (__force __typeof__(*(ptr)))__gu_val;                             \
>>         __gu_err;                                                       \
>
> Is the above really correct? The barrier is *before* the conditional
> branch that might be mis-predicted.
>
> I don't know how the ppc barrier works, but that sounds completely bogus.

Yeah it should be after the branch.

I don't have a formal spec for the barrier yet, it should be defined in
a hopefully soon to be released revision of the ISA.

But the gist is it will stall execution until any older branches are no
longer speculating.

It doesn't order any two arbitrary instructions, such as a comparison
and a branch, which I suspect is how Michal was interpreting it.

cheers

^ permalink raw reply

* Re: [PATCH RFC rebase 3/9] powerpc/64: Use barrier_nospec in syscall entry
From: Michael Ellerman @ 2018-03-16 13:28 UTC (permalink / raw)
  To: Michal Suchánek, Nicholas Piggin
  Cc: Kate Stewart, Madhavan Srinivasan, Mahesh Salgaonkar, Al Viro,
	Paul Mackerras, Michael Neuling, Bryant G. Ly, Naveen N. Rao,
	Daniel Axtens, Cédric Le Goater, David Gibson,
	Greg Kroah-Hartman, linux-kernel, Sergey Senozhatsky,
	Masami Hiramatsu, Andrew Donnellan, Philippe Ombredanne,
	Joe Perches, Oliver O'Halloran, Andrew Morton, linuxppc-dev,
	Tobin C. Harding
In-Reply-To: <20180316101549.31238bdf@naga.suse.cz>

Hi Michal,

Thanks for working on this series in the absence of any documentation.

Michal Such=C3=A1nek <msuchanek@suse.de> writes:
> On Fri, 16 Mar 2018 15:18:23 +1000
> Nicholas Piggin <npiggin@gmail.com> wrote:
>
>> On Thu, 15 Mar 2018 20:15:52 +0100
>> Michal Suchanek <msuchanek@suse.de> wrote:
>>=20
>> > On powerpc syscall entry is done in assembly so patch in an explicit
>> > barrier_nospec.=20=20
>>=20
>> Same comment as Linus for this -- the barriers are before the branch
>> here, so is it possible the branch instruction can be speculative
>> while the index is used to load the syscall table?
>
> As far as I understand barriers they separate code before the barrier
> and code after the barrier.
>
> So inserting barrier_nospec after cmpldi means that the result of the
> cmpldi has to be known before any instruction following barrier_nospec
> that depends on the result can be executed.=20

That would make sense, but I don't think that's how the barrier's been
defined.

I don't have a formal spec for it (yet), but what I do have indicates it
only orders older branches vs future instructions.

> However, you have probably knowledge of the powerpc implementation of
> the barrier so if the semantic is actually different then please
> enlighten me.

We have some knowledge, but only some :)

It's not necessarily implemented the same way on each chip revision, so
it's not entirely clear what the formal semantics will be vs what we are
seeing in current implementations. But I think it's safe to say it
should always go after the branch that might be speculatively executed.

Will try and get some better documentation for you.

cheers

^ permalink raw reply

* [RFC PATCH 1/2] ftrace: Allow arches to opt-out of static ftrace
From: Michael Ellerman @ 2018-03-16 13:46 UTC (permalink / raw)
  To: rostedt; +Cc: linuxppc-dev, linux-kernel, linux-arch, naveen.n.rao

There is a small but non-zero amount of code required by arches to
suppory non-dynamic (static) ftrace, and more importantly there is the
added work of testing both configurations.

There are also almost no down sides to dynamic ftrace once it's well
tested, other than a small increase in code/data size.

So give arches the option to opt-out of supporting static ftrace.

This is implemented as a DYNAMIC_FTRACE_CHOICE option, which controls
whether DYNAMIC_FTRACE is presented as a user-selectable option or if
it is just enabled based on its dependencies being enabled (because
it's already default y).

Then the CHOICE option depends on an arch *not* selecting
HAVE_DYNAMIC_FTRACE_ONLY. This would be more natural in reverse, as a
HAVE_STATIC_FTRACE option, but that would require updating every arch.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 Documentation/trace/ftrace-design.txt | 12 ++++++++++++
 kernel/trace/Kconfig                  |  9 ++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/Documentation/trace/ftrace-design.txt b/Documentation/trace/ftrace-design.txt
index a273dd0bbaaa..50c1d252f01d 100644
--- a/Documentation/trace/ftrace-design.txt
+++ b/Documentation/trace/ftrace-design.txt
@@ -391,3 +391,15 @@ Quick notes:
 	  ftrace_graph_call location with a call to ftrace_graph_caller()
 	- ftrace_disable_ftrace_graph_caller() will runtime patch the
 	  ftrace_graph_call location with nops
+
+HAVE_DYNAMIC_FTRACE_ONLY
+------------------------
+
+An arch can select this option to indicate that it only supports dynamic ftrace,
+and not non-dynamic (static) ftrace.
+
+Once dynamic ftrace is well tested it is superior to static ftrace in basically
+all respects other than code/data size.
+
+Selection this option allows an arch to only support dyanmic, removing a small
+amount of code complexity required to support both static and dynamic.
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 0b249e2f0c3c..1998e30d2ea2 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -29,6 +29,9 @@ config HAVE_DYNAMIC_FTRACE
 	help
 	  See Documentation/trace/ftrace-design.txt
 
+config HAVE_DYNAMIC_FTRACE_ONLY
+	bool
+
 config HAVE_DYNAMIC_FTRACE_WITH_REGS
 	bool
 
@@ -488,8 +491,12 @@ config BPF_EVENTS
 config PROBE_EVENTS
 	def_bool n
 
+config DYNAMIC_FTRACE_CHOICE
+	def_bool y
+	depends on !HAVE_DYNAMIC_FTRACE_ONLY
+
 config DYNAMIC_FTRACE
-	bool "enable/disable function tracing dynamically"
+	bool "enable/disable function tracing dynamically" if DYNAMIC_FTRACE_CHOICE
 	depends on FUNCTION_TRACER
 	depends on HAVE_DYNAMIC_FTRACE
 	default y
-- 
2.14.1

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox