From: Eduard Zingerman <eddyz87@gmail.com>
To: Ihor Solodrai <ihor.solodrai@pm.me>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>
Cc: "ast@kernel.org" <ast@kernel.org>,
"andrii@kernel.org" <andrii@kernel.org>,
"daniel@iogearbox.net" <daniel@iogearbox.net>,
"mykolal@fb.com" <mykolal@fb.com>
Subject: Re: [PATCH bpf-next] selftests/bpf: use auto-dependencies for test objects
Date: Thu, 11 Jul 2024 19:21:41 -0700 [thread overview]
Message-ID: <3586ffa2dfbee094aaa8a76ab5f570df37ef4b35.camel@gmail.com> (raw)
In-Reply-To: <17b05c0408489fd5ca474ae8ba3b7a3cc376f484.camel@gmail.com>
On Thu, 2024-07-11 at 16:19 -0700, Eduard Zingerman wrote:
[...]
> While re-testing the patch I've noticed a strange behaviour:
> $ cd <kernel>/tools/testing/selftests/bpf
> $ git clean -xfd .
> $ make -j14
> $ touch progs/atomics.c
> $ make -j14 test_progs
> CLNG-BPF [test_maps] atomics.bpf.o
> CLNG-BPF [test_maps] atomics.bpf.o
> CLNG-BPF [test_maps] atomics.bpf.o
> GEN-SKEL [test_progs] atomics.lskel.h
> GEN-SKEL [test_progs-cpuv4] atomics.lskel.h
> GEN-SKEL [test_progs-no_alu32] atomics.lskel.h
> TEST-OBJ [test_progs] arena_htab.test.o
> TEST-OBJ [test_progs] atomics.test.o
> ... many lines ...
> TEST-OBJ [test_progs] uprobe_multi_test.test.o
> TEST-OBJ [test_progs] usdt.test.o
> TEST-OBJ [test_progs] verify_pkcs7_sig.test.o
> TEST-OBJ [test_progs] vmlinux.test.o
> TEST-OBJ [test_progs] xdp_adjust_tail.test.o
> TEST-OBJ [test_progs] xdp_metadata.test.o
> TEST-OBJ [test_progs] xdp_synproxy.test.o
> BINARY test_progs
> 16:15:34 bpf$ make -j14 test_progs
> TEST-OBJ [test_progs] bpf_iter.test.o
> TEST-OBJ [test_progs] bpf_nf.test.o
> TEST-OBJ [test_progs] bpf_obj_id.test.o
> TEST-OBJ [test_progs] btf.test.o
> TEST-OBJ [test_progs] btf_write.test.o
> TEST-OBJ [test_progs] cgrp_local_storage.test.o
> TEST-OBJ [test_progs] iters.test.o
> TEST-OBJ [test_progs] lsm_cgroup.test.o
> TEST-OBJ [test_progs] send_signal.test.o
> TEST-OBJ [test_progs] sockmap_basic.test.o
> TEST-OBJ [test_progs] sockmap_listen.test.o
> TEST-OBJ [test_progs] trace_vprintk.test.o
> TEST-OBJ [test_progs] usdt.test.o
> TEST-OBJ [test_progs] xdp_metadata.test.o
> BINARY test_progs
> 16:15:37 bpf$ make -j14 test_progs
> TEST-OBJ [test_progs] bpf_obj_id.test.o
> TEST-OBJ [test_progs] sockmap_listen.test.o
> TEST-OBJ [test_progs] xdp_metadata.test.o
> BINARY test_progs
> 16:15:39 bpf$ make -j14 test_progs
> TEST-OBJ [test_progs] sockmap_listen.test.o
> BINARY test_progs
> 16:15:41 bpf$ make -j14 test_progs
> make: 'test_progs' is up to date.
>
> Interestingly enough, this does not happen with your off-list version of
> the patch shared this morning, the one with order-only dependency for .d:
>
> +$(TRUNNER_TEST_OBJS): $(TRUNNER_OUTPUT)/%.test.o: $(TRUNNER_TESTS_DIR)/%.c | $(TRUNNER_OUTPUT)/%.test.d
>
> Could you please double-check what's going on?
After some investigation it turned out that behaviour is specific to LLVM.
Under certain not yet clear conditions clang writes .d file *after* writing .o file.
For example:
{llvm} 19:15:59 bpf$ rm ringbuf.test.o; make `pwd`/ringbuf.test.o; ls -l --time-style=full-iso `pwd`/ringbuf.test.{o,d}
TEST-OBJ [test_progs] ringbuf.test.o
-rw-rw-r-- 1 eddy eddy 1947 2024-07-11 19:16:01.059016929 -0700 /home/eddy/work/bpf-next/tools/testing/selftests/bpf/ringbuf.test.d
-rw-rw-r-- 1 eddy eddy 160544 2024-07-11 19:16:01.055016909 -0700 /home/eddy/work/bpf-next/tools/testing/selftests/bpf/ringbuf.test.o
Note that ringbuf.test.d is newer than ringbuf.test.o.
This happens on each 10 or 20 run of the command.
Such behaviour clearly defies the reason for dependency files generation.
The decision for now is to avoid specifying .d files as direct dependencies
of the .o files and use order-only dependencies instead.
The make feature for reloading included makefiles would take care
of correctly re-specifying dependencies.
[...]
next prev parent reply other threads:[~2024-07-12 2:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-11 21:09 [PATCH bpf-next] selftests/bpf: use auto-dependencies for test objects Ihor Solodrai
2024-07-11 23:19 ` Eduard Zingerman
2024-07-12 2:21 ` Eduard Zingerman [this message]
2024-07-12 4:21 ` Ihor Solodrai
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=3586ffa2dfbee094aaa8a76ab5f570df37ef4b35.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=ihor.solodrai@pm.me \
--cc=mykolal@fb.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.