linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 5933/6583] include/linux/page_ext.h:131:20: error: call to undeclared function 'page_to_section'; ISO C99 and later do not support implicit function declarations
@ 2025-02-26  9:46 kernel test robot
  2025-02-26 14:10 ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: kernel test robot @ 2025-02-26  9:46 UTC (permalink / raw)
  To: Luiz Capitulino
  Cc: llvm, oe-kbuild-all, Andrew Morton, Linux Memory Management List

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   8433c776e1eb1371f5cd40b5fd3a61f9c7b7f3ad
commit: a2d6e9c1a867bb9f13943cb8483e2ab85b630bcd [5933/6583] mm: page_ext: add an iteration API for page extensions
config: i386-buildonly-randconfig-004-20250226 (https://download.01.org/0day-ci/archive/20250226/202502261733.Ma0eUGKJ-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250226/202502261733.Ma0eUGKJ-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/202502261733.Ma0eUGKJ-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from arch/x86/kernel/asm-offsets.c:14:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:21:
   In file included from include/linux/mm.h:8:
   In file included from include/linux/pgalloc_tag.h:12:
>> include/linux/page_ext.h:131:20: error: call to undeclared function 'page_to_section'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     131 |         iter->start_pfn = page_to_pfn(page);
         |                           ^
   include/asm-generic/memory_model.h:64:21: note: expanded from macro 'page_to_pfn'
      64 | #define page_to_pfn __page_to_pfn
         |                     ^
   include/asm-generic/memory_model.h:47:14: note: expanded from macro '__page_to_pfn'
      47 |         int __sec = page_to_section(__pg);                      \
         |                     ^
   include/linux/page_ext.h:131:20: note: did you mean '__nr_to_section'?
   include/asm-generic/memory_model.h:64:21: note: expanded from macro 'page_to_pfn'
      64 | #define page_to_pfn __page_to_pfn
         |                     ^
   include/asm-generic/memory_model.h:47:14: note: expanded from macro '__page_to_pfn'
      47 |         int __sec = page_to_section(__pg);                      \
         |                     ^
   include/linux/mmzone.h:1907:35: note: '__nr_to_section' declared here
    1907 | static inline struct mem_section *__nr_to_section(unsigned long nr)
         |                                   ^
   In file included from arch/x86/kernel/asm-offsets.c:14:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:21:
>> include/linux/mm.h:1965:29: error: static declaration of 'page_to_section' follows non-static declaration
    1965 | static inline unsigned long page_to_section(const struct page *page)
         |                             ^
   include/linux/page_ext.h:131:20: note: previous implicit declaration is here
     131 |         iter->start_pfn = page_to_pfn(page);
         |                           ^
   include/asm-generic/memory_model.h:64:21: note: expanded from macro 'page_to_pfn'
      64 | #define page_to_pfn __page_to_pfn
         |                     ^
   include/asm-generic/memory_model.h:47:14: note: expanded from macro '__page_to_pfn'
      47 |         int __sec = page_to_section(__pg);                      \
         |                     ^
   In file included from arch/x86/kernel/asm-offsets.c:14:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:21:
   In file included from include/linux/mm.h:2302:
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   1 warning and 2 errors generated.
   make[3]: *** [scripts/Makefile.build:102: arch/x86/kernel/asm-offsets.s] Error 1 shuffle=1287424088
   make[3]: Target 'prepare' not remade because of errors.
   make[2]: *** [Makefile:1264: prepare0] Error 2 shuffle=1287424088
   make[2]: Target 'prepare' not remade because of errors.
   make[1]: *** [Makefile:251: __sub-make] Error 2 shuffle=1287424088
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [Makefile:251: __sub-make] Error 2 shuffle=1287424088
   make: Target 'prepare' not remade because of errors.


vim +/page_to_section +131 include/linux/page_ext.h

   118	
   119	/**
   120	 * page_ext_iter_begin() - Prepare for iterating through page extensions.
   121	 * @iter: page extension iterator.
   122	 * @page: The page we're interested in.
   123	 *
   124	 * Must be called with RCU read lock taken.
   125	 *
   126	 * Return: NULL if no page_ext exists for this page.
   127	 */
   128	static inline struct page_ext *page_ext_iter_begin(struct page_ext_iter *iter, struct page *page)
   129	{
   130		iter->index = 0;
 > 131		iter->start_pfn = page_to_pfn(page);
   132		iter->page_ext = lookup_page_ext(page);
   133	
   134		return iter->page_ext;
   135	}
   136	

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-next:master 5933/6583] include/linux/page_ext.h:131:20: error: call to undeclared function 'page_to_section'; ISO C99 and later do not support implicit function declarations
  2025-02-26  9:46 [linux-next:master 5933/6583] include/linux/page_ext.h:131:20: error: call to undeclared function 'page_to_section'; ISO C99 and later do not support implicit function declarations kernel test robot
