Skip to contentSkip to conversation

arch/powerpc/xmon/xmon.c:3138:16: warning: variable 'pgdir' set but not used

PATCH kbuild test robot 2 participants 2 messages May 19, 2020

Subsystems (2)
lore
Share & tools
lore

kbuild test robot

author build bot
#0 lore raw
tree:   https://github.com/hnaz/linux-mm master
head:   2bbf0589bfeb27800c730b76eacf34528eee5418
commit: 47dde7dbc279f3698c76a7b92ac0d0f1913539af [476/523] powerpc: add support for folded p4d page tables
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
git checkout 47dde7dbc279f3698c76a7b92ac0d0f1913539af
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>, old ones prefixed by <<):

arch/powerpc/xmon/xmon.c: In function 'show_pte':

>> arch/powerpc/xmon/xmon.c:3138:16: warning: variable 'pgdir' set but not used [-Wunused-but-set-variable]

3138 | pgd_t *pgdp, *pgdir;
| ^~~~~
arch/powerpc/xmon/xmon.c: At top level:
arch/powerpc/xmon/xmon.c:4122:1: warning: no previous prototype for 'spu_inst_dump' [-Wmissing-prototypes] 4122 | spu_inst_dump(unsigned long adr, long count, int praddr)
| ^~~~~~~~~~~~~
arch/powerpc/xmon/xmon.c: In function 'xmon_print_symbol':
arch/powerpc/xmon/xmon.c:3557:14: warning: variable 'name' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered] 3557 | const char *name = NULL;
| ^~~~
arch/powerpc/xmon/xmon.c: In function 'stop_spus':
arch/powerpc/xmon/xmon.c:3990:6: warning: variable 'i' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered] 3990 | int i;
| ^
arch/powerpc/xmon/xmon.c: In function 'restart_spus':
arch/powerpc/xmon/xmon.c:4031:6: warning: variable 'i' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered] 4031 | int i;
| ^
arch/powerpc/xmon/xmon.c: In function 'dump_opal_msglog':
arch/powerpc/xmon/xmon.c:2937:9: warning: variable 'pos' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered] 2937 | loff_t pos = 0;
| ^~~
arch/powerpc/xmon/xmon.c: In function 'show_pte':
arch/powerpc/xmon/xmon.c:3136:22: warning: variable 'tsk' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered] 3136 | struct task_struct *tsk = NULL;
| ^~~
arch/powerpc/xmon/xmon.c: In function 'show_tasks':
arch/powerpc/xmon/xmon.c:3234:22: warning: variable 'tsk' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered] 3234 | struct task_struct *tsk = NULL;
| ^~~
arch/powerpc/xmon/xmon.c: In function 'xmon_core':
arch/powerpc/xmon/xmon.c:490:6: warning: variable 'cmd' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered] 490 | int cmd = 0;
| ^~~
arch/powerpc/xmon/xmon.c:849:14: warning: variable 'bp' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered] 849 | struct bpt *bp;
| ^~
arch/powerpc/xmon/xmon.c:849:14: warning: variable 'bp' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered] arch/powerpc/xmon/xmon.c:488:48: warning: argument 'fromipi' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered] 488 | static int xmon_core(struct pt_regs *regs, int fromipi)
| ~~~~^~~~~~~

vim +/pgdir +3138 arch/powerpc/xmon/xmon.c

