linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [akpm-mm:mm-unstable 357/379] mm/vma.h:114:19: error: use of undeclared identifier 'USER_PGTABLES_CEILING'
@ 2024-08-24 15:14 kernel test robot
  2024-08-24 19:43 ` Lorenzo Stoakes
  0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2024-08-24 15:14 UTC (permalink / raw)
  To: Liam R. Howlett
  Cc: llvm, oe-kbuild-all, Andrew Morton, Linux Memory Management List,
	Lorenzo Stoakes

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
head:   b659edec079c90012cf8d05624e312d1062b8b87
commit: ca39aca8db2d78ff82356defba75d14ce78a67b9 [357/379] mm/vma: track start and end for munmap in vma_munmap_struct
config: arm-allnoconfig (https://download.01.org/0day-ci/archive/20240824/202408242348.uGvgH9tt-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 08e5a1de8227512d4774a534b91cb2353cef6284)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240824/202408242348.uGvgH9tt-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/202408242348.uGvgH9tt-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from mm/filemap.c:15:
   In file included from include/linux/dax.h:6:
   In file included from include/linux/mm.h:2198:
   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_"
         |                               ~~~~~~~~~~~ ^ ~~~
   In file included from mm/filemap.c:52:
   In file included from mm/internal.h:13:
   include/linux/mm_inline.h:47:41: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
      47 |         __mod_lruvec_state(lruvec, NR_LRU_BASE + lru, nr_pages);
         |                                    ~~~~~~~~~~~ ^ ~~~
   include/linux/mm_inline.h:49:22: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
      49 |                                 NR_ZONE_LRU_BASE + lru, nr_pages);
         |                                 ~~~~~~~~~~~~~~~~ ^ ~~~
   In file included from mm/filemap.c:52:
   In file included from mm/internal.h:22:
>> mm/vma.h:114:19: error: use of undeclared identifier 'USER_PGTABLES_CEILING'
     114 |         vms->unmap_end = USER_PGTABLES_CEILING;
         |                          ^
   3 warnings and 1 error generated.
--
   In file included from mm/vmscan.c:15:
   In file included from include/linux/mm.h:2198:
   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_"
         |                               ~~~~~~~~~~~ ^ ~~~
   In file included from mm/vmscan.c:30:
   include/linux/mm_inline.h:47:41: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
      47 |         __mod_lruvec_state(lruvec, NR_LRU_BASE + lru, nr_pages);
         |                                    ~~~~~~~~~~~ ^ ~~~
   include/linux/mm_inline.h:49:22: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
      49 |                                 NR_ZONE_LRU_BASE + lru, nr_pages);
         |                                 ~~~~~~~~~~~~~~~~ ^ ~~~
   In file included from mm/vmscan.c:67:
   In file included from mm/internal.h:22:
>> mm/vma.h:114:19: error: use of undeclared identifier 'USER_PGTABLES_CEILING'
     114 |         vms->unmap_end = USER_PGTABLES_CEILING;
         |                          ^
   mm/vmscan.c:401:51: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     401 |                         size += zone_page_state(zone, NR_ZONE_LRU_BASE + lru);
         |                                                       ~~~~~~~~~~~~~~~~ ^ ~~~
   mm/vmscan.c:1730:4: warning: arithmetic between different enumeration types ('enum vm_event_item' and 'enum zone_type') [-Wenum-enum-conversion]
    1730 |                         __count_zid_vm_events(PGSCAN_SKIP, zid, nr_skipped[zid]);
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:139:34: note: expanded from macro '__count_zid_vm_events'
     139 |         __count_vm_events(item##_NORMAL - ZONE_NORMAL + zid, delta)
         |                           ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~
   mm/vmscan.c:2235:51: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
    2235 |         inactive = lruvec_page_state(lruvec, NR_LRU_BASE + inactive_lru);
         |                                              ~~~~~~~~~~~ ^ ~~~~~~~~~~~~
   mm/vmscan.c:2236:49: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
    2236 |         active = lruvec_page_state(lruvec, NR_LRU_BASE + active_lru);
         |                                            ~~~~~~~~~~~ ^ ~~~~~~~~~~
   mm/vmscan.c:6251:3: warning: arithmetic between different enumeration types ('enum vm_event_item' and 'enum zone_type') [-Wenum-enum-conversion]
    6251 |                 __count_zid_vm_events(ALLOCSTALL, sc->reclaim_idx, 1);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:139:34: note: expanded from macro '__count_zid_vm_events'
     139 |         __count_vm_events(item##_NORMAL - ZONE_NORMAL + zid, delta)
         |                           ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~
   8 warnings and 1 error generated.
--
   In file included from mm/page_alloc.c:19:
   In file included from include/linux/mm.h:2198:
   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_"
         |                               ~~~~~~~~~~~ ^ ~~~
   In file included from mm/page_alloc.c:44:
   include/linux/mm_inline.h:47:41: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
      47 |         __mod_lruvec_state(lruvec, NR_LRU_BASE + lru, nr_pages);
         |                                    ~~~~~~~~~~~ ^ ~~~
   include/linux/mm_inline.h:49:22: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
      49 |                                 NR_ZONE_LRU_BASE + lru, nr_pages);
         |                                 ~~~~~~~~~~~~~~~~ ^ ~~~
   In file included from mm/page_alloc.c:59:
   In file included from mm/internal.h:22:
>> mm/vma.h:114:19: error: use of undeclared identifier 'USER_PGTABLES_CEILING'
     114 |         vms->unmap_end = USER_PGTABLES_CEILING;
         |                          ^
   mm/page_alloc.c:2892:2: warning: arithmetic between different enumeration types ('enum vm_event_item' and 'enum zone_type') [-Wenum-enum-conversion]
    2892 |         __count_zid_vm_events(PGALLOC, page_zonenum(page), 1 << order);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:139:34: note: expanded from macro '__count_zid_vm_events'
     139 |         __count_vm_events(item##_NORMAL - ZONE_NORMAL + zid, delta)
         |                           ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~
   mm/page_alloc.c:3009:3: warning: arithmetic between different enumeration types ('enum vm_event_item' and 'enum zone_type') [-Wenum-enum-conversion]
    3009 |                 __count_zid_vm_events(PGALLOC, page_zonenum(page), 1 << order);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:139:34: note: expanded from macro '__count_zid_vm_events'
     139 |         __count_vm_events(item##_NORMAL - ZONE_NORMAL + zid, delta)
         |                           ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~
   mm/page_alloc.c:4651:2: warning: arithmetic between different enumeration types ('enum vm_event_item' and 'enum zone_type') [-Wenum-enum-conversion]
    4651 |         __count_zid_vm_events(PGALLOC, zone_idx(zone), nr_account);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:139:34: note: expanded from macro '__count_zid_vm_events'
     139 |         __count_vm_events(item##_NORMAL - ZONE_NORMAL + zid, delta)
         |                           ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~
   6 warnings and 1 error generated.


vim +/USER_PGTABLES_CEILING +114 mm/vma.h

    67	
    68	/* Required for do_brk_flags(). */
    69	void init_vma_prep(struct vma_prepare *vp,
    70			   struct vm_area_struct *vma);
    71	
    72	/* Required for do_brk_flags(). */
    73	void vma_complete(struct vma_prepare *vp,
    74			  struct vma_iterator *vmi, struct mm_struct *mm);
    75	
    76	int vma_expand(struct vma_iterator *vmi, struct vm_area_struct *vma,
    77		       unsigned long start, unsigned long end, pgoff_t pgoff,
    78		       struct vm_area_struct *next);
    79	
    80	int vma_shrink(struct vma_iterator *vmi, struct vm_area_struct *vma,
    81		       unsigned long start, unsigned long end, pgoff_t pgoff);
    82	
    83	/*
    84	 * init_vma_munmap() - Initializer wrapper for vma_munmap_struct
    85	 * @vms: The vma munmap struct
    86	 * @vmi: The vma iterator
    87	 * @vma: The first vm_area_struct to munmap
    88	 * @start: The aligned start address to munmap
    89	 * @end: The aligned end address to munmap
    90	 * @uf: The userfaultfd list_head
    91	 * @unlock: Unlock after the operation.  Only unlocked on success
    92	 */
    93	static inline void init_vma_munmap(struct vma_munmap_struct *vms,
    94			struct vma_iterator *vmi, struct vm_area_struct *vma,
    95			unsigned long start, unsigned long end, struct list_head *uf,
    96			bool unlock)
    97	{
    98		vms->vmi = vmi;
    99		vms->vma = vma;
   100		if (vma) {
   101			vms->mm = vma->vm_mm;
   102			vms->start = start;
   103			vms->end = end;
   104		} else {
   105			vms->mm = NULL;
   106			vms->start = vms->end = 0;
   107		}
   108		vms->unlock = unlock;
   109		vms->uf = uf;
   110		vms->vma_count = 0;
   111		vms->nr_pages = vms->locked_vm = vms->nr_accounted = 0;
   112		vms->exec_vm = vms->stack_vm = vms->data_vm = 0;
   113		vms->unmap_start = FIRST_USER_ADDRESS;
 > 114		vms->unmap_end = USER_PGTABLES_CEILING;
   115	}
   116	

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


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

* Re: [akpm-mm:mm-unstable 357/379] mm/vma.h:114:19: error: use of undeclared identifier 'USER_PGTABLES_CEILING'
  2024-08-24 15:14 [akpm-mm:mm-unstable 357/379] mm/vma.h:114:19: error: use of undeclared identifier 'USER_PGTABLES_CEILING' kernel test robot
@ 2024-08-24 19:43 ` Lorenzo Stoakes
  2024-08-25  0:05   ` SeongJae Park
  0 siblings, 1 reply; 4+ messages in thread
From: Lorenzo Stoakes @ 2024-08-24 19:43 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Liam R. Howlett, llvm, oe-kbuild-all, kernel test robot,
	Linux Memory Management List

On Sat, Aug 24, 2024 at 11:14:17PM GMT, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
> head:   b659edec079c90012cf8d05624e312d1062b8b87
> commit: ca39aca8db2d78ff82356defba75d14ce78a67b9 [357/379] mm/vma: track start and end for munmap in vma_munmap_struct
> config: arm-allnoconfig (https://download.01.org/0day-ci/archive/20240824/202408242348.uGvgH9tt-lkp@intel.com/config)
> compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 08e5a1de8227512d4774a534b91cb2353cef6284)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240824/202408242348.uGvgH9tt-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/202408242348.uGvgH9tt-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
>    In file included from mm/filemap.c:15:
>    In file included from include/linux/dax.h:6:
>    In file included from include/linux/mm.h:2198:
>    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_"
>          |                               ~~~~~~~~~~~ ^ ~~~
>    In file included from mm/filemap.c:52:
>    In file included from mm/internal.h:13:
>    include/linux/mm_inline.h:47:41: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
>       47 |         __mod_lruvec_state(lruvec, NR_LRU_BASE + lru, nr_pages);
>          |                                    ~~~~~~~~~~~ ^ ~~~
>    include/linux/mm_inline.h:49:22: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
>       49 |                                 NR_ZONE_LRU_BASE + lru, nr_pages);
>          |                                 ~~~~~~~~~~~~~~~~ ^ ~~~
>    In file included from mm/filemap.c:52:
>    In file included from mm/internal.h:22:
> >> mm/vma.h:114:19: error: use of undeclared identifier 'USER_PGTABLES_CEILING'
>      114 |         vms->unmap_end = USER_PGTABLES_CEILING;
>          |                          ^
>    3 warnings and 1 error generated.

[snip]

Thanks for the report!

This is a trivial issue, and can be fixed with the attached fix-patch. This also
resolves the issue reported in
https://lore.kernel.org/oe-kbuild-all/202408242304.1A1fXTgE-lkp@intel.com/

----8<----
From 565ad376b0a3aa5822ef479faadff271e90ba51c Mon Sep 17 00:00:00 2001
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Date: Sat, 24 Aug 2024 20:20:17 +0100
Subject: [PATCH] mm: include linux/pgtable.h in vma_internal.h

For some arches this is required in order to have access to
USER_PGTABLES_CEILING and FIRST_USER_ADDRESS.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408242348.uGvgH9tt-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202408242304.1A1fXTgE-lkp@intel.com/
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
---
 mm/vma_internal.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/vma_internal.h b/mm/vma_internal.h
index b930ab12a587..971b13e880c9 100644
--- a/mm/vma_internal.h
+++ b/mm/vma_internal.h
@@ -33,6 +33,7 @@
 #include <linux/mutex.h>
 #include <linux/pagemap.h>
 #include <linux/pfn.h>
+#include <linux/pgtable.h>
 #include <linux/rcupdate.h>
 #include <linux/rmap.h>
 #include <linux/rwsem.h>
--
2.46.0


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

* Re: [akpm-mm:mm-unstable 357/379] mm/vma.h:114:19: error: use of undeclared identifier 'USER_PGTABLES_CEILING'
  2024-08-24 19:43 ` Lorenzo Stoakes
