[stable:linux-5.4.y 5541/6083] ERROR: "__memcat_p" [drivers/hwtracing/stm/stm_core.ko] undefined!

7 views
Skip to first unread message

kernel test robot

unread,
May 2, 2021, 3:28:33 PM5/2/21
to Arnd Bergmann, kbuil...@lists.01.org, clang-bu...@googlegroups.com, Greg Kroah-Hartman, Andrew Morton, Linux Memory Management List, Sasha Levin
Hi Arnd,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-5.4.y
head: 370636ffbb8695e6af549011ad91a048c8cab267
commit: 99f1960cae4f417d513be5ea55136383c2a58798 [5541/6083] stop_machine: mark helpers __always_inline
config: x86_64-randconfig-a002-20210502 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=99f1960cae4f417d513be5ea55136383c2a58798
git remote add stable https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
git fetch --no-tags stable linux-5.4.y
git checkout 99f1960cae4f417d513be5ea55136383c2a58798
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <l...@intel.com>

All errors (new ones prefixed by >>):

>> ERROR: "__memcat_p" [drivers/hwtracing/stm/stm_core.ko] undefined!

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuil...@lists.01.org
.config.gz

Arnd Bergmann

unread,
May 3, 2021, 8:42:31 AM5/3/21
to kernel test robot, kbuil...@lists.01.org, clang-built-linux, Greg Kroah-Hartman, Andrew Morton, Linux Memory Management List, Sasha Levin, Alexander Shishkin
On Sun, May 2, 2021 at 9:28 PM kernel test robot <l...@intel.com> wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-5.4.y
> head: 370636ffbb8695e6af549011ad91a048c8cab267
> commit: 99f1960cae4f417d513be5ea55136383c2a58798 [5541/6083] stop_machine: mark helpers __always_inline
> config: x86_64-randconfig-a002-20210502 (attached as .config)
> compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # install x86_64 cross compiling tool for clang build
> # apt-get install binutils-x86-64-linux-gnu
> # https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=99f1960cae4f417d513be5ea55136383c2a58798
> git remote add stable https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
> git fetch --no-tags stable linux-5.4.y
> git checkout 99f1960cae4f417d513be5ea55136383c2a58798
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <l...@intel.com>
>
> All errors (new ones prefixed by >>):
>
> >> ERROR: "__memcat_p" [drivers/hwtracing/stm/stm_core.ko] undefined!

I'm fairly sure this is unrelated to my patch, but I don't see what
happened here.
The function is defined in lib/memcat_p.c, which was added in v4.20, commit
93048c094415 ("lib: Fix ia64 bootloader linkage"), so it shouldn't fail in v5.4.
The same release also introduced the only user in commit a23bbec205b9
("stm class: Use memcat_p()"), and this is the one that causes the failure.

I also see that drivers/hwtracing/stm/policy.c is the only file that actually
calls memcat_p() (which is an inline function calling __memcat_p), so it's
possible that the $(lib-y) object gets dropped by the linker because there
are no other references to it from the kernel.

However, in this case I would expect to see the same problem on mainline
kernels, but I don't.

Adding Alexander Shishkin to Cc, maybe he has seen this before.

Arnd

Nick Desaulniers

unread,
May 3, 2021, 1:00:55 PM5/3/21
to Arnd Bergmann, kernel test robot, kbuil...@lists.01.org, clang-built-linux, Greg Kroah-Hartman, Andrew Morton, Linux Memory Management List, Sasha Levin, Alexander Shishkin, Masahiro Yamada
On Mon, May 3, 2021 at 5:42 AM Arnd Bergmann <ar...@arndb.de> wrote:
>
> On Sun, May 2, 2021 at 9:28 PM kernel test robot <l...@intel.com> wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-5.4.y
> > head: 370636ffbb8695e6af549011ad91a048c8cab267
> > commit: 99f1960cae4f417d513be5ea55136383c2a58798 [5541/6083] stop_machine: mark helpers __always_inline
> > config: x86_64-randconfig-a002-20210502 (attached as .config)
> > compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
> > reproduce (this is a W=1 build):
> > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > chmod +x ~/bin/make.cross
> > # install x86_64 cross compiling tool for clang build
> > # apt-get install binutils-x86-64-linux-gnu
> > # https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=99f1960cae4f417d513be5ea55136383c2a58798
> > git remote add stable https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
> > git fetch --no-tags stable linux-5.4.y
> > git checkout 99f1960cae4f417d513be5ea55136383c2a58798
> > # save the attached .config to linux build tree
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <l...@intel.com>
> >
> > All errors (new ones prefixed by >>):
> >
> > >> ERROR: "__memcat_p" [drivers/hwtracing/stm/stm_core.ko] undefined!
>
> I'm fairly sure this is unrelated to my patch, but I don't see what
> happened here.

