Re: [v3 PATCH 4/6] arm64: mm: support large block mapping when rodata=full

From: kernel test robot
Date: Fri Mar 07 2025 - 20:53:23 EST


Hi Yang,

kernel test robot noticed the following build warnings:

[auto build test WARNING on arm64/for-next/core]
[also build test WARNING on linus/master v6.14-rc5 next-20250307]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Yang-Shi/arm64-Add-BBM-Level-2-cpu-feature/20250305-062252
base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
patch link: https://lore.kernel.org/r/20250304222018.615808-5-yang%40os.amperecomputing.com
patch subject: [v3 PATCH 4/6] arm64: mm: support large block mapping when rodata=full
config: arm64-randconfig-002-20250308 (https://download.01.org/0day-ci/archive/20250308/202503080930.7ZetfmFz-lkp@xxxxxxxxx/config)
compiler: aarch64-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250308/202503080930.7ZetfmFz-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503080930.7ZetfmFz-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

arch/arm64/mm/mmu.c: In function 'alloc_init_pud':
>> arch/arm64/mm/mmu.c:511:35: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
511 | pud_clear_fixmap();
| ^
arch/arm64/mm/mmu.c: In function 'alloc_init_p4d':
arch/arm64/mm/mmu.c:570:35: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
570 | p4d_clear_fixmap();
| ^


vim +/if +511 arch/arm64/mm/mmu.c

d27cfa1fc823d3 Ard Biesheuvel 2017-03-09 428
2451145c9a60e0 Yang Shi 2025-03-04 429 static int alloc_init_pud(p4d_t *p4dp, unsigned long addr, unsigned long end,
da141706aea52c Laura Abbott 2015-01-21 430 phys_addr_t phys, pgprot_t prot,
90292aca9854a2 Yu Zhao 2019-03-11 431 phys_addr_t (*pgtable_alloc)(int),
c0951366d4b7e0 Ard Biesheuvel 2017-03-09 432 int flags)
c1cc1552616d0f Catalin Marinas 2012-03-05 433 {
c1cc1552616d0f Catalin Marinas 2012-03-05 434 unsigned long next;
2451145c9a60e0 Yang Shi 2025-03-04 435 int ret = 0;
e9f6376858b979 Mike Rapoport 2020-06-04 436 p4d_t p4d = READ_ONCE(*p4dp);
6ed8a3a094b43a Ard Biesheuvel 2024-02-14 437 pud_t *pudp;
6fad683b9a5c21 Yang Shi 2025-03-04 438 bool split = flags & SPLIT_MAPPINGS;
6fad683b9a5c21 Yang Shi 2025-03-04 439
6fad683b9a5c21 Yang Shi 2025-03-04 440 if (split) {
6fad683b9a5c21 Yang Shi 2025-03-04 441 BUG_ON(p4d_none(p4d));
6fad683b9a5c21 Yang Shi 2025-03-04 442 pudp = pud_offset(p4dp, addr);
6fad683b9a5c21 Yang Shi 2025-03-04 443 goto split_pgtable;
6fad683b9a5c21 Yang Shi 2025-03-04 444 }
c1cc1552616d0f Catalin Marinas 2012-03-05 445
e9f6376858b979 Mike Rapoport 2020-06-04 446 if (p4d_none(p4d)) {
efe72541355d4d Yicong Yang 2024-11-02 447 p4dval_t p4dval = P4D_TYPE_TABLE | P4D_TABLE_UXN | P4D_TABLE_AF;
132233a759580f Laura Abbott 2016-02-05 448 phys_addr_t pud_phys;
87143f404f338d Ard Biesheuvel 2021-03-10 449
87143f404f338d Ard Biesheuvel 2021-03-10 450 if (flags & NO_EXEC_MAPPINGS)
87143f404f338d Ard Biesheuvel 2021-03-10 451 p4dval |= P4D_TABLE_PXN;
132233a759580f Laura Abbott 2016-02-05 452 BUG_ON(!pgtable_alloc);
90292aca9854a2 Yu Zhao 2019-03-11 453 pud_phys = pgtable_alloc(PUD_SHIFT);
2451145c9a60e0 Yang Shi 2025-03-04 454 if (!pud_phys)
2451145c9a60e0 Yang Shi 2025-03-04 455 return -ENOMEM;
0e9df1c905d829 Ryan Roberts 2024-04-12 456 pudp = pud_set_fixmap(pud_phys);
0e9df1c905d829 Ryan Roberts 2024-04-12 457 init_clear_pgtable(pudp);
0e9df1c905d829 Ryan Roberts 2024-04-12 458 pudp += pud_index(addr);
87143f404f338d Ard Biesheuvel 2021-03-10 459 __p4d_populate(p4dp, pud_phys, p4dval);
0e9df1c905d829 Ryan Roberts 2024-04-12 460 } else {
e9f6376858b979 Mike Rapoport 2020-06-04 461 BUG_ON(p4d_bad(p4d));
e9f6376858b979 Mike Rapoport 2020-06-04 462 pudp = pud_set_fixmap_offset(p4dp, addr);
0e9df1c905d829 Ryan Roberts 2024-04-12 463 }
0e9df1c905d829 Ryan Roberts 2024-04-12 464
6fad683b9a5c21 Yang Shi 2025-03-04 465 split_pgtable:
c1cc1552616d0f Catalin Marinas 2012-03-05 466 do {
20a004e7b017cc Will Deacon 2018-02-15 467 pud_t old_pud = READ_ONCE(*pudp);
e98216b52176ba Ard Biesheuvel 2016-10-21 468
c1cc1552616d0f Catalin Marinas 2012-03-05 469 next = pud_addr_end(addr, end);
206a2a73a62d37 Steve Capper 2014-05-06 470
6fad683b9a5c21 Yang Shi 2025-03-04 471 if (split) {
6fad683b9a5c21 Yang Shi 2025-03-04 472 ret = split_pud(pudp, old_pud, pgtable_alloc);
6fad683b9a5c21 Yang Shi 2025-03-04 473 if (ret)
6fad683b9a5c21 Yang Shi 2025-03-04 474 break;
6fad683b9a5c21 Yang Shi 2025-03-04 475
6fad683b9a5c21 Yang Shi 2025-03-04 476 ret = alloc_init_cont_pmd(pudp, addr, next, phys, prot,
6fad683b9a5c21 Yang Shi 2025-03-04 477 pgtable_alloc, flags);
6fad683b9a5c21 Yang Shi 2025-03-04 478 if (ret)
6fad683b9a5c21 Yang Shi 2025-03-04 479 break;
6fad683b9a5c21 Yang Shi 2025-03-04 480
6fad683b9a5c21 Yang Shi 2025-03-04 481 continue;
6fad683b9a5c21 Yang Shi 2025-03-04 482 }
6fad683b9a5c21 Yang Shi 2025-03-04 483
206a2a73a62d37 Steve Capper 2014-05-06 484 /*
206a2a73a62d37 Steve Capper 2014-05-06 485 * For 4K granule only, attempt to put down a 1GB block
206a2a73a62d37 Steve Capper 2014-05-06 486 */
1310222c276b79 Anshuman Khandual 2022-02-16 487 if (pud_sect_supported() &&
1310222c276b79 Anshuman Khandual 2022-02-16 488 ((addr | next | phys) & ~PUD_MASK) == 0 &&
c0951366d4b7e0 Ard Biesheuvel 2017-03-09 489 (flags & NO_BLOCK_MAPPINGS) == 0) {
20a004e7b017cc Will Deacon 2018-02-15 490 pud_set_huge(pudp, phys, prot);
206a2a73a62d37 Steve Capper 2014-05-06 491
206a2a73a62d37 Steve Capper 2014-05-06 492 /*
e98216b52176ba Ard Biesheuvel 2016-10-21 493 * After the PUD entry has been populated once, we
e98216b52176ba Ard Biesheuvel 2016-10-21 494 * only allow updates to the permission attributes.
206a2a73a62d37 Steve Capper 2014-05-06 495 */
e98216b52176ba Ard Biesheuvel 2016-10-21 496 BUG_ON(!pgattr_change_is_safe(pud_val(old_pud),
20a004e7b017cc Will Deacon 2018-02-15 497 READ_ONCE(pud_val(*pudp))));
206a2a73a62d37 Steve Capper 2014-05-06 498 } else {
2451145c9a60e0 Yang Shi 2025-03-04 499 ret = alloc_init_cont_pmd(pudp, addr, next, phys, prot,
c0951366d4b7e0 Ard Biesheuvel 2017-03-09 500 pgtable_alloc, flags);
2451145c9a60e0 Yang Shi 2025-03-04 501 if (ret)
2451145c9a60e0 Yang Shi 2025-03-04 502 break;
e98216b52176ba Ard Biesheuvel 2016-10-21 503
e98216b52176ba Ard Biesheuvel 2016-10-21 504 BUG_ON(pud_val(old_pud) != 0 &&
20a004e7b017cc Will Deacon 2018-02-15 505 pud_val(old_pud) != READ_ONCE(pud_val(*pudp)));
206a2a73a62d37 Steve Capper 2014-05-06 506 }
c1cc1552616d0f Catalin Marinas 2012-03-05 507 phys += next - addr;
20a004e7b017cc Will Deacon 2018-02-15 508 } while (pudp++, addr = next, addr != end);
f4710445458c0a Mark Rutland 2016-01-25 509
6fad683b9a5c21 Yang Shi 2025-03-04 510 if (!split)
f4710445458c0a Mark Rutland 2016-01-25 @511 pud_clear_fixmap();
2451145c9a60e0 Yang Shi 2025-03-04 512
2451145c9a60e0 Yang Shi 2025-03-04 513 return ret;
c1cc1552616d0f Catalin Marinas 2012-03-05 514 }
c1cc1552616d0f Catalin Marinas 2012-03-05 515

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki