[davidhildenbrand:unshare_new 2/4] include/linux/mm.h:1384:31: error: implicit declaration of function 'PageAnonUnshared'

From: kernel test robot
Date: Mon Dec 20 2021 - 23:00:32 EST


tree: git://github.com/davidhildenbrand/linux unshare_new
head: 0b0d58f51fe2675e4dcfb11263ad4cbec053711f
commit: a37ffb6fd951d770096d5612e00da380d4b3a286 [2/4] mm: support GUP-triggered unsharing via FAULT_FLAG_UNSHARE (!hugetlb)
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20211221/202112211111.sq7Cb8GK-lkp@xxxxxxxxx/config)
compiler: mips-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/davidhildenbrand/linux/commit/a37ffb6fd951d770096d5612e00da380d4b3a286
git remote add davidhildenbrand git://github.com/davidhildenbrand/linux
git fetch --no-tags davidhildenbrand unshare_new
git checkout a37ffb6fd951d770096d5612e00da380d4b3a286
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips prepare

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

All errors (new ones prefixed by >>):

In file included from arch/mips/kernel/asm-offsets.c:15:
include/linux/mm.h: In function 'page_needs_cow_for_dma':
>> include/linux/mm.h:1384:31: error: implicit declaration of function 'PageAnonUnshared' [-Werror=implicit-function-declaration]
1384 | if (PageAnon(page) && PageAnonUnshared(page)) {
| ^~~~~~~~~~~~~~~~
>> include/linux/mm.h:1386:25: error: implicit declaration of function 'ClearPageAnonUnshared' [-Werror=implicit-function-declaration]
1386 | ClearPageAnonUnshared(page);
| ^~~~~~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c: At top level:
arch/mips/kernel/asm-offsets.c:26:6: warning: no previous prototype for 'output_ptreg_defines' [-Wmissing-prototypes]
26 | void output_ptreg_defines(void)
| ^~~~~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:78:6: warning: no previous prototype for 'output_task_defines' [-Wmissing-prototypes]
78 | void output_task_defines(void)
| ^~~~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:92:6: warning: no previous prototype for 'output_thread_info_defines' [-Wmissing-prototypes]
92 | void output_thread_info_defines(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:108:6: warning: no previous prototype for 'output_thread_defines' [-Wmissing-prototypes]
108 | void output_thread_defines(void)
| ^~~~~~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:136:6: warning: no previous prototype for 'output_thread_fpu_defines' [-Wmissing-prototypes]
136 | void output_thread_fpu_defines(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:179:6: warning: no previous prototype for 'output_mm_defines' [-Wmissing-prototypes]
179 | void output_mm_defines(void)
| ^~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:218:6: warning: no previous prototype for 'output_sc_defines' [-Wmissing-prototypes]
218 | void output_sc_defines(void)
| ^~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:253:6: warning: no previous prototype for 'output_signal_defined' [-Wmissing-prototypes]
253 | void output_signal_defined(void)
| ^~~~~~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:320:6: warning: no previous prototype for 'output_pbe_defines' [-Wmissing-prototypes]
320 | void output_pbe_defines(void)
| ^~~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:332:6: warning: no previous prototype for 'output_pm_defines' [-Wmissing-prototypes]
332 | void output_pm_defines(void)
| ^~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:346:6: warning: no previous prototype for 'output_kvm_defines' [-Wmissing-prototypes]
346 | void output_kvm_defines(void)
| ^~~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:390:6: warning: no previous prototype for 'output_cps_defines' [-Wmissing-prototypes]
390 | void output_cps_defines(void)
| ^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:121: arch/mips/kernel/asm-offsets.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1197: prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:219: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.


vim +/PageAnonUnshared +1384 include/linux/mm.h

1355
1356 /*
1357 * This should most likely only be called during fork() to see whether we
1358 * should break the cow immediately for a page on the src mm.
1359 */
1360 static inline bool page_needs_cow_for_dma(struct vm_area_struct *vma,
1361 struct page *page)
1362 {
1363 if (!is_cow_mapping(vma->vm_flags))
1364 return false;
1365
1366 /*
1367 * If an anon page is markes as "unshared" we must not share it with
1368 * our child, ever. Try to unshare: unsharing is only possible if there
1369 * are no additional references on the page. Users that care about
1370 * unsharing to take R/O references that are consitent with the MM
1371 * (i.e., GUP) have to synchronize against fork() to detect
1372 * concurrent unsharing, back off, and trigger unsharing again.
1373 *
1374 * For ordinary GUP, this is synchronized via the mmap_lock. For
1375 * gup-fast, this is synchronized via the mm->write_protect_seq of
1376 * the parent.
1377 *
1378 * Notes:
1379 * 1) This covers the DMA pinned case below for anonymous pages, just
1380 * the way pinning also increases the page_count() of the page.
1381 * 2) This also covers references on the page that are not due to
1382 * page pinning.
1383 */
> 1384 if (PageAnon(page) && PageAnonUnshared(page)) {
1385 if (page_count(page) == 1) {
> 1386 ClearPageAnonUnshared(page);
1387 return false;
1388 }
1389 return true;
1390 }
1391
1392 if (!test_bit(MMF_HAS_PINNED, &vma->vm_mm->flags))
1393 return false;
1394
1395 return page_maybe_dma_pinned(page);
1396 }
1397

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