@ 2025-02-26 14:10 ` Arnd Bergmann
  2025-02-26 14:24   ` Luiz Capitulino
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2025-02-26 14:10 UTC (permalink / raw)
  To: kernel test robot, Luiz Capitulino
  Cc: llvm, oe-kbuild-all, Andrew Morton, Linux Memory Management List

On Wed, Feb 26, 2025, at 10:46, kernel test robot wrote:
> commit: a2d6e9c1a867bb9f13943cb8483e2ab85b630bcd [5933/6583] mm: 
> page_ext: add an iteration API for page extensions
> config: i386-buildonly-randconfig-004-20250226 

>
>    In file included from arch/x86/kernel/asm-offsets.c:14:
>    In file included from include/linux/suspend.h:5:
>    In file included from include/linux/swap.h:9:
>    In file included from include/linux/memcontrol.h:21:
>    In file included from include/linux/mm.h:8:
>    In file included from include/linux/pgalloc_tag.h:12:
>>> include/linux/page_ext.h:131:20: error: call to undeclared function 'page_to_section'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
>      131 |         iter->start_pfn = page_to_pfn(page);
>          |                           ^
>    include/asm-generic/memory_model.h:64:21: note: expanded from macro 
> 'page_to_pfn'
>       64 | #define page_to_pfn __page_to_pfn

I'm getting this on all configurations that set CONFIG_SPARSEMEM
but not CONFIG_SPARSEMEM_VMMEMMAP.

There is also a possible problem with linux/page_ext.h
including pgtable.h and mmzone.h, which I think can lead
to circular header inclusions with linux/mm.h.

      Arnd


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-next:master 5933/6583] include/linux/page_ext.h:131:20: error: call to undeclared function 'page_to_section'; ISO C99 and later do not support implicit function declarations
  2025-02-26 14:10 ` Arnd Bergmann
@ 2025-02-26 14:24   ` Luiz Capitulino
  2025-02-26 20:31     ` Andrew Morton
  2025-02-28 13:17     ` David Hildenbrand
  0 siblings, 2 replies; 5+ messages in thread
From: Luiz Capitulino @ 2025-02-26 14:24 UTC (permalink / raw)
  To: Arnd Bergmann, kernel test robot, Andrew Morton
  Cc: llvm, oe-kbuild-all, Linux Memory Management List

On 2025-02-26 09:10, Arnd Bergmann wrote:
> On Wed, Feb 26, 2025, at 10:46, kernel test robot wrote:
>> commit: a2d6e9c1a867bb9f13943cb8483e2ab85b630bcd [5933/6583] mm:
>> page_ext: add an iteration API for page extensions
>> config: i386-buildonly-randconfig-004-20250226
> 
>>
>>     In file included from arch/x86/kernel/asm-offsets.c:14:
>>     In file included from include/linux/suspend.h:5:
>>     In file included from include/linux/swap.h:9:
>>     In file included from include/linux/memcontrol.h:21:
>>     In file included from include/linux/mm.h:8:
>>     In file included from include/linux/pgalloc_tag.h:12:
>>>> include/linux/page_ext.h:131:20: error: call to undeclared function 'page_to_section'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
>>       131 |         iter->start_pfn = page_to_pfn(page);
>>           |                           ^
>>     include/asm-generic/memory_model.h:64:21: note: expanded from macro
>> 'page_to_pfn'
>>        64 | #define page_to_pfn __page_to_pfn
> 
> I'm getting this on all configurations that set CONFIG_SPARSEMEM
> but not CONFIG_SPARSEMEM_VMMEMMAP.

Oh, thanks. I didn't build with CONFIG_SPARSEMEM_VMEMMAP=n.

> There is also a possible problem with linux/page_ext.h
> including pgtable.h and mmzone.h, which I think can lead
> to circular header inclusions with linux/mm.h.

Thanks, I'll look into this.

Andrew, I think you'll have to drop this for now. I may not
have the time to look into this this week.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-next:master 5933/6583] include/linux/page_ext.h:131:20: error: call to undeclared function 'page_to_section'; ISO C99 and later do not support implicit function declarations
  2025-02-26 14:24   ` Luiz Capitulino
@ 2025-02-26 20:31     ` Andrew Morton
  2025-02-28 13:17     ` David Hildenbrand
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2025-02-26 20:31 UTC (permalink / raw)
  To: Luiz Capitulino
  Cc: Arnd Bergmann, kernel test robot, llvm, oe-kbuild-all,
	Linux Memory Management List

On Wed, 26 Feb 2025 09:24:11 -0500 Luiz Capitulino <luizcap@redhat.com> wrote:

> Andrew, I think you'll have to drop this for now. I may not
> have the time to look into this this week.

Done, thanks.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-next:master 5933/6583] include/linux/page_ext.h:131:20: error: call to undeclared function 'page_to_section'; ISO C99 and later do not support implicit function declarations
  2025-02-26 14:24   ` Luiz Capitulino
  2025-02-26 20:31     ` Andrew Morton
@ 2025-02-28 13:17     ` David Hildenbrand
  1 sibling, 0 replies; 5+ messages in thread
From: David Hildenbrand @ 2025-02-28 13:17 UTC (permalink / raw)
  To: Luiz Capitulino, Arnd Bergmann, kernel test robot, Andrew Morton
  Cc: llvm, oe-kbuild-all, Linux Memory Management List

On 26.02.25 15:24, Luiz Capitulino wrote:
> On 2025-02-26 09:10, Arnd Bergmann wrote:
>> On Wed, Feb 26, 2025, at 10:46, kernel test robot wrote:
>>> commit: a2d6e9c1a867bb9f13943cb8483e2ab85b630bcd [5933/6583] mm:
>>> page_ext: add an iteration API for page extensions
>>> config: i386-buildonly-randconfig-004-20250226
>>
>>>
>>>      In file included from arch/x86/kernel/asm-offsets.c:14:
>>>      In file included from include/linux/suspend.h:5:
>>>      In file included from include/linux/swap.h:9:
>>>      In file included from include/linux/memcontrol.h:21:
>>>      In file included from include/linux/mm.h:8:
>>>      In file included from include/linux/pgalloc_tag.h:12:
>>>>> include/linux/page_ext.h:131:20: error: call to undeclared function 'page_to_section'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
>>>        131 |         iter->start_pfn = page_to_pfn(page);
>>>            |                           ^
>>>      include/asm-generic/memory_model.h:64:21: note: expanded from macro
>>> 'page_to_pfn'
>>>         64 | #define page_to_pfn __page_to_pfn
>>
>> I'm getting this on all configurations that set CONFIG_SPARSEMEM
>> but not CONFIG_SPARSEMEM_VMMEMMAP.
> 
> Oh, thanks. I didn't build with CONFIG_SPARSEMEM_VMEMMAP=n.
> 
>> There is also a possible problem with linux/page_ext.h
>> including pgtable.h and mmzone.h, which I think can lead
>> to circular header inclusions with linux/mm.h.
> 
> Thanks, I'll look into this.
> 
> Andrew, I think you'll have to drop this for now. I may not
> have the time to look into this this week.

If we feed lookup_page_ext() the PFN instead, and let the caller
of page_ext_iter_begin() deal with the pfn_to_page(), we should be able to
make it work.

<linux/mmzone.h> still needs to be included, but I assume this should be
fine for now.


 From a526d3819de7e36a45743d447638b7251881e508 Mon Sep 17 00:00:00 2001
From: David Hildenbrand <david@redhat.com>
Date: Fri, 28 Feb 2025 14:10:15 +0100
Subject: [PATCH] tmp

Signed-off-by: David Hildenbrand <david@redhat.com>
---
  include/linux/page_ext.h | 20 ++++++++++----------
  mm/page_ext.c            | 14 ++++++--------
  2 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/include/linux/page_ext.h b/include/linux/page_ext.h
index 33a118b31a222..0c4ff10969453 100644
--- a/include/linux/page_ext.h
+++ b/include/linux/page_ext.h
@@ -2,7 +2,6 @@
  #ifndef __LINUX_PAGE_EXT_H
  #define __LINUX_PAGE_EXT_H
  
-#include <linux/pgtable.h>
  #include <linux/types.h>
  #include <linux/mmzone.h>
  #include <linux/stacktrace.h>
@@ -95,7 +94,7 @@ static inline bool page_ext_iter_next_fast_possible(unsigned long next_pfn)
  
  extern struct page_ext *page_ext_get(const struct page *page);
  extern void page_ext_put(struct page_ext *page_ext);
-extern struct page_ext *lookup_page_ext(const struct page *page);
+extern struct page_ext *lookup_page_ext(unsigned long pfn);
  
  static inline void *page_ext_data(struct page_ext *page_ext,
  				  struct page_ext_operations *ops)
@@ -119,17 +118,18 @@ struct page_ext_iter {
  /**
   * page_ext_iter_begin() - Prepare for iterating through page extensions.
   * @iter: page extension iterator.
- * @page: The page we're interested in.
+ * @pfn: PFN of the page we're interested in.
   *
   * Must be called with RCU read lock taken.
   *
   * Return: NULL if no page_ext exists for this page.
   */
-static inline struct page_ext *page_ext_iter_begin(struct page_ext_iter *iter, struct page *page)
+static inline struct page_ext *page_ext_iter_begin(struct page_ext_iter *iter,
+		unsigned long pfn)
  {
  	iter->index = 0;
-	iter->start_pfn = page_to_pfn(page);
-	iter->page_ext = lookup_page_ext(page);
+	iter->start_pfn = pfn;
+	iter->page_ext = lookup_page_ext(iter->start_pfn);
  
  	return iter->page_ext;
  }
@@ -155,7 +155,7 @@ static inline struct page_ext *page_ext_iter_next(struct page_ext_iter *iter)
  	if (page_ext_iter_next_fast_possible(pfn))
  		iter->page_ext = page_ext_next(iter->page_ext);
  	else
-		iter->page_ext = lookup_page_ext(pfn_to_page(pfn));
+		iter->page_ext = lookup_page_ext(pfn);
  
  	return iter->page_ext;
  }
@@ -181,9 +181,9 @@ static inline struct page_ext *page_ext_iter_get(const struct page_ext_iter *ite
   *
   * IMPORTANT: must be called with RCU read lock taken.
   */
-#define for_each_page_ext(__page, __pgcount, __page_ext, __iter) \
-	for (__page_ext = page_ext_iter_begin(&__iter, __page);  \
-		__page_ext && __iter.index < __pgcount;          \
+#define for_each_page_ext(__page, __pgcount, __page_ext, __iter)	     \
+	for (__page_ext = page_ext_iter_begin(&__iter, page_to_pfn(__page)); \
+		__page_ext && __iter.index < __pgcount; 		     \
  		__page_ext = page_ext_iter_next(&__iter))
  
  #else /* !CONFIG_PAGE_EXTENSION */
diff --git a/mm/page_ext.c b/mm/page_ext.c
index 23ad30597c05c..19cc0af9c5651 100644
--- a/mm/page_ext.c
+++ b/mm/page_ext.c
@@ -165,14 +165,14 @@ void __meminit pgdat_page_ext_init(struct pglist_data *pgdat)
  	pgdat->node_page_ext = NULL;
  }
  
-struct page_ext *lookup_page_ext(const struct page *page)
+struct page_ext *lookup_page_ext(unsigned long pfn)
  {
-	unsigned long pfn = page_to_pfn(page);
+	const int nid = page_to_nid(pfn_to_page(pfn));
  	unsigned long index;
  	struct page_ext *base;
  
  	WARN_ON_ONCE(!rcu_read_lock_held());
-	base = NODE_DATA(page_to_nid(page))->node_page_ext;
+	base = NODE_DATA(nid)->node_page_ext;
  	/*
  	 * The sanity checks the page allocator does upon freeing a
  	 * page can reach here before the page_ext arrays are
@@ -181,8 +181,7 @@ struct page_ext *lookup_page_ext(const struct page *page)
  	 */
  	if (unlikely(!base))
  		return NULL;
-	index = pfn - round_down(node_start_pfn(page_to_nid(page)),
-					MAX_ORDER_NR_PAGES);
+	index = pfn - round_down(node_start_pfn(nid), MAX_ORDER_NR_PAGES);
  	return get_entry(base, index);
  }
  
@@ -245,9 +244,8 @@ static bool page_ext_invalid(struct page_ext *page_ext)
  	return !page_ext || (((unsigned long)page_ext & PAGE_EXT_INVALID) == PAGE_EXT_INVALID);
  }
  
-struct page_ext *lookup_page_ext(const struct page *page)
+struct page_ext *lookup_page_ext(unsigned long pfn)
  {
-	unsigned long pfn = page_to_pfn(page);
  	struct mem_section *section = __pfn_to_section(pfn);
  	struct page_ext *page_ext = READ_ONCE(section->page_ext);
  
@@ -523,7 +521,7 @@ struct page_ext *page_ext_get(const struct page *page)
  	struct page_ext *page_ext;
  
  	rcu_read_lock();
-	page_ext = lookup_page_ext(page);
+	page_ext = lookup_page_ext(page_to_pfn(page));
  	if (!page_ext) {
  		rcu_read_unlock();
  		return NULL;
-- 
2.48.1


-- 
Cheers,

David / dhildenb



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-02-28 13:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-26  9:46 [linux-next:master 5933/6583] include/linux/page_ext.h:131:20: error: call to undeclared function 'page_to_section'; ISO C99 and later do not support implicit function declarations kernel test robot
2025-02-26 14:10 ` Arnd Bergmann
2025-02-26 14:24   ` Luiz Capitulino
2025-02-26 20:31     ` Andrew Morton
2025-02-28 13:17     ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox