tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 642b151f45dd54809ea00ecd3976a56c1ec9b53d
commit: 7235db268a2777bc380b99b7db49ff7b19c8fb76 sparc32: use pgtable-nopud instead of 4level-fixup
config: sparc-defconfig (attached as .config)
compiler: sparc-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 7235db268a2777bc380b99b7db49ff7b19c8fb76
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <[email protected]>
All errors (new ones prefixed by >>, old ones prefixed by <<):
arch/sparc/mm/srmmu.c: In function 'srmmu_nocache_init':
>> arch/sparc/mm/srmmu.c:300:9: error: variable 'pud' set but not used [-Werror=unused-but-set-variable]
300 | pud_t *pud;
| ^~~
arch/sparc/mm/srmmu.c: In function 'poke_hypersparc':
arch/sparc/mm/srmmu.c:1128:25: error: variable 'clear' set but not used [-Werror=unused-but-set-variable]
1128 | volatile unsigned long clear;
| ^~~~~
cc1: all warnings being treated as errors
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7235db268a2777bc380b99b7db49ff7b19c8fb76
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout 7235db268a2777bc380b99b7db49ff7b19c8fb76
vim +/pud +300 arch/sparc/mm/srmmu.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 293
50215d6511265d Adrian Bunk 2008-06-05 294 static void __init srmmu_nocache_init(void)
^1da177e4c3f41 Linus Torvalds 2005-04-16 295 {
e8c29c839b5c9f Sam Ravnborg 2014-04-21 296 void *srmmu_nocache_bitmap;
^1da177e4c3f41 Linus Torvalds 2005-04-16 297 unsigned int bitmap_bits;
^1da177e4c3f41 Linus Torvalds 2005-04-16 298 pgd_t *pgd;
7235db268a2777 Mike Rapoport 2019-12-04 299 p4d_t *p4d;
7235db268a2777 Mike Rapoport 2019-12-04 @300 pud_t *pud;
^1da177e4c3f41 Linus Torvalds 2005-04-16 301 pmd_t *pmd;
^1da177e4c3f41 Linus Torvalds 2005-04-16 302 pte_t *pte;
^1da177e4c3f41 Linus Torvalds 2005-04-16 303 unsigned long paddr, vaddr;
^1da177e4c3f41 Linus Torvalds 2005-04-16 304 unsigned long pteval;
^1da177e4c3f41 Linus Torvalds 2005-04-16 305
^1da177e4c3f41 Linus Torvalds 2005-04-16 306 bitmap_bits = srmmu_nocache_size >> SRMMU_NOCACHE_BITMAP_SHIFT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 307
9415673e3e19f7 Mike Rapoport 2019-03-11 308 srmmu_nocache_pool = memblock_alloc(srmmu_nocache_size,
9415673e3e19f7 Mike Rapoport 2019-03-11 309 SRMMU_NOCACHE_ALIGN_MAX);
b1e1c869ffd1d8 Mike Rapoport 2019-03-11 310 if (!srmmu_nocache_pool)
b1e1c869ffd1d8 Mike Rapoport 2019-03-11 311 panic("%s: Failed to allocate %lu bytes align=0x%x\n",
b1e1c869ffd1d8 Mike Rapoport 2019-03-11 312 __func__, srmmu_nocache_size, SRMMU_NOCACHE_ALIGN_MAX);
^1da177e4c3f41 Linus Torvalds 2005-04-16 313 memset(srmmu_nocache_pool, 0, srmmu_nocache_size);
^1da177e4c3f41 Linus Torvalds 2005-04-16 314
54df2db36c93bb Akinobu Mita 2013-03-29 315 srmmu_nocache_bitmap =
9415673e3e19f7 Mike Rapoport 2019-03-11 316 memblock_alloc(BITS_TO_LONGS(bitmap_bits) * sizeof(long),
9415673e3e19f7 Mike Rapoport 2019-03-11 317 SMP_CACHE_BYTES);
b1e1c869ffd1d8 Mike Rapoport 2019-03-11 318 if (!srmmu_nocache_bitmap)
b1e1c869ffd1d8 Mike Rapoport 2019-03-11 319 panic("%s: Failed to allocate %zu bytes\n", __func__,
b1e1c869ffd1d8 Mike Rapoport 2019-03-11 320 BITS_TO_LONGS(bitmap_bits) * sizeof(long));
^1da177e4c3f41 Linus Torvalds 2005-04-16 321 bit_map_init(&srmmu_nocache_map, srmmu_nocache_bitmap, bitmap_bits);
^1da177e4c3f41 Linus Torvalds 2005-04-16 322
f71a2aacc63e31 Sam Ravnborg 2012-07-26 323 srmmu_swapper_pg_dir = __srmmu_get_nocache(SRMMU_PGD_TABLE_SIZE, SRMMU_PGD_TABLE_SIZE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 324 memset(__nocache_fix(srmmu_swapper_pg_dir), 0, SRMMU_PGD_TABLE_SIZE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 325 init_mm.pgd = srmmu_swapper_pg_dir;
^1da177e4c3f41 Linus Torvalds 2005-04-16 326
^1da177e4c3f41 Linus Torvalds 2005-04-16 327 srmmu_early_allocate_ptable_skeleton(SRMMU_NOCACHE_VADDR, srmmu_nocache_end);
^1da177e4c3f41 Linus Torvalds 2005-04-16 328
^1da177e4c3f41 Linus Torvalds 2005-04-16 329 paddr = __pa((unsigned long)srmmu_nocache_pool);
^1da177e4c3f41 Linus Torvalds 2005-04-16 330 vaddr = SRMMU_NOCACHE_VADDR;
^1da177e4c3f41 Linus Torvalds 2005-04-16 331
^1da177e4c3f41 Linus Torvalds 2005-04-16 332 while (vaddr < srmmu_nocache_end) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 333 pgd = pgd_offset_k(vaddr);
7235db268a2777 Mike Rapoport 2019-12-04 334 p4d = p4d_offset(__nocache_fix(pgd), vaddr);
7235db268a2777 Mike Rapoport 2019-12-04 335 pud = pud_offset(__nocache_fix(p4d), vaddr);
9701b264d3267b Sam Ravnborg 2012-05-13 336 pmd = pmd_offset(__nocache_fix(pgd), vaddr);
9701b264d3267b Sam Ravnborg 2012-05-13 337 pte = pte_offset_kernel(__nocache_fix(pmd), vaddr);
^1da177e4c3f41 Linus Torvalds 2005-04-16 338
^1da177e4c3f41 Linus Torvalds 2005-04-16 339 pteval = ((paddr >> 4) | SRMMU_ET_PTE | SRMMU_PRIV);
^1da177e4c3f41 Linus Torvalds 2005-04-16 340
^1da177e4c3f41 Linus Torvalds 2005-04-16 341 if (srmmu_cache_pagetables)
^1da177e4c3f41 Linus Torvalds 2005-04-16 342 pteval |= SRMMU_CACHE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 343
62875cff73fbb7 David S. Miller 2012-05-12 344 set_pte(__nocache_fix(pte), __pte(pteval));
^1da177e4c3f41 Linus Torvalds 2005-04-16 345
^1da177e4c3f41 Linus Torvalds 2005-04-16 346 vaddr += PAGE_SIZE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 347 paddr += PAGE_SIZE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 348 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 349
^1da177e4c3f41 Linus Torvalds 2005-04-16 350 flush_cache_all();
^1da177e4c3f41 Linus Torvalds 2005-04-16 351 flush_tlb_all();
^1da177e4c3f41 Linus Torvalds 2005-04-16 352 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 353
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
On Wed, May 20, 2020 at 08:57:33AM +0800, kbuild test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 642b151f45dd54809ea00ecd3976a56c1ec9b53d
> commit: 7235db268a2777bc380b99b7db49ff7b19c8fb76 sparc32: use pgtable-nopud instead of 4level-fixup
> config: sparc-defconfig (attached as .config)
> compiler: sparc-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 7235db268a2777bc380b99b7db49ff7b19c8fb76
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <[email protected]>
>
> All errors (new ones prefixed by >>, old ones prefixed by <<):
>
> arch/sparc/mm/srmmu.c: In function 'srmmu_nocache_init':
> >> arch/sparc/mm/srmmu.c:300:9: error: variable 'pud' set but not used [-Werror=unused-but-set-variable]
> 300 | pud_t *pud;
> | ^~~
Here's the fix vs v5.7-rc6-mmots-2020-05-19-21-52:
From 192848144e61e3ebacd34598386e4fa773d19ae9 Mon Sep 17 00:00:00 2001
From: Mike Rapoport <[email protected]>
Date: Wed, 20 May 2020 15:39:22 +0300
Subject: [PATCH] sparc32: use PUD rather than PGD to get PMD in
srmmu_nocache_init()
The kbuild test robot reported the following warning:
arch/sparc/mm/srmmu.c: In function 'srmmu_nocache_init':
>> arch/sparc/mm/srmmu.c:300:9: error: variable 'pud' set but not used
>> [-Werror=unused-but-set-variable]
300 | pud_t *pud;
This warning is caused by misprint in the page table traversal in
srmmu_nocache_init() function which accessed a PMD entry using PGD rather
than PUD.
Since sparc32 has only 3 page table levels, the PGD and PUD are essentially
the same and usage of __nocache_fix() removed the type checking.
Use PUD for the consistency and to silence the compiler warning.
Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Mike Rapoport <[email protected]>
---
arch/sparc/mm/srmmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index 6cb1ea2d2b5c..75b56bdd38ef 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -304,7 +304,7 @@ static void __init srmmu_nocache_init(void)
pgd = pgd_offset_k(vaddr);
p4d = p4d_offset(__nocache_fix(pgd), vaddr);
pud = pud_offset(__nocache_fix(p4d), vaddr);
- pmd = pmd_offset(__nocache_fix(pgd), vaddr);
+ pmd = pmd_offset(__nocache_fix(pud), vaddr);
pte = pte_offset_kernel(__nocache_fix(pmd), vaddr);
pteval = ((paddr >> 4) | SRMMU_ET_PTE | SRMMU_PRIV);
--
2.26.2
On Wed, 20 May 2020 16:20:05 +0300 Mike Rapoport <[email protected]> wrote:
> The kbuild test robot reported the following warning:
>
> arch/sparc/mm/srmmu.c: In function 'srmmu_nocache_init':
> >> arch/sparc/mm/srmmu.c:300:9: error: variable 'pud' set but not used
> >> [-Werror=unused-but-set-variable]
> 300 | pud_t *pud;
>
> This warning is caused by misprint in the page table traversal in
> srmmu_nocache_init() function which accessed a PMD entry using PGD rather
> than PUD.
> Since sparc32 has only 3 page table levels, the PGD and PUD are essentially
> the same and usage of __nocache_fix() removed the type checking.
>
> Use PUD for the consistency and to silence the compiler warning.
>
> ...
>
> --- a/arch/sparc/mm/srmmu.c
> +++ b/arch/sparc/mm/srmmu.c
> @@ -304,7 +304,7 @@ static void __init srmmu_nocache_init(void)
> pgd = pgd_offset_k(vaddr);
> p4d = p4d_offset(__nocache_fix(pgd), vaddr);
> pud = pud_offset(__nocache_fix(p4d), vaddr);
> - pmd = pmd_offset(__nocache_fix(pgd), vaddr);
> + pmd = pmd_offset(__nocache_fix(pud), vaddr);
> pte = pte_offset_kernel(__nocache_fix(pmd), vaddr);
>
> pteval = ((paddr >> 4) | SRMMU_ET_PTE | SRMMU_PRIV);
I added
Fixes: 7235db268a2777bc38 ("sparc32: use pgtable-nopud instead of 4level-fixup")
and, after a bit of thought,
Cc: <[email protected]>
Because that's a fairly scary-looking warning.