@ 2024-08-25  0:05   ` SeongJae Park
  2024-08-25 11:34     ` Lorenzo Stoakes
  0 siblings, 1 reply; 4+ messages in thread
From: SeongJae Park @ 2024-08-25  0:05 UTC (permalink / raw)
  To: Lorenzo Stoakes
  Cc: SeongJae Park, Andrew Morton, Liam R. Howlett, llvm,
	oe-kbuild-all, kernel test robot, Linux Memory Management List

Hello,

On Sat, 24 Aug 2024 20:43:25 +0100 Lorenzo Stoakes <lorenzo.stoakes@oracle.com> wrote:

> On Sat, Aug 24, 2024 at 11:14:17PM GMT, kernel test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
> > head:   b659edec079c90012cf8d05624e312d1062b8b87
> > commit: ca39aca8db2d78ff82356defba75d14ce78a67b9 [357/379] mm/vma: track start and end for munmap in vma_munmap_struct
> > config: arm-allnoconfig (https://download.01.org/0day-ci/archive/20240824/202408242348.uGvgH9tt-lkp@intel.com/config)
> > compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 08e5a1de8227512d4774a534b91cb2353cef6284)
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240824/202408242348.uGvgH9tt-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/202408242348.uGvgH9tt-lkp@intel.com/
> >
> > All errors (new ones prefixed by >>):
> >
> >    In file included from mm/filemap.c:15:
> >    In file included from include/linux/dax.h:6:
> >    In file included from include/linux/mm.h:2198:
> >    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_"
> >          |                               ~~~~~~~~~~~ ^ ~~~
> >    In file included from mm/filemap.c:52:
> >    In file included from mm/internal.h:13:
> >    include/linux/mm_inline.h:47:41: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
> >       47 |         __mod_lruvec_state(lruvec, NR_LRU_BASE + lru, nr_pages);
> >          |                                    ~~~~~~~~~~~ ^ ~~~
> >    include/linux/mm_inline.h:49:22: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
> >       49 |                                 NR_ZONE_LRU_BASE + lru, nr_pages);
> >          |                                 ~~~~~~~~~~~~~~~~ ^ ~~~
> >    In file included from mm/filemap.c:52:
> >    In file included from mm/internal.h:22:
> > >> mm/vma.h:114:19: error: use of undeclared identifier 'USER_PGTABLES_CEILING'
> >      114 |         vms->unmap_end = USER_PGTABLES_CEILING;
> >          |                          ^
> >    3 warnings and 1 error generated.
> 
> [snip]
> 
> Thanks for the report!
> 
> This is a trivial issue, and can be fixed with the attached fix-patch. This also
> resolves the issue reported in
> https://lore.kernel.org/oe-kbuild-all/202408242304.1A1fXTgE-lkp@intel.com/
> 
> ----8<----
> From 565ad376b0a3aa5822ef479faadff271e90ba51c Mon Sep 17 00:00:00 2001
> From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> Date: Sat, 24 Aug 2024 20:20:17 +0100
> Subject: [PATCH] mm: include linux/pgtable.h in vma_internal.h
> 
> For some arches this is required in order to have access to
> USER_PGTABLES_CEILING and FIRST_USER_ADDRESS.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202408242348.uGvgH9tt-lkp@intel.com/
> Closes: https://lore.kernel.org/oe-kbuild-all/202408242304.1A1fXTgE-lkp@intel.com/
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
>  mm/vma_internal.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mm/vma_internal.h b/mm/vma_internal.h
> index b930ab12a587..971b13e880c9 100644
> --- a/mm/vma_internal.h
> +++ b/mm/vma_internal.h
> @@ -33,6 +33,7 @@
>  #include <linux/mutex.h>
>  #include <linux/pagemap.h>
>  #include <linux/pfn.h>
> +#include <linux/pgtable.h>
>  #include <linux/rcupdate.h>
>  #include <linux/rmap.h>
>  #include <linux/rwsem.h>
> --
> 2.46.0

