All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: David Hildenbrand <david@redhat.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [davidhildenbrand:migrate_misplaced 3/11] mm/pagewalk.c:891:7: error: implicit declaration of function 'is_pmd_migration_entry'; did you mean 'list_first_entry'?
Date: Fri, 21 Jun 2024 05:52:22 +0800	[thread overview]
Message-ID: <202406210822.KcNY87FE-lkp@intel.com> (raw)

tree:   https://github.com/davidhildenbrand/linux migrate_misplaced
head:   1cdf378b2096345dcb6cddabd16a16fb93bb6299
commit: 57e15cac22902c7324d90c148cdb109b9d2ff362 [3/11] mm/pagewalk: introduce folio_walk_start() + folio_walk_end()
config: i386-buildonly-randconfig-002-20240621 (https://download.01.org/0day-ci/archive/20240621/202406210822.KcNY87FE-lkp@intel.com/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240621/202406210822.KcNY87FE-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406210822.KcNY87FE-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   mm/pagewalk.c: In function 'folio_walk_start':
>> mm/pagewalk.c:891:7: error: implicit declaration of function 'is_pmd_migration_entry'; did you mean 'list_first_entry'? [-Werror=implicit-function-declaration]
          is_pmd_migration_entry(*pmd)) {
          ^~~~~~~~~~~~~~~~~~~~~~
          list_first_entry
>> mm/pagewalk.c:892:24: error: implicit declaration of function 'pmd_to_swp_entry'; did you mean '__pte_to_swp_entry'? [-Werror=implicit-function-declaration]
       swp_entry_t entry = pmd_to_swp_entry(*pmd);
                           ^~~~~~~~~~~~~~~~
                           __pte_to_swp_entry
>> mm/pagewalk.c:892:24: error: invalid initializer
>> mm/pagewalk.c:894:11: error: implicit declaration of function 'pfn_swap_entry_to_page'; did you mean '__swp_entry_to_pte'? [-Werror=implicit-function-declaration]
       page = pfn_swap_entry_to_page(entry);
              ^~~~~~~~~~~~~~~~~~~~~~
              __swp_entry_to_pte
>> mm/pagewalk.c:894:9: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
       page = pfn_swap_entry_to_page(entry);
            ^
>> mm/pagewalk.c:922:23: error: implicit declaration of function 'pte_to_swp_entry'; did you mean '__pte_to_swp_entry'? [-Werror=implicit-function-declaration]
      swp_entry_t entry = pte_to_swp_entry(ptent);
                          ^~~~~~~~~~~~~~~~
                          __pte_to_swp_entry
   mm/pagewalk.c:922:23: error: invalid initializer
>> mm/pagewalk.c:925:7: error: implicit declaration of function 'is_migration_entry'; did you mean 'list_first_entry'? [-Werror=implicit-function-declaration]
          is_migration_entry(entry)) {
          ^~~~~~~~~~~~~~~~~~
          list_first_entry
   mm/pagewalk.c:926:9: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
       page = pfn_swap_entry_to_page(entry);
            ^
   cc1: some warnings being treated as errors


vim +891 mm/pagewalk.c

   767	
   768	/*
   769	 * folio_walk_start - walk the page tables to a folio
   770	 * @vma: the VMA.
   771	 * @addr: the virtual address to use for the page table walk.
   772	 * @fw: filled with information on success.
   773	 *
   774	 * Walk the page tables and lookup a mapped folio.
   775	 *
   776	 * As default, returns only folios that are not special (e.g., not the
   777	 * zeropage) and never returns folios that are supposed to be ignored by the
   778	 * VM (e.g., VM_PFNMAP, weird devmap stuff) -- see vm_normal_page(). If
   779	 * requested, zeropages will be returned as well.
   780	 *
   781	 * As default, this function only considers present page table entries.
   782	 * If requested, it will also consider migration entries, but one has to
   783	 * be a bit careful, especially with large folios that might get concurrently
   784	 * split.
   785	 *
   786	 * Other entries are ignored and result in -ENOENT. Similarly if no suitable
   787	 * folio is mapped (e.g., zeropage without FW_ZEROPAGE), -ENOENT is returned.
   788	 * That is, -ENOENT might either indicate "there is nothing" or "there is
   789	 * nothing applicable we can return".
   790	 *
   791	 * On success, @fw is filled and the function returns the folio while the PTL
   792	 * is still held and folio_walk_end() must be called to clean up, like
   793	 * releasing any held locks. The returned folio must *not* be used after the
   794	 * call to folio_walk_end(), unless a short-term folio reference is taken before
   795	 * that call. Note that the folio may get unmapped immediately after calling
   796	 * folio_walk_end().
   797	 *
   798	 * This function must *not* be used as a naive replacement for
   799	 * get_user_pages() / pin_user_pages(), especially not to perform DMA or
   800	 * carelessly modify page content. This function may *only* be used to grab
   801	 * short-term folio references, never to grab long-term folio references.
   802	 *
   803	 * Using the page table entry pointers in @fw for reading or modifying the
   804	 * entry should be avoided where possible: however, for the purpose of
   805	 * temporarily clearing the entry or setting/clearing access/dirty bits,
   806	 * there might be valid use cases.
   807	 *
   808	 * The mmap lock must be held in read mode.
   809	 *
   810	 * Return: folio pointer on success. -ENOENT if no suitable folio was found and
   811	 * -EAGAIN on invalid inputs. Never returns 0.
   812	 */
   813	struct folio *folio_walk_start(struct vm_area_struct *vma, unsigned long addr,
   814			struct folio_walk *fw, folio_walk_flags_t flags)
   815	{
   816		enum folio_walk_level level;
   817		pte_t *pte = NULL, ptent;
   818		unsigned long offset = 0;
   819		bool writable = false;
   820		struct page *page;
   821		spinlock_t *ptl;
   822		void *entryp;
   823		pgd_t *pgd;
   824		p4d_t *p4d;
   825		pud_t *pud;
   826		pmd_t *pmd;
   827	
   828		mmap_assert_locked(vma->vm_mm);
   829	
   830		if (addr < vma->vm_start || addr >= vma->vm_end)
   831			return ERR_PTR(-EINVAL);
   832	
   833		if (is_vm_hugetlb_page(vma))
   834			return folio_walk_start_hugetlb(vma, addr, fw, flags);
   835	
   836		pgd = pgd_offset(vma->vm_mm, addr);
   837		if (pgd_none_or_clear_bad(pgd))
   838			return ERR_PTR(-ENOENT);
   839		p4d = p4d_offset(pgd, addr);
   840		if (p4d_none_or_clear_bad(p4d))
   841			return ERR_PTR(-ENOENT);
   842		pud = pud_offset(p4d, addr);
   843		if (pud_none_or_clear_bad(pud))
   844			return ERR_PTR(-ENOENT);
   845		if (pud_leaf(*pud)) {
   846			ptl = pud_lock(vma->vm_mm, pud);
   847	
   848			/*
   849			 * We might have raced with split_huge_pud() that could have
   850			 * zapped the page table. Note that we currently never replace
   851			 * a PUD leaf by a filled page table like we do for anonymous
   852			 * THPs.
   853			 */
   854			if (!pud_present(*pud) || !pud_leaf(*pud) || pud_devmap(*pud)) {
   855				spin_unlock(ptl);
   856				return ERR_PTR(-ENOENT);
   857			}
   858	
   859			entryp = pud;
   860			level = FW_LEVEL_PUD;
   861			page = pud_page(*pud);
   862			offset = addr & (PUD_SIZE - 1);
   863			writable = pud_write(*pud);
   864			goto found;
   865		}
   866		pmd = pmd_offset(pud, addr);
   867		if (pmd_none(*pmd))
   868			return ERR_PTR(-ENOENT);
   869	
   870		ptl = pmd_trans_huge_lock(pmd, vma);
   871		if (ptl) {
   872			if (pmd_none(*pmd)) {
   873				spin_unlock(ptl);
   874				return ERR_PTR(-ENOENT);
   875			}
   876	
   877			entryp = pmd;
   878			level = FW_LEVEL_PMD;
   879			if (pmd_present(*pmd)) {
   880				offset = addr & (PMD_SIZE - 1);
   881				writable = pmd_write(*pmd);
   882				page = vm_normal_page_pmd(vma, addr, *pmd);
   883				if (page) {
   884					goto found;
   885				} else if ((flags & FW_ZEROPAGE) &&
   886					    is_huge_zero_pmd(*pmd)) {
   887					page = pfn_to_page(pmd_pfn(*pmd));
   888					goto found;
   889				}
   890			} else if ((flags & FW_MIGRATION_ENTRIES) &&
 > 891				   is_pmd_migration_entry(*pmd)) {
 > 892				swp_entry_t entry = pmd_to_swp_entry(*pmd);
   893	
 > 894				page = pfn_swap_entry_to_page(entry);
   895				if (page) {
   896					offset = addr & (PMD_SIZE - 1);
   897					goto found;
   898				}
   899			}
   900			spin_unlock(ptl);
   901			return ERR_PTR(-ENOENT);
   902		}
   903	
   904		pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
   905		if (!pte)
   906			return ERR_PTR(-ENOENT);
   907		entryp = pte;
   908		level = FW_LEVEL_PTE;
   909	
   910		ptent = ptep_get(pte);
   911		if (pte_present(ptent)) {
   912			page = vm_normal_page(vma, addr, ptent);
   913			writable = pte_write(ptent);
   914			if (page) {
   915				goto found;
   916			} else if ((flags & FW_ZEROPAGE) &&
   917				   is_zero_pfn(pte_pfn(ptent))) {
   918				page = pfn_to_page(pmd_pfn(*pmd));
   919				goto found;
   920			}
   921		} else if (!pte_none(ptent)) {
 > 922			swp_entry_t entry = pte_to_swp_entry(ptent);
   923	
   924			if ((flags & FW_MIGRATION_ENTRIES) &&
 > 925			    is_migration_entry(entry)) {
   926				page = pfn_swap_entry_to_page(entry);
   927				if (page) {
   928					offset = 0;
   929					goto found;
   930				}
   931			}
   932		}
   933		pte_unmap_unlock(pte, ptl);
   934		return ERR_PTR(-ENOENT);
   935	found:
   936		return fill_folio_walk(fw, page, offset, writable, vma, ptl, entryp,
   937				       level);
   938	}
   939	

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

                 reply	other threads:[~2024-06-20 21:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202406210822.KcNY87FE-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=david@redhat.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.