80eff6c4847997 Balbir Singh      2017-10-30  3132  
80eff6c4847997 Balbir Singh      2017-10-30  3133  static void show_pte(unsigned long addr)
80eff6c4847997 Balbir Singh      2017-10-30  3134  {
80eff6c4847997 Balbir Singh      2017-10-30  3135  	unsigned long tskv = 0;
80eff6c4847997 Balbir Singh      2017-10-30  3136  	struct task_struct *tsk = NULL;
80eff6c4847997 Balbir Singh      2017-10-30  3137  	struct mm_struct *mm;
80eff6c4847997 Balbir Singh      2017-10-30 @3138  	pgd_t *pgdp, *pgdir;
47dde7dbc279f3 Mike Rapoport     2020-05-16  3139  	p4d_t *p4dp;
80eff6c4847997 Balbir Singh      2017-10-30  3140  	pud_t *pudp;
80eff6c4847997 Balbir Singh      2017-10-30  3141  	pmd_t *pmdp;
80eff6c4847997 Balbir Singh      2017-10-30  3142  	pte_t *ptep;
80eff6c4847997 Balbir Singh      2017-10-30  3143  
80eff6c4847997 Balbir Singh      2017-10-30  3144  	if (!scanhex(&tskv))
80eff6c4847997 Balbir Singh      2017-10-30  3145  		mm = &init_mm;
80eff6c4847997 Balbir Singh      2017-10-30  3146  	else
80eff6c4847997 Balbir Singh      2017-10-30  3147  		tsk = (struct task_struct *)tskv;
80eff6c4847997 Balbir Singh      2017-10-30  3148  
80eff6c4847997 Balbir Singh      2017-10-30  3149  	if (tsk == NULL)
80eff6c4847997 Balbir Singh      2017-10-30  3150  		mm = &init_mm;
80eff6c4847997 Balbir Singh      2017-10-30  3151  	else
80eff6c4847997 Balbir Singh      2017-10-30  3152  		mm = tsk->active_mm;
80eff6c4847997 Balbir Singh      2017-10-30  3153  
80eff6c4847997 Balbir Singh      2017-10-30  3154  	if (setjmp(bus_error_jmp) != 0) {
80eff6c4847997 Balbir Singh      2017-10-30  3155  		catch_memory_errors = 0;
d8104182087319 Michael Ellerman  2017-12-06  3156  		printf("*** Error dumping pte for task %px\n", tsk);
80eff6c4847997 Balbir Singh      2017-10-30  3157  		return;
80eff6c4847997 Balbir Singh      2017-10-30  3158  	}
80eff6c4847997 Balbir Singh      2017-10-30  3159  
80eff6c4847997 Balbir Singh      2017-10-30  3160  	catch_memory_errors = 1;
80eff6c4847997 Balbir Singh      2017-10-30  3161  	sync();
80eff6c4847997 Balbir Singh      2017-10-30  3162  
80eff6c4847997 Balbir Singh      2017-10-30  3163  	if (mm == &init_mm) {
80eff6c4847997 Balbir Singh      2017-10-30  3164  		pgdp = pgd_offset_k(addr);
80eff6c4847997 Balbir Singh      2017-10-30  3165  		pgdir = pgd_offset_k(0);
80eff6c4847997 Balbir Singh      2017-10-30  3166  	} else {
80eff6c4847997 Balbir Singh      2017-10-30  3167  		pgdp = pgd_offset(mm, addr);
80eff6c4847997 Balbir Singh      2017-10-30  3168  		pgdir = pgd_offset(mm, 0);
80eff6c4847997 Balbir Singh      2017-10-30  3169  	}
80eff6c4847997 Balbir Singh      2017-10-30  3170  
47dde7dbc279f3 Mike Rapoport     2020-05-16  3171  	p4dp = p4d_offset(pgdp, addr);
47dde7dbc279f3 Mike Rapoport     2020-05-16  3172  
47dde7dbc279f3 Mike Rapoport     2020-05-16  3173  	if (p4d_none(*p4dp)) {
47dde7dbc279f3 Mike Rapoport     2020-05-16  3174  		printf("No valid P4D\n");
80eff6c4847997 Balbir Singh      2017-10-30  3175  		return;
80eff6c4847997 Balbir Singh      2017-10-30  3176  	}
80eff6c4847997 Balbir Singh      2017-10-30  3177  
47dde7dbc279f3 Mike Rapoport     2020-05-16  3178  	if (p4d_is_leaf(*p4dp)) {
47dde7dbc279f3 Mike Rapoport     2020-05-16  3179  		format_pte(p4dp, p4d_val(*p4dp));
80eff6c4847997 Balbir Singh      2017-10-30  3180  		return;
80eff6c4847997 Balbir Singh      2017-10-30  3181  	}
80eff6c4847997 Balbir Singh      2017-10-30  3182  
47dde7dbc279f3 Mike Rapoport     2020-05-16  3183  	printf("p4dp @ 0x%px = 0x%016lx\n", p4dp, p4d_val(*p4dp));
47dde7dbc279f3 Mike Rapoport     2020-05-16  3184  
47dde7dbc279f3 Mike Rapoport     2020-05-16  3185  	pudp = pud_offset(p4dp, addr);
80eff6c4847997 Balbir Singh      2017-10-30  3186  
80eff6c4847997 Balbir Singh      2017-10-30  3187  	if (pud_none(*pudp)) {
80eff6c4847997 Balbir Singh      2017-10-30  3188  		printf("No valid PUD\n");
80eff6c4847997 Balbir Singh      2017-10-30  3189  		return;
80eff6c4847997 Balbir Singh      2017-10-30  3190  	}
80eff6c4847997 Balbir Singh      2017-10-30  3191  
d6eacedd1f0ebf Aneesh Kumar K.V  2019-05-14  3192  	if (pud_is_leaf(*pudp)) {
80eff6c4847997 Balbir Singh      2017-10-30  3193  		format_pte(pudp, pud_val(*pudp));
80eff6c4847997 Balbir Singh      2017-10-30  3194  		return;
80eff6c4847997 Balbir Singh      2017-10-30  3195  	}
80eff6c4847997 Balbir Singh      2017-10-30  3196  
e70d8f55268ba9 Mathieu Malaterre 2018-03-25  3197  	printf("pudp @ 0x%px = 0x%016lx\n", pudp, pud_val(*pudp));
80eff6c4847997 Balbir Singh      2017-10-30  3198  
80eff6c4847997 Balbir Singh      2017-10-30  3199  	pmdp = pmd_offset(pudp, addr);
80eff6c4847997 Balbir Singh      2017-10-30  3200  
80eff6c4847997 Balbir Singh      2017-10-30  3201  	if (pmd_none(*pmdp)) {
80eff6c4847997 Balbir Singh      2017-10-30  3202  		printf("No valid PMD\n");
80eff6c4847997 Balbir Singh      2017-10-30  3203  		return;
80eff6c4847997 Balbir Singh      2017-10-30  3204  	}
80eff6c4847997 Balbir Singh      2017-10-30  3205  
d6eacedd1f0ebf Aneesh Kumar K.V  2019-05-14  3206  	if (pmd_is_leaf(*pmdp)) {
80eff6c4847997 Balbir Singh      2017-10-30  3207  		format_pte(pmdp, pmd_val(*pmdp));
80eff6c4847997 Balbir Singh      2017-10-30  3208  		return;
80eff6c4847997 Balbir Singh      2017-10-30  3209  	}
e70d8f55268ba9 Mathieu Malaterre 2018-03-25  3210  	printf("pmdp @ 0x%px = 0x%016lx\n", pmdp, pmd_val(*pmdp));
80eff6c4847997 Balbir Singh      2017-10-30  3211  
80eff6c4847997 Balbir Singh      2017-10-30  3212  	ptep = pte_offset_map(pmdp, addr);
80eff6c4847997 Balbir Singh      2017-10-30  3213  	if (pte_none(*ptep)) {
80eff6c4847997 Balbir Singh      2017-10-30  3214  		printf("no valid PTE\n");
80eff6c4847997 Balbir Singh      2017-10-30  3215  		return;
80eff6c4847997 Balbir Singh      2017-10-30  3216  	}
80eff6c4847997 Balbir Singh      2017-10-30  3217  
80eff6c4847997 Balbir Singh      2017-10-30  3218  	format_pte(ptep, pte_val(*ptep));
80eff6c4847997 Balbir Singh      2017-10-30  3219  
80eff6c4847997 Balbir Singh      2017-10-30  3220  	sync();
80eff6c4847997 Balbir Singh      2017-10-30  3221  	__delay(200);
80eff6c4847997 Balbir Singh      2017-10-30  3222  	catch_memory_errors = 0;
80eff6c4847997 Balbir Singh      2017-10-30  3223  }
80eff6c4847997 Balbir Singh      2017-10-30  3224  #else
80eff6c4847997 Balbir Singh      2017-10-30  3225  static void show_pte(unsigned long addr)
80eff6c4847997 Balbir Singh      2017-10-30  3226  {
80eff6c4847997 Balbir Singh      2017-10-30  3227  	printf("show_pte not yet implemented\n");
80eff6c4847997 Balbir Singh      2017-10-30  3228  }
80eff6c4847997 Balbir Singh      2017-10-30  3229  #endif /* CONFIG_PPC_BOOK3S_64 */
80eff6c4847997 Balbir Singh      2017-10-30  3230  

