linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: SeongJae Park <sj@kernel.org>, Andrew Morton <akpm@linux-foundation.org>
Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
	llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	kernel test robot <lkp@intel.com>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [akpm-mm:mm-unstable 357/379] mm/vma.h:114:19: error: use of undeclared identifier 'USER_PGTABLES_CEILING'
Date: Sun, 25 Aug 2024 12:34:57 +0100	[thread overview]
Message-ID: <7d0ea994-f750-49c5-b392-ae7117369cf3@lucifer.local> (raw)
In-Reply-To: <20240825000510.136384-1-sj@kernel.org>

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


      reply	other threads:[~2024-08-25 11:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-24 15:14 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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7d0ea994-f750-49c5-b392-ae7117369cf3@lucifer.local \
    --to=lorenzo.stoakes@oracle.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=sj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox