[rppt:pks/v0.0 25/27] mm/page_alloc.c:5529:23: error: implicit declaration of function 'set_memory_4k'; did you mean 'set_memory_nx'?

From: kernel test robot
Date: Thu Nov 04 2021 - 09:54:54 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git pks/v0.0
head: eed09ce6622d550ab5b10a86e7dd6c2ff6bd59d9
commit: 21323d5d53b8e2c647a52f87a36a9bd7ca9c3670 [25/27] mm/page_alloc: add MIGRATE_PTE_MAPPED and __GFP_PTE_MAPPED_2
config: arc-randconfig-r043-20211104 (attached as .config)
compiler: arc-elf-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://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git/commit/?id=21323d5d53b8e2c647a52f87a36a9bd7ca9c3670
git remote add rppt https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git
git fetch --no-tags rppt pks/v0.0
git checkout 21323d5d53b8e2c647a52f87a36a9bd7ca9c3670
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arc

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

All errors (new ones prefixed by >>):

mm/page_alloc.c:3931:15: warning: no previous prototype for 'should_fail_alloc_page' [-Wmissing-prototypes]
3931 | noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
| ^~~~~~~~~~~~~~~~~~~~~~
mm/page_alloc.c: In function '__alloc_pages':
>> mm/page_alloc.c:5529:23: error: implicit declaration of function 'set_memory_4k'; did you mean 'set_memory_nx'? [-Werror=implicit-function-declaration]
5529 | err = set_memory_4k(addr, nr_pages);
| ^~~~~~~~~~~~~
| set_memory_nx
cc1: some warnings being treated as errors


vim +5529 mm/page_alloc.c

5454
5455 /*
5456 * This is the 'heart' of the zoned buddy allocator.
5457 */
5458 struct page *__alloc_pages(gfp_t gfp, unsigned int order, int preferred_nid,
5459 nodemask_t *nodemask)
5460 {
5461 struct page *page;
5462 unsigned int alloc_flags = ALLOC_WMARK_LOW;
5463 gfp_t alloc_gfp; /* The gfp_t that was actually used for allocation */
5464 struct alloc_context ac = { };
5465
5466 /*
5467 * There are several places where we assume that the order value is sane
5468 * so bail out early if the request is out of bound.
5469 */
5470 if (unlikely(order >= MAX_ORDER)) {
5471 WARN_ON_ONCE(!(gfp & __GFP_NOWARN));
5472 return NULL;
5473 }
5474
5475 gfp &= gfp_allowed_mask;
5476 /*
5477 * Apply scoped allocation constraints. This is mainly about GFP_NOFS
5478 * resp. GFP_NOIO which has to be inherited for all allocation requests
5479 * from a particular context which has been marked by
5480 * memalloc_no{fs,io}_{save,restore}. And PF_MEMALLOC_PIN which ensures
5481 * movable zones are not used during allocation.
5482 */
5483 gfp = current_gfp_context(gfp);
5484 alloc_gfp = gfp;
5485 if (!prepare_alloc_pages(gfp, order, preferred_nid, nodemask, &ac,
5486 &alloc_gfp, &alloc_flags))
5487 return NULL;
5488
5489 if ((alloc_gfp & __GFP_PTE_MAPPED) && order == 0) {
5490 page = alloc_page_pte_mapped(alloc_gfp);
5491 if (page)
5492 goto out;
5493 }
5494
5495 /*
5496 * Forbid the first pass from falling back to types that fragment
5497 * memory until all local zones are considered.
5498 */
5499 alloc_flags |= alloc_flags_nofragment(ac.preferred_zoneref->zone, gfp);
5500
5501 /* First allocation attempt */
5502 page = get_page_from_freelist(alloc_gfp, order, alloc_flags, &ac);
5503 if (likely(page))
5504 goto out;
5505
5506 alloc_gfp = gfp;
5507 ac.spread_dirty_pages = false;
5508
5509 /*
5510 * Restore the original nodemask if it was potentially replaced with
5511 * &cpuset_current_mems_allowed to optimize the fast-path attempt.
5512 */
5513 ac.nodemask = nodemask;
5514
5515 page = __alloc_pages_slowpath(alloc_gfp, order, &ac);
5516
5517 out:
5518 if (memcg_kmem_enabled() && (gfp & __GFP_ACCOUNT) && page &&
5519 unlikely(__memcg_kmem_charge_page(page, gfp, order) != 0)) {
5520 __free_pages(page, order);
5521 page = NULL;
5522 }
5523
5524 if (gfp & __GFP_PTE_MAPPED_2) {
5525 unsigned long addr = (unsigned long)page_address(page);
5526 unsigned long nr_pages = (1 << order);
5527 int err;
5528
> 5529 err = set_memory_4k(addr, nr_pages);
5530 if (err) {
5531 /* FIXME: reset pageblock migratetype */
5532 /* set_pageblock_migratetype(old_mt) */
5533 __free_pages(page, order);
5534 page = NULL;
5535 }
5536
5537 /* FIXME: should we flush TLB here or later? */
5538 /* flush_tlb_kernel_range(addr, addr + PAGE_SIZE * nr_pages); */
5539 }
5540
5541 trace_mm_page_alloc(page, order, alloc_gfp, ac.migratetype);
5542
5543 return page;
5544 }
5545 EXPORT_SYMBOL(__alloc_pages);
5546

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

Attachment: .config.gz
Description: application/gzip