mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] LoongArch: Add missing linux/mm.h include in asm/io.h
@ 2026-05-21  6:33 George Guo
  2026-05-21  7:09 ` Huacai Chen
  2026-05-21 11:06 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: George Guo @ 2026-05-21  6:33 UTC (permalink / raw)
  To: Huacai Chen, loongarch
  Cc: WANG Xuerui, Jiaxun Yang, linux-kernel, George Guo, Kexin Liu

From: George Guo <guodongtai@kylinos.cn>

When CONFIG_KFENCE is enabled, the virt_to_phys() and phys_to_virt()
macros in arch/loongarch/include/asm/io.h expand to use offset_in_page()
and page_address(), both of which are declared in <linux/mm.h>.

Without this include, any translation unit that includes <asm/io.h> and
expands these macros with CONFIG_KFENCE=y will fail to build:

  asm/io.h: error: implicit declaration of function 'offset_in_page'
  asm/io.h: error: implicit declaration of function 'page_address'

Add the missing include to fix these build errors.

Fixes: 0ca84aeaee15 ("LoongArch: Make {virt, phys, page, pfn} translation work with KFENCE")
Co-developed-by: Kexin Liu <liukexin@kylinos.cn>
Signed-off-by: Kexin Liu <liukexin@kylinos.cn>
Signed-off-by: George Guo <guodongtai@kylinos.cn>
---
 arch/loongarch/include/asm/io.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/loongarch/include/asm/io.h b/arch/loongarch/include/asm/io.h
index 0130185e0349..7ff4aa72a34a 100644
--- a/arch/loongarch/include/asm/io.h
+++ b/arch/loongarch/include/asm/io.h
@@ -13,6 +13,7 @@
 #include <asm/page.h>
 #include <asm/pgtable-bits.h>
 #include <asm/string.h>
+#include <linux/mm.h>
 
 extern void __init __iomem *early_ioremap(phys_addr_t phys_addr, unsigned long size);
 extern void __init early_iounmap(void __iomem *addr, unsigned long size);
-- 
2.25.1


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

* Re: [PATCH 1/1] LoongArch: Add missing linux/mm.h include in asm/io.h
  2026-05-21  6:33 [PATCH 1/1] LoongArch: Add missing linux/mm.h include in asm/io.h George Guo
@ 2026-05-21  7:09 ` Huacai Chen
  2026-05-21 11:06 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: Huacai Chen @ 2026-05-21  7:09 UTC (permalink / raw)
  To: George Guo
  Cc: loongarch, WANG Xuerui, Jiaxun Yang, linux-kernel, George Guo, Kexin Liu

On Thu, May 21, 2026 at 2:33 PM George Guo <dongtai.guo@linux.dev> wrote:
>
> From: George Guo <guodongtai@kylinos.cn>
>
> When CONFIG_KFENCE is enabled, the virt_to_phys() and phys_to_virt()
> macros in arch/loongarch/include/asm/io.h expand to use offset_in_page()
> and page_address(), both of which are declared in <linux/mm.h>.
>
> Without this include, any translation unit that includes <asm/io.h> and
> expands these macros with CONFIG_KFENCE=y will fail to build:
>
>   asm/io.h: error: implicit declaration of function 'offset_in_page'
>   asm/io.h: error: implicit declaration of function 'page_address'
From which .c file the warning is? I can't reproduce it.

Huacai

>
> Add the missing include to fix these build errors.
>
> Fixes: 0ca84aeaee15 ("LoongArch: Make {virt, phys, page, pfn} translation work with KFENCE")
> Co-developed-by: Kexin Liu <liukexin@kylinos.cn>
> Signed-off-by: Kexin Liu <liukexin@kylinos.cn>
> Signed-off-by: George Guo <guodongtai@kylinos.cn>
> ---
>  arch/loongarch/include/asm/io.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/loongarch/include/asm/io.h b/arch/loongarch/include/asm/io.h
> index 0130185e0349..7ff4aa72a34a 100644
> --- a/arch/loongarch/include/asm/io.h
> +++ b/arch/loongarch/include/asm/io.h
> @@ -13,6 +13,7 @@
>  #include <asm/page.h>
>  #include <asm/pgtable-bits.h>
>  #include <asm/string.h>
> +#include <linux/mm.h>
>
>  extern void __init __iomem *early_ioremap(phys_addr_t phys_addr, unsigned long size);
>  extern void __init early_iounmap(void __iomem *addr, unsigned long size);
> --
> 2.25.1
>

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

* Re: [PATCH 1/1] LoongArch: Add missing linux/mm.h include in asm/io.h
  2026-05-21  6:33 [PATCH 1/1] LoongArch: Add missing linux/mm.h include in asm/io.h George Guo
  2026-05-21  7:09 ` Huacai Chen
@ 2026-05-21 11:06 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-05-21 11:06 UTC (permalink / raw)
  To: George Guo, Huacai Chen, loongarch
  Cc: llvm, oe-kbuild-all, WANG Xuerui, Jiaxun Yang, linux-kernel,
	George Guo, Kexin Liu

Hi George,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v7.1-rc4 next-20260520]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/George-Guo/LoongArch-Add-missing-linux-mm-h-include-in-asm-io-h/20260521-143448
base:   linus/master
patch link:    https://lore.kernel.org/r/20260521063310.52926-1-dongtai.guo%40linux.dev
patch subject: [PATCH 1/1] LoongArch: Add missing linux/mm.h include in asm/io.h
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20260521/202605211925.DbDvQ6ii-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/20260521/202605211925.DbDvQ6ii-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/202605211925.DbDvQ6ii-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from kernel/sched/rq-offsets.c:5:
   In file included from kernel/sched/sched.h:28:
   In file included from include/linux/cgroup_api.h:1:
   In file included from include/linux/cgroup.h:17:
   In file included from include/linux/fs.h:45:
   In file included from include/linux/slab.h:264:
   In file included from include/linux/kasan.h:21:
   In file included from arch/loongarch/include/asm/kasan.h:10:
   In file included from arch/loongarch/include/asm/io.h:16:
>> include/linux/mm.h:882:2: error: call to undeclared function 'kfree'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     882 |         kfree(vma->numab_state);
         |         ^
   In file included from kernel/sched/rq-offsets.c:5:
   In file included from kernel/sched/sched.h:28:
   In file included from include/linux/cgroup_api.h:1:
   In file included from include/linux/cgroup.h:17:
   In file included from include/linux/fs.h:45:
>> include/linux/slab.h:513:6: error: conflicting types for 'kfree'
     513 | void kfree(const void *objp);
         |      ^
   include/linux/mm.h:882:2: note: previous implicit declaration is here
     882 |         kfree(vma->numab_state);
         |         ^
   2 errors generated.
   make[3]: *** [scripts/Makefile.build:184: kernel/sched/rq-offsets.s] Error 1
   make[3]: Target 'prepare' not remade because of errors.
   make[2]: *** [Makefile:1375: prepare0] Error 2
   make[2]: Target 'prepare' not remade because of errors.
   make[1]: *** [Makefile:248: __sub-make] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [Makefile:248: __sub-make] Error 2
   make: Target 'prepare' not remade because of errors.


vim +/kfree +882 include/linux/mm.h

^1da177e4c3f4152 Linus Torvalds 2005-04-16  874  
ef6a22b70f6d9044 Mel Gorman     2023-03-01  875  #ifdef CONFIG_NUMA_BALANCING
ef6a22b70f6d9044 Mel Gorman     2023-03-01  876  static inline void vma_numab_state_init(struct vm_area_struct *vma)
ef6a22b70f6d9044 Mel Gorman     2023-03-01  877  {
ef6a22b70f6d9044 Mel Gorman     2023-03-01  878  	vma->numab_state = NULL;
ef6a22b70f6d9044 Mel Gorman     2023-03-01  879  }
ef6a22b70f6d9044 Mel Gorman     2023-03-01  880  static inline void vma_numab_state_free(struct vm_area_struct *vma)
ef6a22b70f6d9044 Mel Gorman     2023-03-01  881  {
ef6a22b70f6d9044 Mel Gorman     2023-03-01 @882  	kfree(vma->numab_state);
ef6a22b70f6d9044 Mel Gorman     2023-03-01  883  }
ef6a22b70f6d9044 Mel Gorman     2023-03-01  884  #else
ef6a22b70f6d9044 Mel Gorman     2023-03-01  885  static inline void vma_numab_state_init(struct vm_area_struct *vma) {}
ef6a22b70f6d9044 Mel Gorman     2023-03-01  886  static inline void vma_numab_state_free(struct vm_area_struct *vma) {}
ef6a22b70f6d9044 Mel Gorman     2023-03-01  887  #endif /* CONFIG_NUMA_BALANCING */
ef6a22b70f6d9044 Mel Gorman     2023-03-01  888  

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

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

end of thread, other threads:[~2026-05-21 11:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-21  6:33 [PATCH 1/1] LoongArch: Add missing linux/mm.h include in asm/io.h George Guo
2026-05-21  7:09 ` Huacai Chen
2026-05-21 11:06 ` kernel test robot

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

all inboxes | Powered by JetHome®