[davidhildenbrand:unshare_new 3/4] mm/gup.c:39:6: error: conflicting types for 'gup_must_unshare'

From: kernel test robot
Date: Tue Dec 21 2021 - 14:54:19 EST


tree: git://github.com/davidhildenbrand/linux unshare_new
head: 0b0d58f51fe2675e4dcfb11263ad4cbec053711f
commit: d3eb6d68346c3d9e89ae68461e0eabb5bc7def17 [3/4] mm: gup: trigger unsharing via FAULT_FLAG_UNSHARE when required (!hugetlb)
config: hexagon-randconfig-r045-20211220 (https://download.01.org/0day-ci/archive/20211222/202112220333.iWZqSzKw-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 555eacf75f21cd1dfc6363d73ad187b730349543)
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/d3eb6d68346c3d9e89ae68461e0eabb5bc7def17
git remote add davidhildenbrand git://github.com/davidhildenbrand/linux
git fetch --no-tags davidhildenbrand unshare_new
git checkout d3eb6d68346c3d9e89ae68461e0eabb5bc7def17
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash

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

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

In file included from mm/gup.c:7:
include/linux/mm.h:1384:24: error: implicit declaration of function 'PageAnonUnshared' [-Werror,-Wimplicit-function-declaration]
if (PageAnon(page) && PageAnonUnshared(page)) {
^
include/linux/mm.h:1386:4: error: implicit declaration of function 'ClearPageAnonUnshared' [-Werror,-Wimplicit-function-declaration]
ClearPageAnonUnshared(page);
^
include/linux/mm.h:1386:4: note: did you mean 'PageAnonUnshared'?
include/linux/mm.h:1384:24: note: 'PageAnonUnshared' declared here
if (PageAnon(page) && PageAnonUnshared(page)) {
^
>> mm/gup.c:39:6: error: conflicting types for 'gup_must_unshare'
bool gup_must_unshare(unsigned int flags, struct page *page)
^
include/linux/mm.h:3086:13: note: previous declaration is here
extern bool gup_must_unshare(unsigned int flags, struct page *page,
^
>> mm/gup.c:593:34: error: too few arguments to function call, expected 3, have 2
if (gup_must_unshare(flags, page)) {
~~~~~~~~~~~~~~~~ ^
include/linux/mm.h:3086:13: note: 'gup_must_unshare' declared here
extern bool gup_must_unshare(unsigned int flags, struct page *page,
^
>> mm/gup.c:595:7: error: implicit declaration of function 'mark_anon_page_exclusive' [-Werror,-Wimplicit-function-declaration]
if (mark_anon_page_exclusive(page, pte_write(pte))) {
^
5 errors generated.
--
In file included from mm/memory.c:43:
include/linux/mm.h:1384:24: error: implicit declaration of function 'PageAnonUnshared' [-Werror,-Wimplicit-function-declaration]
if (PageAnon(page) && PageAnonUnshared(page)) {
^
include/linux/mm.h:1386:4: error: implicit declaration of function 'ClearPageAnonUnshared' [-Werror,-Wimplicit-function-declaration]
ClearPageAnonUnshared(page);
^
include/linux/mm.h:1386:4: note: did you mean 'PageAnonUnshared'?
include/linux/mm.h:1384:24: note: 'PageAnonUnshared' declared here
if (PageAnon(page) && PageAnonUnshared(page)) {
^
mm/memory.c:3018:3: error: implicit declaration of function '__SetPageAnonUnshared' [-Werror,-Wimplicit-function-declaration]
__SetPageAnonUnshared(new_page);
^
mm/memory.c:3191:24: error: implicit declaration of function 'PageAnonUnshared' [-Werror,-Wimplicit-function-declaration]
if (PageKsm(page) || PageAnonUnshared(page))
^
mm/memory.c:3207:4: error: implicit declaration of function 'SetPageAnonUnshared' [-Werror,-Wimplicit-function-declaration]
SetPageAnonUnshared(page);
^
mm/memory.c:3207:4: note: did you mean 'PageAnonUnshared'?
include/linux/mm.h:1384:24: note: 'PageAnonUnshared' declared here
if (PageAnon(page) && PageAnonUnshared(page)) {
^
mm/memory.c:3215:10: error: implicit declaration of function 'wp_page_unshare' [-Werror,-Wimplicit-function-declaration]
return wp_page_unshare(vmf);
^
mm/memory.c:3215:10: note: did you mean 'do_wp_page_unshare'?
mm/memory.c:3177:19: note: 'do_wp_page_unshare' declared here
static vm_fault_t do_wp_page_unshare(struct vm_fault *vmf)
^
>> mm/memory.c:3247:3: error: implicit declaration of function 'SetPageExclusive' [-Werror,-Wimplicit-function-declaration]
SetPageExclusive(page);
^
mm/memory.c:3247:3: note: did you mean 'SetPageAnonExclusive'?
include/linux/page-flags.h:952:29: note: 'SetPageAnonExclusive' declared here
static __always_inline void SetPageAnonExclusive(struct page *page)
^
mm/memory.c:3255:3: error: implicit declaration of function 'SetPageExclusive' [-Werror,-Wimplicit-function-declaration]
SetPageExclusive(page);
^
>> mm/memory.c:3240:5: warning: no previous prototype for function 'mark_anon_page_exclusive' [-Wmissing-prototypes]
int mark_anon_page_exclusive(struct page *page, bool mapped_writable)
^
mm/memory.c:3240:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int mark_anon_page_exclusive(struct page *page, bool mapped_writable)
^
static
mm/memory.c:3376:29: error: use of undeclared identifier 'page'
return do_wp_page_unshare(page);
^
mm/memory.c:3415:7: error: implicit declaration of function 'PageAnonUnshared' [-Werror,-Wimplicit-function-declaration]
if (PageAnonUnshared(page))
^
mm/memory.c:4591:8: error: implicit declaration of function 'PageAnonUnshared' [-Werror,-Wimplicit-function-declaration]
if (PageAnonUnshared(page))
^
mm/memory.c:4591:25: error: use of undeclared identifier 'page'
if (PageAnonUnshared(page))
^
mm/memory.c:4593:19: error: use of undeclared identifier 'page'
if (page_count(page) == 1) {
^
mm/memory.c:4594:5: error: implicit declaration of function 'SetPageAnonUnshared' [-Werror,-Wimplicit-function-declaration]
SetPageAnonUnshared(page);
^
mm/memory.c:4594:25: error: use of undeclared identifier 'page'
SetPageAnonUnshared(page);
^
1 warning and 15 errors generated.


vim +/gup_must_unshare +39 mm/gup.c

31
32 /*
33 * Indicates for which pages we have to trigger unsharing first to make
34 * anonymous pages exclusive to the MM. Once exlusive, only fork() can
35 * turn the pages !exclusive -- and only if there are no additional references.
36 *
37 * This function is safe to be called in IRQ context.
38 */
> 39 bool gup_must_unshare(unsigned int flags, struct page *page)
40 {
41 if (flags & FOLL_NOUNSHARE)
42 return false;
43 else if (!(flags & FOLL_UNSHARE)) {
44 /*
45 * As a default, unshare only for FOLL_PIN. The corner cases
46 * that cannot use FOLL_PIN right now and have to use FOLL_GET
47 * (i.e., O_DIRECT), although they are reading/writing page
48 * content should manually set FOLL_UNSHARE with FOLL_GET.
49 */
50 if (!(flags & FOLL_PIN))
51 return false;
52 }
53 /*
54 * All of the following properties should be stable also during
55 * gup-fast-only, whereby we hold a reference to the compound page.
56 * (similarly to the page_is_secretmem() check) and require a proper
57 * sync on unmap from the page table to avoid use-after-free.
58 */
59 if (!PageAnon(page))
60 return false;
61 if (PageKsm(page))
62 return false;
63 if (PageHuge(page))
64 /* TODO: handle hugetlb as well. */
65 return false;
66 /*
67 * Without the mmap_lock, this can change during fork(). gup-fast-only
68 * is handled properly via the mm->write_protect_seq and undos the
69 * pinning in case we detect that fork() might have changed this.
70 */
71 return !PageAnonExclusive(page);
72 }
73

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