Even after applying the above patch, I get similar errors when CONFIG_MMU is
unset[1], as below.  Maybe the case should also be handled?

    In file included from /lib/../mm/internal.h:22:0,
                     from /lib/vsprintf.c:50:
    /lib/../mm/vma.h: In function 'init_vma_munmap':
    /lib/../mm/vma.h:113:21: error: 'FIRST_USER_ADDRESS' undeclared (first use in this function); did you mean 'IFLA_PERM_ADDRESS'?
      vms->unmap_start = FIRST_USER_ADDRESS;
                         ^~~~~~~~~~~~~~~~~~
                         IFLA_PERM_ADDRESS
    /lib/../mm/vma.h:113:21: note: each undeclared identifier is reported only once for each function it appears in
    /lib/../mm/vma.h:114:19: error: 'USER_PGTABLES_CEILING' undeclared (first use in this function)
      vms->unmap_end = USER_PGTABLES_CEILING;
                       ^~~~~~~~~~~~~~~~~~~~~


[1] https://github.com/damonitor/damon-tests/blob/master/corr/tests/build_m68k.sh


Thanks,
SJ


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

* Re: [akpm-mm:mm-unstable 357/379] mm/vma.h:114:19: error: use of undeclared identifier 'USER_PGTABLES_CEILING'
  2024-08-25  0:05   ` SeongJae Park
@ 2024-08-25 11:34     ` Lorenzo Stoakes
  0 siblings, 0 replies; 4+ messages in thread
