On Wed, Nov 13, 2024 at 3:25 AM Toke Høiland-Jørgensen <toke@xxxxxxxxxx> wrote: > > The selftests build four kernel modules which use copy-pasted Makefile > targets. This is a bit messy, and doesn't scale so well when we add more > modules, so let's consolidate these rules into a single rule generated > for each module name, and move the module sources into a single > directory. > > To avoid parallel builds of the different modules stepping on each > other's toes during the 'modpost' phase of the Kbuild 'make modules', we > annotate the module copy target as .NOTPARALLEL, which makes all > its *dependencies* execute sequentially regardless of whether make is > doing parallel builds or not. This means the recursive make calls into > the test_kmods directory will be serialised, and when the first one > actually builds all four modules in the subdirectory, make will > correctly skip the three other calls, so we end up with just one build > of the subdir modules. > > Acked-by: Viktor Malik <vmalik@xxxxxxxxxx> > Signed-off-by: Toke Høiland-Jørgensen <toke@xxxxxxxxxx> > --- > Changes in v4: > - Rebase on bpf-next > - Link to v3: https://lore.kernel.org/r/20241111-bpf-selftests-mod-compile-v3-1-e2e6369ed670@xxxxxxxxxx > > Changes in v3: > - Use .NOTPARALLEL annotation instead of creating a modules.built file Is it just me, or did this make everything non-parallel? When I applied this locally, even .bpf.c compilation and skeleton generation was sequential despite `make -j$(nproc)`. We can't do that, it's too much of a regression. pw-bot: cr > - Link to v2: https://lore.kernel.org/r/20241107-bpf-selftests-mod-compile-v2-1-ef781fe9ca95@xxxxxxxxxx > [...]