It's unrelated to your patch. It was fixed in 5.7 by
7273ad2b08f8ac9563579d16a3cf528857b26f49 and a few other dependencies
according to https://github.com/ClangBuiltLinux/linux/issues/515.

--
Thanks,
~Nick Desaulniers

Arnd Bergmann

unread,
May 3, 2021, 3:17:29 PM5/3/21
to Nick Desaulniers, kernel test robot, kbuil...@lists.01.org, clang-built-linux, Greg Kroah-Hartman, Andrew Morton, Linux Memory Management List, Sasha Levin, Alexander Shishkin, Masahiro Yamada, stable
On Mon, May 3, 2021 at 7:00 PM 'Nick Desaulniers' via Clang Built
Linux <clang-bu...@googlegroups.com> wrote:
> > > >> ERROR: "__memcat_p" [drivers/hwtracing/stm/stm_core.ko] undefined!
> >
> > I'm fairly sure this is unrelated to my patch, but I don't see what
> > happened here.
>
> It's unrelated to your patch. It was fixed in 5.7 by
> 7273ad2b08f8ac9563579d16a3cf528857b26f49 and a few other dependencies
> according to https://github.com/ClangBuiltLinux/linux/issues/515.
>

Ah right, the big hammer.

Greg, not sure what we want to do here. Backporting

7273ad2b08f8 ("kbuild: link lib-y objects to vmlinux forcibly when
CONFIG_MODULES=y")

to v5.4 and earlier would be an easy workaround, but it has the potential
of adding extra bloat to the kernel image since it links in all other
library objects as well.

Arnd

Greg Kroah-Hartman

unread,
May 4, 2021, 12:43:01 AM5/4/21
to Arnd Bergmann, Nick Desaulniers, kernel test robot, kbuil...@lists.01.org, clang-built-linux, Andrew Morton, Linux Memory Management List, Sasha Levin, Alexander Shishkin, Masahiro Yamada, stable
I've lost the thread here, but what _real_ problem is happening here
that doing the above is required?

thanks,

greg k-h

Arnd Bergmann

unread,
May 4, 2021, 3:41:57 AM5/4/21
to Greg Kroah-Hartman, Nick Desaulniers, kernel test robot, kbuil...@lists.01.org, clang-built-linux, Andrew Morton, Linux Memory Management List, Sasha Levin, Alexander Shishkin, Masahiro Yamada, stable
Randconfig builds fail if drivers/hwtracing/stm/stm_core.ko is a loadable
modules and nothing inside vmlinux forces lib/memcat_p.o to be
linked in. A simpler workaround for v5.4 would be:

diff --git a/lib/Makefile b/lib/Makefile
index a5c5f342ade0..745d1207e9e2 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -33,7 +33,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
flex_proportions.o ratelimit.o show_mem.o \
is_single_threaded.o plist.o decompress.o kobject_uevent.o \
earlycpio.o seq_buf.o siphash.o dec_and_lock.o \
- nmi_backtrace.o nodemask.o win_minmax.o memcat_p.o \
+ nmi_backtrace.o nodemask.o win_minmax.o \
buildid.o

lib-$(CONFIG_PRINTK) += dump_stack.o
@@ -48,7 +48,7 @@ obj-y += bcd.o sort.o parser.o debug_locks.o random32.o \
bsearch.o find_bit.o llist.o memweight.o kfifo.o \
percpu-refcount.o rhashtable.o \
once.o refcount.o usercopy.o errseq.o bucket_locks.o \
- generic-radix-tree.o
+ generic-radix-tree.o memcat_p.o
obj-$(CONFIG_STRING_SELFTEST) += test_string.o
obj-y += string_helpers.o
obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o

which is the same as what 7273ad2b08f8 does, but only for this one file
instead of all of lib/*.o.

Arnd

Greg Kroah-Hartman

unread,
May 4, 2021, 4:26:04 AM5/4/21
to Arnd Bergmann, Nick Desaulniers, kernel test robot, kbuil...@lists.01.org, clang-built-linux, Andrew Morton, Linux Memory Management List, Sasha Levin, Alexander Shishkin, Masahiro Yamada, stable
I think a "one off" change would be best here. Can you submit it?

thanks,

greg k-h

Arnd Bergmann

unread,
May 4, 2021, 6:46:47 AM5/4/21
to Greg Kroah-Hartman, Nick Desaulniers, kernel test robot, kbuil...@lists.01.org, clang-built-linux, Andrew Morton, Linux Memory Management List, Sasha Levin, Alexander Shishkin, Masahiro Yamada, stable

Greg Kroah-Hartman

unread,
May 4, 2021, 10:16:11 AM5/4/21
to Arnd Bergmann, Nick Desaulniers, kernel test robot, kbuil...@lists.01.org, clang-built-linux, Andrew Morton, Linux Memory Management List, Sasha Levin, Alexander Shishkin, Masahiro Yamada, stable
Thanks, now queued up.

greg k-h
Reply all
Reply to author
Forward
0 new messages