[RFC] [kbuild test robot] random-order parallel building

From: Masahiro Yamada
Date: Thu May 11 2023 - 23:25:57 EST


Hello, maintainers of the kbuild test robot.

I have a proposal for the 0day tests.


GNU Make traditionally processes the dependency from left to right.

For example, if you have dependency like this:

all: foo bar baz

GNU Make builds foo, bar, baz, in this order.


Some projects that are not capable of parallel builds
rely on that behavior implicitly.

Kbuild, however, is intended to work well in parallel.
(As the maintainer, I really care about it.)


>From time to time, people add "just worked for me" code,
but apparently that lacks proper dependency.
Sometimes it requires an expensive CPU to reproduce
parallel build issues.


For example, see this report,
https://lkml.org/lkml/2016/11/30/587

The report says 'make -j112' reproduces the broken parallel build.
Most people do not have such a build machine that comes with 112 cores.
It is difficult to reproduce it (or even notice it).

(Some time later, it was root-caused by 07a422bb213a)



GNU Make 4.4 got this option.

--shuffle[={SEED|random|reverse|none}]
Perform shuffle of prerequisites and goals.



'make --shuffle=reverse' will build in reverse order.
In the example above, baz, bar, foo.

'make --shuffle' will randomize the build order.


If there exists a missing dependency among foo, bar, baz,
it will fail to build.



We already perform the randconfig daily basis.
So, random-order parallel building is a similar idea.

Perhaps, it makes sense to add the "--shuffle=SEED" option
but it requires GNU Make 4.4. (or GNU Make 4.4.1)
Is this too new?



--
Best Regards
Masahiro Yamada