:::::: The code at line 3138 was first introduced by commit
:::::: 80eff6c484799722736471d15ff9cc86b64cae7a powerpc/xmon: Support dumping software pagetables

:::::: TO: Balbir Singh <[email protected]>
:::::: CC: Michael Ellerman <[email protected]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#1 lore raw
Quoted 13 lines · kbuild test robot
tree:   https://github.com/hnaz/linux-mm master
head:   2bbf0589bfeb27800c730b76eacf34528eee5418
commit: 47dde7dbc279f3698c76a7b92ac0d0f1913539af [476/523] powerpc: add support for folded p4d page tables
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
git checkout 47dde7dbc279f3698c76a7b92ac0d0f1913539af
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate

Quoted 8 lines

All warnings (new ones prefixed by >>, old ones prefixed by <<):

arch/powerpc/xmon/xmon.c: In function 'show_pte':

Quoted 1 line
Quoted 1 line

arch/powerpc/xmon/xmon.c:3138:16: warning: variable 'pgdir' set but not used [-Wunused-but-set-variable]

3138 | pgd_t *pgdp, *pgdir;
| ^~~~~

...

The fix is below:

From ced3189aa0b1c3888c4e8d4ff2d6575ad93859f7 Mon Sep 17 00:00:00 2001
From: Mike Rapoport <[email protected]>
Date: Tue, 19 May 2020 21:11:05 +0300
Subject: [PATCH] powerpc/xmon: drop unused pgdir varialble in show_pte()
function

The kernel build robot complained:

arch/powerpc/xmon/xmon.c: In function 'show_pte':

Quoted 2 lines
Quoted 2 lines

arch/powerpc/xmon/xmon.c:3138:16: warning: variable 'pgdir' set but not used [-Wunused-but-set-variable]

3138 | pgd_t *pgdp, *pgdir;
| ^~~~~

Remove the unused pgdir variable and adjust if () else statement to comply with the coding style.

---
 arch/powerpc/xmon/xmon.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
arch/powerpc/xmon/xmon.c +3 -6
index 506fd93fcf1e..da7f62f1daec 100644
@@ -3134,7 +3134,7 @@ static void show_pte(unsigned long addr)
 	unsigned long tskv = 0;
 	struct task_struct *tsk = NULL;
 	struct mm_struct *mm;
-	pgd_t *pgdp, *pgdir;
+	pgd_t *pgdp;
 	p4d_t *p4dp;
 	pud_t *pudp;
 	pmd_t *pmdp;
@@ -3159,13 +3159,10 @@ static void show_pte(unsigned long addr)
 	catch_memory_errors = 1;
 	sync();
 
-	if (mm == &init_mm) {
+	if (mm == &init_mm)
 		pgdp = pgd_offset_k(addr);
-		pgdir = pgd_offset_k(0);
-	} else {
+	else
 		pgdp = pgd_offset(mm, addr);
-		pgdir = pgd_offset(mm, 0);
-	}
 
 	p4dp = p4d_offset(pgdp, addr);
 
Signature · 1 line
2.26.2
Quoted 3 lines

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Signature · 2 lines
Sincerely yours,
Mike.