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

From: Philip Li
Date: Fri May 12 2023 - 03:12:49 EST


On Fri, May 12, 2023 at 12:25:13PM +0900, Masahiro Yamada wrote:
> Hello, maintainers of the kbuild test robot.
>
> I have a proposal for the 0day tests.

Thanks a lot for the proposal for the shuffle make, we will do some
investigation to try this random order parallel build. The gnu make
we currently use is 4.3, we will try the 4.4 to see any problem.

For the timeline, we may provide update later this month.

>
>
> 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?

Our production environment is 4.3 right now. It will take extra
time for us to upgrade the environment but it's doable for us.

>
>
>
> --
> Best Regards
> Masahiro Yamada