* [linux-next:master 1016/2825] make[2]: *** kselftest/livepatch/test_modules: No such file or directory. Stop.
@ 2024-01-29 23:08 kernel test robot
2024-01-30 14:39 ` Marcos Paulo de Souza
0 siblings, 1 reply; 7+ messages in thread
From: kernel test robot @ 2024-01-29 23:08 UTC (permalink / raw)
To: Marcos Paulo de Souza
Cc: oe-kbuild-all, Linux Memory Management List, Shuah Khan,
Joe Lawrence, Petr Mladek
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 596764183be8ebb13352b281a442a1f1151c9b06
commit: c4bbe83d27c2446a033cc0381c3fb6be5e8c41c7 [1016/2825] livepatch: Move tests from lib/livepatch to selftests/livepatch
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240130/202401300736.GkSZoSrA-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/202401300736.GkSZoSrA-lkp@intel.com/
All errors (new ones prefixed by >>):
>> make[2]: *** kselftest/livepatch/test_modules: No such file or directory. Stop.
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [linux-next:master 1016/2825] make[2]: *** kselftest/livepatch/test_modules: No such file or directory. Stop.
2024-01-29 23:08 [linux-next:master 1016/2825] make[2]: *** kselftest/livepatch/test_modules: No such file or directory. Stop kernel test robot
@ 2024-01-30 14:39 ` Marcos Paulo de Souza
2024-01-31 15:34 ` Petr Mladek
0 siblings, 1 reply; 7+ messages in thread
From: Marcos Paulo de Souza @ 2024-01-30 14:39 UTC (permalink / raw)
To: kernel test robot
Cc: oe-kbuild-all, Linux Memory Management List, Shuah Khan,
Joe Lawrence, Petr Mladek
On Tue, 2024-01-30 at 07:08 +0800, kernel test robot wrote:
> tree:
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git m
> aster
> head: 596764183be8ebb13352b281a442a1f1151c9b06
> commit: c4bbe83d27c2446a033cc0381c3fb6be5e8c41c7 [1016/2825]
> livepatch: Move tests from lib/livepatch to selftests/livepatch
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> reproduce (this is a W=1 build):
> (https://download.01.org/0day-ci/archive/20240130/202401300736.GkSZoS
> rA-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/202401300736.GkSZoSrA-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
> > > make[2]: *** kselftest/livepatch/test_modules: No such file or
> > > directory. Stop.
>
I had problems to compile the bpf tests, usually resulting in errors
like this:
$ make W=1 O=/tmp/kselftest -C tools/testing/selftests/bpf
make: Entering directory
'/home/mpdesouza/git/linux/tools/testing/selftests/bpf'
CLNG-BPF [test_maps] connect_unix_prog.bpf.o
progs/connect_unix_prog.c:28:15: error: no member named 'uaddrlen' in
'struct bpf_sock_addr_kern'
if (sa_kern->uaddrlen != unaddrlen)
~~~~~~~ ^
1 error generated.
make: *** [Makefile:619: /tmp/kselftest//connect_unix_prog.bpf.o] Error
1
But, if I simply feed the livepatch selftests as target I'm able to
trigger the problem:
$ make W=1 O=/tmp/kselftest -C tools/testing/selftests/
TARGETS=livepatch
make: Entering directory
'/home/mpdesouza/git/linux/tools/testing/selftests'
make[1]: Entering directory
'/home/mpdesouza/git/linux/tools/testing/selftests/livepatch'
make -C /tmp/kselftest/kselftest/livepatch/test_modules
make[2]: Entering directory
'/home/mpdesouza/git/linux/tools/testing/selftests/livepatch'
make[2]: *** /tmp/kselftest/kselftest/livepatch/test_modules: No such
file or directory. Stop.
make[2]: Leaving directory
'/home/mpdesouza/git/linux/tools/testing/selftests/livepatch'
make[1]: *** [../lib.mk:92: gen_mods_dir] Error 2
make[1]: Leaving directory
'/home/mpdesouza/git/linux/tools/testing/selftests/livepatch'
make: *** [Makefile:180: all] Error 2
make: Leaving directory
'/home/mpdesouza/git/linux/tools/testing/selftests'
When looking at the lib.mk, I just followed the other variables and did
the same:
TEST_GEN_MODS_DIR := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_MODS_DIR))
But later on, I jump into $(TEST_GEN_MODS_DIR), which is invalid
because of the O= that is used a prefix for the path:
/tmp/kselftest/kselftest/livepatch/test_modules. My first idea was to
just remove the patsubst and take TEST_GEN_MODS_DIR, which should be
livepatch/test_modules in this case, but it then returns another
problem:
make: Entering directory
'/home/mpdesouza/git/linux/tools/testing/selftests'
make[1]: Entering directory
'/home/mpdesouza/git/linux/tools/testing/selftests/livepatch'
make -C test_modules
make[2]: Entering directory
'/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_modul
es'
make -C /lib/modules/6.5.9-1-default/build modules
KBUILD_EXTMOD=/home/mpdesouza/git/linux/tools/testing/selftests/livepat
ch/test_modules
make[3]: Entering directory '/usr/src/linux-6.5.9-1-obj/x86_64/default'
make[4]: Entering directory '/tmp/kselftest'
/usr/src/linux-6.5.9-1/Makefile:754: include/config/auto.conf: No such
file or directory
make[4]: *** [/usr/src/linux-6.5.9-1/Makefile:234: __sub-make] Error 2
make[4]: Leaving directory '/tmp/kselftest'
make[3]: *** [../../../linux-6.5.9-1/Makefile:234: __sub-make] Error 2
make[3]: Leaving directory '/usr/src/linux-6.5.9-1-obj/x86_64/default'
make[2]: *** [Makefile:16: modules] Error 2
make[2]: Leaving directory
'/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_modul
es'
make[1]: *** [../lib.mk:92: gen_mods_dir] Error 2
make[1]: Leaving directory
'/home/mpdesouza/git/linux/tools/testing/selftests/livepatch'
make: *** [Makefile:180: all] Error 2
make: Leaving directory
'/home/mpdesouza/git/linux/tools/testing/selftests'
Joe, Petr, Shuah,
Any ideas? I don't understand why we have that
make[4]: Entering directory '/tmp/kselftest'
I would expected that Kbuild would just spill the resulting module and
object files into the O= dir, instead of "jumping there". What am I
missing?
Thanks in advance for the help,
Marcos
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [linux-next:master 1016/2825] make[2]: *** kselftest/livepatch/test_modules: No such file or directory. Stop.
2024-01-30 14:39 ` Marcos Paulo de Souza
@ 2024-01-31 15:34 ` Petr Mladek
2024-01-31 18:39 ` Marcos Paulo de Souza
0 siblings, 1 reply; 7+ messages in thread
From: Petr Mladek @ 2024-01-31 15:34 UTC (permalink / raw)
To: Marcos Paulo de Souza
Cc: kernel test robot, oe-kbuild-all, Linux Memory Management List,
Shuah Khan, Joe Lawrence
On Tue 2024-01-30 11:39:56, Marcos Paulo de Souza wrote:
> On Tue, 2024-01-30 at 07:08 +0800, kernel test robot wrote:
> > tree:
> > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git m
> > aster
> > head: 596764183be8ebb13352b281a442a1f1151c9b06
> > commit: c4bbe83d27c2446a033cc0381c3fb6be5e8c41c7 [1016/2825]
> > livepatch: Move tests from lib/livepatch to selftests/livepatch
> > compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> > reproduce (this is a W=1 build):
> > (https://download.01.org/0day-ci/archive/20240130/202401300736.GkSZoS
> > rA-lkp@intel.com/reproduce)
> >
> When looking at the lib.mk, I just followed the other variables and did
> the same:
>
> TEST_GEN_MODS_DIR := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_MODS_DIR))
>
> But later on, I jump into $(TEST_GEN_MODS_DIR), which is invalid
> because of the O= that is used a prefix for the path:
> /tmp/kselftest/kselftest/livepatch/test_modules. My first idea was to
> just remove the patsubst and take TEST_GEN_MODS_DIR, which should be
> livepatch/test_modules in this case, but it then returns another
> problem:
>
>
> make: Entering directory
> '/home/mpdesouza/git/linux/tools/testing/selftests'
> make[1]: Entering directory
> '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch'
> make -C test_modules
> make[2]: Entering directory
> '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_modul
>
> es'
> make -C /lib/modules/6.5.9-1-default/build modules
> KBUILD_EXTMOD=/home/mpdesouza/git/linux/tools/testing/selftests/livepat
>
> ch/test_modules
Nit: There are sometimes strange empty lines between split long
lines. It looks like somehow messed cut&paste.
> make[3]: Entering directory '/usr/src/linux-6.5.9-1-obj/x86_64/default'
> make[4]: Entering directory '/tmp/kselftest'
> /usr/src/linux-6.5.9-1/Makefile:754: include/config/auto.conf: No such
> file or directory
I see the same. It looks to me like a bug in kernel-devel package.
/usr/src/linux-6.5.9-1/Makefile is from the kernel-devel package
for the running kernel. It should try to include auto.conf used
for building the running kernel:
1. auto.conf should be packaged in kernel-devel.
2. The Makefile from the kernel-devel packages should be able
to find/use auto.conf from the kernel-devel package.
IMHO, this actually helped to find a bug that
make -C tools/testing/selftests/livepatch used auto.conf from
the git tree while the modules are built against headers
for the running kernel.
That said, I wonder why this problem does not happen when building
external modules (KMPs). I would expect that they are using
the same Makefile from the kernel-devel package.
Maybe the external modules somehow manage to clear "need-config"
used by /usr/src/linux-6.5.9-1/Makefile. Maybe we do not need
to include it either.
> make[4]: *** [/usr/src/linux-6.5.9-1/Makefile:234: __sub-make] Error 2
> make[4]: Leaving directory '/tmp/kselftest'
> make[3]: *** [../../../linux-6.5.9-1/Makefile:234: __sub-make] Error 2
> make[3]: Leaving directory '/usr/src/linux-6.5.9-1-obj/x86_64/default'
> make[2]: *** [Makefile:16: modules] Error 2
> make[2]: Leaving directory
> '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_modul
>
> es'
> make[1]: *** [../lib.mk:92: gen_mods_dir] Error 2
> make[1]: Leaving directory
> '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch'
> make: *** [Makefile:180: all] Error 2
> make: Leaving directory
> '/home/mpdesouza/git/linux/tools/testing/selftests'
Best Regards,
Petr
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [linux-next:master 1016/2825] make[2]: *** kselftest/livepatch/test_modules: No such file or directory. Stop.
2024-01-31 15:34 ` Petr Mladek
@ 2024-01-31 18:39 ` Marcos Paulo de Souza
2024-01-31 18:40 ` Marcos Paulo de Souza
0 siblings, 1 reply; 7+ messages in thread
From: Marcos Paulo de Souza @ 2024-01-31 18:39 UTC (permalink / raw)
To: Petr Mladek
Cc: kernel test robot, oe-kbuild-all, Linux Memory Management List,
Shuah Khan, Joe Lawrence
On Wed, 2024-01-31 at 16:34 +0100, Petr Mladek wrote:
> On Tue 2024-01-30 11:39:56, Marcos Paulo de Souza wrote:
> > On Tue, 2024-01-30 at 07:08 +0800, kernel test robot wrote:
> > > tree:
> > > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> > > m
> > > aster
> > > head: 596764183be8ebb13352b281a442a1f1151c9b06
> > > commit: c4bbe83d27c2446a033cc0381c3fb6be5e8c41c7 [1016/2825]
> > > livepatch: Move tests from lib/livepatch to selftests/livepatch
> > > compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> > > reproduce (this is a W=1 build):
> > > (
> > > https://download.01.org/0day-ci/archive/20240130/202401300736.GkSZ
> > > oS
> > > rA-lkp@intel.com/reproduce)
> > >
> > When looking at the lib.mk, I just followed the other variables and
> > did
> > the same:
> >
> > TEST_GEN_MODS_DIR := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_MODS_DIR))
> >
> > But later on, I jump into $(TEST_GEN_MODS_DIR), which is invalid
> > because of the O= that is used a prefix for the path:
> > /tmp/kselftest/kselftest/livepatch/test_modules. My first idea was
> > to
> > just remove the patsubst and take TEST_GEN_MODS_DIR, which should
> > be
> > livepatch/test_modules in this case, but it then returns another
> > problem:
> >
> >
> > make: Entering directory
> > '/home/mpdesouza/git/linux/tools/testing/selftests'
> > make[1]: Entering directory
> > '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch'
> > make -C test_modules
> > make[2]: Entering directory
> > '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_m
> > odul
> >
> > es'
> > make -C /lib/modules/6.5.9-1-default/build modules
> > KBUILD_EXTMOD=/home/mpdesouza/git/linux/tools/testing/selftests/liv
> > epat
> >
> > ch/test_modules
>
> Nit: There are sometimes strange empty lines between split long
> lines. It looks like somehow messed cut&paste.
Sorry about it. I'll double check the output next time I copy from my
terminal.
>
> > make[3]: Entering directory '/usr/src/linux-6.5.9-1-
> > obj/x86_64/default'
> > make[4]: Entering directory '/tmp/kselftest'
> > /usr/src/linux-6.5.9-1/Makefile:754: include/config/auto.conf: No
> > such
> > file or directory
>
> I see the same. It looks to me like a bug in kernel-devel package.
>
> /usr/src/linux-6.5.9-1/Makefile is from the kernel-devel package
> for the running kernel. It should try to include auto.conf used
> for building the running kernel:
>
> 1. auto.conf should be packaged in kernel-devel.
>
> 2. The Makefile from the kernel-devel packages should be able
> to find/use auto.conf from the kernel-devel package.
>
> IMHO, this actually helped to find a bug that
> make -C tools/testing/selftests/livepatch used auto.conf from
> the git tree while the modules are built against headers
> for the running kernel.
>
> That said, I wonder why this problem does not happen when building
> external modules (KMPs). I would expect that they are using
> the same Makefile from the kernel-devel package.
>
> Maybe the external modules somehow manage to clear "need-config"
> used by /usr/src/linux-6.5.9-1/Makefile. Maybe we do not need
> to include it either.
>
> > make[4]: *** [/usr/src/linux-6.5.9-1/Makefile:234: __sub-make]
> > Error 2
> > make[4]: Leaving directory '/tmp/kselftest'
> > make[3]: *** [../../../linux-6.5.9-1/Makefile:234: __sub-make]
> > Error 2
> > make[3]: Leaving directory '/usr/src/linux-6.5.9-1-
> > obj/x86_64/default'
> > make[2]: *** [Makefile:16: modules] Error 2
> > make[2]: Leaving directory
> > '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_m
> > odul
> >
> > es'
> > make[1]: *** [../lib.mk:92: gen_mods_dir] Error 2
> > make[1]: Leaving directory
> > '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch'
> > make: *** [Makefile:180: all] Error 2
> > make: Leaving directory
> > '/home/mpdesouza/git/linux/tools/testing/selftests'
Well, this maybe be indeed a bug in kernel-devel. I added some debug
messages to make (-dd), and I believe that I understood what's going
wrong.
First of all, if we compile an out-of-tree module, like this:
make -C tools/testing/selftests/livepatch/test_modules
it goes to /usr/src/linux-6.5.9-1-obj/x86_64/default, and everything
works. I printed the abs_objtree and it's in fact where it should.
On like 234 of the toplevel Makefile, ion the __sub-make target, it
executed the make passed -C to $(abs_objtree), and -f to
$(abs_srctree). abs_objtree points to /usr/src/linux-6.5.9-1-
obj/x86_64/default while abs_srctree points to /usr/src/linux-6.5.9-1.
Everything works.
But things change whenever we use the O= argument. Its value is passed
to abs_objtree, making the __sub-make to execute is a peculiar way:
while abs_objtree is /tmp/kselftest, abs_srctree continues to be
/usr/src/linux-6.5.9-1. That's why the include fails in this case:
ifdef need-config
include include/config/auto.conf
endif
As we are calling the include from /tmp/kselftest, and Makefile include
rules try to searching for the file in the directory of it's
execution[1], it fails. IIUC, all include paths on the toplevel
makefile should have $(abs_srctree) as prefix, so it could work. But as
Petr said, we don't have the include/config directory packaged in
kernel-devel.
I would like to note that this is a problem with out-of-tree module
building, and not only kselftest related. If we pass O= when building a
module, this will happen.
For testing purposes, I added the include/{generated,config}
directories into my /usr/src/linux/include, and added abs_srctree to
the include mentioned above, and now it's failing with:
# CC [M]
/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_module
s/test_klp_atomic_replace.o
gcc -Wp,-
MMD,/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_mo
dules/.test_klp_atomic_replace.o.d -nostdinc -I/usr/src/linux-6.5.9-
1/arch/x86/include -I./arch/x86/include/generated -I/usr/src/linux-
6.5.9-1/include -I./include -I/usr/src/linux-6.5.9-
1/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -
I/usr/src/linux-6.5.9-1/include/uapi -I./include/generated/uapi -
include /usr/src/linux-6.5.9-1/include/linux/compiler-version.h -
include /usr/src/linux-6.5.9-1/include/linux/kconfig.h -include
/usr/src/linux-6.5.9-1/include/linux/compiler_types.h -D__KERNEL__ -
Werror -fmacro-prefix-map=/usr/src/linux-6.5.9-1/= -std=gnu11 -fshort-
wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -Wall -
Wundef -Werror=implicit-function-declaration -Werror=implicit-int -
Werror=return-type -Werror=strict-prototypes -Wno-format-security -Wno-
trigraphs -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-
protection=branch -fno-jump-tables -m64 -falign-jumps=1 -falign-loops=1
-mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-
setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -
fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -
mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-
return=thunk-extern -fno-jump-tables -fpatchable-function-entry=16,16 -
fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-
truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-
allow-store-data-races -Wframe-larger-than=2048 -fstack-protector-
strong -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-
variable -Wno-dangling-pointer -ftrivial-auto-var-init=zero -fno-stack-
clash-protection -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -
falign-functions=16 -Wvla -Wno-pointer-sign -Wcast-function-type -
fstrict-flex-arrays=3 -Wno-stringop-truncation -Wno-stringop-overflow -
Wno-restrict -Wno-maybe-uninitialized -Wno-array-bounds -Wno-alloc-
size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow -fno-
stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-
pointer-types -Werror=designated-init -Wno-packed-not-aligned -g -
DMODULE -DKBUILD_BASENAME='"test_klp_atomic_replace"' -
DKBUILD_MODNAME='"test_klp_atomic_replace"' -
D__KBUILD_MODNAME=kmod_test_klp_atomic_replace -c -o
/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_module
s/test_klp_atomic_replace.o
/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_module
s/test_klp_atomic_replace.c
In file included from /usr/src/linux-6.5.9-
1/include/linux/build_bug.h:5,
from /usr/src/linux-6.5.9-
1/include/linux/container_of.h:5,
from /usr/src/linux-6.5.9-1/include/linux/list.h:5,
from /usr/src/linux-6.5.9-1/include/linux/module.h:12,
from
/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_module
s/test_klp_atomic_replace.c:6:
/usr/src/linux-6.5.9-1/include/linux/compiler.h:246:10: fatal error:
asm/rwonce.h: No such file or directory
246 | #include <asm/rwonce.h>
| ^~~~~~~~~~~~~~
compilation terminated.
Which seems to be missing the asm-generic targets (?). I'm not sure
what to think now, if this is indeed a bug or if we should adjust other
configurations. As you can see, my lack of Kbuild/Makefile knowledge is
big, but I'm doing my best to understand what's wrong and how I could
fix it :)
What do you think about it? Thanks in advance!
(I'm not sure if the output is messed up again...)
[1]: https://www.gnu.org/software/make/manual/html_node/Include.html
>
> Best Regards,
> Petr
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [linux-next:master 1016/2825] make[2]: *** kselftest/livepatch/test_modules: No such file or directory. Stop.
2024-01-31 18:39 ` Marcos Paulo de Souza
@ 2024-01-31 18:40 ` Marcos Paulo de Souza
2024-02-05 18:05 ` Marcos Paulo de Souza
0 siblings, 1 reply; 7+ messages in thread
From: Marcos Paulo de Souza @ 2024-01-31 18:40 UTC (permalink / raw)
To: Petr Mladek
Cc: kernel test robot, oe-kbuild-all, Linux Memory Management List,
Shuah Khan, Joe Lawrence
CC'ing Miroslav, as he was also involved in the patchset and can have
some ideas about how to fix this issue.
On Wed, 2024-01-31 at 15:39 -0300, Marcos Paulo de Souza wrote:
> On Wed, 2024-01-31 at 16:34 +0100, Petr Mladek wrote:
> > On Tue 2024-01-30 11:39:56, Marcos Paulo de Souza wrote:
> > > On Tue, 2024-01-30 at 07:08 +0800, kernel test robot wrote:
> > > > tree:
> > > > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> > > > m
> > > > aster
> > > > head: 596764183be8ebb13352b281a442a1f1151c9b06
> > > > commit: c4bbe83d27c2446a033cc0381c3fb6be5e8c41c7 [1016/2825]
> > > > livepatch: Move tests from lib/livepatch to selftests/livepatch
> > > > compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> > > > reproduce (this is a W=1 build):
> > > > (
> > > > https://download.01.org/0day-ci/archive/20240130/202401300736.GkSZ
> > > > oS
> > > > rA-lkp@intel.com/reproduce)
> > > >
> > > When looking at the lib.mk, I just followed the other variables
> > > and
> > > did
> > > the same:
> > >
> > > TEST_GEN_MODS_DIR := $(patsubst
> > > %,$(OUTPUT)/%,$(TEST_GEN_MODS_DIR))
> > >
> > > But later on, I jump into $(TEST_GEN_MODS_DIR), which is invalid
> > > because of the O= that is used a prefix for the path:
> > > /tmp/kselftest/kselftest/livepatch/test_modules. My first idea
> > > was
> > > to
> > > just remove the patsubst and take TEST_GEN_MODS_DIR, which should
> > > be
> > > livepatch/test_modules in this case, but it then returns another
> > > problem:
> > >
> > >
> > > make: Entering directory
> > > '/home/mpdesouza/git/linux/tools/testing/selftests'
> > > make[1]: Entering directory
> > > '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch'
> > > make -C test_modules
> > > make[2]: Entering directory
> > > '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test
> > > _m
> > > odul
> > >
> > > es'
> > > make -C /lib/modules/6.5.9-1-default/build modules
> > > KBUILD_EXTMOD=/home/mpdesouza/git/linux/tools/testing/selftests/l
> > > iv
> > > epat
> > >
> > > ch/test_modules
> >
> > Nit: There are sometimes strange empty lines between split long
> > lines. It looks like somehow messed cut&paste.
>
> Sorry about it. I'll double check the output next time I copy from my
> terminal.
>
> >
> > > make[3]: Entering directory '/usr/src/linux-6.5.9-1-
> > > obj/x86_64/default'
> > > make[4]: Entering directory '/tmp/kselftest'
> > > /usr/src/linux-6.5.9-1/Makefile:754: include/config/auto.conf: No
> > > such
> > > file or directory
> >
> > I see the same. It looks to me like a bug in kernel-devel package.
> >
> > /usr/src/linux-6.5.9-1/Makefile is from the kernel-devel package
> > for the running kernel. It should try to include auto.conf used
> > for building the running kernel:
> >
> > 1. auto.conf should be packaged in kernel-devel.
> >
> > 2. The Makefile from the kernel-devel packages should be able
> > to find/use auto.conf from the kernel-devel package.
> >
> > IMHO, this actually helped to find a bug that
> > make -C tools/testing/selftests/livepatch used auto.conf from
> > the git tree while the modules are built against headers
> > for the running kernel.
> >
> > That said, I wonder why this problem does not happen when building
> > external modules (KMPs). I would expect that they are using
> > the same Makefile from the kernel-devel package.
> >
> > Maybe the external modules somehow manage to clear "need-config"
> > used by /usr/src/linux-6.5.9-1/Makefile. Maybe we do not need
> > to include it either.
> >
> > > make[4]: *** [/usr/src/linux-6.5.9-1/Makefile:234: __sub-make]
> > > Error 2
> > > make[4]: Leaving directory '/tmp/kselftest'
> > > make[3]: *** [../../../linux-6.5.9-1/Makefile:234: __sub-make]
> > > Error 2
> > > make[3]: Leaving directory '/usr/src/linux-6.5.9-1-
> > > obj/x86_64/default'
> > > make[2]: *** [Makefile:16: modules] Error 2
> > > make[2]: Leaving directory
> > > '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test
> > > _m
> > > odul
> > >
> > > es'
> > > make[1]: *** [../lib.mk:92: gen_mods_dir] Error 2
> > > make[1]: Leaving directory
> > > '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch'
> > > make: *** [Makefile:180: all] Error 2
> > > make: Leaving directory
> > > '/home/mpdesouza/git/linux/tools/testing/selftests'
>
> Well, this maybe be indeed a bug in kernel-devel. I added some debug
> messages to make (-dd), and I believe that I understood what's going
> wrong.
>
> First of all, if we compile an out-of-tree module, like this:
>
> make -C tools/testing/selftests/livepatch/test_modules
>
> it goes to /usr/src/linux-6.5.9-1-obj/x86_64/default, and everything
> works. I printed the abs_objtree and it's in fact where it should.
>
> On like 234 of the toplevel Makefile, ion the __sub-make target, it
> executed the make passed -C to $(abs_objtree), and -f to
> $(abs_srctree). abs_objtree points to /usr/src/linux-6.5.9-1-
> obj/x86_64/default while abs_srctree points to /usr/src/linux-6.5.9-
> 1.
> Everything works.
>
> But things change whenever we use the O= argument. Its value is
> passed
> to abs_objtree, making the __sub-make to execute is a peculiar way:
> while abs_objtree is /tmp/kselftest, abs_srctree continues to be
> /usr/src/linux-6.5.9-1. That's why the include fails in this case:
>
> ifdef need-config
> include include/config/auto.conf
> endif
>
> As we are calling the include from /tmp/kselftest, and Makefile
> include
> rules try to searching for the file in the directory of it's
> execution[1], it fails. IIUC, all include paths on the toplevel
> makefile should have $(abs_srctree) as prefix, so it could work. But
> as
> Petr said, we don't have the include/config directory packaged in
> kernel-devel.
>
> I would like to note that this is a problem with out-of-tree module
> building, and not only kselftest related. If we pass O= when building
> a
> module, this will happen.
>
> For testing purposes, I added the include/{generated,config}
> directories into my /usr/src/linux/include, and added abs_srctree to
> the include mentioned above, and now it's failing with:
>
> # CC [M]
> /home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_modu
> le
> s/test_klp_atomic_replace.o
> gcc -Wp,-
> MMD,/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_
> mo
> dules/.test_klp_atomic_replace.o.d -nostdinc -I/usr/src/linux-6.5.9-
> 1/arch/x86/include -I./arch/x86/include/generated -I/usr/src/linux-
> 6.5.9-1/include -I./include -I/usr/src/linux-6.5.9-
> 1/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -
> I/usr/src/linux-6.5.9-1/include/uapi -I./include/generated/uapi -
> include /usr/src/linux-6.5.9-1/include/linux/compiler-version.h -
> include /usr/src/linux-6.5.9-1/include/linux/kconfig.h -include
> /usr/src/linux-6.5.9-1/include/linux/compiler_types.h -D__KERNEL__ -
> Werror -fmacro-prefix-map=/usr/src/linux-6.5.9-1/= -std=gnu11 -
> fshort-
> wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -Wall
> -
> Wundef -Werror=implicit-function-declaration -Werror=implicit-int -
> Werror=return-type -Werror=strict-prototypes -Wno-format-security -
> Wno-
> trigraphs -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-
> protection=branch -fno-jump-tables -m64 -falign-jumps=1 -falign-
> loops=1
> -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-
> rax-
> setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare
> -
> fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -
> mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-
> return=thunk-extern -fno-jump-tables -fpatchable-function-entry=16,16
> -
> fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-
> truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -
> fno-
> allow-store-data-races -Wframe-larger-than=2048 -fstack-protector-
> strong -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-
> variable -Wno-dangling-pointer -ftrivial-auto-var-init=zero -fno-
> stack-
> clash-protection -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -
> falign-functions=16 -Wvla -Wno-pointer-sign -Wcast-function-type -
> fstrict-flex-arrays=3 -Wno-stringop-truncation -Wno-stringop-overflow
> -
> Wno-restrict -Wno-maybe-uninitialized -Wno-array-bounds -Wno-alloc-
> size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow -fno-
> stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-
> pointer-types -Werror=designated-init -Wno-packed-not-aligned -g -
> DMODULE -DKBUILD_BASENAME='"test_klp_atomic_replace"' -
> DKBUILD_MODNAME='"test_klp_atomic_replace"' -
> D__KBUILD_MODNAME=kmod_test_klp_atomic_replace -c -o
> /home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_modu
> le
> s/test_klp_atomic_replace.o
> /home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_modu
> le
> s/test_klp_atomic_replace.c
> In file included from /usr/src/linux-6.5.9-
> 1/include/linux/build_bug.h:5,
> from /usr/src/linux-6.5.9-
> 1/include/linux/container_of.h:5,
> from /usr/src/linux-6.5.9-1/include/linux/list.h:5,
> from /usr/src/linux-6.5.9-
> 1/include/linux/module.h:12,
> from
> /home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_modu
> le
> s/test_klp_atomic_replace.c:6:
> /usr/src/linux-6.5.9-1/include/linux/compiler.h:246:10: fatal error:
> asm/rwonce.h: No such file or directory
> 246 | #include <asm/rwonce.h>
> | ^~~~~~~~~~~~~~
> compilation terminated.
>
> Which seems to be missing the asm-generic targets (?). I'm not sure
> what to think now, if this is indeed a bug or if we should adjust
> other
> configurations. As you can see, my lack of Kbuild/Makefile knowledge
> is
> big, but I'm doing my best to understand what's wrong and how I could
> fix it :)
>
> What do you think about it? Thanks in advance!
>
> (I'm not sure if the output is messed up again...)
>
> [1]: https://www.gnu.org/software/make/manual/html_node/Include.html
>
> >
> > Best Regards,
> > Petr
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [linux-next:master 1016/2825] make[2]: *** kselftest/livepatch/test_modules: No such file or directory. Stop.
2024-01-31 18:40 ` Marcos Paulo de Souza
@ 2024-02-05 18:05 ` Marcos Paulo de Souza
2024-02-14 14:27 ` Marcos Paulo de Souza
0 siblings, 1 reply; 7+ messages in thread
From: Marcos Paulo de Souza @ 2024-02-05 18:05 UTC (permalink / raw)
To: Petr Mladek
Cc: kernel test robot, oe-kbuild-all, Linux Memory Management List,
Shuah Khan, Joe Lawrence, mbenes
On Wed, 2024-01-31 at 15:40 -0300, Marcos Paulo de Souza wrote:
> CC'ing Miroslav, as he was also involved in the patchset and can have
> some ideas about how to fix this issue.
Finally CCing Miroslav...
>
> On Wed, 2024-01-31 at 15:39 -0300, Marcos Paulo de Souza wrote:
> > On Wed, 2024-01-31 at 16:34 +0100, Petr Mladek wrote:
> > > On Tue 2024-01-30 11:39:56, Marcos Paulo de Souza wrote:
> > > > On Tue, 2024-01-30 at 07:08 +0800, kernel test robot wrote:
> > > > > tree:
> > > > > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> > > > > m
> > > > > aster
> > > > > head: 596764183be8ebb13352b281a442a1f1151c9b06
> > > > > commit: c4bbe83d27c2446a033cc0381c3fb6be5e8c41c7 [1016/2825]
> > > > > livepatch: Move tests from lib/livepatch to
> > > > > selftests/livepatch
> > > > > compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> > > > > reproduce (this is a W=1 build):
> > > > > (
> > > > > https://download.01.org/0day-ci/archive/20240130/202401300736.GkSZ
> > > > > oS
> > > > > rA-lkp@intel.com/reproduce)
> > > > >
> > > > When looking at the lib.mk, I just followed the other variables
> > > > and
> > > > did
> > > > the same:
> > > >
> > > > TEST_GEN_MODS_DIR := $(patsubst
> > > > %,$(OUTPUT)/%,$(TEST_GEN_MODS_DIR))
> > > >
> > > > But later on, I jump into $(TEST_GEN_MODS_DIR), which is
> > > > invalid
> > > > because of the O= that is used a prefix for the path:
> > > > /tmp/kselftest/kselftest/livepatch/test_modules. My first idea
> > > > was
> > > > to
> > > > just remove the patsubst and take TEST_GEN_MODS_DIR, which
> > > > should
> > > > be
> > > > livepatch/test_modules in this case, but it then returns
> > > > another
> > > > problem:
> > > >
> > > >
> > > > make: Entering directory
> > > > '/home/mpdesouza/git/linux/tools/testing/selftests'
> > > > make[1]: Entering directory
> > > > '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch'
> > > > make -C test_modules
> > > > make[2]: Entering directory
> > > > '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/te
> > > > st
> > > > _m
> > > > odul
> > > >
> > > > es'
> > > > make -C /lib/modules/6.5.9-1-default/build modules
> > > > KBUILD_EXTMOD=/home/mpdesouza/git/linux/tools/testing/selftests
> > > > /l
> > > > iv
> > > > epat
> > > >
> > > > ch/test_modules
> > >
> > > Nit: There are sometimes strange empty lines between split long
> > > lines. It looks like somehow messed cut&paste.
> >
> > Sorry about it. I'll double check the output next time I copy from
> > my
> > terminal.
> >
> > >
> > > > make[3]: Entering directory '/usr/src/linux-6.5.9-1-
> > > > obj/x86_64/default'
> > > > make[4]: Entering directory '/tmp/kselftest'
> > > > /usr/src/linux-6.5.9-1/Makefile:754: include/config/auto.conf:
> > > > No
> > > > such
> > > > file or directory
> > >
> > > I see the same. It looks to me like a bug in kernel-devel
> > > package.
> > >
> > > /usr/src/linux-6.5.9-1/Makefile is from the kernel-devel package
> > > for the running kernel. It should try to include auto.conf used
> > > for building the running kernel:
> > >
> > > 1. auto.conf should be packaged in kernel-devel.
> > >
> > > 2. The Makefile from the kernel-devel packages should be able
> > > to find/use auto.conf from the kernel-devel package.
> > >
> > > IMHO, this actually helped to find a bug that
> > > make -C tools/testing/selftests/livepatch used auto.conf from
> > > the git tree while the modules are built against headers
> > > for the running kernel.
> > >
> > > That said, I wonder why this problem does not happen when
> > > building
> > > external modules (KMPs). I would expect that they are using
> > > the same Makefile from the kernel-devel package.
> > >
> > > Maybe the external modules somehow manage to clear "need-config"
> > > used by /usr/src/linux-6.5.9-1/Makefile. Maybe we do not need
> > > to include it either.
> > >
> > > > make[4]: *** [/usr/src/linux-6.5.9-1/Makefile:234: __sub-make]
> > > > Error 2
> > > > make[4]: Leaving directory '/tmp/kselftest'
> > > > make[3]: *** [../../../linux-6.5.9-1/Makefile:234: __sub-make]
> > > > Error 2
> > > > make[3]: Leaving directory '/usr/src/linux-6.5.9-1-
> > > > obj/x86_64/default'
> > > > make[2]: *** [Makefile:16: modules] Error 2
> > > > make[2]: Leaving directory
> > > > '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/te
> > > > st
> > > > _m
> > > > odul
> > > >
> > > > es'
> > > > make[1]: *** [../lib.mk:92: gen_mods_dir] Error 2
> > > > make[1]: Leaving directory
> > > > '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch'
> > > > make: *** [Makefile:180: all] Error 2
> > > > make: Leaving directory
> > > > '/home/mpdesouza/git/linux/tools/testing/selftests'
> >
> > Well, this maybe be indeed a bug in kernel-devel. I added some
> > debug
> > messages to make (-dd), and I believe that I understood what's
> > going
> > wrong.
> >
> > First of all, if we compile an out-of-tree module, like this:
> >
> > make -C tools/testing/selftests/livepatch/test_modules
> >
> > it goes to /usr/src/linux-6.5.9-1-obj/x86_64/default, and
> > everything
> > works. I printed the abs_objtree and it's in fact where it should.
> >
> > On like 234 of the toplevel Makefile, ion the __sub-make target, it
> > executed the make passed -C to $(abs_objtree), and -f to
> > $(abs_srctree). abs_objtree points to /usr/src/linux-6.5.9-1-
> > obj/x86_64/default while abs_srctree points to /usr/src/linux-
> > 6.5.9-
> > 1.
> > Everything works.
> >
> > But things change whenever we use the O= argument. Its value is
> > passed
> > to abs_objtree, making the __sub-make to execute is a peculiar way:
> > while abs_objtree is /tmp/kselftest, abs_srctree continues to be
> > /usr/src/linux-6.5.9-1. That's why the include fails in this case:
> >
> > ifdef need-
> > config
> > include
> > include/config/auto.conf
> > endif
> >
> > As we are calling the include from /tmp/kselftest, and Makefile
> > include
> > rules try to searching for the file in the directory of it's
> > execution[1], it fails. IIUC, all include paths on the toplevel
> > makefile should have $(abs_srctree) as prefix, so it could work.
> > But
> > as
> > Petr said, we don't have the include/config directory packaged in
> > kernel-devel.
> >
> > I would like to note that this is a problem with out-of-tree module
> > building, and not only kselftest related. If we pass O= when
> > building
> > a
> > module, this will happen.
> >
> > For testing purposes, I added the include/{generated,config}
> > directories into my /usr/src/linux/include, and added abs_srctree
> > to
> > the include mentioned above, and now it's failing with:
> >
> > # CC [M]
> > /home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_mo
> > du
> > le
> > s/test_klp_atomic_replace.o
> > gcc -Wp,-
> > MMD,/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/tes
> > t_
> > mo
> > dules/.test_klp_atomic_replace.o.d -nostdinc -I/usr/src/linux-
> > 6.5.9-
> > 1/arch/x86/include -I./arch/x86/include/generated -I/usr/src/linux-
> > 6.5.9-1/include -I./include -I/usr/src/linux-6.5.9-
> > 1/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -
> > I/usr/src/linux-6.5.9-1/include/uapi -I./include/generated/uapi -
> > include /usr/src/linux-6.5.9-1/include/linux/compiler-version.h -
> > include /usr/src/linux-6.5.9-1/include/linux/kconfig.h -include
> > /usr/src/linux-6.5.9-1/include/linux/compiler_types.h -D__KERNEL__
> > -
> > Werror -fmacro-prefix-map=/usr/src/linux-6.5.9-1/= -std=gnu11 -
> > fshort-
> > wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -
> > Wall
> > -
> > Wundef -Werror=implicit-function-declaration -Werror=implicit-int -
> > Werror=return-type -Werror=strict-prototypes -Wno-format-security -
> > Wno-
> > trigraphs -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-
> > protection=branch -fno-jump-tables -m64 -falign-jumps=1 -falign-
> > loops=1
> > -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-
> > rax-
> > setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-
> > compare
> > -
> > fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -
> > mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-
> > return=thunk-extern -fno-jump-tables -fpatchable-function-
> > entry=16,16
> > -
> > fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-
> > truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -
> > fno-
> > allow-store-data-races -Wframe-larger-than=2048 -fstack-protector-
> > strong -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-
> > variable -Wno-dangling-pointer -ftrivial-auto-var-init=zero -fno-
> > stack-
> > clash-protection -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -
> > falign-functions=16 -Wvla -Wno-pointer-sign -Wcast-function-type -
> > fstrict-flex-arrays=3 -Wno-stringop-truncation -Wno-stringop-
> > overflow
> > -
> > Wno-restrict -Wno-maybe-uninitialized -Wno-array-bounds -Wno-alloc-
> > size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow -
> > fno-
> > stack-check -fconserve-stack -Werror=date-time -
> > Werror=incompatible-
> > pointer-types -Werror=designated-init -Wno-packed-not-aligned -g -
> > DMODULE -DKBUILD_BASENAME='"test_klp_atomic_replace"' -
> > DKBUILD_MODNAME='"test_klp_atomic_replace"' -
> > D__KBUILD_MODNAME=kmod_test_klp_atomic_replace -c -o
> > /home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_mo
> > du
> > le
> > s/test_klp_atomic_replace.o
> > /home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_mo
> > du
> > le
> > s/test_klp_atomic_replace.c
> > In file included from /usr/src/linux-6.5.9-
> > 1/include/linux/build_bug.h:5,
> > from /usr/src/linux-6.5.9-
> > 1/include/linux/container_of.h:5,
> > from /usr/src/linux-6.5.9-
> > 1/include/linux/list.h:5,
> > from /usr/src/linux-6.5.9-
> > 1/include/linux/module.h:12,
> > from
> > /home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_mo
> > du
> > le
> > s/test_klp_atomic_replace.c:6:
> > /usr/src/linux-6.5.9-1/include/linux/compiler.h:246:10: fatal
> > error:
> > asm/rwonce.h: No such file or directory
> > 246 | #include <asm/rwonce.h>
> > | ^~~~~~~~~~~~~~
> > compilation terminated.
> >
> > Which seems to be missing the asm-generic targets (?). I'm not sure
> > what to think now, if this is indeed a bug or if we should adjust
> > other
> > configurations. As you can see, my lack of Kbuild/Makefile
> > knowledge
> > is
> > big, but I'm doing my best to understand what's wrong and how I
> > could
> > fix it :)
> >
> > What do you think about it? Thanks in advance!
> >
> > (I'm not sure if the output is messed up again...)
> >
> > [1]:
> > https://www.gnu.org/software/make/manual/html_node/Include.html
> >
> > >
> > > Best Regards,
> > > Petr
> >
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [linux-next:master 1016/2825] make[2]: *** kselftest/livepatch/test_modules: No such file or directory. Stop.
2024-02-05 18:05 ` Marcos Paulo de Souza
@ 2024-02-14 14:27 ` Marcos Paulo de Souza
0 siblings, 0 replies; 7+ messages in thread
From: Marcos Paulo de Souza @ 2024-02-14 14:27 UTC (permalink / raw)
To: Petr Mladek
Cc: kernel test robot, oe-kbuild-all, Linux Memory Management List,
Shuah Khan, Joe Lawrence, mbenes
I sent an email to linux-kbuild to ask Masahiro about it. I believe
that we should continue the discussion there.
https://lore.kernel.org/linux-kbuild/951fc31ee754ba86acaa9556e1d28c13075c66a2.camel@suse.com/T/#u
Thanks,
Marcos
On Mon, 2024-02-05 at 15:05 -0300, Marcos Paulo de Souza wrote:
> On Wed, 2024-01-31 at 15:40 -0300, Marcos Paulo de Souza wrote:
> > CC'ing Miroslav, as he was also involved in the patchset and can
> > have
> > some ideas about how to fix this issue.
>
> Finally CCing Miroslav...
>
> >
> > On Wed, 2024-01-31 at 15:39 -0300, Marcos Paulo de Souza wrote:
> > > On Wed, 2024-01-31 at 16:34 +0100, Petr Mladek wrote:
> > > > On Tue 2024-01-30 11:39:56, Marcos Paulo de Souza wrote:
> > > > > On Tue, 2024-01-30 at 07:08 +0800, kernel test robot wrote:
> > > > > > tree:
> > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> > > > > > m
> > > > > > aster
> > > > > > head: 596764183be8ebb13352b281a442a1f1151c9b06
> > > > > > commit: c4bbe83d27c2446a033cc0381c3fb6be5e8c41c7
> > > > > > [1016/2825]
> > > > > > livepatch: Move tests from lib/livepatch to
> > > > > > selftests/livepatch
> > > > > > compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> > > > > > reproduce (this is a W=1 build):
> > > > > > (
> > > > > > https://download.01.org/0day-ci/archive/20240130/202401300736.GkSZ
> > > > > > oS
> > > > > > rA-lkp@intel.com/reproduce)
> > > > > >
> > > > > When looking at the lib.mk, I just followed the other
> > > > > variables
> > > > > and
> > > > > did
> > > > > the same:
> > > > >
> > > > > TEST_GEN_MODS_DIR := $(patsubst
> > > > > %,$(OUTPUT)/%,$(TEST_GEN_MODS_DIR))
> > > > >
> > > > > But later on, I jump into $(TEST_GEN_MODS_DIR), which is
> > > > > invalid
> > > > > because of the O= that is used a prefix for the path:
> > > > > /tmp/kselftest/kselftest/livepatch/test_modules. My first
> > > > > idea
> > > > > was
> > > > > to
> > > > > just remove the patsubst and take TEST_GEN_MODS_DIR, which
> > > > > should
> > > > > be
> > > > > livepatch/test_modules in this case, but it then returns
> > > > > another
> > > > > problem:
> > > > >
> > > > >
> > > > > make: Entering directory
> > > > > '/home/mpdesouza/git/linux/tools/testing/selftests'
> > > > > make[1]: Entering directory
> > > > > '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch'
> > > > > make -C test_modules
> > > > > make[2]: Entering directory
> > > > > '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/
> > > > > te
> > > > > st
> > > > > _m
> > > > > odul
> > > > >
> > > > > es'
> > > > > make -C /lib/modules/6.5.9-1-default/build modules
> > > > > KBUILD_EXTMOD=/home/mpdesouza/git/linux/tools/testing/selftes
> > > > > ts
> > > > > /l
> > > > > iv
> > > > > epat
> > > > >
> > > > > ch/test_modules
> > > >
> > > > Nit: There are sometimes strange empty lines between split long
> > > > lines. It looks like somehow messed cut&paste.
> > >
> > > Sorry about it. I'll double check the output next time I copy
> > > from
> > > my
> > > terminal.
> > >
> > > >
> > > > > make[3]: Entering directory '/usr/src/linux-6.5.9-1-
> > > > > obj/x86_64/default'
> > > > > make[4]: Entering directory '/tmp/kselftest'
> > > > > /usr/src/linux-6.5.9-1/Makefile:754:
> > > > > include/config/auto.conf:
> > > > > No
> > > > > such
> > > > > file or directory
> > > >
> > > > I see the same. It looks to me like a bug in kernel-devel
> > > > package.
> > > >
> > > > /usr/src/linux-6.5.9-1/Makefile is from the kernel-devel
> > > > package
> > > > for the running kernel. It should try to include auto.conf used
> > > > for building the running kernel:
> > > >
> > > > 1. auto.conf should be packaged in kernel-devel.
> > > >
> > > > 2. The Makefile from the kernel-devel packages should be able
> > > > to find/use auto.conf from the kernel-devel package.
> > > >
> > > > IMHO, this actually helped to find a bug that
> > > > make -C tools/testing/selftests/livepatch used auto.conf from
> > > > the git tree while the modules are built against headers
> > > > for the running kernel.
> > > >
> > > > That said, I wonder why this problem does not happen when
> > > > building
> > > > external modules (KMPs). I would expect that they are using
> > > > the same Makefile from the kernel-devel package.
> > > >
> > > > Maybe the external modules somehow manage to clear "need-
> > > > config"
> > > > used by /usr/src/linux-6.5.9-1/Makefile. Maybe we do not need
> > > > to include it either.
> > > >
> > > > > make[4]: *** [/usr/src/linux-6.5.9-1/Makefile:234: __sub-
> > > > > make]
> > > > > Error 2
> > > > > make[4]: Leaving directory '/tmp/kselftest'
> > > > > make[3]: *** [../../../linux-6.5.9-1/Makefile:234: __sub-
> > > > > make]
> > > > > Error 2
> > > > > make[3]: Leaving directory '/usr/src/linux-6.5.9-1-
> > > > > obj/x86_64/default'
> > > > > make[2]: *** [Makefile:16: modules] Error 2
> > > > > make[2]: Leaving directory
> > > > > '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/
> > > > > te
> > > > > st
> > > > > _m
> > > > > odul
> > > > >
> > > > > es'
> > > > > make[1]: *** [../lib.mk:92: gen_mods_dir] Error 2
> > > > > make[1]: Leaving directory
> > > > > '/home/mpdesouza/git/linux/tools/testing/selftests/livepatch'
> > > > > make: *** [Makefile:180: all] Error 2
> > > > > make: Leaving directory
> > > > > '/home/mpdesouza/git/linux/tools/testing/selftests'
> > >
> > > Well, this maybe be indeed a bug in kernel-devel. I added some
> > > debug
> > > messages to make (-dd), and I believe that I understood what's
> > > going
> > > wrong.
> > >
> > > First of all, if we compile an out-of-tree module, like this:
> > >
> > > make -C tools/testing/selftests/livepatch/test_modules
> > >
> > > it goes to /usr/src/linux-6.5.9-1-obj/x86_64/default, and
> > > everything
> > > works. I printed the abs_objtree and it's in fact where it
> > > should.
> > >
> > > On like 234 of the toplevel Makefile, ion the __sub-make target,
> > > it
> > > executed the make passed -C to $(abs_objtree), and -f to
> > > $(abs_srctree). abs_objtree points to /usr/src/linux-6.5.9-1-
> > > obj/x86_64/default while abs_srctree points to /usr/src/linux-
> > > 6.5.9-
> > > 1.
> > > Everything works.
> > >
> > > But things change whenever we use the O= argument. Its value is
> > > passed
> > > to abs_objtree, making the __sub-make to execute is a peculiar
> > > way:
> > > while abs_objtree is /tmp/kselftest, abs_srctree continues to be
> > > /usr/src/linux-6.5.9-1. That's why the include fails in this
> > > case:
> > >
> > > ifdef need-
> > > config
> > > include
> > > include/config/auto.conf
> > > endif
> > >
> > > As we are calling the include from /tmp/kselftest, and Makefile
> > > include
> > > rules try to searching for the file in the directory of it's
> > > execution[1], it fails. IIUC, all include paths on the toplevel
> > > makefile should have $(abs_srctree) as prefix, so it could work.
> > > But
> > > as
> > > Petr said, we don't have the include/config directory packaged in
> > > kernel-devel.
> > >
> > > I would like to note that this is a problem with out-of-tree
> > > module
> > > building, and not only kselftest related. If we pass O= when
> > > building
> > > a
> > > module, this will happen.
> > >
> > > For testing purposes, I added the include/{generated,config}
> > > directories into my /usr/src/linux/include, and added abs_srctree
> > > to
> > > the include mentioned above, and now it's failing with:
> > >
> > > # CC [M]
> > > /home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_
> > > mo
> > > du
> > > le
> > > s/test_klp_atomic_replace.o
> > > gcc -Wp,-
> > > MMD,/home/mpdesouza/git/linux/tools/testing/selftests/livepatch/t
> > > es
> > > t_
> > > mo
> > > dules/.test_klp_atomic_replace.o.d -nostdinc -I/usr/src/linux-
> > > 6.5.9-
> > > 1/arch/x86/include -I./arch/x86/include/generated -
> > > I/usr/src/linux-
> > > 6.5.9-1/include -I./include -I/usr/src/linux-6.5.9-
> > > 1/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -
> > > I/usr/src/linux-6.5.9-1/include/uapi -I./include/generated/uapi -
> > > include /usr/src/linux-6.5.9-1/include/linux/compiler-version.h -
> > > include /usr/src/linux-6.5.9-1/include/linux/kconfig.h -include
> > > /usr/src/linux-6.5.9-1/include/linux/compiler_types.h -
> > > D__KERNEL__
> > > -
> > > Werror -fmacro-prefix-map=/usr/src/linux-6.5.9-1/= -std=gnu11 -
> > > fshort-
> > > wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -
> > > Wall
> > > -
> > > Wundef -Werror=implicit-function-declaration -Werror=implicit-int
> > > -
> > > Werror=return-type -Werror=strict-prototypes -Wno-format-security
> > > -
> > > Wno-
> > > trigraphs -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-
> > > protection=branch -fno-jump-tables -m64 -falign-jumps=1 -falign-
> > > loops=1
> > > -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -
> > > mskip-
> > > rax-
> > > setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-
> > > compare
> > > -
> > > fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -
> > > mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-
> > > return=thunk-extern -fno-jump-tables -fpatchable-function-
> > > entry=16,16
> > > -
> > > fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-
> > > truncation -Wno-format-overflow -Wno-address-of-packed-member -O2
> > > -
> > > fno-
> > > allow-store-data-races -Wframe-larger-than=2048 -fstack-
> > > protector-
> > > strong -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-
> > > variable -Wno-dangling-pointer -ftrivial-auto-var-init=zero -fno-
> > > stack-
> > > clash-protection -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -
> > > falign-functions=16 -Wvla -Wno-pointer-sign -Wcast-function-type
> > > -
> > > fstrict-flex-arrays=3 -Wno-stringop-truncation -Wno-stringop-
> > > overflow
> > > -
> > > Wno-restrict -Wno-maybe-uninitialized -Wno-array-bounds -Wno-
> > > alloc-
> > > size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow -
> > > fno-
> > > stack-check -fconserve-stack -Werror=date-time -
> > > Werror=incompatible-
> > > pointer-types -Werror=designated-init -Wno-packed-not-aligned -g
> > > -
> > > DMODULE -DKBUILD_BASENAME='"test_klp_atomic_replace"' -
> > > DKBUILD_MODNAME='"test_klp_atomic_replace"' -
> > > D__KBUILD_MODNAME=kmod_test_klp_atomic_replace -c -o
> > > /home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_
> > > mo
> > > du
> > > le
> > > s/test_klp_atomic_replace.o
> > > /home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_
> > > mo
> > > du
> > > le
> > > s/test_klp_atomic_replace.c
> > > In file included from /usr/src/linux-6.5.9-
> > > 1/include/linux/build_bug.h:5,
> > > from /usr/src/linux-6.5.9-
> > > 1/include/linux/container_of.h:5,
> > > from /usr/src/linux-6.5.9-
> > > 1/include/linux/list.h:5,
> > > from /usr/src/linux-6.5.9-
> > > 1/include/linux/module.h:12,
> > > from
> > > /home/mpdesouza/git/linux/tools/testing/selftests/livepatch/test_
> > > mo
> > > du
> > > le
> > > s/test_klp_atomic_replace.c:6:
> > > /usr/src/linux-6.5.9-1/include/linux/compiler.h:246:10: fatal
> > > error:
> > > asm/rwonce.h: No such file or directory
> > > 246 | #include <asm/rwonce.h>
> > > | ^~~~~~~~~~~~~~
> > > compilation terminated.
> > >
> > > Which seems to be missing the asm-generic targets (?). I'm not
> > > sure
> > > what to think now, if this is indeed a bug or if we should adjust
> > > other
> > > configurations. As you can see, my lack of Kbuild/Makefile
> > > knowledge
> > > is
> > > big, but I'm doing my best to understand what's wrong and how I
> > > could
> > > fix it :)
> > >
> > > What do you think about it? Thanks in advance!
> > >
> > > (I'm not sure if the output is messed up again...)
> > >
> > > [1]:
> > > https://www.gnu.org/software/make/manual/html_node/Include.html
> > >
> > > >
> > > > Best Regards,
> > > > Petr
> > >
> >
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-02-14 14:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-29 23:08 [linux-next:master 1016/2825] make[2]: *** kselftest/livepatch/test_modules: No such file or directory. Stop kernel test robot
2024-01-30 14:39 ` Marcos Paulo de Souza
2024-01-31 15:34 ` Petr Mladek
2024-01-31 18:39 ` Marcos Paulo de Souza
2024-01-31 18:40 ` Marcos Paulo de Souza
2024-02-05 18:05 ` Marcos Paulo de Souza
2024-02-14 14:27 ` Marcos Paulo de Souza
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).