Re: [PATCH v1] mm, pagemap: expose hwpoison entry

From: kernel test robot
Date: Mon Oct 04 2021 - 22:54:30 EST


Hi Naoya,

I love your patch! Perhaps something to improve:

[auto build test WARNING on hnaz-mm/master]

url: https://github.com/0day-ci/linux/commits/Naoya-Horiguchi/mm-pagemap-expose-hwpoison-entry/20211004-195200
base: https://github.com/hnaz/linux-mm master
config: ia64-defconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/f1735ae85d981e413e70ff0041fcb7f775525699
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Naoya-Horiguchi/mm-pagemap-expose-hwpoison-entry/20211004-195200
git checkout f1735ae85d981e413e70ff0041fcb7f775525699
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=ia64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

fs/proc/task_mmu.c: In function 'pagemap_hugetlb_range':
>> fs/proc/task_mmu.c:1558:20: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
1558 | if (pm->show_pfn)
| ^


vim +/else +1558 fs/proc/task_mmu.c

1505
1506 #ifdef CONFIG_HUGETLB_PAGE
1507 /* This function walks within one hugetlb entry in the single call */
1508 static int pagemap_hugetlb_range(pte_t *ptep, unsigned long hmask,
1509 unsigned long addr, unsigned long end,
1510 struct mm_walk *walk)
1511 {
1512 struct pagemapread *pm = walk->private;
1513 struct vm_area_struct *vma = walk->vma;
1514 u64 flags = 0, frame = 0;
1515 int err = 0;
1516 pte_t pte;
1517 struct page *page = NULL;
1518
1519 if (vma->vm_flags & VM_SOFTDIRTY)
1520 flags |= PM_SOFT_DIRTY;
1521
1522 pte = huge_ptep_get(ptep);
1523 if (pte_present(pte)) {
1524 page = pte_page(pte);
1525
1526 flags |= PM_PRESENT;
1527 if (pm->show_pfn)
1528 frame = pte_pfn(pte) +
1529 ((addr & ~hmask) >> PAGE_SHIFT);
1530 } else if (is_swap_pte(pte)) {
1531 swp_entry_t entry = pte_to_swp_entry(pte);
1532 unsigned long offset;
1533
1534 if (pm->show_pfn) {
1535 offset = swp_offset(entry) +
1536 ((addr & ~hmask) >> PAGE_SHIFT);
1537 frame = swp_type(entry) |
1538 (offset << MAX_SWAPFILES_SHIFT);
1539 }
1540 flags |= PM_SWAP;
1541 if (is_migration_entry(entry))
1542 page = compound_head(pfn_swap_entry_to_page(entry));
1543 if (is_hwpoison_entry(entry))
1544 flags |= PM_HWPOISON;
1545 }
1546
1547 if (page && !PageAnon(page))
1548 flags |= PM_FILE;
1549 if (page && page_mapcount(page) == 1)
1550 flags |= PM_MMAP_EXCLUSIVE;
1551
1552 for (; addr != end; addr += PAGE_SIZE) {
1553 pagemap_entry_t pme = make_pme(frame, flags);
1554
1555 err = add_to_pagemap(addr, &pme, pm);
1556 if (err)
1557 return err;
> 1558 if (pm->show_pfn)
1559 if (flags & PM_PRESENT)
1560 frame++;
1561 else if (flags & PM_SWAP)
1562 frame += (1 << MAX_SWAPFILES_SHIFT);
1563 }
1564
1565 cond_resched();
1566
1567 return err;
1568 }
1569 #else
1570 #define pagemap_hugetlb_range NULL
1571 #endif /* HUGETLB_PAGE */
1572

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

Attachment: .config.gz
Description: application/gzip