From: Lorenzo Stoakes @ 2024-08-25 11:34 UTC (permalink / raw)
  To: SeongJae Park, Andrew Morton
  Cc: Liam R. Howlett, llvm, oe-kbuild-all, kernel test robot,
	Linux Memory Management List

On Sat, Aug 24, 2024 at 05:05:10PM GMT, SeongJae Park wrote:
> Hello,
>
> On Sat, 24 Aug 2024 20:43:25 +0100 Lorenzo Stoakes <lorenzo.stoakes@oracle.com> wrote:

[snip]

> > From 565ad376b0a3aa5822ef479faadff271e90ba51c Mon Sep 17 00:00:00 2001
> > From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> > Date: Sat, 24 Aug 2024 20:20:17 +0100
> > Subject: [PATCH] mm: include linux/pgtable.h in vma_internal.h
> >
> > For some arches this is required in order to have access to
> > USER_PGTABLES_CEILING and FIRST_USER_ADDRESS.
> >
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202408242348.uGvgH9tt-lkp@intel.com/
> > Closes: https://lore.kernel.org/oe-kbuild-all/202408242304.1A1fXTgE-lkp@intel.com/
> > Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> > ---
> >  mm/vma_internal.h | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/mm/vma_internal.h b/mm/vma_internal.h
> > index b930ab12a587..971b13e880c9 100644
> > --- a/mm/vma_internal.h
> > +++ b/mm/vma_internal.h
> > @@ -33,6 +33,7 @@
> >  #include <linux/mutex.h>
> >  #include <linux/pagemap.h>
> >  #include <linux/pfn.h>
> > +#include <linux/pgtable.h>
> >  #include <linux/rcupdate.h>
> >  #include <linux/rmap.h>
> >  #include <linux/rwsem.h>
> > --
> > 2.46.0
>
> Even after applying the above patch, I get similar errors when CONFIG_MMU is
> unset[1], as below.  Maybe the case should also be handled?
>
>     In file included from /lib/../mm/internal.h:22:0,
>                      from /lib/vsprintf.c:50:
>     /lib/../mm/vma.h: In function 'init_vma_munmap':
>     /lib/../mm/vma.h:113:21: error: 'FIRST_USER_ADDRESS' undeclared (first use in this function); did you mean 'IFLA_PERM_ADDRESS'?
>       vms->unmap_start = FIRST_USER_ADDRESS;
>                          ^~~~~~~~~~~~~~~~~~
>                          IFLA_PERM_ADDRESS
>     /lib/../mm/vma.h:113:21: note: each undeclared identifier is reported only once for each function it appears in
>     /lib/../mm/vma.h:114:19: error: 'USER_PGTABLES_CEILING' undeclared (first use in this function)
>       vms->unmap_end = USER_PGTABLES_CEILING;
>                        ^~~~~~~~~~~~~~~~~~~~~
>
>
> [1] https://github.com/damonitor/damon-tests/blob/master/corr/tests/build_m68k.sh
>
>
> Thanks,
> SJ

Lord, do I _love_ these museum-piece arches. Great spot though thanks.

I actually build an m68k kernel locally and did not hit this, so I wonder
if there's some horrible include chain going in from... lib/vsprintf.c of
all places. But anyway.

I checked and nommu does not compile vma.c (nor obviously does it compile
mmap.c) which are the two users of init_vma_munmap(), so we're safe to just
wrap this in an #ifdef CONFIG_MMU.


Andrew - could you apply this simple fix patch also please? This should
appease the horrors of nommu builds. Thanks!

----8<----
From a0b3718a0d09d1cfeaefcd94395ea6d6da2fec91 Mon Sep 17 00:00:00 2001
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Date: Sun, 25 Aug 2024 12:29:47 +0100
Subject: [PATCH] mm: fixup vma.h for nommu

Some series of includes result in vma.h being imported by nommu under
certain circumstances, which references FIRST_USER_ADDRESS and
USER_PGTABLES_CEILING, neither of which are necessarily defined in a nommu
scenario.

Work around this by wrapping the inline function which references these
(init_vma_munmap()) in an #ifdef CONFIG_MMU.

Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
---
 mm/vma.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/vma.h b/mm/vma.h
index edc9034d675c..9d4f44a9942b 100644
--- a/mm/vma.h
+++ b/mm/vma.h
@@ -152,6 +152,7 @@ static inline int vma_iter_store_gfp(struct vma_iterator *vmi,
 	return 0;
 }

+#ifdef CONFIG_MMU
 /*
  * init_vma_munmap() - Initializer wrapper for vma_munmap_struct
  * @vms: The vma munmap struct
@@ -185,6 +186,7 @@ static inline void init_vma_munmap(struct vma_munmap_struct *vms,
 	vms->clear_ptes = false;
 	vms->closed_vm_ops = false;
 }
+#endif

 int vms_gather_munmap_vmas(struct vma_munmap_struct *vms,
 		struct ma_state *mas_detach);
--
2.46.0


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

end of thread, other threads:[~2024-08-25 17:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-24 15:14 [akpm-mm:mm-unstable 357/379] mm/vma.h:114:19: error: use of undeclared identifier 'USER_PGTABLES_CEILING' kernel test robot
2024-08-24 19:43 ` Lorenzo Stoakes
2024-08-25  0:05   ` SeongJae Park
2024-08-25 11:34     ` Lorenzo Stoakes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).