Re: [PATCH] x86/mm/64: Rename the register_page_bootmem_memmap() 'size' parameter to 'nr_pages'

From: Baoquan He
Date: Fri Oct 27 2017 - 19:45:28 EST


Hi,

On 10/27/17 at 11:51pm, kbuild test robot wrote:
> Hi Ingo,
>
> Thank you for the patch! Yet we hit a small issue.
> [auto build test ERROR on tip/x86/core]
> [also build test ERROR on v4.14-rc6 next-20171018]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Ingo-Molnar/x86-mm-64-Rename-the-register_page_bootmem_memmap-size-parameter-to-nr_pages/20171027-181456
> config: x86_64-kexec (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64
>
> All errors (new ones prefixed by >>):
>
> arch/x86/mm/init_64.c: In function 'register_page_bootmem_memmap':
> >> arch/x86/mm/init_64.c:1341:15: error: 'nr_pages' redeclared as different kind of symbol
> unsigned int nr_pages;
> ^~~~~~~~
> arch/x86/mm/init_64.c:1332:46: note: previous definition of 'nr_pages' was here
> struct page *start_page, unsigned long nr_pages)
> ^~~~~~~~
The code change is incomplete in this thread, Ingo helped rewrite the
patch log in the suggested patch. I catched this error too when rebuilt,
will post v3. Please drop this one.

Thanks
Baoquan

>
> vim +/nr_pages +1341 arch/x86/mm/init_64.c
>
> c2b91e2ee Yinghai Lu 2008-04-12 1329
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1330 #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HAVE_BOOTMEM_INFO_NODE)
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1331 void register_page_bootmem_memmap(unsigned long section_nr,
> 56f1692b6 Ingo Molnar 2017-10-24 1332 struct page *start_page, unsigned long nr_pages)
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1333 {
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1334 unsigned long addr = (unsigned long)start_page;
> 56f1692b6 Ingo Molnar 2017-10-24 1335 unsigned long end = (unsigned long)(start_page + nr_pages);
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1336 unsigned long next;
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1337 pgd_t *pgd;
> f2a6a7050 Kirill A. Shutemov 2017-03-17 1338 p4d_t *p4d;
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1339 pud_t *pud;
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1340 pmd_t *pmd;
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 @1341 unsigned int nr_pages;
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1342 struct page *page;
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1343
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1344 for (; addr < end; addr = next) {
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1345 pte_t *pte = NULL;
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1346
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1347 pgd = pgd_offset_k(addr);
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1348 if (pgd_none(*pgd)) {
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1349 next = (addr + PAGE_SIZE) & PAGE_MASK;
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1350 continue;
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1351 }
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1352 get_page_bootmem(section_nr, pgd_page(*pgd), MIX_SECTION_INFO);
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1353
> f2a6a7050 Kirill A. Shutemov 2017-03-17 1354 p4d = p4d_offset(pgd, addr);
> f2a6a7050 Kirill A. Shutemov 2017-03-17 1355 if (p4d_none(*p4d)) {
> f2a6a7050 Kirill A. Shutemov 2017-03-17 1356 next = (addr + PAGE_SIZE) & PAGE_MASK;
> f2a6a7050 Kirill A. Shutemov 2017-03-17 1357 continue;
> f2a6a7050 Kirill A. Shutemov 2017-03-17 1358 }
> f2a6a7050 Kirill A. Shutemov 2017-03-17 1359 get_page_bootmem(section_nr, p4d_page(*p4d), MIX_SECTION_INFO);
> f2a6a7050 Kirill A. Shutemov 2017-03-17 1360
> f2a6a7050 Kirill A. Shutemov 2017-03-17 1361 pud = pud_offset(p4d, addr);
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1362 if (pud_none(*pud)) {
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1363 next = (addr + PAGE_SIZE) & PAGE_MASK;
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1364 continue;
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1365 }
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1366 get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO);
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1367
> 16bf92261 Borislav Petkov 2016-03-29 1368 if (!boot_cpu_has(X86_FEATURE_PSE)) {
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1369 next = (addr + PAGE_SIZE) & PAGE_MASK;
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1370 pmd = pmd_offset(pud, addr);
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1371 if (pmd_none(*pmd))
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1372 continue;
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1373 get_page_bootmem(section_nr, pmd_page(*pmd),
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1374 MIX_SECTION_INFO);
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1375
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1376 pte = pte_offset_kernel(pmd, addr);
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1377 if (pte_none(*pte))
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1378 continue;
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1379 get_page_bootmem(section_nr, pte_page(*pte),
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1380 SECTION_INFO);
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1381 } else {
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1382 next = pmd_addr_end(addr, end);
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1383
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1384 pmd = pmd_offset(pud, addr);
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1385 if (pmd_none(*pmd))
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1386 continue;
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1387
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1388 nr_pages = 1 << (get_order(PMD_SIZE));
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1389 page = pmd_page(*pmd);
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1390 while (nr_pages--)
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1391 get_page_bootmem(section_nr, page++,
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1392 SECTION_INFO);
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1393 }
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1394 }
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1395 }
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1396 #endif
> 46723bfa5 Yasuaki Ishimatsu 2013-02-22 1397
>
> :::::: The code at line 1341 was first introduced by commit
> :::::: 46723bfa540f0a1e494476a1734d03626a0bd1e0 memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap
>
> :::::: TO: Yasuaki Ishimatsu <isimatu.yasuaki@xxxxxxxxxxxxxx>
> :::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation