Re: [PATCH v6 30/37] mm: vmalloc: Enable memory allocation profiling

From: Suren Baghdasaryan
Date: Tue Mar 26 2024 - 03:51:51 EST


On Mon, Mar 25, 2024 at 11:20 AM SeongJae Park <sj@xxxxxxxxxx> wrote:
>
> On Mon, 25 Mar 2024 10:59:01 -0700 Suren Baghdasaryan <surenb@xxxxxxxxxx> wrote:
>
> > On Mon, Mar 25, 2024 at 10:49 AM SeongJae Park <sj@xxxxxxxxxx> wrote:
> > >
> > > On Mon, 25 Mar 2024 14:56:01 +0000 Suren Baghdasaryan <surenb@xxxxxxxxxx> wrote:
> > >
> > > > On Sat, Mar 23, 2024 at 6:05 PM SeongJae Park <sj@xxxxxxxxxx> wrote:
> > > > >
> > > > > Hi Suren and Kent,
> > > > >
> > > > > On Thu, 21 Mar 2024 09:36:52 -0700 Suren Baghdasaryan <surenb@xxxxxxxxxx> wrote:
> > > > >
> > > > > > From: Kent Overstreet <kent.overstreet@xxxxxxxxx>
> > > > > >
> > > > > > This wrapps all external vmalloc allocation functions with the
> > > > > > alloc_hooks() wrapper, and switches internal allocations to _noprof
> > > > > > variants where appropriate, for the new memory allocation profiling
> > > > > > feature.
> > > > >
> > > > > I just noticed latest mm-unstable fails running kunit on my machine as below.
> > > > > 'git-bisect' says this is the first commit of the failure.
> > > > >
> > > > > $ ./tools/testing/kunit/kunit.py run --build_dir ../kunit.out/
> > > > > [10:59:53] Configuring KUnit Kernel ...
> > > > > [10:59:53] Building KUnit Kernel ...
> > > > > Populating config with:
> > > > > $ make ARCH=um O=../kunit.out/ olddefconfig
> > > > > Building with:
> > > > > $ make ARCH=um O=../kunit.out/ --jobs=36
> > > > > ERROR:root:/usr/bin/ld: arch/um/os-Linux/main.o: in function `__wrap_malloc':
> > > > > main.c:(.text+0x10b): undefined reference to `vmalloc'
> > > > > collect2: error: ld returned 1 exit status
> > > > >
> > > > > Haven't looked into the code yet, but reporting first. May I ask your idea?
> > > >
> > > > Hi SeongJae,
> > > > Looks like we missed adding "#include <linux/vmalloc.h>" inside
> > > > arch/um/os-Linux/main.c in this patch:
> > > > https://lore.kernel.org/all/20240321163705.3067592-2-surenb@xxxxxxxxxx/.
> > > > I'll be posing fixes for all 0-day issues found over the weekend and
> > > > will include a fix for this. In the meantime, to work around it you
> > > > can add that include yourself. Please let me know if the issue still
> > > > persists after doing that.
> > >
> > > Thank you, Suren. The change made the error message disappears. However, it
> > > introduced another one.
> >
> > Ok, let me investigate and I'll try to get a fix for it today evening.
>
> Thank you for this kind reply. Nonetheless, this is not blocking some real
> thing from me. So, no rush. Plese take your time :)

I posted a fix here:
https://lore.kernel.org/all/20240326073750.726636-1-surenb@xxxxxxxxxx/
Please let me know if this resolves the issue.
Thanks,
Suren.

>
>
> Thanks,
> SJ
>
> > Thanks,
> > Suren.
> >
> > >
> > > $ git diff
> > > diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
> > > index c8a42ecbd7a2..8fe274e9f3a4 100644
> > > --- a/arch/um/os-Linux/main.c
> > > +++ b/arch/um/os-Linux/main.c
> > > @@ -16,6 +16,7 @@
> > > #include <kern_util.h>
> > > #include <os.h>
> > > #include <um_malloc.h>
> > > +#include <linux/vmalloc.h>
> > >
> > > #define PGD_BOUND (4 * 1024 * 1024)
> > > #define STACKSIZE (8 * 1024 * 1024)
> > > $
> > > $ ./tools/testing/kunit/kunit.py run --build_dir ../kunit.out/
> > > [10:43:13] Configuring KUnit Kernel ...
> > > [10:43:13] Building KUnit Kernel ...
> > > Populating config with:
> > > $ make ARCH=um O=../kunit.out/ olddefconfig
> > > Building with:
> > > $ make ARCH=um O=../kunit.out/ --jobs=36
> > > ERROR:root:In file included from .../arch/um/kernel/asm-offsets.c:1:
> > > .../arch/x86/um/shared/sysdep/kernel-offsets.h:9:6: warning: no previous prototype for ‘foo’ [-Wmissing-prototypes]
> > > 9 | void foo(void)
> > > | ^~~
> > > In file included from .../include/linux/alloc_tag.h:8,
> > > from .../include/linux/vmalloc.h:5,
> > > from .../arch/um/os-Linux/main.c:19:
> > > .../include/linux/bug.h:5:10: fatal error: asm/bug.h: No such file or directory
> > > 5 | #include <asm/bug.h>
> > > | ^~~~~~~~~~~
> > > compilation terminated.
> > >
> > >
> > > Thanks,
> > > SJ
> > >
> > > [...]
> >
>
> --
> To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@xxxxxxxxxxx.
>